@squiz/db-lib 1.74.0 → 1.75.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/lib/AbstractRepository.postgres.integration.spec.d.ts +2 -0
- package/lib/AbstractRepository.postgres.integration.spec.d.ts.map +1 -0
- package/lib/{AbstractRepository.integration.spec.js → AbstractRepository.postgres.integration.spec.js} +1 -1
- package/lib/AbstractRepository.postgres.integration.spec.js.map +1 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.d.ts +3 -1
- package/lib/dynamodb/AbstractDynamoDbRepository.d.ts.map +1 -1
- package/lib/dynamodb/AbstractDynamoDbRepository.js +40 -22
- package/lib/dynamodb/AbstractDynamoDbRepository.js.map +1 -1
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.d.ts +2 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.d.ts.map +1 -1
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.js +156 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.js.map +1 -1
- package/lib/error/UnknownKeyAttributeError.d.ts +6 -0
- package/lib/error/UnknownKeyAttributeError.d.ts.map +1 -0
- package/lib/error/UnknownKeyAttributeError.js +12 -0
- package/lib/error/UnknownKeyAttributeError.js.map +1 -0
- package/package.json +1 -2
- package/src/dynamodb/AbstractDynamoDbRepository.spec.ts +167 -0
- package/src/dynamodb/AbstractDynamoDbRepository.ts +43 -22
- package/src/error/UnknownKeyAttributeError.ts +8 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/AbstractRepository.integration.spec.d.ts +0 -2
- package/lib/AbstractRepository.integration.spec.d.ts.map +0 -1
- package/lib/AbstractRepository.integration.spec.js.map +0 -1
- /package/src/{AbstractRepository.integration.spec.ts → AbstractRepository.postgres.integration.spec.ts} +0 -0
package/CHANGELOG.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AbstractRepository.postgres.integration.spec.d.ts","sourceRoot":"","sources":["../src/AbstractRepository.postgres.integration.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AbstractRepository.postgres.integration.spec.js","sourceRoot":"","sources":["../src/AbstractRepository.postgres.integration.spec.ts"],"names":[],"mappings":";;AAAA,6DAA0D;AAC1D,2DAAwD;AAWxD,MAAM,QAAQ;IAQZ,YAAY,OAA2B,EAAE;;QACvC,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,gBAAgB,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,gBAAgB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,UAAU,mCAAI,iBAAiB,CAAC;QACvD,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,UAAU,mCAAI,iBAAiB,CAAC;QACvD,IAAI,CAAC,YAAY,CAAC,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,mCAAI,iBAAiB,CAAC;QAC7D,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,gBAAgB,CAAC;IACtD,CAAC;CACF;AAED,SAAS,cAAc;IACrB,OAAO;QACL,SAAS,EAAE,WAAW;QACtB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,YAAY;QACxB,YAAY,EAAE,YAAY;QAC1B,SAAS,EAAE,WAAW;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,CAA2B,CAAC;AAE9E,MAAM,iCAAkC,SAAQ,uCAAuC;CAAG;AAE1F,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAI,EAAkE,CAAC;IACvE,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,EAAE,GAAG,IAAI,qCAAiB,CACxB,mCAAmC,EACnC,OAAO,CAAC,GAAG,CAAC,8BAA+B,EAC3C,EAAE,EACF,EAA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,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,kCAAkC,CACtG,iEAAiE,CAClE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -40,6 +40,7 @@ export type EntityDefinition = {
|
|
40
40
|
keys: TableKeys;
|
41
41
|
indexes: TableIndexes;
|
42
42
|
fieldsAsJsonString: string[];
|
43
|
+
optionalIndexes?: (keyof TableIndexes)[];
|
43
44
|
};
|
44
45
|
export declare abstract class AbstractDynamoDbRepository<SHAPE extends object, DATA_CLASS extends SHAPE> implements Reader<SHAPE>, Writer<SHAPE> {
|
45
46
|
protected tableName: string;
|
@@ -53,6 +54,7 @@ export declare abstract class AbstractDynamoDbRepository<SHAPE extends object, D
|
|
53
54
|
protected keys: TableKeys;
|
54
55
|
protected indexes: TableIndexes;
|
55
56
|
protected keysFormat: KeysFormat;
|
57
|
+
protected optionalIndexes: (keyof TableIndexes)[];
|
56
58
|
protected fieldsAsJsonString: string[];
|
57
59
|
constructor(tableName: string, dbManager: DynamoDbManager<Repositories>, entityName: string, entityDefinition: EntityDefinition, classRef: {
|
58
60
|
new (data?: Record<string, unknown>): DATA_CLASS;
|
@@ -95,7 +97,7 @@ export declare abstract class AbstractDynamoDbRepository<SHAPE extends object, D
|
|
95
97
|
*/
|
96
98
|
deleteItems(items: Partial<SHAPE>[]): Promise<void>;
|
97
99
|
private deleteBatchItems;
|
98
|
-
private
|
100
|
+
private getItemsKeys;
|
99
101
|
/**
|
100
102
|
* Finds all the items matching the partition key or
|
101
103
|
* the gsi key (when gsi index name is specified)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AbstractDynamoDbRepository.d.ts","sourceRoot":"","sources":["../../src/dynamodb/AbstractDynamoDbRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EASjB,MAAM,uBAAuB,CAAC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O,CAAC,UAAU,EAAE,CAAC;IAiD5F;;;;OAIG;IACH,OAAO,CAAC,+BAA+B;IASvC;;;;;;;;OAQG;IACU,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IA6FjH;;;;;;;;;;OAUG;IACU,UAAU,CACrB,KAAK,EAAE,UAAU,EACjB,WAAW,GAAE,WAAgB,EAC7B,eAAe,GAAE,OAAO,CAAC,KAAK,CAAM,GACnC,OAAO,CAAC,UAAU,CAAC;IAmDtB;;;;;;;OAOG;IACU,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCpG;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU;IAahE,SAAS,CAAC,iCAAiC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQzE;;;;;OAKG;IACH,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM;IAI7C;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM;IAI7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,MAAM,UAAU,GAAG,MAAM;IAuC/E;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAWhC"}
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractDynamoDbRepository = void 0;
|
4
4
|
const __1 = require("..");
|
5
5
|
const InvalidDataFormatError_1 = require("../error/InvalidDataFormatError");
|
6
|
+
const UnknownKeyAttributeError_1 = require("../error/UnknownKeyAttributeError");
|
6
7
|
const MAX_REATTEMPTS = 3;
|
7
8
|
class AbstractDynamoDbRepository {
|
8
9
|
constructor(tableName, dbManager, entityName, entityDefinition, classRef) {
|
@@ -11,6 +12,7 @@ class AbstractDynamoDbRepository {
|
|
11
12
|
this.entityName = entityName;
|
12
13
|
this.entityDefinition = entityDefinition;
|
13
14
|
this.classRef = classRef;
|
15
|
+
this.optionalIndexes = [];
|
14
16
|
this.client = dbManager.client;
|
15
17
|
this.keys = entityDefinition.keys;
|
16
18
|
this.indexes = entityDefinition.indexes;
|
@@ -20,9 +22,13 @@ class AbstractDynamoDbRepository {
|
|
20
22
|
[this.keys.sk.attributeName]: this.keys.sk.format,
|
21
23
|
};
|
22
24
|
Object.keys(this.indexes).forEach((key) => {
|
25
|
+
var _a;
|
23
26
|
const index = this.indexes[key];
|
24
27
|
this.keysFormat[index.pk.attributeName] = index.pk.format;
|
25
28
|
this.keysFormat[index.sk.attributeName] = index.sk.format;
|
29
|
+
if ((_a = entityDefinition.optionalIndexes) === null || _a === void 0 ? void 0 : _a.includes(key)) {
|
30
|
+
this.optionalIndexes.push(key);
|
31
|
+
}
|
26
32
|
});
|
27
33
|
}
|
28
34
|
/**
|
@@ -60,9 +66,10 @@ class AbstractDynamoDbRepository {
|
|
60
66
|
async getItems(items) {
|
61
67
|
// this is the maximum items allowed by BatchGetItem()
|
62
68
|
const batchSize = 100;
|
69
|
+
const keys = this.getItemsKeys(items);
|
63
70
|
let result = [];
|
64
|
-
for (let i = 0; i <
|
65
|
-
const batchResult = await this.getBatchItems(
|
71
|
+
for (let i = 0; i < keys.length; i += batchSize) {
|
72
|
+
const batchResult = await this.getBatchItems(keys.slice(i, i + batchSize));
|
66
73
|
result = result.concat(batchResult);
|
67
74
|
}
|
68
75
|
return result;
|
@@ -73,11 +80,11 @@ class AbstractDynamoDbRepository {
|
|
73
80
|
* @param items
|
74
81
|
* @returns
|
75
82
|
*/
|
76
|
-
async getBatchItems(
|
83
|
+
async getBatchItems(keys) {
|
77
84
|
let resultItems = [];
|
78
85
|
let requestKeys = {
|
79
86
|
[this.tableName]: {
|
80
|
-
Keys:
|
87
|
+
Keys: keys,
|
81
88
|
},
|
82
89
|
};
|
83
90
|
let reattemptsCount = 0;
|
@@ -106,9 +113,9 @@ class AbstractDynamoDbRepository {
|
|
106
113
|
async deleteItems(items) {
|
107
114
|
// this is the maximum items allowed by BatchWriteItem()
|
108
115
|
const batchSize = 25;
|
109
|
-
|
110
|
-
|
111
|
-
await this.deleteBatchItems(keys);
|
116
|
+
const keys = this.getItemsKeys(items);
|
117
|
+
for (let i = 0; i < keys.length; i += batchSize) {
|
118
|
+
await this.deleteBatchItems(keys.slice(i, i + batchSize));
|
112
119
|
}
|
113
120
|
}
|
114
121
|
async deleteBatchItems(keys) {
|
@@ -132,7 +139,7 @@ class AbstractDynamoDbRepository {
|
|
132
139
|
requestItems = response.UnprocessedItems;
|
133
140
|
}
|
134
141
|
}
|
135
|
-
|
142
|
+
getItemsKeys(items) {
|
136
143
|
const keys = [];
|
137
144
|
for (const item of items) {
|
138
145
|
keys.push({
|
@@ -140,11 +147,12 @@ class AbstractDynamoDbRepository {
|
|
140
147
|
[this.keys.sk.attributeName]: this.getSk(item),
|
141
148
|
});
|
142
149
|
}
|
143
|
-
// keys
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
150
|
+
// filter duplicate items keys
|
151
|
+
return keys.filter((key, index) => {
|
152
|
+
return (index ===
|
153
|
+
keys.findIndex((key2) => key[this.keys.pk.attributeName] === key2[this.keys.pk.attributeName] &&
|
154
|
+
key[this.keys.sk.attributeName] === key2[this.keys.sk.attributeName]));
|
155
|
+
});
|
148
156
|
}
|
149
157
|
/**
|
150
158
|
* Finds all the items matching the partition key or
|
@@ -221,7 +229,7 @@ class AbstractDynamoDbRepository {
|
|
221
229
|
* @throws MissingKeyValuesError
|
222
230
|
*/
|
223
231
|
async updateItem(newValue, transaction = {}) {
|
224
|
-
var _a
|
232
|
+
var _a;
|
225
233
|
const oldValue = await this.getItem(newValue);
|
226
234
|
if (oldValue === undefined) {
|
227
235
|
return undefined;
|
@@ -235,7 +243,7 @@ class AbstractDynamoDbRepository {
|
|
235
243
|
const expressionAttributeValues = {};
|
236
244
|
const updatedAttributes = [];
|
237
245
|
for (const modelProperty of Object.keys(newValue)) {
|
238
|
-
const propValue =
|
246
|
+
const propValue = newValue[modelProperty];
|
239
247
|
if (propValue === oldValue[modelProperty]) {
|
240
248
|
// don't need to update the properties that are unchanged
|
241
249
|
continue;
|
@@ -276,7 +284,7 @@ class AbstractDynamoDbRepository {
|
|
276
284
|
ExpressionAttributeNames: expressionAttributeNames,
|
277
285
|
ConditionExpression: `attribute_exists(${this.keys.pk.attributeName})`,
|
278
286
|
};
|
279
|
-
if ((
|
287
|
+
if ((_a = transaction.id) === null || _a === void 0 ? void 0 : _a.length) {
|
280
288
|
// this command will be executed together with
|
281
289
|
// other db write commands in the "transaction" block
|
282
290
|
this.dbManager.addWriteTransactionItem(transaction.id, {
|
@@ -326,11 +334,21 @@ class AbstractDynamoDbRepository {
|
|
326
334
|
[this.keys.pk.attributeName]: this.getPk({ ...value, ...additionalValue }),
|
327
335
|
[this.keys.sk.attributeName]: this.getSk({ ...value, ...additionalValue }),
|
328
336
|
};
|
329
|
-
Object.
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
337
|
+
for (const [key, index] of Object.entries(this.indexes)) {
|
338
|
+
try {
|
339
|
+
keyFields[index.pk.attributeName] = this.getKey({ ...value, ...additionalValue }, index.pk.attributeName);
|
340
|
+
keyFields[index.sk.attributeName] = this.getKey({ ...value, ...additionalValue }, index.sk.attributeName);
|
341
|
+
}
|
342
|
+
catch (e) {
|
343
|
+
if (e.name === 'MissingKeyValuesError' && this.optionalIndexes.includes(key)) {
|
344
|
+
// ignore optional index fields missing error
|
345
|
+
delete keyFields[index.pk.attributeName];
|
346
|
+
delete keyFields[index.pk.attributeName];
|
347
|
+
continue;
|
348
|
+
}
|
349
|
+
throw e;
|
350
|
+
}
|
351
|
+
}
|
334
352
|
const putCommandInput = {
|
335
353
|
TableName: this.tableName,
|
336
354
|
Item: {
|
@@ -470,7 +488,7 @@ class AbstractDynamoDbRepository {
|
|
470
488
|
var _a;
|
471
489
|
let keyFormat = this.keysFormat[attributeName];
|
472
490
|
if (keyFormat == undefined || !keyFormat.length) {
|
473
|
-
throw new
|
491
|
+
throw new UnknownKeyAttributeError_1.UnknownKeyAttributeError(`Key format not defined or empty for key attribute '${attributeName}' in entity ${this.entityName}`);
|
474
492
|
}
|
475
493
|
const matches = keyFormat.match(/{[a-zA-Z]+?}/g);
|
476
494
|
const replacements = !matches
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AbstractDynamoDbRepository.js","sourceRoot":"","sources":["../../src/dynamodb/AbstractDynamoDbRepository.ts"],"names":[],"mappings":";;;AAYA,0BAA+F;AAC/F,4EAAyE;AA2DzE,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,MAAsB,0BAA0B;IAY9C,YACY,SAAiB,EACjB,SAAwC,EACxC,UAAkB,EAClB,gBAAkC,EAClC,QAA8D;QAJ9D,cAAS,GAAT,SAAS,CAAQ;QACjB,cAAS,GAAT,SAAS,CAA+B;QACxC,eAAU,GAAV,UAAU,CAAQ;QAClB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,aAAQ,GAAR,QAAQ,CAAsD;QAExE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAE/B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC;QAE9D,IAAI,CAAC,UAAU,GAAG;YAChB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,aA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: object;
|
10
|
+
email?: string;
|
10
11
|
}
|
11
12
|
declare class TestItem implements ITestItem {
|
12
13
|
name: string;
|
@@ -14,6 +15,7 @@ declare class TestItem implements ITestItem {
|
|
14
15
|
country: string;
|
15
16
|
data: object;
|
16
17
|
data2?: object;
|
18
|
+
email?: string;
|
17
19
|
constructor(data?: Partial<ITestItem>);
|
18
20
|
}
|
19
21
|
export type TestRepositories = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AbstractDynamoDbRepository.spec.d.ts","sourceRoot":"","sources":["../../src/dynamodb/AbstractDynamoDbRepository.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAgB,MAAM,8BAA8B,CAAC;AAsBxF,OAAO,EAAE,eAAe,EAAe,MAAM,mBAAmB,CAAC;AAIjE,OAAO,0BAA0B,CAAC;AAQlC,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,QAAS,YAAW,SAAS;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEV,IAAI,GAAE,OAAO,CAAC,SAAS,CAAM;
|
1
|
+
{"version":3,"file":"AbstractDynamoDbRepository.spec.d.ts","sourceRoot":"","sources":["../../src/dynamodb/AbstractDynamoDbRepository.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAgB,MAAM,8BAA8B,CAAC;AAsBxF,OAAO,EAAE,eAAe,EAAe,MAAM,mBAAmB,CAAC;AAIjE,OAAO,0BAA0B,CAAC;AAQlC,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,QAAS,YAAW,SAAS;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEV,IAAI,GAAE,OAAO,CAAC,SAAS,CAAM;CA0B1C;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;AA2C9D,cAAM,kBAAmB,SAAQ,0BAA0B,CAAC,SAAS,EAAE,QAAQ,CAAC;gBAClE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa;CAGxD"}
|
@@ -35,6 +35,12 @@ class TestItem {
|
|
35
35
|
if (typeof this.data !== 'object' || Array.isArray(this.data)) {
|
36
36
|
throw Error('Invalid "data"');
|
37
37
|
}
|
38
|
+
if (data.email !== undefined) {
|
39
|
+
if (typeof data.email !== 'string') {
|
40
|
+
throw Error('Invalid "name"');
|
41
|
+
}
|
42
|
+
this.email = data.email;
|
43
|
+
}
|
38
44
|
}
|
39
45
|
}
|
40
46
|
const TABLE_NAME = 'test-table';
|
@@ -61,9 +67,20 @@ const TEST_ITEM_ENTITY_DEFINITION = {
|
|
61
67
|
attributeName: 'gsi1_sk',
|
62
68
|
},
|
63
69
|
},
|
70
|
+
'gsi2_pk-gsi2_sk-index': {
|
71
|
+
pk: {
|
72
|
+
format: 'email#{email}',
|
73
|
+
attributeName: 'gsi2_pk',
|
74
|
+
},
|
75
|
+
sk: {
|
76
|
+
format: '#meta',
|
77
|
+
attributeName: 'gsi2_sk',
|
78
|
+
},
|
79
|
+
},
|
64
80
|
},
|
65
81
|
// field to be stored as JSON string
|
66
82
|
fieldsAsJsonString: ['data2'],
|
83
|
+
optionalIndexes: ['gsi2_pk-gsi2_sk-index'],
|
67
84
|
};
|
68
85
|
class TestItemRepository extends AbstractDynamoDbRepository_1.AbstractDynamoDbRepository {
|
69
86
|
constructor(tableName, dbManager) {
|
@@ -128,6 +145,56 @@ describe('AbstractRepository', () => {
|
|
128
145
|
},
|
129
146
|
}));
|
130
147
|
});
|
148
|
+
it('should create and return the item with multiple gsi fields', async () => {
|
149
|
+
ddbClientMock.on(lib_dynamodb_1.PutCommand).resolves({
|
150
|
+
$metadata: {
|
151
|
+
httpStatusCode: 200,
|
152
|
+
},
|
153
|
+
});
|
154
|
+
const input = {
|
155
|
+
TableName: TABLE_NAME,
|
156
|
+
Item: {
|
157
|
+
pk: 'test_item#foo',
|
158
|
+
sk: '#meta',
|
159
|
+
gsi1_pk: 'country#au',
|
160
|
+
gsi1_sk: 'age#99',
|
161
|
+
gsi2_pk: 'email#foo@bar.xyz',
|
162
|
+
gsi2_sk: '#meta',
|
163
|
+
name: 'foo',
|
164
|
+
age: 99,
|
165
|
+
country: 'au',
|
166
|
+
data: {},
|
167
|
+
// "data2" property is defined to be stored as JSON string
|
168
|
+
data2: '{"foo":"bar","num":123}',
|
169
|
+
email: 'foo@bar.xyz',
|
170
|
+
},
|
171
|
+
ConditionExpression: `attribute_not_exists(pk)`,
|
172
|
+
};
|
173
|
+
const item = {
|
174
|
+
name: 'foo',
|
175
|
+
age: 99,
|
176
|
+
country: 'au',
|
177
|
+
data: {},
|
178
|
+
data2: {
|
179
|
+
foo: 'bar',
|
180
|
+
num: 123,
|
181
|
+
},
|
182
|
+
email: 'foo@bar.xyz',
|
183
|
+
};
|
184
|
+
const result = await repository.createItem(item);
|
185
|
+
expect(ddbClientMock).toHaveReceivedCommandWith(lib_dynamodb_1.PutCommand, input);
|
186
|
+
expect(result).toEqual(new TestItem({
|
187
|
+
name: 'foo',
|
188
|
+
age: 99,
|
189
|
+
country: 'au',
|
190
|
+
data: {},
|
191
|
+
data2: {
|
192
|
+
foo: 'bar',
|
193
|
+
num: 123,
|
194
|
+
},
|
195
|
+
email: 'foo@bar.xyz',
|
196
|
+
}));
|
197
|
+
});
|
131
198
|
it('should throw error if invalid input', async () => {
|
132
199
|
const item = {
|
133
200
|
name: 'foo',
|
@@ -514,6 +581,66 @@ describe('AbstractRepository', () => {
|
|
514
581
|
}),
|
515
582
|
]);
|
516
583
|
});
|
584
|
+
it('should remove duplicate items in BatchGetItem request', async () => {
|
585
|
+
ddbClientMock.on(lib_dynamodb_1.BatchGetCommand).resolves({
|
586
|
+
$metadata: {
|
587
|
+
httpStatusCode: 200,
|
588
|
+
},
|
589
|
+
Responses: {
|
590
|
+
[TABLE_NAME]: [
|
591
|
+
{
|
592
|
+
name: 'foo',
|
593
|
+
age: 99,
|
594
|
+
country: 'au',
|
595
|
+
data: {},
|
596
|
+
data2: '{"foo":"bar","num":123}',
|
597
|
+
},
|
598
|
+
{
|
599
|
+
name: 'foo2',
|
600
|
+
age: 999,
|
601
|
+
country: 'au',
|
602
|
+
data: {},
|
603
|
+
data2: '{"foo":"bar","num":123}',
|
604
|
+
},
|
605
|
+
],
|
606
|
+
},
|
607
|
+
});
|
608
|
+
const input = {
|
609
|
+
RequestItems: {
|
610
|
+
[TABLE_NAME]: {
|
611
|
+
Keys: [
|
612
|
+
{ pk: 'test_item#foo', sk: '#meta' },
|
613
|
+
{ pk: 'test_item#foo2', sk: '#meta' },
|
614
|
+
],
|
615
|
+
},
|
616
|
+
},
|
617
|
+
};
|
618
|
+
const requestItems = [{ name: 'foo' }, { name: 'foo2' }, { name: 'foo2' }];
|
619
|
+
const result = await repository.getItems(requestItems);
|
620
|
+
expect(ddbClientMock).toHaveReceivedCommandWith(lib_dynamodb_1.BatchGetCommand, input);
|
621
|
+
expect(result).toEqual([
|
622
|
+
new TestItem({
|
623
|
+
name: 'foo',
|
624
|
+
age: 99,
|
625
|
+
country: 'au',
|
626
|
+
data: {},
|
627
|
+
data2: {
|
628
|
+
foo: 'bar',
|
629
|
+
num: 123,
|
630
|
+
},
|
631
|
+
}),
|
632
|
+
new TestItem({
|
633
|
+
name: 'foo2',
|
634
|
+
age: 999,
|
635
|
+
country: 'au',
|
636
|
+
data: {},
|
637
|
+
data2: {
|
638
|
+
foo: 'bar',
|
639
|
+
num: 123,
|
640
|
+
},
|
641
|
+
}),
|
642
|
+
]);
|
643
|
+
});
|
517
644
|
it('should retry if unprocessed keys returned', async () => {
|
518
645
|
const input1 = {
|
519
646
|
RequestItems: {
|
@@ -728,6 +855,35 @@ describe('AbstractRepository', () => {
|
|
728
855
|
await repository.deleteItems(requestItems);
|
729
856
|
expect(ddbClientMock).toHaveReceivedCommandWith(lib_dynamodb_1.BatchWriteCommand, input);
|
730
857
|
});
|
858
|
+
it('should remove duplicate items in batchWrite() request', async () => {
|
859
|
+
ddbClientMock.on(lib_dynamodb_1.BatchWriteCommand).resolves({
|
860
|
+
$metadata: {
|
861
|
+
httpStatusCode: 200,
|
862
|
+
},
|
863
|
+
ItemCollectionMetrics: {
|
864
|
+
[TABLE_NAME]: [{}],
|
865
|
+
},
|
866
|
+
});
|
867
|
+
const input = {
|
868
|
+
RequestItems: {
|
869
|
+
[TABLE_NAME]: [
|
870
|
+
{
|
871
|
+
DeleteRequest: {
|
872
|
+
Key: { pk: 'test_item#foo', sk: '#meta' },
|
873
|
+
},
|
874
|
+
},
|
875
|
+
{
|
876
|
+
DeleteRequest: {
|
877
|
+
Key: { pk: 'test_item#foo2', sk: '#meta' },
|
878
|
+
},
|
879
|
+
},
|
880
|
+
],
|
881
|
+
},
|
882
|
+
};
|
883
|
+
const requestItems = [{ name: 'foo' }, { name: 'foo2' }, { name: 'foo2' }, { name: 'foo' }];
|
884
|
+
await repository.deleteItems(requestItems);
|
885
|
+
expect(ddbClientMock).toHaveReceivedCommandWith(lib_dynamodb_1.BatchWriteCommand, input);
|
886
|
+
});
|
731
887
|
it('should use re-try if unprocessed items returned', async () => {
|
732
888
|
const input1 = {
|
733
889
|
RequestItems: {
|