@effect-aws/client-s3 1.10.9 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -3
  3. package/dist/dts/Errors.d.ts +10 -6
  4. package/dist/dts/Errors.d.ts.map +1 -1
  5. package/dist/dts/S3ClientInstance.d.ts +4 -2
  6. package/dist/dts/S3ClientInstance.d.ts.map +1 -1
  7. package/dist/dts/S3Service.d.ts +117 -129
  8. package/dist/dts/S3Service.d.ts.map +1 -1
  9. package/dist/dts/S3ServiceConfig.d.ts +2 -1
  10. package/dist/dts/S3ServiceConfig.d.ts.map +1 -1
  11. package/dist/esm/Errors.js +4 -2
  12. package/dist/esm/Errors.js.map +1 -1
  13. package/dist/esm/S3ClientInstance.js +5 -3
  14. package/dist/esm/S3ClientInstance.js.map +1 -1
  15. package/dist/esm/S3Service.js +6 -3
  16. package/dist/esm/S3Service.js.map +1 -1
  17. package/dist/esm/S3ServiceConfig.js +7 -6
  18. package/dist/esm/S3ServiceConfig.js.map +1 -1
  19. package/package.json +8 -14
  20. package/src/Errors.ts +9 -5
  21. package/src/S3ClientInstance.ts +6 -4
  22. package/src/S3Service.ts +128 -140
  23. package/src/S3ServiceConfig.ts +8 -7
  24. package/dist/cjs/Errors.d.ts +0 -26
  25. package/dist/cjs/Errors.d.ts.map +0 -1
  26. package/dist/cjs/Errors.js +0 -22
  27. package/dist/cjs/Errors.js.map +0 -1
  28. package/dist/cjs/S3ClientInstance.d.ts +0 -24
  29. package/dist/cjs/S3ClientInstance.d.ts.map +0 -1
  30. package/dist/cjs/S3ClientInstance.js +0 -50
  31. package/dist/cjs/S3ClientInstance.js.map +0 -1
  32. package/dist/cjs/S3Service.d.ts +0 -497
  33. package/dist/cjs/S3Service.d.ts.map +0 -1
  34. package/dist/cjs/S3Service.js +0 -174
  35. package/dist/cjs/S3Service.js.map +0 -1
  36. package/dist/cjs/S3ServiceConfig.d.ts +0 -25
  37. package/dist/cjs/S3ServiceConfig.d.ts.map +0 -1
  38. package/dist/cjs/S3ServiceConfig.js +0 -35
  39. package/dist/cjs/S3ServiceConfig.js.map +0 -1
  40. package/dist/cjs/index.d.ts +0 -44
  41. package/dist/cjs/index.d.ts.map +0 -1
  42. package/dist/cjs/index.js +0 -56
  43. package/dist/cjs/index.js.map +0 -1
@@ -3,18 +3,19 @@
3
3
  */
4
4
  import type { S3ClientConfig } from "@aws-sdk/client-s3";
5
5
  import { ServiceLogger } from "@effect-aws/commons";
6
- import { Effect, FiberRef, Layer } from "effect";
6
+ import * as Effect from "effect/Effect";
7
7
  import { dual } from "effect/Function";
8
- import { globalValue } from "effect/GlobalValue";
8
+ import * as Layer from "effect/Layer";
9
+ import * as ServiceMap from "effect/ServiceMap";
9
10
  import type { S3Service } from "./S3Service.js";
10
11
 
11
12
  /**
12
13
  * @since 1.0.0
13
14
  * @category s3 service config
14
15
  */
15
- const currentS3ServiceConfig = globalValue(
16
+ const currentS3ServiceConfig = ServiceMap.Reference<S3Service.Config>(
16
17
  "@effect-aws/client-s3/currentS3ServiceConfig",
17
- () => FiberRef.unsafeMake<S3Service.Config>({}),
18
+ { defaultValue: () => ({}) },
18
19
  );
19
20
 
20
21
  /**
@@ -27,21 +28,21 @@ export const withS3ServiceConfig: {
27
28
  } = dual(
28
29
  2,
29
30
  <A, E, R>(effect: Effect.Effect<A, E, R>, config: S3Service.Config): Effect.Effect<A, E, R> =>
30
- Effect.locally(effect, currentS3ServiceConfig, config),
31
+ Effect.provideService(effect, currentS3ServiceConfig, config),
31
32
  );
32
33
 
33
34
  /**
34
35
  * @since 1.0.0
35
36
  * @category s3 service config
36
37
  */
37
- export const setS3ServiceConfig = (config: S3Service.Config) => Layer.locallyScoped(currentS3ServiceConfig, config);
38
+ export const setS3ServiceConfig = (config: S3Service.Config) => Layer.succeed(currentS3ServiceConfig, config);
38
39
 
39
40
  /**
40
41
  * @since 1.0.0
41
42
  * @category adapters
42
43
  */
43
44
  export const toS3ClientConfig: Effect.Effect<S3ClientConfig> = Effect.gen(function*() {
44
- const { logger: serviceLogger, ...config } = yield* FiberRef.get(currentS3ServiceConfig);
45
+ const { logger: serviceLogger, ...config } = yield* currentS3ServiceConfig;
45
46
 
46
47
  const logger = serviceLogger === true
47
48
  ? yield* ServiceLogger.toClientLogger(ServiceLogger.defaultServiceLogger)
@@ -1,26 +0,0 @@
1
- import type { BucketAlreadyExists, BucketAlreadyOwnedByYou, EncryptionTypeMismatch, IdempotencyParameterMismatch, InvalidObjectState, InvalidRequest, InvalidWriteOffset, NoSuchBucket, NoSuchKey, NoSuchUpload, NotFound, ObjectAlreadyInActiveTierError as ObjectAlreadyInActiveTierException, ObjectNotInActiveTierError as ObjectNotInActiveTierException, S3ServiceException, TooManyParts } from "@aws-sdk/client-s3";
2
- import type { TaggedException } from "@effect-aws/commons";
3
- import { Data } from "effect";
4
- export declare const AllServiceErrors: readonly ["BucketAlreadyExists", "BucketAlreadyOwnedByYou", "EncryptionTypeMismatch", "IdempotencyParameterMismatch", "InvalidObjectState", "InvalidRequest", "InvalidWriteOffset", "NoSuchBucket", "NoSuchKey", "NoSuchUpload", "NotFound", "ObjectAlreadyInActiveTierError", "ObjectNotInActiveTierError", "TooManyParts"];
5
- export type BucketAlreadyExistsError = TaggedException<BucketAlreadyExists>;
6
- export type BucketAlreadyOwnedByYouError = TaggedException<BucketAlreadyOwnedByYou>;
7
- export type EncryptionTypeMismatchError = TaggedException<EncryptionTypeMismatch>;
8
- export type IdempotencyParameterMismatchError = TaggedException<IdempotencyParameterMismatch>;
9
- export type InvalidObjectStateError = TaggedException<InvalidObjectState>;
10
- export type InvalidRequestError = TaggedException<InvalidRequest>;
11
- export type InvalidWriteOffsetError = TaggedException<InvalidWriteOffset>;
12
- export type NoSuchBucketError = TaggedException<NoSuchBucket>;
13
- export type NoSuchKeyError = TaggedException<NoSuchKey>;
14
- export type NoSuchUploadError = TaggedException<NoSuchUpload>;
15
- export type NotFoundError = TaggedException<NotFound>;
16
- export type ObjectAlreadyInActiveTierError = TaggedException<ObjectAlreadyInActiveTierException>;
17
- export type ObjectNotInActiveTierError = TaggedException<ObjectNotInActiveTierException>;
18
- export type TooManyPartsError = TaggedException<TooManyParts>;
19
- export type S3ServiceError = TaggedException<S3ServiceException & {
20
- name: "S3ServiceError";
21
- }>;
22
- export declare const S3ServiceError: Data.Case.Constructor<S3ServiceError, "_tag">;
23
- export type SdkError = TaggedException<Error & {
24
- name: "SdkError";
25
- }>;
26
- //# sourceMappingURL=Errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../src/Errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,8BAA8B,IAAI,kCAAkC,EACpE,0BAA0B,IAAI,8BAA8B,EAC5D,kBAAkB,EAClB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,eAAO,MAAM,gBAAgB,8TAenB,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC;AAC5E,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC,uBAAuB,CAAC,CAAC;AACpF,MAAM,MAAM,2BAA2B,GAAG,eAAe,CAAC,sBAAsB,CAAC,CAAC;AAClF,MAAM,MAAM,iCAAiC,GAAG,eAAe,CAAC,4BAA4B,CAAC,CAAC;AAC9F,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;AAClE,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AACtD,MAAM,MAAM,8BAA8B,GAAG,eAAe,CAAC,kCAAkC,CAAC,CAAC;AACjG,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC,8BAA8B,CAAC,CAAC;AACzF,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;AAE9D,MAAM,MAAM,cAAc,GAAG,eAAe,CAC1C,kBAAkB,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAChD,CAAC;AACF,eAAO,MAAM,cAAc,+CAAgD,CAAC;AAC5E,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.S3ServiceError = exports.AllServiceErrors = void 0;
4
- const effect_1 = require("effect");
5
- exports.AllServiceErrors = [
6
- "BucketAlreadyExists",
7
- "BucketAlreadyOwnedByYou",
8
- "EncryptionTypeMismatch",
9
- "IdempotencyParameterMismatch",
10
- "InvalidObjectState",
11
- "InvalidRequest",
12
- "InvalidWriteOffset",
13
- "NoSuchBucket",
14
- "NoSuchKey",
15
- "NoSuchUpload",
16
- "NotFound",
17
- "ObjectAlreadyInActiveTierError",
18
- "ObjectNotInActiveTierError",
19
- "TooManyParts",
20
- ];
21
- exports.S3ServiceError = effect_1.Data.tagged("S3ServiceError");
22
- //# sourceMappingURL=Errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../src/Errors.ts"],"names":[],"mappings":";;;AAkBA,mCAA8B;AAEjB,QAAA,gBAAgB,GAAG;IAC9B,qBAAqB;IACrB,yBAAyB;IACzB,wBAAwB;IACxB,8BAA8B;IAC9B,oBAAoB;IACpB,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,WAAW;IACX,cAAc;IACd,UAAU;IACV,gCAAgC;IAChC,4BAA4B;IAC5B,cAAc;CACN,CAAC;AAoBE,QAAA,cAAc,GAAG,aAAI,CAAC,MAAM,CAAiB,gBAAgB,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * @since 1.0.0
3
- */
4
- import { S3Client } from "@aws-sdk/client-s3";
5
- import { Context, Effect, Layer } from "effect";
6
- declare const S3ClientInstance_base: Context.TagClass<S3ClientInstance, "@effect-aws/client-s3/S3ClientInstance", S3Client>;
7
- /**
8
- * @since 1.0.0
9
- * @category tags
10
- */
11
- export declare class S3ClientInstance extends S3ClientInstance_base {
12
- }
13
- /**
14
- * @since 1.0.0
15
- * @category constructors
16
- */
17
- export declare const make: Effect.Effect<S3Client, never, import("effect/Scope").Scope>;
18
- /**
19
- * @since 1.0.0
20
- * @category layers
21
- */
22
- export declare const layer: Layer.Layer<S3ClientInstance, never, never>;
23
- export {};
24
- //# sourceMappingURL=S3ClientInstance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"S3ClientInstance.d.ts","sourceRoot":"","sources":["../../src/S3ClientInstance.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;;AAGhD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,qBAEP;CAAG;AAElC;;;GAGG;AACH,eAAO,MAAM,IAAI,8DAOhB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK,6CAAuC,CAAC"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.layer = exports.make = exports.S3ClientInstance = void 0;
27
- /**
28
- * @since 1.0.0
29
- */
30
- const client_s3_1 = require("@aws-sdk/client-s3");
31
- const effect_1 = require("effect");
32
- const S3ServiceConfig = __importStar(require("./S3ServiceConfig.js"));
33
- /**
34
- * @since 1.0.0
35
- * @category tags
36
- */
37
- class S3ClientInstance extends effect_1.Context.Tag("@effect-aws/client-s3/S3ClientInstance")() {
38
- }
39
- exports.S3ClientInstance = S3ClientInstance;
40
- /**
41
- * @since 1.0.0
42
- * @category constructors
43
- */
44
- exports.make = effect_1.Effect.flatMap(S3ServiceConfig.toS3ClientConfig, (config) => effect_1.Effect.acquireRelease(effect_1.Effect.sync(() => new client_s3_1.S3Client(config)), (client) => effect_1.Effect.sync(() => client.destroy())));
45
- /**
46
- * @since 1.0.0
47
- * @category layers
48
- */
49
- exports.layer = effect_1.Layer.scoped(S3ClientInstance, exports.make);
50
- //# sourceMappingURL=S3ClientInstance.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"S3ClientInstance.js","sourceRoot":"","sources":["../../src/S3ClientInstance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,kDAA8C;AAC9C,mCAAgD;AAChD,sEAAwD;AAExD;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,gBAAO,CAAC,GAAG,CAC/C,wCAAwC,CACzC,EAA8B;CAAG;AAFlC,4CAEkC;AAElC;;;GAGG;AACU,QAAA,IAAI,GAAG,eAAM,CAAC,OAAO,CAChC,eAAe,CAAC,gBAAgB,EAChC,CAAC,MAAM,EAAE,EAAE,CACT,eAAM,CAAC,cAAc,CACnB,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,oBAAQ,CAAC,MAAM,CAAC,CAAC,EACvC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAChD,CACJ,CAAC;AAEF;;;GAGG;AACU,QAAA,KAAK,GAAG,cAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAI,CAAC,CAAC"}