effect-cloudflare-r2-layer 1.0.63 → 1.1.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.
- package/README.md +36 -0
- package/cjs/layer/file-storage.layer.js +1 -0
- package/cjs/layer/file-storage.layer.js.map +1 -1
- package/cjs/r2/implementations/file-exists.effect.js +23 -0
- package/cjs/r2/implementations/file-exists.effect.js.map +1 -0
- package/cjs/r2/implementations/index.js +1 -0
- package/cjs/r2/implementations/index.js.map +1 -1
- package/cjs/r2/r2-file-storage.layer.js +1 -0
- package/cjs/r2/r2-file-storage.layer.js.map +1 -1
- package/dts/layer/file-storage.layer.d.ts +2 -0
- package/dts/r2/implementations/file-exists.effect.d.ts +3 -0
- package/dts/r2/implementations/index.d.ts +1 -0
- package/esm/layer/file-storage.layer.js +1 -0
- package/esm/layer/file-storage.layer.js.map +1 -1
- package/esm/r2/implementations/file-exists.effect.js +19 -0
- package/esm/r2/implementations/file-exists.effect.js.map +1 -0
- package/esm/r2/implementations/index.js +1 -0
- package/esm/r2/implementations/index.js.map +1 -1
- package/esm/r2/r2-file-storage.layer.js +2 -1
- package/esm/r2/r2-file-storage.layer.js.map +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
@@ -75,6 +75,7 @@ R2_DOCUMENTS_SECRET_ACCESS_KEY=""
|
|
75
75
|
| [`readAsJson`](#-readasjson) | Fetches a file, expecting a content extending `Record<string, unknown>`. |
|
76
76
|
| [`readAsText`](#-readastext) | Fetches a file as a string. |
|
77
77
|
| [`readAsRawBinary`](#-readasrawbinary) | Fetches a file as raw binary (ArrayBuffer). |
|
78
|
+
| [`fileExists`](#-fileexists) | Checks if a file exists in a bucket |
|
78
79
|
|
79
80
|
### 🔶 `createBucket`
|
80
81
|
|
@@ -458,3 +459,38 @@ const task = pipe(
|
|
458
459
|
)
|
459
460
|
);
|
460
461
|
```
|
462
|
+
|
463
|
+
### 🔶 `fileExists`
|
464
|
+
|
465
|
+
```typescript
|
466
|
+
type fileExists = <TBucket extends string>(
|
467
|
+
bucket: TBucket,
|
468
|
+
fileName: string
|
469
|
+
) => Effect.Effect<boolean, ConfigError | FileStorageError, FileStorage>;
|
470
|
+
```
|
471
|
+
|
472
|
+
#### 🧿 Example
|
473
|
+
|
474
|
+
```typescript
|
475
|
+
import { Effect, pipe } from 'effect';
|
476
|
+
import {
|
477
|
+
CloudflareR2StorageLayerLive,
|
478
|
+
FileStorageLayer,
|
479
|
+
} from 'effect-cloudflare-r2-layer';
|
480
|
+
|
481
|
+
type Bucket = 'assets' | 'config';
|
482
|
+
|
483
|
+
const filePath = 'my-app/config.json';
|
484
|
+
|
485
|
+
const task = pipe(
|
486
|
+
Effect.gen(function* () {
|
487
|
+
const exists = yield* FileStorageLayer.fileExists<Bucket>(
|
488
|
+
'config',
|
489
|
+
filePath
|
490
|
+
);
|
491
|
+
|
492
|
+
// ...
|
493
|
+
}),
|
494
|
+
Effect.provide(CloudflareR2StorageLayerLive)
|
495
|
+
);
|
496
|
+
```
|
@@ -13,5 +13,6 @@ exports.FileStorageLayer = {
|
|
13
13
|
readAsText: (bucket, fileName) => (0, _effects_1.tapLayer)(exports.FileStorageLayerContext, ({ readAsText }) => readAsText(bucket, fileName)),
|
14
14
|
uploadFile: (input) => (0, _effects_1.tapLayer)(exports.FileStorageLayerContext, ({ uploadFile }) => uploadFile(input)),
|
15
15
|
deleteFile: (input) => (0, _effects_1.tapLayer)(exports.FileStorageLayerContext, ({ deleteFile }) => deleteFile(input)),
|
16
|
+
fileExists: (bucket, fileName) => (0, _effects_1.tapLayer)(exports.FileStorageLayerContext, ({ fileExists }) => fileExists(bucket, fileName)),
|
16
17
|
};
|
17
18
|
//# sourceMappingURL=file-storage.layer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-storage.layer.js","sourceRoot":"","sources":["../../../src/layer/file-storage.layer.ts"],"names":[],"mappings":";;;AAQA,mCAAiC;AAIjC,uCAAoC;
|
1
|
+
{"version":3,"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AC7B;IACH,UAAU,EAAE,CAAyB,KAA+B,EAAE,EAAE,CACtE,IAAA,mBAAQ,EAAC,+BAAuB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1E,UAAU,EAAE,CAAyB,KAA+B,EAAE,EAAE,CACtE,IAAA,mBAAQ,EAAC,+BAAuB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1E,UAAU,EAAE,CAAyB,MAAe,EAAE,QAAgB,EAAE,EAAE,CACxE,IAAA,mBAAQ,EAAC,+BAAuB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACnD,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAC7B;CACJ,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.fileExists = void 0;
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
5
|
+
const effect_1 = require("effect");
|
6
|
+
const _errors_1 = require("./../../errors/index.js");
|
7
|
+
const _provider_1 = require("./../providers/r2-file-storage.provider.js");
|
8
|
+
const fileExists = (bucketName, documentKey) => (0, effect_1.pipe)(_provider_1.cloudflareR2StorageProvider, effect_1.Effect.flatMap((provider) => effect_1.Effect.tryPromise({
|
9
|
+
try: () => provider.send(new client_s3_1.HeadObjectCommand({
|
10
|
+
Bucket: bucketName,
|
11
|
+
Key: documentKey,
|
12
|
+
})),
|
13
|
+
catch: (e) => new _errors_1.FileStorageError({ cause: e }),
|
14
|
+
})), effect_1.Effect.map(() => true), effect_1.Effect.catchTag('file-storage-error', (e) => {
|
15
|
+
if (e.cause instanceof Error && e.cause.name === 'NotFound') {
|
16
|
+
return effect_1.Effect.succeed(false);
|
17
|
+
}
|
18
|
+
return effect_1.Effect.fail(new _errors_1.FileStorageError({ cause: e }));
|
19
|
+
}), effect_1.Effect.withSpan('file-exists', {
|
20
|
+
attributes: { bucketName, documentKey },
|
21
|
+
}));
|
22
|
+
exports.fileExists = fileExists;
|
23
|
+
//# sourceMappingURL=file-exists.effect.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file-exists.effect.js","sourceRoot":"","sources":["../../../../src/r2/implementations/file-exists.effect.ts"],"names":[],"mappings":";;;AAAA,kDAAuD;AACvD,mCAAsC;AAEtC,qCAA2C;AAC3C,yCAAwD;AAEjD,MAAM,UAAU,GAAG,CACxB,UAAmB,EACnB,WAAmB,EACnB,EAAE,CACF,IAAA,aAAI,EACF,uCAA2B,EAC3B,eAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1B,eAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,GAAG,EAAE,CACR,QAAQ,CAAC,IAAI,CACX,IAAI,6BAAiB,CAAC;QACpB,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE,WAAW;KACjB,CAAC,CACH;IACH,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,0BAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACjD,CAAC,CACH,EACD,eAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EACtB,eAAM,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE;IAC1C,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC5D,OAAO,eAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,eAAM,CAAC,IAAI,CAAC,IAAI,0BAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC,EACF,eAAM,CAAC,QAAQ,CAAC,aAAa,EAAE;IAC7B,UAAU,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE;CACxC,CAAC,CACH,CAAC;AA5BS,QAAA,UAAU,cA4BnB"}
|
@@ -22,4 +22,5 @@ __exportStar(require("./read-as-json.effect.js"), exports);
|
|
22
22
|
__exportStar(require("./read-as-raw-binary.effect.js"), exports);
|
23
23
|
__exportStar(require("./read-as-text.effect.js"), exports);
|
24
24
|
__exportStar(require("./delete-file.effect.js"), exports);
|
25
|
+
__exportStar(require("./file-exists.effect.js"), exports);
|
25
26
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/r2/implementations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,0DAAwC;AACxC,2DAAyC;AACzC,iEAA+C;AAC/C,2DAAyC;AACzC,0DAAwC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/r2/implementations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,0DAAwC;AACxC,2DAAyC;AACzC,iEAA+C;AAC/C,2DAAyC;AACzC,0DAAwC;AACxC,0DAAwC"}
|
@@ -13,5 +13,6 @@ exports.CloudflareR2StorageLayerLive = effect_1.Layer.succeed(file_storage_layer
|
|
13
13
|
readAsText: _implementation_1.readAsText,
|
14
14
|
readAsJson: _implementation_1.readAsJson,
|
15
15
|
readAsRawBinary: _implementation_1.readAsRawBinary,
|
16
|
+
fileExists: _implementation_1.fileExists,
|
16
17
|
}));
|
17
18
|
//# sourceMappingURL=r2-file-storage.layer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"r2-file-storage.layer.js","sourceRoot":"","sources":["../../../src/r2/r2-file-storage.layer.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAE/B,
|
1
|
+
{"version":3,"file":"r2-file-storage.layer.js","sourceRoot":"","sources":["../../../src/r2/r2-file-storage.layer.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAE/B,qDAUyB;AAEzB,0EAAyE;AAE5D,QAAA,4BAA4B,GAAG,cAAK,CAAC,OAAO,CACvD,+CAAuB,EACvB,+CAAuB,CAAC,EAAE,CAAC;IACzB,YAAY,EAAZ,8BAAY;IACZ,WAAW,EAAX,6BAAW;IACX,UAAU,EAAV,4BAAU;IACV,UAAU,EAAV,4BAAU;IACV,UAAU,EAAV,4BAAU;IACV,UAAU,EAAV,4BAAU;IACV,UAAU,EAAV,4BAAU;IACV,eAAe,EAAf,iCAAe;IACf,UAAU,EAAV,4BAAU;CACX,CAAC,CACH,CAAC"}
|
@@ -15,6 +15,7 @@ export interface FileStorage {
|
|
15
15
|
readonly readAsText: <TBucket extends string>(bucketName: TBucket, documentKey: string) => Effect.Effect<string, ConfigError.ConfigError | HttpClientError | FileStorageError, HttpClient.HttpClient | Scope>;
|
16
16
|
readonly uploadFile: <TBucket extends string>({ bucketName, documentKey, data, contentType, }: UploadFileInput<TBucket>) => Effect.Effect<PutObjectCommandOutput, ConfigError.ConfigError | FileStorageError, never>;
|
17
17
|
readonly deleteFile: <TBucket extends string>({ bucketName, documentKey, }: DeleteFileInput<TBucket>) => Effect.Effect<DeleteObjectCommandOutput, ConfigError.ConfigError | FileStorageError, never>;
|
18
|
+
readonly fileExists: <TBucket extends string>(bucketName: TBucket, documentKey: string) => Effect.Effect<boolean, ConfigError.ConfigError | FileStorageError>;
|
18
19
|
}
|
19
20
|
export declare const FileStorageLayerContext: Context.Tag<FileStorage, FileStorage>;
|
20
21
|
export declare const FileStorageLayer: {
|
@@ -26,4 +27,5 @@ export declare const FileStorageLayer: {
|
|
26
27
|
readAsText: <TBucket extends string>(bucket: TBucket, fileName: string) => Effect.Effect<string, FileStorageError | ConfigError.ConfigError | HttpClientError, HttpClient.HttpClient | Scope | FileStorage>;
|
27
28
|
uploadFile: <TBucket extends string>(input: UploadFileInput<TBucket>) => Effect.Effect<PutObjectCommandOutput, FileStorageError | ConfigError.ConfigError, FileStorage>;
|
28
29
|
deleteFile: <TBucket extends string>(input: DeleteFileInput<TBucket>) => Effect.Effect<DeleteObjectCommandOutput, FileStorageError | ConfigError.ConfigError, FileStorage>;
|
30
|
+
fileExists: <TBucket extends string>(bucket: TBucket, fileName: string) => Effect.Effect<boolean, FileStorageError | ConfigError.ConfigError, FileStorage>;
|
29
31
|
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { Effect } from 'effect';
|
2
|
+
import { FileStorageError } from './../../errors/index.js';
|
3
|
+
export declare const fileExists: <TBucket extends string>(bucketName: TBucket, documentKey: string) => Effect.Effect<boolean, FileStorageError | import("effect/ConfigError").ConfigError, never>;
|
@@ -10,5 +10,6 @@ export const FileStorageLayer = {
|
|
10
10
|
readAsText: (bucket, fileName) => tapLayer(FileStorageLayerContext, ({ readAsText }) => readAsText(bucket, fileName)),
|
11
11
|
uploadFile: (input) => tapLayer(FileStorageLayerContext, ({ uploadFile }) => uploadFile(input)),
|
12
12
|
deleteFile: (input) => tapLayer(FileStorageLayerContext, ({ deleteFile }) => deleteFile(input)),
|
13
|
+
fileExists: (bucket, fileName) => tapLayer(FileStorageLayerContext, ({ fileExists }) => fileExists(bucket, fileName)),
|
13
14
|
};
|
14
15
|
//# sourceMappingURL=file-storage.layer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-storage.layer.js","sourceRoot":"","sources":["../../../src/layer/file-storage.layer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIjC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"file-storage.layer.js","sourceRoot":"","sources":["../../../src/layer/file-storage.layer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIjC,OAAO,EAAE,QAAQ,EA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,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1E,UAAU,EAAE,CAAyB,KAA+B,EAAE,EAAE,CACtE,QAAQ,CAAC,uBAAuB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1E,UAAU,EAAE,CAAyB,MAAe,EAAE,QAAgB,EAAE,EAAE,CACxE,QAAQ,CAAC,uBAAuB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACnD,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAC7B;CACJ,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { HeadObjectCommand } from '@aws-sdk/client-s3';
|
2
|
+
import { Effect, pipe } from 'effect';
|
3
|
+
import { FileStorageError } from './../../errors/index.js';
|
4
|
+
import { cloudflareR2StorageProvider } from './../providers/r2-file-storage.provider.js';
|
5
|
+
export const fileExists = (bucketName, documentKey) => pipe(cloudflareR2StorageProvider, Effect.flatMap((provider) => Effect.tryPromise({
|
6
|
+
try: () => provider.send(new HeadObjectCommand({
|
7
|
+
Bucket: bucketName,
|
8
|
+
Key: documentKey,
|
9
|
+
})),
|
10
|
+
catch: (e) => new FileStorageError({ cause: e }),
|
11
|
+
})), Effect.map(() => true), Effect.catchTag('file-storage-error', (e) => {
|
12
|
+
if (e.cause instanceof Error && e.cause.name === 'NotFound') {
|
13
|
+
return Effect.succeed(false);
|
14
|
+
}
|
15
|
+
return Effect.fail(new FileStorageError({ cause: e }));
|
16
|
+
}), Effect.withSpan('file-exists', {
|
17
|
+
attributes: { bucketName, documentKey },
|
18
|
+
}));
|
19
|
+
//# sourceMappingURL=file-exists.effect.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file-exists.effect.js","sourceRoot":"","sources":["../../../../src/r2/implementations/file-exists.effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oB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../src/r2/implementations/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/r2/implementations/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Layer } from 'effect';
|
2
|
-
import { bucketInfos, createBucket, deleteFile, getFileUrl, readAsJson, readAsRawBinary, readAsText, uploadFile, } from './implementations/index.js';
|
2
|
+
import { bucketInfos, createBucket, deleteFile, fileExists, getFileUrl, readAsJson, readAsRawBinary, readAsText, uploadFile, } from './implementations/index.js';
|
3
3
|
import { FileStorageLayerContext } from '../layer/file-storage.layer.js';
|
4
4
|
export const CloudflareR2StorageLayerLive = Layer.succeed(FileStorageLayerContext, FileStorageLayerContext.of({
|
5
5
|
createBucket,
|
@@ -10,5 +10,6 @@ export const CloudflareR2StorageLayerLive = Layer.succeed(FileStorageLayerContex
|
|
10
10
|
readAsText,
|
11
11
|
readAsJson,
|
12
12
|
readAsRawBinary,
|
13
|
+
fileExists,
|
13
14
|
}));
|
14
15
|
//# sourceMappingURL=r2-file-storage.layer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"r2-file-storage.layer.js","sourceRoot":"","sources":["../../../src/r2/r2-file-storage.layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,CAAC,OAAO,CACvD,uBAAuB,EACvB,uBAAuB,CAAC,EAAE,CAAC;IACzB,YAAY;IACZ,WAAW;IACX,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,eAAe;
|
1
|
+
{"version":3,"file":"r2-file-storage.layer.js","sourceRoot":"","sources":["../../../src/r2/r2-file-storage.layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,CAAC,OAAO,CACvD,uBAAuB,EACvB,uBAAuB,CAAC,EAAE,CAAC;IACzB,YAAY;IACZ,WAAW;IACX,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,eAAe;IACf,UAAU;CACX,CAAC,CACH,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "effect-cloudflare-r2-layer",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.1.1",
|
4
4
|
"author": "jpb06 <jp.bois.06@outlook.fr>",
|
5
5
|
"description": "An effect layer to interact with Cloudware R2 storage service",
|
6
6
|
"keywords": [
|
@@ -46,31 +46,31 @@
|
|
46
46
|
"sync-icons": "bun generateReadmeIcons -h 50"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@aws-sdk/client-s3": "3.
|
50
|
-
"@aws-sdk/s3-request-presigner": "3.
|
51
|
-
"@effect/platform": "0.77.
|
49
|
+
"@aws-sdk/client-s3": "3.758.0",
|
50
|
+
"@aws-sdk/s3-request-presigner": "3.758.0",
|
51
|
+
"@effect/platform": "0.77.4",
|
52
52
|
"dotenv": "16.4.7",
|
53
|
-
"effect": "3.13.
|
53
|
+
"effect": "3.13.4"
|
54
54
|
},
|
55
55
|
"peerDependencies": {
|
56
|
-
"typescript": "5.
|
56
|
+
"typescript": "5.8.2"
|
57
57
|
},
|
58
58
|
"devDependencies": {
|
59
59
|
"@biomejs/biome": "1.9.4",
|
60
60
|
"@types/bun": "latest",
|
61
61
|
"@types/fs-extra": "11.0.4",
|
62
|
-
"@vitest/coverage-v8": "3.0.
|
62
|
+
"@vitest/coverage-v8": "3.0.7",
|
63
63
|
"comment-json": "4.2.5",
|
64
64
|
"copyfiles": "2.4.1",
|
65
65
|
"del-cli": "6.0.0",
|
66
|
-
"effect-errors": "1.8.
|
66
|
+
"effect-errors": "1.8.39",
|
67
67
|
"fs-extra": "11.3.0",
|
68
68
|
"glob": "11.0.1",
|
69
|
-
"npm-check-updates": "17.1.
|
69
|
+
"npm-check-updates": "17.1.15",
|
70
70
|
"readme-package-icons": "1.2.0",
|
71
|
-
"ts-paths-resolver": "1.2.
|
71
|
+
"ts-paths-resolver": "1.2.33",
|
72
72
|
"tsx": "4.19.3",
|
73
|
-
"vitest": "3.0.
|
74
|
-
"vitest-mock-extended": "
|
73
|
+
"vitest": "3.0.7",
|
74
|
+
"vitest-mock-extended": "3.0.1"
|
75
75
|
}
|
76
76
|
}
|