@wbce-d9/storage-driver-s3 10.0.1 → 10.0.3
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/dist/index.test.js +18 -6
- package/package.json +10 -9
package/dist/index.test.js
CHANGED
|
@@ -278,7 +278,9 @@ describe('#read', () => {
|
|
|
278
278
|
test('Returns stream from S3 client', async () => {
|
|
279
279
|
const mockGetObjectCommand = {};
|
|
280
280
|
vi.mocked(driver['client'].send).mockReturnValue({ Body: sample.stream });
|
|
281
|
-
vi.mocked(GetObjectCommand).
|
|
281
|
+
vi.mocked(GetObjectCommand).mockImplementation(function () {
|
|
282
|
+
return mockGetObjectCommand;
|
|
283
|
+
});
|
|
282
284
|
const stream = await driver.read(sample.path.input, sample.range);
|
|
283
285
|
expect(driver['client'].send).toHaveBeenCalledWith(mockGetObjectCommand);
|
|
284
286
|
expect(stream).toBe(sample.stream);
|
|
@@ -301,7 +303,9 @@ describe('#stat', () => {
|
|
|
301
303
|
});
|
|
302
304
|
test('Calls #send with HeadObjectCommand', async () => {
|
|
303
305
|
const mockHeadObjectCommand = {};
|
|
304
|
-
vi.mocked(HeadObjectCommand).
|
|
306
|
+
vi.mocked(HeadObjectCommand).mockImplementation(function () {
|
|
307
|
+
return mockHeadObjectCommand;
|
|
308
|
+
});
|
|
305
309
|
await driver.stat(sample.path.input);
|
|
306
310
|
expect(driver['client'].send).toHaveBeenCalledWith(mockHeadObjectCommand);
|
|
307
311
|
});
|
|
@@ -372,7 +376,9 @@ describe('#copy', () => {
|
|
|
372
376
|
});
|
|
373
377
|
test('Executes CopyObjectCommand', async () => {
|
|
374
378
|
const mockCommand = {};
|
|
375
|
-
vi.mocked(CopyObjectCommand).
|
|
379
|
+
vi.mocked(CopyObjectCommand).mockImplementation(function () {
|
|
380
|
+
return mockCommand;
|
|
381
|
+
});
|
|
376
382
|
await driver.copy(sample.path.src, sample.path.dest);
|
|
377
383
|
expect(driver['client'].send).toHaveBeenCalledWith(mockCommand);
|
|
378
384
|
});
|
|
@@ -429,7 +435,9 @@ describe('#write', () => {
|
|
|
429
435
|
});
|
|
430
436
|
test('Waits for upload to be done', async () => {
|
|
431
437
|
const mockUpload = { done: vi.fn() };
|
|
432
|
-
vi.mocked(Upload).
|
|
438
|
+
vi.mocked(Upload).mockImplementation(function () {
|
|
439
|
+
return mockUpload;
|
|
440
|
+
});
|
|
433
441
|
await driver.write(sample.path.input, sample.stream);
|
|
434
442
|
expect(mockUpload.done).toHaveBeenCalledOnce();
|
|
435
443
|
});
|
|
@@ -444,7 +452,9 @@ describe('#delete', () => {
|
|
|
444
452
|
});
|
|
445
453
|
test('Executes DeleteObjectCommand', async () => {
|
|
446
454
|
const mockDeleteObjectCommand = {};
|
|
447
|
-
vi.mocked(DeleteObjectCommand).
|
|
455
|
+
vi.mocked(DeleteObjectCommand).mockImplementation(function () {
|
|
456
|
+
return mockDeleteObjectCommand;
|
|
457
|
+
});
|
|
448
458
|
await driver.delete(sample.path.input);
|
|
449
459
|
expect(driver['client'].send).toHaveBeenCalledWith(mockDeleteObjectCommand);
|
|
450
460
|
});
|
|
@@ -461,7 +471,9 @@ describe('#list', () => {
|
|
|
461
471
|
});
|
|
462
472
|
test('Calls send with the command', async () => {
|
|
463
473
|
const mockListObjectsV2Command = {};
|
|
464
|
-
vi.mocked(ListObjectsV2Command).
|
|
474
|
+
vi.mocked(ListObjectsV2Command).mockImplementation(function () {
|
|
475
|
+
return mockListObjectsV2Command;
|
|
476
|
+
});
|
|
465
477
|
vi.mocked(driver['client'].send).mockResolvedValue({});
|
|
466
478
|
await driver.list(sample.path.input).next();
|
|
467
479
|
expect(driver['client'].send).toHaveBeenCalledWith(mockListObjectsV2Command);
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wbce-d9/storage-driver-s3",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "S3 file storage abstraction for `@wbce-d9/storage`",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/LaWebcapsule/
|
|
8
|
+
"url": "https://github.com/LaWebcapsule/d9.git",
|
|
9
9
|
"directory": "packages/storage-driver-s3"
|
|
10
10
|
},
|
|
11
|
-
"funding": "https://github.com/LaWebcapsule/
|
|
11
|
+
"funding": "https://github.com/LaWebcapsule/d9?sponsor=1",
|
|
12
12
|
"license": "GPL-3.0",
|
|
13
13
|
"author": "Rijk van Zanten <rijkvanzanten@me.com>",
|
|
14
14
|
"exports": {
|
|
@@ -25,17 +25,18 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@aws-sdk/abort-controller": "3.357.0",
|
|
28
|
-
"@aws-sdk/client-s3": "3.
|
|
29
|
-
"@aws-sdk/lib-storage": "3.
|
|
28
|
+
"@aws-sdk/client-s3": "3.1062.0",
|
|
29
|
+
"@aws-sdk/lib-storage": "3.1062.0",
|
|
30
30
|
"@wbce-d9/storage": "10.0.0",
|
|
31
|
-
"@wbce-d9/utils": "10.0.
|
|
31
|
+
"@wbce-d9/utils": "10.0.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@wbce-d9/tsconfig": "2.0.0",
|
|
35
34
|
"@ngneat/falso": "6.4.0",
|
|
36
|
-
"@
|
|
35
|
+
"@types/node": "22.15.29",
|
|
36
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
37
|
+
"@wbce-d9/tsconfig": "2.0.0",
|
|
37
38
|
"typescript": "5.0.4",
|
|
38
|
-
"vitest": "
|
|
39
|
+
"vitest": "4.1.11"
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
42
|
"build": "tsc --build",
|