@_linked/s3 1.2.1 → 1.3.0
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/CHANGELOG.md +47 -0
- package/lib/esm/shapes/S3Bucket.d.ts +24 -3
- package/lib/esm/shapes/S3Bucket.js +25 -23
- package/lib/esm/shapes/S3Bucket.js.map +1 -1
- package/lib/esm/shapes/S3FileStore.d.ts +14 -3
- package/lib/esm/shapes/S3FileStore.js +17 -9
- package/lib/esm/shapes/S3FileStore.js.map +1 -1
- package/package.json +7 -7
- package/tsconfig-esm.json +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @\_linked/s3
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#21](https://github.com/linked-fw/s3/pull/21) [`b5c6464`](https://github.com/linked-fw/s3/commit/b5c6464b0c93b09161f8c476aaf9e480eb4a45a3) Thanks [@flyon](https://github.com/flyon)! - `S3Bucket` no longer extends `Shape`, and drops `@linkedShape` with its
|
|
8
|
+
`static targetClass`.
|
|
9
|
+
|
|
10
|
+
Completes what `S3FileStore` started. The class used nothing from `Shape`: no
|
|
11
|
+
`this.id`, no `this.uri`, no `nodeShape`, no Shape statics, no property
|
|
12
|
+
decorators. `label` is its own field. The only inherited behaviour was a
|
|
13
|
+
`super()` call that deliberately passed `undefined` for the string form — doing
|
|
14
|
+
nothing — and both construction sites pass a string.
|
|
15
|
+
|
|
16
|
+
**One observable change, unlike the earlier store migrations.** Those three never
|
|
17
|
+
carried `@linkedShape`, so removing `extends Shape` was inert. This one does, and
|
|
18
|
+
`linkedShape` is typed `<T extends typeof Shape>`, so the decorator has to go too.
|
|
19
|
+
That means S3Bucket's auto-minted NodeShape disappears from `getAllShapeClasses()`,
|
|
20
|
+
and therefore from `indexShapesIntoMemory` and from `syncShapes` materialization.
|
|
21
|
+
Since `syncShapes` prunes orphans, a dataset that already holds that NodeShape
|
|
22
|
+
will have it removed on the next sync.
|
|
23
|
+
|
|
24
|
+
That shape was propertyless, and `s3:Bucket` has no RDF definition in this
|
|
25
|
+
package's ontology data (`src/data/s3.json` defines only the scaffold's
|
|
26
|
+
`s3:ExampleClass`), so nothing described it and no reader of it was found. Bumped
|
|
27
|
+
`minor` rather than `patch` because it is a registration change, not purely
|
|
28
|
+
internal.
|
|
29
|
+
|
|
30
|
+
## 1.2.2
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#19](https://github.com/linked-fw/s3/pull/19) [`36e930c`](https://github.com/linked-fw/s3/commit/36e930cf28a3b9c3288744a9291a1d7ba509f859) Thanks [@flyon](https://github.com/flyon)! - `S3FileStore` no longer extends `Shape`, and drops its inert `static targetClass`.
|
|
35
|
+
|
|
36
|
+
It used nothing from `Shape`: no `this.id`, no `this.uri`, no `nodeShape`, no Shape
|
|
37
|
+
statics, and no caller treats it as one. `label` is its own field, not an inherited
|
|
38
|
+
one. `targetClass` was already dead — it is only ever read by `@linkedShape`, which
|
|
39
|
+
this class never carried, and `s3:FileStore` is not defined in this package's
|
|
40
|
+
ontology data.
|
|
41
|
+
|
|
42
|
+
The old `super()` minted `${DATA_ROOT}/s3-filestore/${name}` with a comment saying
|
|
43
|
+
the URI had to match between frontend and backend. Nothing read it: the only
|
|
44
|
+
occurrence of that path anywhere in the codebase was the `super()` call itself.
|
|
45
|
+
|
|
46
|
+
Stores and datasets stopped being Shapes deliberately in core `0e8c86e`
|
|
47
|
+
("datasets are not shapes"). No API change — the constructor signature is unchanged
|
|
48
|
+
and the class still implements `IFileStore` in full.
|
|
49
|
+
|
|
3
50
|
## 1.2.1
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DeleteObjectCommandInput, HeadObjectCommandOutput, S3Client } from '@aws-sdk/client-s3';
|
|
2
2
|
import { PutObjectCommandInput, PutObjectCommandOutput } from '@aws-sdk/client-s3/dist-types/commands/PutObjectCommand';
|
|
3
3
|
import { StreamingBlobPayloadInputTypes } from '@smithy/types';
|
|
4
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
5
4
|
export interface S3ClientConfigInput {
|
|
6
5
|
endpoint?: string;
|
|
7
6
|
accessKeyId?: string;
|
|
@@ -19,11 +18,33 @@ export declare const createS3Client: (config?: S3ClientConfigInput) => S3Client;
|
|
|
19
18
|
* per-instance clients by passing config into S3Bucket/S3FileStore.
|
|
20
19
|
*/
|
|
21
20
|
export declare const s3Client: S3Client;
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A bucket is not a Shape.
|
|
23
|
+
*
|
|
24
|
+
* This class used to `extends Shape` and carry `@linkedShape` with
|
|
25
|
+
* `static targetClass = s3.Bucket`, but used nothing from `Shape`: no `this.id`,
|
|
26
|
+
* no `this.uri`, no `nodeShape`, no Shape statics, no property decorators.
|
|
27
|
+
* `label` is its own field. The only inherited behaviour was a `super()` call
|
|
28
|
+
* that deliberately passed `undefined` for the string form — i.e. did nothing at
|
|
29
|
+
* all — and both construction sites pass a string.
|
|
30
|
+
*
|
|
31
|
+
* Dropping `extends Shape` forces dropping the decorator with it, since
|
|
32
|
+
* `linkedShape` is typed `<T extends typeof Shape>`. That removes S3Bucket's
|
|
33
|
+
* auto-minted NodeShape from the shape index, which is the one observable
|
|
34
|
+
* change — see the changeset. The shape was propertyless and `s3:Bucket` has no
|
|
35
|
+
* RDF definition in this package's ontology data, so nothing described it.
|
|
36
|
+
*
|
|
37
|
+
* Follows `S3FileStore`, `LocalFileStore` and `FusekiStore`, and core `0e8c86e`
|
|
38
|
+
* ("datasets are not shapes").
|
|
39
|
+
*/
|
|
40
|
+
export declare class S3Bucket {
|
|
24
41
|
protected _client: S3Client;
|
|
25
42
|
label: string;
|
|
26
43
|
private ensureKeyPromise;
|
|
44
|
+
/**
|
|
45
|
+
* `n` names the bucket. The `{id}` form is still accepted so existing callers
|
|
46
|
+
* keep compiling, but it is no longer stored as a node id — nothing read it.
|
|
47
|
+
*/
|
|
27
48
|
constructor(n?: string | {
|
|
28
49
|
id: string;
|
|
29
50
|
}, clientConfig?: S3ClientConfigInput);
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
1
|
import { CopyObjectCommand, CreateBucketCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsCommand, PutObjectCommand, S3Client, } from '@aws-sdk/client-s3';
|
|
11
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
12
|
-
import { s3 } from '../ontologies/s3.js';
|
|
13
|
-
import { linkedShape } from '../package.js';
|
|
14
2
|
export const endpoint = process.env.S3_BUCKET_ENDPOINT;
|
|
15
3
|
/**
|
|
16
4
|
* Builds an S3 client from explicit config, falling back to legacy env vars.
|
|
@@ -33,11 +21,31 @@ export const createS3Client = (config = {}) => {
|
|
|
33
21
|
* per-instance clients by passing config into S3Bucket/S3FileStore.
|
|
34
22
|
*/
|
|
35
23
|
export const s3Client = createS3Client();
|
|
36
|
-
|
|
24
|
+
/**
|
|
25
|
+
* A bucket is not a Shape.
|
|
26
|
+
*
|
|
27
|
+
* This class used to `extends Shape` and carry `@linkedShape` with
|
|
28
|
+
* `static targetClass = s3.Bucket`, but used nothing from `Shape`: no `this.id`,
|
|
29
|
+
* no `this.uri`, no `nodeShape`, no Shape statics, no property decorators.
|
|
30
|
+
* `label` is its own field. The only inherited behaviour was a `super()` call
|
|
31
|
+
* that deliberately passed `undefined` for the string form — i.e. did nothing at
|
|
32
|
+
* all — and both construction sites pass a string.
|
|
33
|
+
*
|
|
34
|
+
* Dropping `extends Shape` forces dropping the decorator with it, since
|
|
35
|
+
* `linkedShape` is typed `<T extends typeof Shape>`. That removes S3Bucket's
|
|
36
|
+
* auto-minted NodeShape from the shape index, which is the one observable
|
|
37
|
+
* change — see the changeset. The shape was propertyless and `s3:Bucket` has no
|
|
38
|
+
* RDF definition in this package's ontology data, so nothing described it.
|
|
39
|
+
*
|
|
40
|
+
* Follows `S3FileStore`, `LocalFileStore` and `FusekiStore`, and core `0e8c86e`
|
|
41
|
+
* ("datasets are not shapes").
|
|
42
|
+
*/
|
|
43
|
+
export class S3Bucket {
|
|
44
|
+
/**
|
|
45
|
+
* `n` names the bucket. The `{id}` form is still accepted so existing callers
|
|
46
|
+
* keep compiling, but it is no longer stored as a node id — nothing read it.
|
|
47
|
+
*/
|
|
37
48
|
constructor(n, clientConfig) {
|
|
38
|
-
// `undefined`, not `null`: Shape only skips assigning an id for undefined,
|
|
39
|
-
// and would read `.id` off null otherwise.
|
|
40
|
-
super(typeof n === 'string' ? undefined : n);
|
|
41
49
|
this.ensureKeyPromise = new Map();
|
|
42
50
|
if (typeof n === 'string') {
|
|
43
51
|
this.label = n;
|
|
@@ -268,11 +276,5 @@ let S3Bucket = class S3Bucket extends Shape {
|
|
|
268
276
|
console.log('Could not create bucket: ', err);
|
|
269
277
|
}
|
|
270
278
|
}
|
|
271
|
-
}
|
|
272
|
-
S3Bucket.targetClass = s3.Bucket;
|
|
273
|
-
S3Bucket = __decorate([
|
|
274
|
-
linkedShape,
|
|
275
|
-
__metadata("design:paramtypes", [Object, Object])
|
|
276
|
-
], S3Bucket);
|
|
277
|
-
export { S3Bucket };
|
|
279
|
+
}
|
|
278
280
|
//# sourceMappingURL=S3Bucket.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"S3Bucket.js","sourceRoot":"","sources":["../../../src/shapes/S3Bucket.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"S3Bucket.js","sourceRoot":"","sources":["../../../src/shapes/S3Bucket.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,mBAAmB,EACnB,mBAAmB,EAEnB,gBAAgB,EAEhB,iBAAiB,EAGjB,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAe5B,MAAM,CAAC,MAAM,QAAQ,GAAW,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAA8B,EAAE,EAAE,EAAE;;IACjE,OAAA,IAAI,QAAQ,CAAC;QACX,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAC3D,2EAA2E;QAC3E,WAAW,EAAE;YACX,WAAW,EAAE,MAAA,MAAM,CAAC,WAAW,mCAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB;YAChE,eAAe,EACb,MAAA,MAAM,CAAC,eAAe,mCAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB;SAC9D;QACD,MAAM,EAAE,MAAA,MAAA,MAAM,CAAC,MAAM,mCAAI,OAAO,CAAC,GAAG,CAAC,UAAU,mCAAI,WAAW;KAC/D,CAAC,CAAA;CAAA,CAAC;AAEL;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;AAEzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,QAAQ;IAMnB;;;OAGG;IACH,YAAY,CAA2B,EAA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4 @@
|
|
|
1
1
|
import { FileStat, IFileStore, SaveFileOptions } from '@_linked/core/interfaces/IFileStore';
|
|
2
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
3
2
|
import { type S3ClientConfigInput } from './S3Bucket.js';
|
|
4
3
|
import type { Readable } from 'stream';
|
|
5
4
|
export interface S3FileStoreConfig {
|
|
@@ -8,8 +7,20 @@ export interface S3FileStoreConfig {
|
|
|
8
7
|
prefix?: string;
|
|
9
8
|
clientConfig?: S3ClientConfigInput;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A file store is not a Shape.
|
|
12
|
+
*
|
|
13
|
+
* This class used to `extends Shape` and declare `static targetClass = s3.FileStore`,
|
|
14
|
+
* but used nothing from `Shape`: no `this.id`, no `this.uri`, no `nodeShape`, no
|
|
15
|
+
* Shape statics, and no caller treats it as a Shape. `label` is its own field, not
|
|
16
|
+
* an inherited one. The `targetClass` was inert — it is only ever read by
|
|
17
|
+
* `@linkedShape`, which this class never carried, and `s3:FileStore` is not defined
|
|
18
|
+
* in this package's ontology data.
|
|
19
|
+
*
|
|
20
|
+
* Stores and datasets stopped being Shapes deliberately in core `0e8c86e`
|
|
21
|
+
* ("datasets are not shapes").
|
|
22
|
+
*/
|
|
23
|
+
export declare class S3FileStore implements IFileStore {
|
|
13
24
|
label: string;
|
|
14
25
|
private _bucket;
|
|
15
26
|
private readonly config;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { normalizeSaveFileOptions, } from '@_linked/core/interfaces/IFileStore';
|
|
2
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
3
2
|
import mime from 'mime';
|
|
4
3
|
import path from 'path';
|
|
5
|
-
import { s3 } from '../ontologies/s3.js';
|
|
6
4
|
import { S3Bucket } from './S3Bucket.js';
|
|
7
5
|
const trimSlashes = (value = '') => value.replace(/^\/+|\/+$/g, '');
|
|
8
6
|
const trimTrailingSlash = (value = '') => value.replace(/\/+$/g, '');
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A file store is not a Shape.
|
|
9
|
+
*
|
|
10
|
+
* This class used to `extends Shape` and declare `static targetClass = s3.FileStore`,
|
|
11
|
+
* but used nothing from `Shape`: no `this.id`, no `this.uri`, no `nodeShape`, no
|
|
12
|
+
* Shape statics, and no caller treats it as a Shape. `label` is its own field, not
|
|
13
|
+
* an inherited one. The `targetClass` was inert — it is only ever read by
|
|
14
|
+
* `@linkedShape`, which this class never carried, and `s3:FileStore` is not defined
|
|
15
|
+
* in this package's ontology data.
|
|
16
|
+
*
|
|
17
|
+
* Stores and datasets stopped being Shapes deliberately in core `0e8c86e`
|
|
18
|
+
* ("datasets are not shapes").
|
|
19
|
+
*/
|
|
20
|
+
export class S3FileStore {
|
|
10
21
|
constructor(n, config = {}) {
|
|
22
|
+
// The old `super()` minted `${DATA_ROOT}/s3-filestore/${n}` with a comment
|
|
23
|
+
// claiming the URI had to match between frontend and backend. Nothing ever
|
|
24
|
+
// read it — the only occurrence in the codebase was the `super()` call itself.
|
|
11
25
|
if (typeof n === 'string') {
|
|
12
|
-
//set a fixed URI. This is important because the URI needs to match on the frontend and backend
|
|
13
|
-
super(`${process.env.DATA_ROOT}/s3-filestore/${n}`);
|
|
14
26
|
this.label = n;
|
|
15
27
|
}
|
|
16
|
-
else {
|
|
17
|
-
super(n);
|
|
18
|
-
}
|
|
19
28
|
this.config = config;
|
|
20
29
|
this.accessURL = this.resolveAccessURL();
|
|
21
30
|
}
|
|
@@ -211,5 +220,4 @@ export class S3FileStore extends Shape {
|
|
|
211
220
|
};
|
|
212
221
|
}
|
|
213
222
|
}
|
|
214
|
-
S3FileStore.targetClass = s3.FileStore;
|
|
215
223
|
//# sourceMappingURL=S3FileStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"S3FileStore.js","sourceRoot":"","sources":["../../../src/shapes/S3FileStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,wBAAwB,GACz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AIG;IACH,KAAK,CAAC,UAAU,CAAC,QAAgB;QAC/B,IAAI,CAAC;YACH,wEAAwE;YACxE,qEAAqE;YACrE,wEAAwE;YACxE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CACvC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAC/C,CAAC;YACF,OAAO,IAAI,KAAK,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ,CAAC,QAAgB;;QAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE3D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,0EAA0E;YAC1E,0EAA0E;YAC1E,wEAAwE;YACxE,2EAA2E;YAC3E,uEAAuE;YACvE,IAAI,EAAE,MAAA,IAAI,CAAC,aAAa,mCAAI,CAAC;YAC7B,kEAAkE;YAClE,8DAA8D;YAC9D,kEAAkE;YAClE,oEAAoE;YACpE,kCAAkC;YAClC,MAAM,EAAE,MAAA,IAAI,CAAC,cAAc,mCAAI,SAAS;YACxC,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git+https://github.com/linked-fw/s3.git"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.3.0",
|
|
15
15
|
"packageManager": "npm@11.19.1",
|
|
16
16
|
"linkedPackage": true,
|
|
17
17
|
"type": "module",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "npm exec linked dev",
|
|
23
23
|
"build": "rimraf ./lib && npm run build-esm && npm run copy-to-lib",
|
|
24
|
-
"build-esm": "echo \"compiling ESM\" && rimraf ./lib/esm &&
|
|
24
|
+
"build-esm": "echo \"compiling ESM\" && rimraf ./lib/esm && tsc -p tsconfig-esm.json",
|
|
25
25
|
"copy-to-lib": "echo 'copying JSON assets to lib folder' && copyfiles -u 1 'src/**/*.json' lib/esm",
|
|
26
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules
|
|
27
|
-
"typecheck": "
|
|
26
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.cjs && npm run typecheck",
|
|
27
|
+
"typecheck": "tsc -p tsconfig-tests.json"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"lincd",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"aws"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@_linked/core": "^2.
|
|
42
|
-
"@_linked/server": "^2.
|
|
41
|
+
"@_linked/core": "^2.21.0",
|
|
42
|
+
"@_linked/server": "^2.5.1",
|
|
43
43
|
"@_linked/server-utils": "^1.0",
|
|
44
44
|
"@aws-sdk/client-s3": "^3.159.0",
|
|
45
45
|
"@aws-sdk/credential-providers": "^3.159.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"mime": "2.6.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@_linked/cli": "^1.
|
|
50
|
+
"@_linked/cli": "^1.19.0",
|
|
51
51
|
"@changesets/changelog-github": "^0.5.2",
|
|
52
52
|
"@changesets/cli": "^2.29.8",
|
|
53
53
|
"@jest/globals": "^29.7.0",
|