@squiz/db-lib 1.76.0 → 1.77.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 (38) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/dynamodb/AbstractDynamoDbRepository.d.ts +1 -1
  3. package/lib/dynamodb/AbstractDynamoDbRepository.d.ts.map +1 -1
  4. package/lib/dynamodb/AbstractDynamoDbRepository.js +6 -5
  5. package/lib/dynamodb/AbstractDynamoDbRepository.js.map +1 -1
  6. package/lib/dynamodb/AbstractDynamoDbRepository.spec.d.ts.map +1 -1
  7. package/lib/dynamodb/AbstractDynamoDbRepository.spec.js +15 -14
  8. package/lib/dynamodb/AbstractDynamoDbRepository.spec.js.map +1 -1
  9. package/lib/dynamodb/getDynamoDbOptions.d.ts.map +1 -1
  10. package/lib/externalized/ExternalizedDynamoDbRepository.d.ts +166 -0
  11. package/lib/externalized/ExternalizedDynamoDbRepository.d.ts.map +1 -0
  12. package/lib/externalized/ExternalizedDynamoDbRepository.js +535 -0
  13. package/lib/externalized/ExternalizedDynamoDbRepository.js.map +1 -0
  14. package/lib/externalized/ExternalizedDynamoDbRepository.spec.d.ts +2 -0
  15. package/lib/externalized/ExternalizedDynamoDbRepository.spec.d.ts.map +1 -0
  16. package/lib/externalized/ExternalizedDynamoDbRepository.spec.js +431 -0
  17. package/lib/externalized/ExternalizedDynamoDbRepository.spec.js.map +1 -0
  18. package/lib/index.d.ts +2 -0
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js +3 -0
  21. package/lib/index.js.map +1 -1
  22. package/lib/s3/S3ExternalStorage.d.ts +66 -0
  23. package/lib/s3/S3ExternalStorage.d.ts.map +1 -0
  24. package/lib/s3/S3ExternalStorage.js +84 -0
  25. package/lib/s3/S3ExternalStorage.js.map +1 -0
  26. package/lib/s3/S3ExternalStorage.spec.d.ts +12 -0
  27. package/lib/s3/S3ExternalStorage.spec.d.ts.map +1 -0
  28. package/lib/s3/S3ExternalStorage.spec.js +130 -0
  29. package/lib/s3/S3ExternalStorage.spec.js.map +1 -0
  30. package/package.json +7 -6
  31. package/src/dynamodb/AbstractDynamoDbRepository.spec.ts +2 -1
  32. package/src/dynamodb/AbstractDynamoDbRepository.ts +3 -1
  33. package/src/externalized/ExternalizedDynamoDbRepository.spec.ts +539 -0
  34. package/src/externalized/ExternalizedDynamoDbRepository.ts +625 -0
  35. package/src/index.ts +4 -0
  36. package/src/s3/S3ExternalStorage.spec.ts +181 -0
  37. package/src/s3/S3ExternalStorage.ts +118 -0
  38. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,539 @@
1
+ import { ExternalizedDynamoDbRepository } from './ExternalizedDynamoDbRepository';
2
+ import { S3ExternalStorage, S3StorageLocation } from '../s3/S3ExternalStorage';
3
+ import { DynamoDbManager } from '../dynamodb/DynamoDbManager';
4
+ import { EntityDefinition } from '../dynamodb/AbstractDynamoDbRepository';
5
+
6
+ // Mock model class for testing
7
+ interface TestItemShape {
8
+ id: string;
9
+ name: string;
10
+ data: Array<{ key: string; value: object }>;
11
+ }
12
+
13
+ class TestItem implements TestItemShape {
14
+ id: string;
15
+ name: string;
16
+ data: Array<{ key: string; value: object }>;
17
+ storageLocation?: S3StorageLocation;
18
+
19
+ constructor(input: Record<string, unknown> = {}) {
20
+ this.id = (input.id as string) || '';
21
+ this.name = (input.name as string) || '';
22
+ this.data = (input.data as Array<{ key: string; value: object }>) || [];
23
+ // Note: storageLocation is intentionally not set from input to simulate model stripping it
24
+ }
25
+ }
26
+
27
+ // Test entity definition
28
+ const testEntityDefinition: EntityDefinition = {
29
+ keys: {
30
+ pk: {
31
+ attributeName: 'pk',
32
+ format: 'ITEM#${id}',
33
+ },
34
+ sk: {
35
+ attributeName: 'sk',
36
+ format: 'ITEM#${id}',
37
+ },
38
+ },
39
+ indexes: {},
40
+ fieldsAsJsonString: ['data'],
41
+ };
42
+
43
+ // Concrete test repository
44
+ class TestRepo extends ExternalizedDynamoDbRepository<TestItemShape, TestItem> {
45
+ public mockSuperUpdateItem?: jest.Mock;
46
+ public mockSuperGetItem?: jest.Mock;
47
+ public mockSuperCreateItem?: jest.Mock;
48
+
49
+ constructor(dbManager: DynamoDbManager<any>, storage: S3ExternalStorage, overrides: Partial<EntityDefinition> = {}) {
50
+ super('test-table', dbManager, 'test_item', { ...testEntityDefinition, ...overrides }, TestItem, storage);
51
+ }
52
+
53
+ // Expose protected methods for testing
54
+ public async testPrepareValueForStorage(value: TestItem): Promise<TestItem> {
55
+ return await (this as any).prepareValueForStorage(value);
56
+ }
57
+
58
+ public async testHydrateFromExternalStorage(record?: TestItem): Promise<TestItem | undefined> {
59
+ return await (this as any).hydrateFromExternalStorage(record);
60
+ }
61
+
62
+ public testIsDynamoItemSizeLimitError(error: unknown): boolean {
63
+ return (this as any).isDynamoItemSizeLimitError(error);
64
+ }
65
+
66
+ public testIsContentInS3(item: TestItem): boolean {
67
+ return (this as any).isContentInS3(item);
68
+ }
69
+
70
+ public testGetKeyFieldsValues(obj: Record<string, unknown>): Record<string, unknown> {
71
+ return (this as any).getKeyFieldsValues(obj);
72
+ }
73
+
74
+ // Override updateItem to allow mocking super.updateItem
75
+ public async updateItem(value: Partial<TestItemShape>): Promise<TestItem | undefined> {
76
+ if (this.mockSuperUpdateItem) {
77
+ // Use mock if provided
78
+ const previousLocation = await (this as any).fetchStoredLocation(value);
79
+ const updatedItem = await this.mockSuperUpdateItem(value);
80
+ if (!updatedItem) {
81
+ return undefined;
82
+ }
83
+ const newLocation = (updatedItem as any).storageLocation;
84
+ if (previousLocation && previousLocation.key !== newLocation?.key) {
85
+ await (this as any).storage.delete(previousLocation);
86
+ }
87
+ return updatedItem;
88
+ }
89
+ return super.updateItem(value);
90
+ }
91
+ }
92
+
93
+ const createDbManager = (clientOverrides: Record<string, jest.Mock> = {}) =>
94
+ ({
95
+ client: {
96
+ get: jest.fn(),
97
+ put: jest.fn(),
98
+ delete: jest.fn(),
99
+ update: jest.fn(),
100
+ query: jest.fn(),
101
+ ...clientOverrides,
102
+ },
103
+ repositories: {} as any,
104
+ executeInTransaction: async <T>(fn: (transaction: any) => Promise<T>): Promise<T> => fn({}),
105
+ addWriteTransactionItem: jest.fn(),
106
+ } as unknown as DynamoDbManager<any>);
107
+
108
+ const createStorage = () =>
109
+ ({
110
+ save: jest.fn(),
111
+ load: jest.fn(),
112
+ delete: jest.fn(),
113
+ } as unknown as S3ExternalStorage);
114
+
115
+ const createTestItem = (overrides: Partial<TestItem> = {}): TestItem => {
116
+ const item = new TestItem({
117
+ id: 'item-1',
118
+ name: 'Test',
119
+ data: [{ key: 'sample', value: { main: [] } }],
120
+ ...overrides,
121
+ });
122
+ return item;
123
+ };
124
+
125
+ describe('ExternalizedDynamoDbRepository', () => {
126
+ describe('prepareValueForStorage', () => {
127
+ it('externalizes data to S3 when prepareValueForStorage is called', async () => {
128
+ const storage = {
129
+ ...createStorage(),
130
+ save: jest.fn().mockResolvedValue({ location: { type: 's3', key: 'item-key' }, size: 500 }),
131
+ } as unknown as S3ExternalStorage;
132
+ const repo = new TestRepo(createDbManager(), storage);
133
+ const item = createTestItem();
134
+
135
+ const storedValue = await repo.testPrepareValueForStorage(item);
136
+
137
+ expect(storage.save).toHaveBeenCalled();
138
+ // storedValue is a minimal payload - original item is NOT mutated
139
+ expect(storedValue.data).toEqual([]);
140
+ expect(storedValue.storageLocation).toEqual({ type: 's3', key: 'item-key' });
141
+ });
142
+
143
+ it('removes existing storageLocation before saving to S3', async () => {
144
+ const storage = {
145
+ ...createStorage(),
146
+ save: jest.fn().mockResolvedValue({ location: { type: 's3', key: 'new-key' }, size: 500 }),
147
+ } as unknown as S3ExternalStorage;
148
+ const repo = new TestRepo(createDbManager(), storage);
149
+ const item = createTestItem();
150
+ (item as any).storageLocation = { type: 's3', key: 'old-key' };
151
+
152
+ await repo.testPrepareValueForStorage(item);
153
+
154
+ // Verify save was called without storageLocation in the payload
155
+ const savedPayload = (storage.save as jest.Mock).mock.calls[0][2];
156
+ expect(savedPayload.storageLocation).toBeUndefined();
157
+ });
158
+ });
159
+
160
+ describe('createItem', () => {
161
+ it('creates item with storageLocation preserved', async () => {
162
+ const client = createDbManager().client as any;
163
+ (client.put as jest.Mock).mockResolvedValue({});
164
+ const storage = {
165
+ ...createStorage(),
166
+ save: jest.fn().mockResolvedValue({ location: { type: 's3', key: 'item-key' }, size: 500 }),
167
+ load: jest.fn().mockResolvedValue(createTestItem()),
168
+ } as unknown as S3ExternalStorage;
169
+
170
+ const repo = new TestRepo({ client } as any, storage);
171
+ const item = createTestItem();
172
+
173
+ // Use prepareValueForStorage to externalize data and set storageLocation
174
+ const preparedItem = await repo.testPrepareValueForStorage(item);
175
+
176
+ // Verify the prepared value has minimal payload (empty data)
177
+ expect(preparedItem.data).toEqual([]);
178
+ expect(preparedItem.storageLocation).toEqual({ type: 's3', key: 'item-key' });
179
+
180
+ // Original item should NOT be mutated
181
+ expect(item.storageLocation).toBeUndefined();
182
+ });
183
+
184
+ it('automatically externalizes to S3 when createItem exceeds DynamoDB size limit', async () => {
185
+ const client = createDbManager().client as any;
186
+ let callCount = 0;
187
+ (client.put as jest.Mock).mockImplementation(() => {
188
+ callCount++;
189
+ if (callCount === 1) {
190
+ // First call fails with size limit error
191
+ const error = new Error('Item size has exceeded the maximum allowed size');
192
+ (error as any).code = 'ValidationException';
193
+ throw error;
194
+ }
195
+ // Second call succeeds
196
+ return Promise.resolve({});
197
+ });
198
+
199
+ const storage = {
200
+ ...createStorage(),
201
+ save: jest.fn().mockResolvedValue({ location: { type: 's3', key: 'auto-key' }, size: 500 }),
202
+ load: jest.fn().mockResolvedValue(createTestItem()),
203
+ } as unknown as S3ExternalStorage;
204
+
205
+ const repo = new TestRepo({ client } as any, storage);
206
+ const item = createTestItem({ data: [{ key: 'large', value: { content: 'x'.repeat(500000) } }] });
207
+
208
+ await repo.createItem(item);
209
+
210
+ // Should have called save to externalize
211
+ expect(storage.save).toHaveBeenCalled();
212
+ // Should have retried the put
213
+ expect(client.put).toHaveBeenCalledTimes(2);
214
+ });
215
+
216
+ it('cleans up old S3 file when overrideExisting is true', async () => {
217
+ const oldLocation = { type: 's3' as const, key: 'old-key' };
218
+ const newLocation = { type: 's3' as const, key: 'new-key' };
219
+
220
+ const client = createDbManager({
221
+ get: jest.fn().mockResolvedValue({
222
+ Item: {
223
+ id: 'item-1',
224
+ name: 'Old',
225
+ storageLocation: oldLocation,
226
+ },
227
+ }),
228
+ put: jest.fn().mockResolvedValue({}),
229
+ }).client as any;
230
+
231
+ const storage = {
232
+ ...createStorage(),
233
+ save: jest.fn().mockResolvedValue({ location: newLocation, size: 500 }),
234
+ load: jest.fn().mockResolvedValue(createTestItem()),
235
+ } as unknown as S3ExternalStorage;
236
+
237
+ const repo = new TestRepo({ client } as any, storage);
238
+ const item = createTestItem();
239
+ const preparedItem = await repo.testPrepareValueForStorage(item);
240
+
241
+ await repo.createItem(preparedItem, {}, {}, { overrideExisting: true });
242
+
243
+ expect(storage.delete).toHaveBeenCalledWith(oldLocation);
244
+ });
245
+ });
246
+
247
+ describe('updateItem', () => {
248
+ it('cleans up old S3 file when updating with new storageLocation', async () => {
249
+ const oldLocation = { type: 's3' as const, key: 'old-key' };
250
+ const newLocation = { type: 's3' as const, key: 'new-key' };
251
+
252
+ const client = createDbManager({
253
+ get: jest.fn().mockResolvedValue({
254
+ Item: {
255
+ id: 'item-1',
256
+ name: 'Test',
257
+ storageLocation: oldLocation,
258
+ },
259
+ }),
260
+ update: jest.fn().mockResolvedValue({
261
+ Attributes: {
262
+ id: 'item-1',
263
+ name: 'Updated',
264
+ storageLocation: newLocation,
265
+ },
266
+ }),
267
+ }).client as any;
268
+
269
+ const storage = createStorage();
270
+ const repo = new TestRepo({ client } as any, storage);
271
+
272
+ const updateValue = {
273
+ id: 'item-1',
274
+ name: 'Updated',
275
+ };
276
+
277
+ const updatedItem = createTestItem({ id: 'item-1', name: 'Updated' });
278
+ (updatedItem as any).storageLocation = newLocation;
279
+
280
+ repo.mockSuperUpdateItem = jest.fn().mockResolvedValue(updatedItem as any);
281
+
282
+ await repo.updateItem(updateValue);
283
+
284
+ expect(storage.delete).toHaveBeenCalledWith(oldLocation);
285
+ });
286
+
287
+ it('does not delete S3 file when storageLocation is unchanged', async () => {
288
+ const location = { type: 's3' as const, key: 'same-key' };
289
+
290
+ const client = createDbManager({
291
+ get: jest.fn().mockResolvedValue({
292
+ Item: {
293
+ id: 'item-1',
294
+ name: 'Test',
295
+ storageLocation: location,
296
+ },
297
+ }),
298
+ update: jest.fn().mockResolvedValue({
299
+ Attributes: {
300
+ id: 'item-1',
301
+ name: 'Updated',
302
+ storageLocation: location,
303
+ },
304
+ }),
305
+ }).client as any;
306
+
307
+ const storage = createStorage();
308
+ const repo = new TestRepo({ client } as any, storage);
309
+
310
+ const updateValue = {
311
+ id: 'item-1',
312
+ name: 'Updated',
313
+ };
314
+
315
+ const updatedItem = createTestItem({ id: 'item-1', name: 'Updated' });
316
+ (updatedItem as any).storageLocation = location;
317
+
318
+ repo.mockSuperUpdateItem = jest.fn().mockResolvedValue(updatedItem as any);
319
+
320
+ await repo.updateItem(updateValue);
321
+
322
+ expect(storage.delete).not.toHaveBeenCalled();
323
+ });
324
+ });
325
+
326
+ describe('getItem', () => {
327
+ it('loads payload from external storage when storageLocation is set', async () => {
328
+ const storage = createStorage();
329
+ const fullData = {
330
+ id: 'item-1',
331
+ name: 'From S3',
332
+ data: [{ key: 'sample', value: { main: [] } }],
333
+ };
334
+ (storage.load as jest.Mock).mockResolvedValue(fullData);
335
+
336
+ const repo = new TestRepo(createDbManager({ get: jest.fn() as any }), storage);
337
+ const result = await repo.testHydrateFromExternalStorage({
338
+ id: 'item-1',
339
+ name: 'Placeholder',
340
+ data: [],
341
+ storageLocation: { type: 's3', key: 'item-key' },
342
+ } as TestItem);
343
+
344
+ expect(storage.load).toHaveBeenCalledWith({ type: 's3', key: 'item-key' });
345
+ expect(result?.name).toBe('From S3');
346
+ expect(result?.data).toEqual([{ key: 'sample', value: { main: [] } }]);
347
+ });
348
+
349
+ it('returns inline data when no storageLocation is present', async () => {
350
+ const storage = createStorage();
351
+ const repo = new TestRepo(createDbManager({ get: jest.fn() as any }), storage);
352
+ const inlineRecord = {
353
+ id: 'item-1',
354
+ name: 'Inline Item',
355
+ data: [{ key: 'sample', value: { main: [] } }],
356
+ } as TestItem;
357
+
358
+ const result = await repo.testHydrateFromExternalStorage(inlineRecord);
359
+
360
+ expect(storage.load).not.toHaveBeenCalled();
361
+ expect(result).toBeDefined();
362
+ expect(result?.name).toBe('Inline Item');
363
+ expect(result?.data).toEqual([{ key: 'sample', value: { main: [] } }]);
364
+ });
365
+
366
+ it('never includes storageLocation in response', async () => {
367
+ const storage = createStorage();
368
+ const fullData = {
369
+ id: 'item-1',
370
+ name: 'From S3',
371
+ data: [{ key: 'sample', value: { main: [] } }],
372
+ };
373
+ (storage.load as jest.Mock).mockResolvedValue(fullData);
374
+
375
+ const repo = new TestRepo(createDbManager(), storage);
376
+ const result = await repo.testHydrateFromExternalStorage({
377
+ id: 'item-1',
378
+ name: 'Placeholder',
379
+ data: [],
380
+ storageLocation: { type: 's3', key: 'item-key' },
381
+ } as TestItem);
382
+
383
+ // storageLocation is an internal implementation detail and should never be exposed
384
+ expect(result?.storageLocation).toBeUndefined();
385
+ expect(result?.name).toBe('From S3');
386
+ expect(result?.data).toEqual([{ key: 'sample', value: { main: [] } }]);
387
+ });
388
+ });
389
+
390
+ describe('deleteItem', () => {
391
+ it('deletes externalized payloads when deleting items', async () => {
392
+ const client = createDbManager({
393
+ get: jest.fn().mockResolvedValue({ Item: { storageLocation: { type: 's3', key: 'item-key' } } }),
394
+ delete: jest.fn().mockResolvedValue({}),
395
+ }).client as any;
396
+ const storage = createStorage();
397
+ const repo = new TestRepo({ client } as any, storage);
398
+
399
+ await repo.deleteItem({ id: 'item-1' });
400
+
401
+ expect(storage.delete).toHaveBeenCalledWith({ type: 's3', key: 'item-key' });
402
+ });
403
+
404
+ it('does not attempt to delete S3 when item has no storageLocation', async () => {
405
+ const client = createDbManager({
406
+ get: jest.fn().mockResolvedValue({ Item: { id: 'item-1', name: 'Test' } }),
407
+ delete: jest.fn().mockResolvedValue({}),
408
+ }).client as any;
409
+ const storage = createStorage();
410
+ const repo = new TestRepo({ client } as any, storage);
411
+
412
+ await repo.deleteItem({ id: 'item-1' });
413
+
414
+ expect(storage.delete).not.toHaveBeenCalled();
415
+ });
416
+ });
417
+
418
+ describe('isDynamoItemSizeLimitError', () => {
419
+ it('detects ValidationException with size message', () => {
420
+ const repo = new TestRepo(createDbManager(), createStorage());
421
+ const error = {
422
+ code: 'ValidationException',
423
+ message: 'Item size has exceeded the maximum allowed size',
424
+ };
425
+
426
+ expect(repo.testIsDynamoItemSizeLimitError(error)).toBe(true);
427
+ });
428
+
429
+ it('detects TransactionCanceledException with size in cancellation reasons', () => {
430
+ const repo = new TestRepo(createDbManager(), createStorage());
431
+ const error = {
432
+ code: 'TransactionCanceledException',
433
+ CancellationReasons: [
434
+ {
435
+ Code: 'ValidationException',
436
+ Message: 'Item size exceeded 400 KB limit',
437
+ },
438
+ ],
439
+ };
440
+
441
+ expect(repo.testIsDynamoItemSizeLimitError(error)).toBe(true);
442
+ });
443
+
444
+ it('detects size keywords in error message', () => {
445
+ const repo = new TestRepo(createDbManager(), createStorage());
446
+ const error = {
447
+ message: 'The item size exceeds the maximum allowed size',
448
+ };
449
+
450
+ expect(repo.testIsDynamoItemSizeLimitError(error)).toBe(true);
451
+ });
452
+
453
+ it('returns false for non-size-related errors', () => {
454
+ const repo = new TestRepo(createDbManager(), createStorage());
455
+ const error = {
456
+ code: 'ResourceNotFoundException',
457
+ message: 'Table not found',
458
+ };
459
+
460
+ expect(repo.testIsDynamoItemSizeLimitError(error)).toBe(false);
461
+ });
462
+
463
+ it('returns false for null/undefined errors', () => {
464
+ const repo = new TestRepo(createDbManager(), createStorage());
465
+
466
+ expect(repo.testIsDynamoItemSizeLimitError(null)).toBe(false);
467
+ expect(repo.testIsDynamoItemSizeLimitError(undefined)).toBe(false);
468
+ });
469
+ });
470
+
471
+ describe('isContentInS3', () => {
472
+ it('returns true when storageLocation exists and large content fields are empty', () => {
473
+ const repo = new TestRepo(createDbManager(), createStorage());
474
+ const item = createTestItem({ data: [] });
475
+ (item as any).storageLocation = { type: 's3', key: 'item-key' };
476
+
477
+ expect(repo.testIsContentInS3(item)).toBe(true);
478
+ });
479
+
480
+ it('returns false when storageLocation exists but large content fields have data', () => {
481
+ const repo = new TestRepo(createDbManager(), createStorage());
482
+ const item = createTestItem({ data: [{ key: 'sample', value: { main: [] } }] });
483
+ (item as any).storageLocation = { type: 's3', key: 'item-key' };
484
+
485
+ expect(repo.testIsContentInS3(item)).toBe(false);
486
+ });
487
+
488
+ it('returns false when no storageLocation', () => {
489
+ const repo = new TestRepo(createDbManager(), createStorage());
490
+ const item = createTestItem();
491
+
492
+ expect(repo.testIsContentInS3(item)).toBe(false);
493
+ });
494
+ });
495
+
496
+ describe('getKeyFieldsValues', () => {
497
+ it('preserves key fields and small metadata', () => {
498
+ const repo = new TestRepo(createDbManager(), createStorage());
499
+ const obj = {
500
+ id: 'item-1',
501
+ name: 'Test',
502
+ data: [{ key: 'large', value: { content: 'big' } }],
503
+ };
504
+
505
+ const result = repo.testGetKeyFieldsValues(obj);
506
+
507
+ expect(result.id).toBe('item-1');
508
+ expect(result.name).toBe('Test');
509
+ });
510
+
511
+ it('empties large content fields (fieldsAsJsonString)', () => {
512
+ const repo = new TestRepo(createDbManager(), createStorage());
513
+ const obj = {
514
+ id: 'item-1',
515
+ name: 'Test',
516
+ data: [{ key: 'large', value: { content: 'big' } }],
517
+ };
518
+
519
+ const result = repo.testGetKeyFieldsValues(obj);
520
+
521
+ // data is in fieldsAsJsonString, so should be empty array
522
+ expect(result.data).toEqual([]);
523
+ });
524
+
525
+ it('removes storageLocation from result', () => {
526
+ const repo = new TestRepo(createDbManager(), createStorage());
527
+ const obj = {
528
+ id: 'item-1',
529
+ name: 'Test',
530
+ data: [],
531
+ storageLocation: { type: 's3', key: 'item-key' },
532
+ };
533
+
534
+ const result = repo.testGetKeyFieldsValues(obj);
535
+
536
+ expect(result.storageLocation).toBeUndefined();
537
+ });
538
+ });
539
+ });