Skip to content

Commit 9af5ccd

Browse files
committed
feat: WIP migrate to effect 4
1 parent a3d4597 commit 9af5ccd

472 files changed

Lines changed: 10567 additions & 11104 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.projen/deps.json

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ new Vitest(project, { sharedSetupFiles: ["vitest.setup.ts"] });
4343
project.addDevDeps("vitest-mock-extended");
4444
project.addDevDeps("aws-sdk-client-mock", "aws-sdk-client-mock-vitest@^6.2.1");
4545

46-
const effectDeps = ["effect"];
46+
const effectDeps = ["effect@4.0.0-beta.8"];
4747

4848
project.addScripts({ "codegen-client": "tsx ./scripts/codegen-cli.ts" });
49-
project.addDeps(...effectDeps, "@effect/cli", "@effect/platform", "@effect/platform-node");
50-
project.addDevDeps("@effect/language-service", "@effect/vitest");
49+
project.addDeps(...effectDeps, "@effect/platform-node@4.0.0-beta.8");
50+
project.addDevDeps("@effect/language-service", "@effect/vitest@4.0.0-beta.8");
5151
project.tsconfigBase?.file.addOverride("compilerOptions.plugins", [
5252
{ name: "@effect/language-service" },
5353
]);
@@ -59,7 +59,7 @@ project.addTask("pages:build", { exec: "vitepress build pages" });
5959
project.addTask("pages:preview", { exec: "vitepress preview pages" });
6060

6161
const commonDevDeps = [...effectDeps];
62-
const commonPeerDeps = ["effect@>=3.0.4 <4.0.0"];
62+
const commonPeerDeps = ["effect@>=4.0.0 <5.0.0"];
6363

6464
const commons = new TypeScriptLibProject({
6565
parent: project,
@@ -113,7 +113,7 @@ const lambda = new TypeScriptLibProject({
113113
parent: project,
114114
name: "lambda",
115115
description: "Effectful AWS Lambda handler",
116-
devDeps: ["effect@4.0.0-beta.8", "@effect/platform-node-shared@4.0.0-beta.8", "@types/aws-lambda"],
116+
devDeps: [...effectDeps, "@effect/platform-node-shared@4.0.0-beta.8", "@types/aws-lambda"],
117117
peerDeps: ["effect@>=4.0.0 <5.0.0", "@effect/platform-node-shared@>=4.0.0 <5.0.0"],
118118
addExamples: true,
119119
});
@@ -169,8 +169,8 @@ new TypeScriptLibProject({
169169
parent: project,
170170
name: "s3",
171171
description: "Effectful AWS S3 functions",
172-
devDeps: [...effectDeps, "@effect/platform", "@aws-sdk/client-s3@^3"],
173-
peerDeps: ["effect@>=3.15.5 <4.0.0", "@effect/platform@>=0.83.0"],
172+
devDeps: [...effectDeps, "@aws-sdk/client-s3@^3"],
173+
peerDeps: ["effect@>=4.0.0 <5.0.0"],
174174
workspacePeerDeps: [s3Client],
175175
addExamples: true,
176176
});
@@ -180,8 +180,8 @@ new TypeScriptLibProject({
180180
name: "http-handler",
181181
description: "Effectful AWS HTTP handler",
182182
deps: ["@smithy/types", "@smithy/protocol-http", "@smithy/querystring-builder"],
183-
devDeps: [...effectDeps, "@effect/platform"],
184-
peerDeps: ["effect@>=3.15.5 <4.0.0", "@effect/platform@>=0.83.0"],
183+
devDeps: [...effectDeps],
184+
peerDeps: ["effect@>=4.0.0 <5.0.0"],
185185
workspacePeerDeps: [commons],
186186
});
187187

@@ -191,7 +191,7 @@ new TypeScriptLibProject({
191191
description: "Effectful AWS Aurora DSQL modules",
192192
deps: ["@aws-sdk/dsql-signer@^3"],
193193
devDeps: [...effectDeps],
194-
peerDeps: ["effect@>=3.15.5 <4.0.0"],
194+
peerDeps: ["effect@>=4.0.0 <5.0.0"],
195195
});
196196

197197
project.addGitIgnore("/.direnv"); // flake environment creates .direnv folder

package.json

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/client-account/.projen/deps.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/client-account/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ With default AccountClient instance:
1616
```typescript
1717
import { Account } from "@effect-aws/client-account";
1818

19-
const program = Account.listRegions(args);
19+
const program = Account.use((svc) => svc.listRegions(args));
2020

2121
const result = pipe(
2222
program,
@@ -30,7 +30,7 @@ With custom AccountClient instance:
3030
```typescript
3131
import { Account } from "@effect-aws/client-account";
3232

33-
const program = Account.listRegions(args);
33+
const program = Account.use((svc) => svc.listRegions(args));
3434

3535
const result = await pipe(
3636
program,
@@ -46,7 +46,7 @@ With custom AccountClient configuration:
4646
```typescript
4747
import { Account } from "@effect-aws/client-account";
4848

49-
const program = Account.listRegions(args);
49+
const program = Account.use((svc) => svc.listRegions(args));
5050

5151
const result = await pipe(
5252
program,

packages/client-account/package.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/client-account/src/AccountClientInstance.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
* @since 1.0.0
33
*/
44
import { AccountClient } from "@aws-sdk/client-account";
5-
import { Context, Effect, Layer } from "effect";
5+
import { Effect, Layer, ServiceMap } from "effect";
66
import * as AccountServiceConfig from "./AccountServiceConfig.js";
77

88
/**
99
* @since 1.0.0
1010
* @category tags
1111
*/
12-
export class AccountClientInstance extends Context.Tag(
12+
export class AccountClientInstance extends ServiceMap.Service<AccountClientInstance, AccountClient>()(
1313
"@effect-aws/client-account/AccountClientInstance",
14-
)<AccountClientInstance, AccountClient>() {}
14+
) {}
1515

1616
/**
1717
* @since 1.0.0
@@ -30,4 +30,4 @@ export const make = Effect.flatMap(
3030
* @since 1.0.0
3131
* @category layers
3232
*/
33-
export const layer = Layer.scoped(AccountClientInstance, make);
33+
export const layer = Layer.effect(AccountClientInstance, make);

packages/client-account/src/AccountService.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
import type { HttpHandlerOptions, ServiceLogger } from "@effect-aws/commons";
5454
import { Service } from "@effect-aws/commons";
5555
import type { Cause } from "effect";
56-
import { Effect, Layer } from "effect";
56+
import { Effect, Layer, ServiceMap } from "effect";
5757
import * as Instance from "./AccountClientInstance.js";
5858
import * as AccountServiceConfig from "./AccountServiceConfig.js";
5959
import type {
@@ -97,7 +97,7 @@ interface AccountService$ {
9797
options?: HttpHandlerOptions,
9898
): Effect.Effect<
9999
AcceptPrimaryEmailUpdateCommandOutput,
100-
| Cause.TimeoutException
100+
| Cause.TimeoutError
101101
| SdkError
102102
| AccessDeniedError
103103
| ConflictError
@@ -115,7 +115,7 @@ interface AccountService$ {
115115
options?: HttpHandlerOptions,
116116
): Effect.Effect<
117117
DeleteAlternateContactCommandOutput,
118-
| Cause.TimeoutException
118+
| Cause.TimeoutError
119119
| SdkError
120120
| AccessDeniedError
121121
| InternalServerError
@@ -132,7 +132,7 @@ interface AccountService$ {
132132
options?: HttpHandlerOptions,
133133
): Effect.Effect<
134134
DisableRegionCommandOutput,
135-
| Cause.TimeoutException
135+
| Cause.TimeoutError
136136
| SdkError
137137
| AccessDeniedError
138138
| ConflictError
@@ -149,7 +149,7 @@ interface AccountService$ {
149149
options?: HttpHandlerOptions,
150150
): Effect.Effect<
151151
EnableRegionCommandOutput,
152-
| Cause.TimeoutException
152+
| Cause.TimeoutError
153153
| SdkError
154154
| AccessDeniedError
155155
| ConflictError
@@ -166,7 +166,7 @@ interface AccountService$ {
166166
options?: HttpHandlerOptions,
167167
): Effect.Effect<
168168
GetAccountInformationCommandOutput,
169-
Cause.TimeoutException | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
169+
Cause.TimeoutError | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
170170
>;
171171

172172
/**
@@ -177,7 +177,7 @@ interface AccountService$ {
177177
options?: HttpHandlerOptions,
178178
): Effect.Effect<
179179
GetAlternateContactCommandOutput,
180-
| Cause.TimeoutException
180+
| Cause.TimeoutError
181181
| SdkError
182182
| AccessDeniedError
183183
| InternalServerError
@@ -194,7 +194,7 @@ interface AccountService$ {
194194
options?: HttpHandlerOptions,
195195
): Effect.Effect<
196196
GetContactInformationCommandOutput,
197-
| Cause.TimeoutException
197+
| Cause.TimeoutError
198198
| SdkError
199199
| AccessDeniedError
200200
| InternalServerError
@@ -211,7 +211,7 @@ interface AccountService$ {
211211
options?: HttpHandlerOptions,
212212
): Effect.Effect<
213213
GetGovCloudAccountInformationCommandOutput,
214-
| Cause.TimeoutException
214+
| Cause.TimeoutError
215215
| SdkError
216216
| AccessDeniedError
217217
| InternalServerError
@@ -229,7 +229,7 @@ interface AccountService$ {
229229
options?: HttpHandlerOptions,
230230
): Effect.Effect<
231231
GetPrimaryEmailCommandOutput,
232-
| Cause.TimeoutException
232+
| Cause.TimeoutError
233233
| SdkError
234234
| AccessDeniedError
235235
| InternalServerError
@@ -246,7 +246,7 @@ interface AccountService$ {
246246
options?: HttpHandlerOptions,
247247
): Effect.Effect<
248248
GetRegionOptStatusCommandOutput,
249-
Cause.TimeoutException | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
249+
Cause.TimeoutError | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
250250
>;
251251

252252
/**
@@ -257,7 +257,7 @@ interface AccountService$ {
257257
options?: HttpHandlerOptions,
258258
): Effect.Effect<
259259
ListRegionsCommandOutput,
260-
Cause.TimeoutException | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
260+
Cause.TimeoutError | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
261261
>;
262262

263263
/**
@@ -268,7 +268,7 @@ interface AccountService$ {
268268
options?: HttpHandlerOptions,
269269
): Effect.Effect<
270270
PutAccountNameCommandOutput,
271-
Cause.TimeoutException | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
271+
Cause.TimeoutError | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
272272
>;
273273

274274
/**
@@ -279,7 +279,7 @@ interface AccountService$ {
279279
options?: HttpHandlerOptions,
280280
): Effect.Effect<
281281
PutAlternateContactCommandOutput,
282-
Cause.TimeoutException | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
282+
Cause.TimeoutError | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
283283
>;
284284

285285
/**
@@ -290,7 +290,7 @@ interface AccountService$ {
290290
options?: HttpHandlerOptions,
291291
): Effect.Effect<
292292
PutContactInformationCommandOutput,
293-
Cause.TimeoutException | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
293+
Cause.TimeoutError | SdkError | AccessDeniedError | InternalServerError | TooManyRequestsError | ValidationError
294294
>;
295295

296296
/**
@@ -301,7 +301,7 @@ interface AccountService$ {
301301
options?: HttpHandlerOptions,
302302
): Effect.Effect<
303303
StartPrimaryEmailUpdateCommandOutput,
304-
| Cause.TimeoutException
304+
| Cause.TimeoutError
305305
| SdkError
306306
| AccessDeniedError
307307
| ConflictError
@@ -333,10 +333,10 @@ export const makeAccountService = Effect.gen(function*() {
333333
* @since 1.0.0
334334
* @category models
335335
*/
336-
export class AccountService extends Effect.Tag("@effect-aws/client-account/AccountService")<
336+
export class AccountService extends ServiceMap.Service<
337337
AccountService,
338338
AccountService$
339-
>() {
339+
>()("@effect-aws/client-account/AccountService") {
340340
static readonly defaultLayer = Layer.effect(this, makeAccountService).pipe(Layer.provide(Instance.layer));
341341
static readonly layer = (config: AccountService.Config) =>
342342
Layer.effect(this, makeAccountService).pipe(

0 commit comments

Comments
 (0)