@squiz/db-lib 1.71.2 → 1.72.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -0
- package/lib/AbstractRepository.d.ts +2 -0
- package/lib/AbstractRepository.d.ts.map +1 -0
- package/lib/AbstractRepository.integration.spec.d.ts +1 -0
- package/lib/AbstractRepository.integration.spec.d.ts.map +1 -0
- package/lib/AbstractRepository.integration.spec.js +118 -0
- package/lib/AbstractRepository.integration.spec.js.map +1 -0
- package/lib/AbstractRepository.js +187 -0
- package/lib/AbstractRepository.js.map +1 -0
- package/lib/ConnectionManager.d.ts +1 -0
- package/lib/ConnectionManager.d.ts.map +1 -0
- package/lib/ConnectionManager.js +58 -0
- package/lib/ConnectionManager.js.map +1 -0
- package/lib/Migrator.d.ts +1 -0
- package/lib/Migrator.d.ts.map +1 -0
- package/lib/Migrator.js +160 -0
- package/lib/Migrator.js.map +1 -0
- package/lib/PostgresErrorCodes.d.ts +1 -0
- package/lib/PostgresErrorCodes.d.ts.map +1 -0
- package/lib/PostgresErrorCodes.js +274 -0
- package/lib/PostgresErrorCodes.js.map +1 -0
- package/lib/Repositories.d.ts +1 -0
- package/lib/Repositories.d.ts.map +1 -0
- package/lib/Repositories.js +3 -0
- package/lib/Repositories.js.map +1 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.d.ts +50 -9
- package/lib/dynamodb/AbstractDynamoDbRepository.d.ts.map +1 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.js +456 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.js.map +1 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.d.ts +1 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.d.ts.map +1 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.js +924 -0
- package/lib/dynamodb/AbstractDynamoDbRepository.spec.js.map +1 -0
- package/lib/dynamodb/DynamoDbManager.d.ts +1 -0
- package/lib/dynamodb/DynamoDbManager.d.ts.map +1 -0
- package/lib/dynamodb/DynamoDbManager.js +66 -0
- package/lib/dynamodb/DynamoDbManager.js.map +1 -0
- package/lib/dynamodb/getDynamoDbOptions.d.ts +1 -0
- package/lib/dynamodb/getDynamoDbOptions.d.ts.map +1 -0
- package/lib/dynamodb/getDynamoDbOptions.js +15 -0
- package/lib/dynamodb/getDynamoDbOptions.js.map +1 -0
- package/lib/error/DuplicateItemError.d.ts +1 -0
- package/lib/error/DuplicateItemError.d.ts.map +1 -0
- package/lib/error/DuplicateItemError.js +12 -0
- package/lib/error/DuplicateItemError.js.map +1 -0
- package/lib/error/InvalidDataFormatError.d.ts +1 -0
- package/lib/error/InvalidDataFormatError.d.ts.map +1 -0
- package/lib/error/InvalidDataFormatError.js +12 -0
- package/lib/error/InvalidDataFormatError.js.map +1 -0
- package/lib/error/InvalidDbSchemaError.d.ts +1 -0
- package/lib/error/InvalidDbSchemaError.d.ts.map +1 -0
- package/lib/error/InvalidDbSchemaError.js +12 -0
- package/lib/error/InvalidDbSchemaError.js.map +1 -0
- package/lib/error/MissingKeyValuesError.d.ts +1 -0
- package/lib/error/MissingKeyValuesError.d.ts.map +1 -0
- package/lib/error/MissingKeyValuesError.js +12 -0
- package/lib/error/MissingKeyValuesError.js.map +1 -0
- package/lib/error/TransactionError.d.ts +1 -0
- package/lib/error/TransactionError.d.ts.map +1 -0
- package/lib/error/TransactionError.js +12 -0
- package/lib/error/TransactionError.js.map +1 -0
- package/lib/getConnectionInfo.d.ts +1 -0
- package/lib/getConnectionInfo.d.ts.map +1 -0
- package/lib/getConnectionInfo.js +30 -0
- package/lib/getConnectionInfo.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +33 -70416
- package/lib/index.js.map +1 -7
- package/package.json +5 -5
- package/src/AbstractRepository.ts +26 -20
- package/src/dynamodb/AbstractDynamoDbRepository.spec.ts +289 -37
- package/src/dynamodb/AbstractDynamoDbRepository.ts +140 -31
- package/src/dynamodb/getDynamoDbOptions.ts +1 -1
- package/tsconfig.json +5 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build.js +0 -31
@@ -0,0 +1,456 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AbstractDynamoDbRepository = void 0;
|
4
|
+
const __1 = require("..");
|
5
|
+
const InvalidDataFormatError_1 = require("../error/InvalidDataFormatError");
|
6
|
+
class AbstractDynamoDbRepository {
|
7
|
+
constructor(tableName, dbManager, entityName, entityDefinition, classRef) {
|
8
|
+
this.tableName = tableName;
|
9
|
+
this.dbManager = dbManager;
|
10
|
+
this.entityName = entityName;
|
11
|
+
this.entityDefinition = entityDefinition;
|
12
|
+
this.classRef = classRef;
|
13
|
+
this.client = dbManager.client;
|
14
|
+
this.keys = entityDefinition.keys;
|
15
|
+
this.indexes = entityDefinition.indexes;
|
16
|
+
this.fieldsAsJsonString = entityDefinition.fieldsAsJsonString;
|
17
|
+
this.keysFormat = {
|
18
|
+
[this.keys.pk.attributeName]: this.keys.pk.format,
|
19
|
+
[this.keys.sk.attributeName]: this.keys.sk.format,
|
20
|
+
};
|
21
|
+
Object.keys(this.indexes).forEach((key) => {
|
22
|
+
const index = this.indexes[key];
|
23
|
+
this.keysFormat[index.pk.attributeName] = index.pk.format;
|
24
|
+
this.keysFormat[index.sk.attributeName] = index.sk.format;
|
25
|
+
});
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Get the single item matching the key fields value in the given
|
29
|
+
* partial item. Will throw MissingKeyValuesError if key field values
|
30
|
+
* are missing
|
31
|
+
*
|
32
|
+
* @param item
|
33
|
+
*
|
34
|
+
* @throws MissingKeyValuesError
|
35
|
+
*/
|
36
|
+
async getItem(item) {
|
37
|
+
const output = await this.client.get({
|
38
|
+
TableName: this.tableName,
|
39
|
+
Key: {
|
40
|
+
[this.keys.pk.attributeName]: this.getPk(item),
|
41
|
+
[this.keys.sk.attributeName]: this.getSk(item),
|
42
|
+
},
|
43
|
+
});
|
44
|
+
if (output.Item === undefined) {
|
45
|
+
return undefined;
|
46
|
+
}
|
47
|
+
return this.hydrateItem(output.Item);
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* Get the single item each matching the key fields value in the given
|
51
|
+
* partial items. Will throw MissingKeyValuesError if key field values
|
52
|
+
* are missing
|
53
|
+
* Uses batchGet() to request 100 items in a batch
|
54
|
+
*
|
55
|
+
* @param item
|
56
|
+
*
|
57
|
+
* @throws MissingKeyValuesError
|
58
|
+
*/
|
59
|
+
async getItems(items) {
|
60
|
+
// this is the maximum items allowed by BatchGetItem()
|
61
|
+
const batchSize = 100;
|
62
|
+
let result = [];
|
63
|
+
for (let i = 0; i < items.length; i += batchSize) {
|
64
|
+
const batchResult = await this.getBatchItems(items.slice(i, i + batchSize));
|
65
|
+
result = result.concat(batchResult);
|
66
|
+
}
|
67
|
+
return result;
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Returns the batch items from the items primary key
|
71
|
+
*
|
72
|
+
* @param items
|
73
|
+
* @returns
|
74
|
+
*/
|
75
|
+
async getBatchItems(items) {
|
76
|
+
const keys = [];
|
77
|
+
for (const item of items) {
|
78
|
+
keys.push({
|
79
|
+
[this.keys.pk.attributeName]: this.getPk(item),
|
80
|
+
[this.keys.sk.attributeName]: this.getSk(item),
|
81
|
+
});
|
82
|
+
}
|
83
|
+
const output = await this.client.batchGet({
|
84
|
+
RequestItems: {
|
85
|
+
[this.tableName]: {
|
86
|
+
Keys: keys,
|
87
|
+
},
|
88
|
+
},
|
89
|
+
});
|
90
|
+
if (output.Responses && output.Responses[this.tableName].length) {
|
91
|
+
return output.Responses[this.tableName].map((i) => this.hydrateItem(i));
|
92
|
+
}
|
93
|
+
return [];
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Finds all the items matching the partition key or
|
97
|
+
* the gsi key (when gsi index name is specified)
|
98
|
+
*
|
99
|
+
* @param item
|
100
|
+
* @param options
|
101
|
+
* @throws MissingKeyValuesError
|
102
|
+
*/
|
103
|
+
async queryItems(item, options) {
|
104
|
+
var _a, _b;
|
105
|
+
const useSortKey = (options === null || options === void 0 ? void 0 : options.useSortKey) || (options === null || options === void 0 ? void 0 : options.filter);
|
106
|
+
const index = options === null || options === void 0 ? void 0 : options.index;
|
107
|
+
let pkName = this.keys.pk.attributeName;
|
108
|
+
let skName = this.keys.sk.attributeName;
|
109
|
+
let indexName = null;
|
110
|
+
if (index) {
|
111
|
+
if (this.indexes[index] === undefined) {
|
112
|
+
throw new __1.MissingKeyValuesError(`Table index '${index}' not defined on entity ${this.entityName}`);
|
113
|
+
}
|
114
|
+
indexName = index;
|
115
|
+
pkName = this.indexes[index].pk.attributeName;
|
116
|
+
skName = this.indexes[index].sk.attributeName;
|
117
|
+
}
|
118
|
+
const pk = this.getKey(item, pkName);
|
119
|
+
const keyConditionExpression = ['#pkName = :pkValue'];
|
120
|
+
const expressionAttributeNames = { '#pkName': pkName };
|
121
|
+
const expressionAttributeValues = { ':pkValue': pk };
|
122
|
+
if (useSortKey) {
|
123
|
+
const sk = (_b = (_a = options === null || options === void 0 ? void 0 : options.filter) === null || _a === void 0 ? void 0 : _a.keyword) !== null && _b !== void 0 ? _b : this.getKey(item, skName);
|
124
|
+
keyConditionExpression.push(this.getFilterKeyConditionExpression(options === null || options === void 0 ? void 0 : options.filter));
|
125
|
+
expressionAttributeNames['#skName'] = skName;
|
126
|
+
expressionAttributeValues[':skValue'] = sk;
|
127
|
+
}
|
128
|
+
const queryCommandInput = {
|
129
|
+
TableName: this.tableName,
|
130
|
+
KeyConditionExpression: keyConditionExpression.join(' AND '),
|
131
|
+
ExpressionAttributeNames: expressionAttributeNames,
|
132
|
+
ExpressionAttributeValues: expressionAttributeValues,
|
133
|
+
};
|
134
|
+
if (indexName) {
|
135
|
+
queryCommandInput['IndexName'] = String(indexName);
|
136
|
+
}
|
137
|
+
if ((options === null || options === void 0 ? void 0 : options.order) !== undefined) {
|
138
|
+
queryCommandInput.ScanIndexForward = options.order === 'asc';
|
139
|
+
}
|
140
|
+
if ((options === null || options === void 0 ? void 0 : options.limit) !== undefined) {
|
141
|
+
queryCommandInput.Limit = options.limit;
|
142
|
+
}
|
143
|
+
const output = await this.client.query(queryCommandInput);
|
144
|
+
return !output.Items ? [] : output.Items.map((item) => this.hydrateItem(item));
|
145
|
+
}
|
146
|
+
/**
|
147
|
+
* Evaluate filter condition for sort key
|
148
|
+
* @param filter
|
149
|
+
* @returns string
|
150
|
+
*/
|
151
|
+
getFilterKeyConditionExpression(filter) {
|
152
|
+
if (filter === undefined) {
|
153
|
+
return '#skName = :skValue';
|
154
|
+
}
|
155
|
+
else if (filter.type === 'begins_with') {
|
156
|
+
return 'begins_with(#skName, :skValue)';
|
157
|
+
}
|
158
|
+
throw new Error(`Invalid query filter type: ${filter === null || filter === void 0 ? void 0 : filter.type}`);
|
159
|
+
}
|
160
|
+
/**
|
161
|
+
* Update the existing item matching the key fields value
|
162
|
+
* in the passed newValue
|
163
|
+
* @param newValue
|
164
|
+
* @param transaction
|
165
|
+
*
|
166
|
+
* @returns Promise<SHAPE | undefined>
|
167
|
+
* @throws MissingKeyValuesError
|
168
|
+
*/
|
169
|
+
async updateItem(newValue, transaction = {}) {
|
170
|
+
var _a, _b;
|
171
|
+
const oldValue = await this.getItem(newValue);
|
172
|
+
if (oldValue === undefined) {
|
173
|
+
return undefined;
|
174
|
+
}
|
175
|
+
const value = { ...oldValue, ...newValue };
|
176
|
+
this.assertValueMatchesModel(value);
|
177
|
+
this.convertSelectedValuesToJsonString(newValue);
|
178
|
+
const updateExpression = [];
|
179
|
+
const expressionAttributeNames = {};
|
180
|
+
const expressionAttributeValues = {};
|
181
|
+
for (const modelProperty of Object.keys(newValue)) {
|
182
|
+
const propValue = (_a = newValue[modelProperty]) !== null && _a !== void 0 ? _a : null;
|
183
|
+
if (propValue === oldValue[modelProperty]) {
|
184
|
+
// don't need to update the properties that are unchanged
|
185
|
+
continue;
|
186
|
+
}
|
187
|
+
const propName = `#${modelProperty}`;
|
188
|
+
const propValuePlaceHolder = `:${modelProperty}`;
|
189
|
+
updateExpression.push(`${propName} = ${propValuePlaceHolder}`);
|
190
|
+
expressionAttributeNames[propName] = modelProperty;
|
191
|
+
expressionAttributeValues[propValuePlaceHolder] = propValue;
|
192
|
+
}
|
193
|
+
if (!updateExpression.length) {
|
194
|
+
// nothing to update
|
195
|
+
return value;
|
196
|
+
}
|
197
|
+
const updateCommandInput = {
|
198
|
+
TableName: this.tableName,
|
199
|
+
Key: {
|
200
|
+
[this.keys.pk.attributeName]: this.getPk(newValue),
|
201
|
+
[this.keys.sk.attributeName]: this.getSk(newValue),
|
202
|
+
},
|
203
|
+
UpdateExpression: 'SET ' + updateExpression.join(','),
|
204
|
+
ExpressionAttributeValues: expressionAttributeValues,
|
205
|
+
ExpressionAttributeNames: expressionAttributeNames,
|
206
|
+
ConditionExpression: `attribute_exists(${this.keys.pk.attributeName})`,
|
207
|
+
};
|
208
|
+
if ((_b = transaction.id) === null || _b === void 0 ? void 0 : _b.length) {
|
209
|
+
// this command will be executed together with
|
210
|
+
// other db write commands in the "transaction" block
|
211
|
+
this.dbManager.addWriteTransactionItem(transaction.id, {
|
212
|
+
Update: updateCommandInput,
|
213
|
+
});
|
214
|
+
return new this.classRef(value);
|
215
|
+
}
|
216
|
+
let output;
|
217
|
+
try {
|
218
|
+
output = await this.client.update({
|
219
|
+
...updateCommandInput,
|
220
|
+
ReturnValues: 'ALL_NEW',
|
221
|
+
});
|
222
|
+
}
|
223
|
+
catch (e) {
|
224
|
+
if (e && e.name === 'ConditionalCheckFailedException') {
|
225
|
+
return undefined;
|
226
|
+
}
|
227
|
+
throw e;
|
228
|
+
}
|
229
|
+
let item = undefined;
|
230
|
+
if (output.Attributes) {
|
231
|
+
item = this.hydrateItem(output.Attributes);
|
232
|
+
}
|
233
|
+
return item ? item : undefined;
|
234
|
+
}
|
235
|
+
/**
|
236
|
+
* Adds new item to the table
|
237
|
+
*
|
238
|
+
* @param value
|
239
|
+
* @param transaction
|
240
|
+
* @param additionalValue Additional item properties that are not part of the DATA_CLASS
|
241
|
+
*
|
242
|
+
* @returns Promise<SHAPE>
|
243
|
+
* @throws DuplicateItemError
|
244
|
+
* @throws MissingKeyValuesError
|
245
|
+
*/
|
246
|
+
async createItem(value, transaction = {}, additionalValue = {}) {
|
247
|
+
var _a;
|
248
|
+
this.assertValueMatchesModel(value);
|
249
|
+
const columns = {};
|
250
|
+
for (const modelProperty of Object.keys(value)) {
|
251
|
+
columns[modelProperty] = value[modelProperty];
|
252
|
+
}
|
253
|
+
this.convertSelectedValuesToJsonString(columns);
|
254
|
+
const keyFields = {
|
255
|
+
[this.keys.pk.attributeName]: this.getPk({ ...value, ...additionalValue }),
|
256
|
+
[this.keys.sk.attributeName]: this.getSk({ ...value, ...additionalValue }),
|
257
|
+
};
|
258
|
+
Object.keys(this.indexes).forEach((key) => {
|
259
|
+
const index = this.indexes[key];
|
260
|
+
keyFields[index.pk.attributeName] = this.getKey({ ...value, ...additionalValue }, index.pk.attributeName);
|
261
|
+
keyFields[index.sk.attributeName] = this.getKey({ ...value, ...additionalValue }, index.sk.attributeName);
|
262
|
+
});
|
263
|
+
const putCommandInput = {
|
264
|
+
TableName: this.tableName,
|
265
|
+
Item: {
|
266
|
+
...keyFields,
|
267
|
+
...columns,
|
268
|
+
},
|
269
|
+
ConditionExpression: `attribute_not_exists(${this.keys.pk.attributeName})`,
|
270
|
+
};
|
271
|
+
if ((_a = transaction.id) === null || _a === void 0 ? void 0 : _a.length) {
|
272
|
+
// this command will be executed together with
|
273
|
+
// other db write commands in the "transaction block"
|
274
|
+
this.dbManager.addWriteTransactionItem(transaction.id, {
|
275
|
+
Put: putCommandInput,
|
276
|
+
});
|
277
|
+
return value;
|
278
|
+
}
|
279
|
+
await this.client.put(putCommandInput);
|
280
|
+
return value;
|
281
|
+
}
|
282
|
+
/**
|
283
|
+
* Deletes an item from the table
|
284
|
+
*
|
285
|
+
* @param partialItem
|
286
|
+
* @param transaction
|
287
|
+
* @returns number
|
288
|
+
* @throw MissingKeyValuesError
|
289
|
+
*/
|
290
|
+
async deleteItem(partialItem, transaction = {}) {
|
291
|
+
var _a;
|
292
|
+
const deleteCommandInput = {
|
293
|
+
TableName: this.tableName,
|
294
|
+
Key: {
|
295
|
+
[this.keys.pk.attributeName]: this.getPk(partialItem),
|
296
|
+
[this.keys.sk.attributeName]: this.getSk(partialItem),
|
297
|
+
},
|
298
|
+
ConditionExpression: `attribute_exists(${this.keys.pk.attributeName})`,
|
299
|
+
};
|
300
|
+
if ((_a = transaction.id) === null || _a === void 0 ? void 0 : _a.length) {
|
301
|
+
// For transaction block, don't worry if the item being deleted does not exist
|
302
|
+
delete deleteCommandInput.ConditionExpression;
|
303
|
+
// this command will be executed together with
|
304
|
+
// other db write commands in the "transaction block"
|
305
|
+
this.dbManager.addWriteTransactionItem(transaction.id, {
|
306
|
+
Delete: deleteCommandInput,
|
307
|
+
});
|
308
|
+
return 1;
|
309
|
+
}
|
310
|
+
try {
|
311
|
+
await this.client.delete(deleteCommandInput);
|
312
|
+
}
|
313
|
+
catch (e) {
|
314
|
+
if (e && e.name === 'ConditionalCheckFailedException') {
|
315
|
+
return 0;
|
316
|
+
}
|
317
|
+
throw e;
|
318
|
+
}
|
319
|
+
return 1;
|
320
|
+
}
|
321
|
+
/**
|
322
|
+
* Return repo model object from the db value
|
323
|
+
* @param item
|
324
|
+
* @returns
|
325
|
+
*/
|
326
|
+
hydrateItem(item) {
|
327
|
+
for (const fieldName of Object.keys(item)) {
|
328
|
+
if (this.fieldsAsJsonString.includes(fieldName)) {
|
329
|
+
if (typeof item[fieldName] === 'string') {
|
330
|
+
item[fieldName] = JSON.parse(item[fieldName]);
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
throw new InvalidDataFormatError_1.InvalidDataFormatError(`Field '${fieldName}' defined as JSON String has a non-string data`);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
337
|
+
return new this.classRef(item);
|
338
|
+
}
|
339
|
+
convertSelectedValuesToJsonString(item) {
|
340
|
+
for (const fieldName of Object.keys(item)) {
|
341
|
+
if (this.fieldsAsJsonString.includes(fieldName)) {
|
342
|
+
item[fieldName] = JSON.stringify(item[fieldName]);
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
/**
|
347
|
+
* Evaluate the partition key value from the partial item
|
348
|
+
* @param item
|
349
|
+
* @returns string
|
350
|
+
* @throw MissingKeyValuesError
|
351
|
+
*/
|
352
|
+
getPk(item) {
|
353
|
+
return this.getKey(item, this.keys.pk.attributeName);
|
354
|
+
}
|
355
|
+
/**
|
356
|
+
* Evaluate the sort key value from the partial item
|
357
|
+
* @param item
|
358
|
+
* @returns string
|
359
|
+
*
|
360
|
+
* @throw MissingKeyValuesError
|
361
|
+
*/
|
362
|
+
getSk(item) {
|
363
|
+
return this.getKey(item, this.keys.sk.attributeName);
|
364
|
+
}
|
365
|
+
/**
|
366
|
+
* Evaluate the key value from the
|
367
|
+
*
|
368
|
+
* Example 1:
|
369
|
+
* Input:
|
370
|
+
* - item: {id: foo, name: 'some-name' }
|
371
|
+
* - attributeName: pk
|
372
|
+
* - this.keysFormat = { pk: 'item#{id}', 'sk': '#meta', ... }
|
373
|
+
* Output:
|
374
|
+
* - 'item#foo'
|
375
|
+
*
|
376
|
+
* Example 2:
|
377
|
+
* Input:
|
378
|
+
* - item: {id: foo, name: 'some-name', itemType: 'A' }
|
379
|
+
* - attributeName: sk
|
380
|
+
* - this.keysFormat = { pk: 'item#{id}', 'sk': 'type#{itemType}', ... }
|
381
|
+
* Output:
|
382
|
+
* - 'type#A'
|
383
|
+
*
|
384
|
+
* Example 3:
|
385
|
+
* Input:
|
386
|
+
* - item: {id: foo, name: 'some-name' }
|
387
|
+
* - attributeName: sk
|
388
|
+
* - this.keysFormat = { pk: 'item#{id}', 'sk': 'name-type#{itemType}{name}', ... }
|
389
|
+
* Output:
|
390
|
+
* - Error: "Key field "itemType" must be specified in the input item"
|
391
|
+
*
|
392
|
+
* @param item
|
393
|
+
* @param attributeName
|
394
|
+
*
|
395
|
+
* @returns string
|
396
|
+
* @throw MissingKeyValuesError
|
397
|
+
*/
|
398
|
+
getKey(item, attributeName) {
|
399
|
+
var _a;
|
400
|
+
let keyFormat = this.keysFormat[attributeName];
|
401
|
+
if (keyFormat == undefined || !keyFormat.length) {
|
402
|
+
throw new __1.MissingKeyValuesError(`Key format not defined or empty for key attribute '${attributeName}' in entity ${this.entityName}`);
|
403
|
+
}
|
404
|
+
const matches = keyFormat.match(/{[a-zA-Z]+?}/g);
|
405
|
+
const replacements = !matches
|
406
|
+
? []
|
407
|
+
: matches.map((match) => {
|
408
|
+
return {
|
409
|
+
property: match.slice(1, -1),
|
410
|
+
placeholder: match,
|
411
|
+
};
|
412
|
+
});
|
413
|
+
for (let i = 0; i < replacements.length; i++) {
|
414
|
+
const field = replacements[i].property;
|
415
|
+
if (item[field] === undefined) {
|
416
|
+
throw new __1.MissingKeyValuesError(`Key field "${String(field)}" must be specified in the input item in entity ${this.entityName}`);
|
417
|
+
}
|
418
|
+
keyFormat = keyFormat.replace(replacements[i].placeholder, String((_a = item[field]) !== null && _a !== void 0 ? _a : ''));
|
419
|
+
}
|
420
|
+
const moreMatches = keyFormat.match(/{[a-zA-Z]+?}/g);
|
421
|
+
if (moreMatches === null || moreMatches === void 0 ? void 0 : moreMatches.length) {
|
422
|
+
throw new __1.MissingKeyValuesError(`Cannot resolve key placeholder(s) for key attribute format '${this.keysFormat[attributeName]} in entity ${this.entityName}: '${moreMatches.join("','")}'`);
|
423
|
+
}
|
424
|
+
return keyFormat;
|
425
|
+
}
|
426
|
+
/**
|
427
|
+
* Whether the given property name is part of the entity's pk/sk string
|
428
|
+
* @param propertyName
|
429
|
+
* @returns boolean
|
430
|
+
*/
|
431
|
+
isPropertyPartOfKeys(propertyName) {
|
432
|
+
if (this.keysFormat[this.keys.pk.attributeName].search(`{${propertyName}}`) !== -1)
|
433
|
+
return true;
|
434
|
+
if (this.keysFormat[this.keys.sk.attributeName].search(`{${propertyName}}`) !== -1)
|
435
|
+
return true;
|
436
|
+
return false;
|
437
|
+
}
|
438
|
+
/**
|
439
|
+
* Validate the data matches with "DATA_MODEL"
|
440
|
+
* @param value
|
441
|
+
* @return void
|
442
|
+
*/
|
443
|
+
assertValueMatchesModel(value) {
|
444
|
+
// Trigger AssertionError if model instantiation fails
|
445
|
+
// see the DATA_CLASS model class
|
446
|
+
const obj = new this.classRef(value);
|
447
|
+
const inputProperties = Object.keys(value);
|
448
|
+
const modelProperties = Object.keys(obj);
|
449
|
+
const excessProperties = inputProperties.filter((prop) => !modelProperties.includes(prop));
|
450
|
+
if (excessProperties.length > 0) {
|
451
|
+
throw new __1.InvalidDbSchemaError(`Excess properties in entity ${this.entityName}: ${excessProperties.join(', ')}`);
|
452
|
+
}
|
453
|
+
}
|
454
|
+
}
|
455
|
+
exports.AbstractDynamoDbRepository = AbstractDynamoDbRepository;
|
456
|
+
//# sourceMappingURL=AbstractDynamoDbRepository.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AbstractDynamoDbRepository.js","sourceRoot":"","sources":["../../src/dynamodb/AbstractDynamoDbRepository.ts"],"names":[],"mappings":";;;AAQA,0BAA+F;AAC/F,4EAAyE;AA0DzE,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,IA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