@pristine-ts/aws 0.0.163 → 0.0.164
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/lib/cjs/clients/dynamodb.client.js +41 -19
- package/dist/lib/cjs/clients/dynamodb.client.js.map +1 -1
- package/dist/lib/cjs/options/find-by-secondary-index.options.js +3 -0
- package/dist/lib/cjs/options/find-by-secondary-index.options.js.map +1 -0
- package/dist/lib/cjs/options/list.options.js +3 -0
- package/dist/lib/cjs/options/list.options.js.map +1 -0
- package/dist/lib/cjs/options/options.js +16 -0
- package/dist/lib/cjs/options/options.js.map +1 -0
- package/dist/lib/cjs/options/pagination.options.js +3 -0
- package/dist/lib/cjs/options/pagination.options.js.map +1 -0
- package/dist/lib/cjs/results/list.result.js +40 -0
- package/dist/lib/cjs/results/list.result.js.map +1 -0
- package/dist/lib/cjs/results/pagination.result.js +3 -0
- package/dist/lib/cjs/results/pagination.result.js.map +1 -0
- package/dist/lib/cjs/results/results.js +15 -0
- package/dist/lib/cjs/results/results.js.map +1 -0
- package/dist/lib/esm/clients/dynamodb.client.js +41 -19
- package/dist/lib/esm/clients/dynamodb.client.js.map +1 -1
- package/dist/lib/esm/options/find-by-secondary-index.options.js +2 -0
- package/dist/lib/esm/options/find-by-secondary-index.options.js.map +1 -0
- package/dist/lib/esm/options/list.options.js +2 -0
- package/dist/lib/esm/options/list.options.js.map +1 -0
- package/dist/lib/esm/options/options.js +4 -0
- package/dist/lib/esm/options/options.js.map +1 -0
- package/dist/lib/esm/options/pagination.options.js +2 -0
- package/dist/lib/esm/options/pagination.options.js.map +1 -0
- package/dist/lib/esm/results/list.result.js +36 -0
- package/dist/lib/esm/results/list.result.js.map +1 -0
- package/dist/lib/esm/results/pagination.result.js +2 -0
- package/dist/lib/esm/results/pagination.result.js.map +1 -0
- package/dist/lib/esm/results/results.js +3 -0
- package/dist/lib/esm/results/results.js.map +1 -0
- package/dist/types/clients/dynamodb.client.d.ts +7 -14
- package/dist/types/interfaces/dynamodb-client.interface.d.ts +7 -14
- package/dist/types/options/find-by-secondary-index.options.d.ts +13 -0
- package/dist/types/options/list.options.d.ts +6 -0
- package/dist/types/options/options.d.ts +3 -0
- package/dist/types/options/pagination.options.d.ts +4 -0
- package/dist/types/results/list.result.d.ts +11 -0
- package/dist/types/results/pagination.result.d.ts +4 -0
- package/dist/types/results/results.d.ts +2 -0
- package/package.json +7 -7
|
@@ -40,6 +40,7 @@ const dynamodb_validation_error_1 = require("../errors/dynamodb-validation.error
|
|
|
40
40
|
const dynamodb_error_1 = require("../errors/dynamodb.error");
|
|
41
41
|
const common_1 = require("@pristine-ts/common");
|
|
42
42
|
const aws_module_keyname_1 = require("../aws.module.keyname");
|
|
43
|
+
const list_result_1 = require("../results/list.result");
|
|
43
44
|
let DynamodbClient = class DynamodbClient {
|
|
44
45
|
constructor(logHandler, region) {
|
|
45
46
|
this.logHandler = logHandler;
|
|
@@ -98,13 +99,20 @@ let DynamodbClient = class DynamodbClient {
|
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
101
|
* Lists all the objects of a type (table).
|
|
101
|
-
* @param
|
|
102
|
+
* @param options The options to use to list.
|
|
102
103
|
*/
|
|
103
|
-
list(
|
|
104
|
+
list(options) {
|
|
104
105
|
var e_1, _a;
|
|
105
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
107
|
try {
|
|
107
|
-
|
|
108
|
+
let scanOptions;
|
|
109
|
+
if (options.pagination) {
|
|
110
|
+
scanOptions = {
|
|
111
|
+
startKey: options.pagination.startKey,
|
|
112
|
+
pageSize: options.pagination.pageSize
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const iterator = (yield this.getMapperClient()).scan(options.classType, scanOptions);
|
|
108
116
|
const items = [];
|
|
109
117
|
try {
|
|
110
118
|
for (var iterator_1 = __asyncValues(iterator), iterator_1_1; iterator_1_1 = yield iterator_1.next(), !iterator_1_1.done;) {
|
|
@@ -120,11 +128,18 @@ let DynamodbClient = class DynamodbClient {
|
|
|
120
128
|
finally { if (e_1) throw e_1.error; }
|
|
121
129
|
}
|
|
122
130
|
this.logHandler.debug("DYNAMODB CLIENT - List items", { items }, aws_module_keyname_1.AwsModuleKeyname);
|
|
123
|
-
|
|
131
|
+
let paginationResult = undefined;
|
|
132
|
+
if (options.pagination) {
|
|
133
|
+
paginationResult = {
|
|
134
|
+
count: iterator.count,
|
|
135
|
+
lastEvaluatedKey: iterator.pages().lastEvaluatedKey,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return new list_result_1.ListResult(items, paginationResult);
|
|
124
139
|
}
|
|
125
140
|
catch (error) {
|
|
126
|
-
error = this.convertError(error, this.getTableName(classType.prototype));
|
|
127
|
-
this.logHandler.error("DYNAMODB CLIENT - Error listing", { error,
|
|
141
|
+
error = this.convertError(error, this.getTableName(options.classType.prototype));
|
|
142
|
+
this.logHandler.error("DYNAMODB CLIENT - Error listing", { error, options, AwsModuleKeyname: aws_module_keyname_1.AwsModuleKeyname });
|
|
128
143
|
throw error;
|
|
129
144
|
}
|
|
130
145
|
});
|
|
@@ -217,20 +232,20 @@ let DynamodbClient = class DynamodbClient {
|
|
|
217
232
|
}
|
|
218
233
|
/**
|
|
219
234
|
* Lists the item by secondary index.
|
|
220
|
-
* @param
|
|
221
|
-
* @param keyCondition The key condition for the secondary index. (ie: {secondaryId: value}).
|
|
222
|
-
* @param secondaryIndexName The name of the secondary index in DynamoDb.
|
|
223
|
-
* @param filterKeysAndValues A map containing the filters keys and values to apply when listing by secondary index. Every key in the map represents an AND and the values represent ORs. (ie: {filterKey1: filterValue, filterKey2: [value1, value1]} means you need filterKey1 to equal filterValue AND filterKey2 to equal value1 OR value2)
|
|
224
|
-
* @param expiresAtFilter A filter to get only the ones that the expiration is later then the value. Can either be a Date or a number representing the timestamp in seconds. (ie: {expiresAt: new Date()}).
|
|
235
|
+
* @param options The options to use.
|
|
225
236
|
*/
|
|
226
|
-
findBySecondaryIndex(
|
|
237
|
+
findBySecondaryIndex(options) {
|
|
227
238
|
var e_2, _a;
|
|
228
239
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
240
|
try {
|
|
230
|
-
const filterExpression = this.createFilterExpression(filterKeysAndValues, expiresAtFilter);
|
|
231
|
-
const queryOptions = { indexName: secondaryIndexName, filter: filterExpression };
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
const filterExpression = this.createFilterExpression(options.filterKeysAndValues, options.expiresAtFilter);
|
|
242
|
+
const queryOptions = { indexName: options.secondaryIndexName, filter: filterExpression };
|
|
243
|
+
if (options.pagination) {
|
|
244
|
+
queryOptions.pageSize = options.pagination.pageSize;
|
|
245
|
+
queryOptions.startKey = options.pagination.startKey;
|
|
246
|
+
}
|
|
247
|
+
this.logHandler.debug("DYNAMODB CLIENT - Querying with options", { queryOptions, options }, aws_module_keyname_1.AwsModuleKeyname);
|
|
248
|
+
const iterator = (yield this.getMapperClient()).query(options.classType, options.keyCondition, queryOptions);
|
|
234
249
|
const items = [];
|
|
235
250
|
try {
|
|
236
251
|
for (var iterator_2 = __asyncValues(iterator), iterator_2_1; iterator_2_1 = yield iterator_2.next(), !iterator_2_1.done;) {
|
|
@@ -246,11 +261,18 @@ let DynamodbClient = class DynamodbClient {
|
|
|
246
261
|
finally { if (e_2) throw e_2.error; }
|
|
247
262
|
}
|
|
248
263
|
this.logHandler.debug("DYNAMODB CLIENT - Found items", { items }, aws_module_keyname_1.AwsModuleKeyname);
|
|
249
|
-
|
|
264
|
+
let paginationResult = undefined;
|
|
265
|
+
if (options.pagination) {
|
|
266
|
+
paginationResult = {
|
|
267
|
+
count: iterator.count,
|
|
268
|
+
lastEvaluatedKey: iterator.pages().lastEvaluatedKey,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return new list_result_1.ListResult(items, paginationResult);
|
|
250
272
|
}
|
|
251
273
|
catch (error) {
|
|
252
|
-
error = this.convertError(error, this.getTableName(classType.prototype));
|
|
253
|
-
this.logHandler.error("DYNAMODB CLIENT - Error finding by secondary index", { error,
|
|
274
|
+
error = this.convertError(error, this.getTableName(options.classType.prototype));
|
|
275
|
+
this.logHandler.error("DYNAMODB CLIENT - Error finding by secondary index", { error, options }, aws_module_keyname_1.AwsModuleKeyname);
|
|
254
276
|
throw error;
|
|
255
277
|
}
|
|
256
278
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.client.js","sourceRoot":"","sources":["../../../../src/clients/dynamodb.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"dynamodb.client.js","sourceRoot":"","sources":["../../../../src/clients/dynamodb.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAkD;AAClD,uFAAwI;AAExI,uFAAoH;AACpH,uCAA4C;AAC5C,2FAAkF;AAClF,qGAA4F;AAC5F,6FAAoF;AACpF,mFAA4E;AAC5E,6DAAuD;AAEvD,gDAAwC;AAExC,8DAAuD;AAGvD,wDAAoD;AAKpD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAKvB,YACoD,UAA+B,EAC7B,MAAc;QADhB,eAAU,GAAV,UAAU,CAAqB;QAC7B,WAAM,GAAN,MAAM,CAAQ;IAEpE,CAAC;IAED;;OAEG;IACU,SAAS;;;YAClB,OAAO,IAAI,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,0BAAQ,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;;KAC3E;IAED;;OAEG;IACU,eAAe;;;YACxB,OAAO,IAAI,CAAC,YAAY,GAAG,MAAA,IAAI,CAAC,YAAY,mCAAI,IAAI,iCAAU,CAAC,EAAC,MAAM,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE,EAAC,CAAC,CAAC;;KACpG;IAED;;;;OAIG;IACK,YAAY,CAAC,kBAAuB;QACxC,OAAO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E,aAAa;QACb,IAAI,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAnVY,cAAc;IAF1B,YAAG,CAAC,yBAAyB,CAAC;IAC9B,qBAAU,EAAE;IAOJ,WAAA,iBAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,iBAAM,CAAC,uBAAuB,CAAC,CAAA;;GAP3B,cAAc,CAmV1B;AAnVY,wCAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-by-secondary-index.options.js","sourceRoot":"","sources":["../../../../src/options/find-by-secondary-index.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.options.js","sourceRoot":"","sources":["../../../../src/options/list.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./find-by-secondary-index.options"), exports);
|
|
14
|
+
__exportStar(require("./list.options"), exports);
|
|
15
|
+
__exportStar(require("./pagination.options"), exports);
|
|
16
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/options/options.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAAkD;AAClD,iDAA+B;AAC/B,uDAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.options.js","sourceRoot":"","sources":["../../../../src/options/pagination.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListResult = void 0;
|
|
4
|
+
class ListResult {
|
|
5
|
+
constructor(_items, _paginationResult) {
|
|
6
|
+
this._items = _items;
|
|
7
|
+
this._paginationResult = _paginationResult;
|
|
8
|
+
this.index = 0;
|
|
9
|
+
this.done = false;
|
|
10
|
+
}
|
|
11
|
+
[Symbol.iterator]() {
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
next() {
|
|
15
|
+
if (this.done) {
|
|
16
|
+
return {
|
|
17
|
+
done: this.done,
|
|
18
|
+
value: undefined,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (this.index === this._items.length) {
|
|
22
|
+
this.done = true;
|
|
23
|
+
return {
|
|
24
|
+
done: this.done,
|
|
25
|
+
value: this._items[this.index],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const value = this._items[this.index];
|
|
29
|
+
this.index += 1;
|
|
30
|
+
return {
|
|
31
|
+
done: false,
|
|
32
|
+
value,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
get paginationResult() {
|
|
36
|
+
return this._paginationResult;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ListResult = ListResult;
|
|
40
|
+
//# sourceMappingURL=list.result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.result.js","sourceRoot":"","sources":["../../../../src/results/list.result.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IAInB,YAAoB,MAAW,EAAU,iBAAoC;QAAzD,WAAM,GAAN,MAAM,CAAK;QAAU,sBAAiB,GAAjB,iBAAiB,CAAmB;QACzE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI;QACA,IAAG,IAAI,CAAC,IAAI,EAAC;YACT,OAAO;gBACH,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,SAAS;aACnB,CAAC;SACL;QAED,IAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,EAAC;YACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,OAAO;gBACH,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACjC,CAAC;SACL;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAChB,OAAO;YACH,IAAI,EAAE,KAAK;YACX,KAAK;SACR,CAAC;IACN,CAAC;IAED,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;CACJ;AAxCD,gCAwCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.result.js","sourceRoot":"","sources":["../../../../src/results/pagination.result.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./list.result"), exports);
|
|
14
|
+
__exportStar(require("./pagination.result"), exports);
|
|
15
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../../../src/results/results.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA8B;AAC9B,sDAAoC"}
|
|
@@ -37,6 +37,7 @@ import { DynamodbValidationError } from "../errors/dynamodb-validation.error";
|
|
|
37
37
|
import { DynamodbError } from "../errors/dynamodb.error";
|
|
38
38
|
import { tag } from "@pristine-ts/common";
|
|
39
39
|
import { AwsModuleKeyname } from "../aws.module.keyname";
|
|
40
|
+
import { ListResult } from "../results/list.result";
|
|
40
41
|
let DynamodbClient = class DynamodbClient {
|
|
41
42
|
constructor(logHandler, region) {
|
|
42
43
|
this.logHandler = logHandler;
|
|
@@ -95,13 +96,20 @@ let DynamodbClient = class DynamodbClient {
|
|
|
95
96
|
}
|
|
96
97
|
/**
|
|
97
98
|
* Lists all the objects of a type (table).
|
|
98
|
-
* @param
|
|
99
|
+
* @param options The options to use to list.
|
|
99
100
|
*/
|
|
100
|
-
list(
|
|
101
|
+
list(options) {
|
|
101
102
|
var e_1, _a;
|
|
102
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
104
|
try {
|
|
104
|
-
|
|
105
|
+
let scanOptions;
|
|
106
|
+
if (options.pagination) {
|
|
107
|
+
scanOptions = {
|
|
108
|
+
startKey: options.pagination.startKey,
|
|
109
|
+
pageSize: options.pagination.pageSize
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const iterator = (yield this.getMapperClient()).scan(options.classType, scanOptions);
|
|
105
113
|
const items = [];
|
|
106
114
|
try {
|
|
107
115
|
for (var iterator_1 = __asyncValues(iterator), iterator_1_1; iterator_1_1 = yield iterator_1.next(), !iterator_1_1.done;) {
|
|
@@ -117,11 +125,18 @@ let DynamodbClient = class DynamodbClient {
|
|
|
117
125
|
finally { if (e_1) throw e_1.error; }
|
|
118
126
|
}
|
|
119
127
|
this.logHandler.debug("DYNAMODB CLIENT - List items", { items }, AwsModuleKeyname);
|
|
120
|
-
|
|
128
|
+
let paginationResult = undefined;
|
|
129
|
+
if (options.pagination) {
|
|
130
|
+
paginationResult = {
|
|
131
|
+
count: iterator.count,
|
|
132
|
+
lastEvaluatedKey: iterator.pages().lastEvaluatedKey,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return new ListResult(items, paginationResult);
|
|
121
136
|
}
|
|
122
137
|
catch (error) {
|
|
123
|
-
error = this.convertError(error, this.getTableName(classType.prototype));
|
|
124
|
-
this.logHandler.error("DYNAMODB CLIENT - Error listing", { error,
|
|
138
|
+
error = this.convertError(error, this.getTableName(options.classType.prototype));
|
|
139
|
+
this.logHandler.error("DYNAMODB CLIENT - Error listing", { error, options, AwsModuleKeyname });
|
|
125
140
|
throw error;
|
|
126
141
|
}
|
|
127
142
|
});
|
|
@@ -214,20 +229,20 @@ let DynamodbClient = class DynamodbClient {
|
|
|
214
229
|
}
|
|
215
230
|
/**
|
|
216
231
|
* Lists the item by secondary index.
|
|
217
|
-
* @param
|
|
218
|
-
* @param keyCondition The key condition for the secondary index. (ie: {secondaryId: value}).
|
|
219
|
-
* @param secondaryIndexName The name of the secondary index in DynamoDb.
|
|
220
|
-
* @param filterKeysAndValues A map containing the filters keys and values to apply when listing by secondary index. Every key in the map represents an AND and the values represent ORs. (ie: {filterKey1: filterValue, filterKey2: [value1, value1]} means you need filterKey1 to equal filterValue AND filterKey2 to equal value1 OR value2)
|
|
221
|
-
* @param expiresAtFilter A filter to get only the ones that the expiration is later then the value. Can either be a Date or a number representing the timestamp in seconds. (ie: {expiresAt: new Date()}).
|
|
232
|
+
* @param options The options to use.
|
|
222
233
|
*/
|
|
223
|
-
findBySecondaryIndex(
|
|
234
|
+
findBySecondaryIndex(options) {
|
|
224
235
|
var e_2, _a;
|
|
225
236
|
return __awaiter(this, void 0, void 0, function* () {
|
|
226
237
|
try {
|
|
227
|
-
const filterExpression = this.createFilterExpression(filterKeysAndValues, expiresAtFilter);
|
|
228
|
-
const queryOptions = { indexName: secondaryIndexName, filter: filterExpression };
|
|
229
|
-
|
|
230
|
-
|
|
238
|
+
const filterExpression = this.createFilterExpression(options.filterKeysAndValues, options.expiresAtFilter);
|
|
239
|
+
const queryOptions = { indexName: options.secondaryIndexName, filter: filterExpression };
|
|
240
|
+
if (options.pagination) {
|
|
241
|
+
queryOptions.pageSize = options.pagination.pageSize;
|
|
242
|
+
queryOptions.startKey = options.pagination.startKey;
|
|
243
|
+
}
|
|
244
|
+
this.logHandler.debug("DYNAMODB CLIENT - Querying with options", { queryOptions, options }, AwsModuleKeyname);
|
|
245
|
+
const iterator = (yield this.getMapperClient()).query(options.classType, options.keyCondition, queryOptions);
|
|
231
246
|
const items = [];
|
|
232
247
|
try {
|
|
233
248
|
for (var iterator_2 = __asyncValues(iterator), iterator_2_1; iterator_2_1 = yield iterator_2.next(), !iterator_2_1.done;) {
|
|
@@ -243,11 +258,18 @@ let DynamodbClient = class DynamodbClient {
|
|
|
243
258
|
finally { if (e_2) throw e_2.error; }
|
|
244
259
|
}
|
|
245
260
|
this.logHandler.debug("DYNAMODB CLIENT - Found items", { items }, AwsModuleKeyname);
|
|
246
|
-
|
|
261
|
+
let paginationResult = undefined;
|
|
262
|
+
if (options.pagination) {
|
|
263
|
+
paginationResult = {
|
|
264
|
+
count: iterator.count,
|
|
265
|
+
lastEvaluatedKey: iterator.pages().lastEvaluatedKey,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return new ListResult(items, paginationResult);
|
|
247
269
|
}
|
|
248
270
|
catch (error) {
|
|
249
|
-
error = this.convertError(error, this.getTableName(classType.prototype));
|
|
250
|
-
this.logHandler.error("DYNAMODB CLIENT - Error finding by secondary index", { error,
|
|
271
|
+
error = this.convertError(error, this.getTableName(options.classType.prototype));
|
|
272
|
+
this.logHandler.error("DYNAMODB CLIENT - Error finding by secondary index", { error, options }, AwsModuleKeyname);
|
|
251
273
|
throw error;
|
|
252
274
|
}
|
|
253
275
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.client.js","sourceRoot":"","sources":["../../../../src/clients/dynamodb.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAC,UAAU,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"dynamodb.client.js","sourceRoot":"","sources":["../../../../src/clients/dynamodb.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAC,UAAU,EAAE,aAAa,EAAkD,MAAM,8CAA8C,CAAC;AAExI,OAAO,EAAsB,MAAM,EAAE,WAAW,EAAe,MAAM,8CAA8C,CAAC;AACpH,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAC,8BAA8B,EAAC,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAC,0BAA0B,EAAC,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAC,GAAG,EAAC,MAA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C,KAAK,EAAE,SAAS,CAAC,CAAC;gBAC5D,KAAK,uBAAuB;oBACxB,OAAO,IAAI,yBAAyB,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;gBACvE,KAAK,qBAAqB;oBACtB,OAAO,IAAI,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;gBACrE;oBACI,OAAO,IAAI,aAAa,CAAC,0BAA0B,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;aACvG;SACJ;QACD,OAAO,IAAI,aAAa,CAAC,wBAAwB,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACrF,CAAC;IAED;;;;;OAKG;IACK,+BAA+B,CAAiC,SAAsC,EAAE,kBAA2C;QACvJ,MAAM,IAAI,GAAM,IAAI,SAAS,EAAE,CAAC;QAChC,MAAM,cAAc,GAAW,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,aAAa;QACb,IAAI,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAnVY,cAAc;IAF1B,GAAG,CAAC,yBAAyB,CAAC;IAC9B,UAAU,EAAE;IAOJ,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;GAP3B,cAAc,CAmV1B;SAnVY,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-by-secondary-index.options.js","sourceRoot":"","sources":["../../../../src/options/find-by-secondary-index.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.options.js","sourceRoot":"","sources":["../../../../src/options/list.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/options/options.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.options.js","sourceRoot":"","sources":["../../../../src/options/pagination.options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class ListResult {
|
|
2
|
+
constructor(_items, _paginationResult) {
|
|
3
|
+
this._items = _items;
|
|
4
|
+
this._paginationResult = _paginationResult;
|
|
5
|
+
this.index = 0;
|
|
6
|
+
this.done = false;
|
|
7
|
+
}
|
|
8
|
+
[Symbol.iterator]() {
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
next() {
|
|
12
|
+
if (this.done) {
|
|
13
|
+
return {
|
|
14
|
+
done: this.done,
|
|
15
|
+
value: undefined,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (this.index === this._items.length) {
|
|
19
|
+
this.done = true;
|
|
20
|
+
return {
|
|
21
|
+
done: this.done,
|
|
22
|
+
value: this._items[this.index],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const value = this._items[this.index];
|
|
26
|
+
this.index += 1;
|
|
27
|
+
return {
|
|
28
|
+
done: false,
|
|
29
|
+
value,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
get paginationResult() {
|
|
33
|
+
return this._paginationResult;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=list.result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.result.js","sourceRoot":"","sources":["../../../../src/results/list.result.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,UAAU;IAInB,YAAoB,MAAW,EAAU,iBAAoC;QAAzD,WAAM,GAAN,MAAM,CAAK;QAAU,sBAAiB,GAAjB,iBAAiB,CAAmB;QACzE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI;QACA,IAAG,IAAI,CAAC,IAAI,EAAC;YACT,OAAO;gBACH,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,SAAS;aACnB,CAAC;SACL;QAED,IAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,EAAC;YACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,OAAO;gBACH,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACjC,CAAC;SACL;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAChB,OAAO;YACH,IAAI,EAAE,KAAK;YACX,KAAK;SACR,CAAC;IACN,CAAC;IAED,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.result.js","sourceRoot":"","sources":["../../../../src/results/pagination.result.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../../../src/results/results.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
|
|
@@ -3,6 +3,9 @@ import { DataMapper, StringToAnyObjectMap } from "@awslabs-community-fork/dynamo
|
|
|
3
3
|
import { ZeroArgumentsConstructor } from "@awslabs-community-fork/dynamodb-data-marshaller";
|
|
4
4
|
import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
5
5
|
import { DynamodbClientInterface } from "../interfaces/dynamodb-client.interface";
|
|
6
|
+
import { ListOptions } from "../options/list.options";
|
|
7
|
+
import { FindBySecondaryIndexOptions } from "../options/find-by-secondary-index.options";
|
|
8
|
+
import { ListResult } from "../results/list.result";
|
|
6
9
|
export declare class DynamodbClient implements DynamodbClientInterface {
|
|
7
10
|
private readonly logHandler;
|
|
8
11
|
private readonly region;
|
|
@@ -33,9 +36,9 @@ export declare class DynamodbClient implements DynamodbClientInterface {
|
|
|
33
36
|
}): Promise<T>;
|
|
34
37
|
/**
|
|
35
38
|
* Lists all the objects of a type (table).
|
|
36
|
-
* @param
|
|
39
|
+
* @param options The options to use to list.
|
|
37
40
|
*/
|
|
38
|
-
list<T extends StringToAnyObjectMap>(
|
|
41
|
+
list<T extends StringToAnyObjectMap>(options: ListOptions<T>): Promise<ListResult<T>>;
|
|
39
42
|
/**
|
|
40
43
|
* Creates an entry in DynamoDb if this id does not already exist.
|
|
41
44
|
* @param item The item to create.
|
|
@@ -61,19 +64,9 @@ export declare class DynamodbClient implements DynamodbClientInterface {
|
|
|
61
64
|
}): Promise<void>;
|
|
62
65
|
/**
|
|
63
66
|
* Lists the item by secondary index.
|
|
64
|
-
* @param
|
|
65
|
-
* @param keyCondition The key condition for the secondary index. (ie: {secondaryId: value}).
|
|
66
|
-
* @param secondaryIndexName The name of the secondary index in DynamoDb.
|
|
67
|
-
* @param filterKeysAndValues A map containing the filters keys and values to apply when listing by secondary index. Every key in the map represents an AND and the values represent ORs. (ie: {filterKey1: filterValue, filterKey2: [value1, value1]} means you need filterKey1 to equal filterValue AND filterKey2 to equal value1 OR value2)
|
|
68
|
-
* @param expiresAtFilter A filter to get only the ones that the expiration is later then the value. Can either be a Date or a number representing the timestamp in seconds. (ie: {expiresAt: new Date()}).
|
|
67
|
+
* @param options The options to use.
|
|
69
68
|
*/
|
|
70
|
-
findBySecondaryIndex<T extends StringToAnyObjectMap>(
|
|
71
|
-
[propertyName: string]: string | boolean | number;
|
|
72
|
-
}, secondaryIndexName: string, filterKeysAndValues?: {
|
|
73
|
-
[key: string]: string | number | boolean | string[] | number[];
|
|
74
|
-
}, expiresAtFilter?: {
|
|
75
|
-
[key: string]: number | Date;
|
|
76
|
-
}): Promise<T[]>;
|
|
69
|
+
findBySecondaryIndex<T extends StringToAnyObjectMap>(options: FindBySecondaryIndexOptions<T>): Promise<ListResult<T>>;
|
|
77
70
|
/**
|
|
78
71
|
* Creates the filter conditions for DynamoDb.
|
|
79
72
|
* @param filterKeysAndValues A map containing the filters keys and values to apply when listing by secondary index. Every key in the map represents an AND and the values represent ORs. (ie: {filterKey1: filterValue, filterKey2: [value1, value1]} means you need filterKey1 to equal filterValue AND filterKey2 to equal value1 OR value2)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DynamoDB } from "@aws-sdk/client-dynamodb";
|
|
2
2
|
import { DataMapper, StringToAnyObjectMap } from "@awslabs-community-fork/dynamodb-data-mapper";
|
|
3
3
|
import { ZeroArgumentsConstructor } from "@awslabs-community-fork/dynamodb-data-marshaller";
|
|
4
|
+
import { ListOptions } from "../options/list.options";
|
|
5
|
+
import { FindBySecondaryIndexOptions } from "../options/find-by-secondary-index.options";
|
|
6
|
+
import { ListResult } from "../results/list.result";
|
|
4
7
|
/**
|
|
5
8
|
* The DynamodbClient Interface defines the methods that a Dynamodb Client must implement.
|
|
6
9
|
*/
|
|
@@ -23,9 +26,9 @@ export interface DynamodbClientInterface {
|
|
|
23
26
|
}): Promise<T>;
|
|
24
27
|
/**
|
|
25
28
|
* Lists all the objects of a type (table).
|
|
26
|
-
* @param
|
|
29
|
+
* @param options The options to use to list.
|
|
27
30
|
*/
|
|
28
|
-
list<T extends StringToAnyObjectMap>(
|
|
31
|
+
list<T extends StringToAnyObjectMap>(options: ListOptions<T>): Promise<ListResult<T>>;
|
|
29
32
|
/**
|
|
30
33
|
* Creates an entry in DynamoDb if this id does not already exist.
|
|
31
34
|
* @param item The item to create.
|
|
@@ -51,17 +54,7 @@ export interface DynamodbClientInterface {
|
|
|
51
54
|
}): Promise<void>;
|
|
52
55
|
/**
|
|
53
56
|
* Lists the item by secondary index.
|
|
54
|
-
* @param
|
|
55
|
-
* @param keyCondition The key condition for the secondary index. (ie: {secondaryId: value}).
|
|
56
|
-
* @param secondaryIndexName The name of the secondary index in DynamoDb.
|
|
57
|
-
* @param filterKeysAndValues A map containing the filters keys and values to apply when listing by secondary index. Every key in the map represents an AND and the values represent ORs. (ie: {filterKey1: filterValue, filterKey2: [value1, value1]} means you need filterKey1 to equal filterValue AND filterKey2 to equal value1 OR value2)
|
|
58
|
-
* @param expiresAtFilter A filter to get only the ones that the expiration is later then the value. Can either be a Date or a number representing the timestamp in seconds. (ie: {expiresAt: new Date()}).
|
|
57
|
+
* @param options The options to use.
|
|
59
58
|
*/
|
|
60
|
-
findBySecondaryIndex<T extends StringToAnyObjectMap>(
|
|
61
|
-
[propertyName: string]: string | boolean | number;
|
|
62
|
-
}, secondaryIndexName: string, filterKeysAndValues?: {
|
|
63
|
-
[key: string]: string | number | boolean | string[] | number[];
|
|
64
|
-
}, expiresAtFilter?: {
|
|
65
|
-
[key: string]: number | Date;
|
|
66
|
-
}): Promise<T[]>;
|
|
59
|
+
findBySecondaryIndex<T extends StringToAnyObjectMap>(options: FindBySecondaryIndexOptions<T>): Promise<ListResult<T>>;
|
|
67
60
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ListOptions } from "./list.options";
|
|
2
|
+
export interface FindBySecondaryIndexOptions<T> extends ListOptions<T> {
|
|
3
|
+
keyCondition: {
|
|
4
|
+
[propertyName: string]: string | boolean | number;
|
|
5
|
+
};
|
|
6
|
+
secondaryIndexName: string;
|
|
7
|
+
filterKeysAndValues?: {
|
|
8
|
+
[key: string]: string | number | boolean | string[] | number[];
|
|
9
|
+
};
|
|
10
|
+
expiresAtFilter?: {
|
|
11
|
+
[key: string]: number | Date;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaginationResult } from "./pagination.result";
|
|
2
|
+
export declare class ListResult<T> implements IterableIterator<T> {
|
|
3
|
+
private _items;
|
|
4
|
+
private _paginationResult?;
|
|
5
|
+
private index;
|
|
6
|
+
private done;
|
|
7
|
+
constructor(_items: T[], _paginationResult?: PaginationResult | undefined);
|
|
8
|
+
[Symbol.iterator](): ListResult<T>;
|
|
9
|
+
next(): IteratorResult<T, T | undefined>;
|
|
10
|
+
get paginationResult(): PaginationResult | undefined;
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/aws",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.164",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/aws.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/aws.module.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"@awslabs-community-fork/dynamodb-data-mapper": "^0.7.9",
|
|
24
24
|
"@awslabs-community-fork/dynamodb-data-marshaller": "^0.7.9",
|
|
25
25
|
"@awslabs-community-fork/dynamodb-expressions": "^0.7.9",
|
|
26
|
-
"@pristine-ts/common": "^0.0.
|
|
27
|
-
"@pristine-ts/event": "^0.0.
|
|
28
|
-
"@pristine-ts/logging": "^0.0.
|
|
29
|
-
"@pristine-ts/networking": "^0.0.
|
|
30
|
-
"@pristine-ts/security": "^0.0.
|
|
26
|
+
"@pristine-ts/common": "^0.0.164",
|
|
27
|
+
"@pristine-ts/event": "^0.0.164",
|
|
28
|
+
"@pristine-ts/logging": "^0.0.164",
|
|
29
|
+
"@pristine-ts/networking": "^0.0.164",
|
|
30
|
+
"@pristine-ts/security": "^0.0.164"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"src/*.{js,ts}"
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "c4e421eb5c60f895d6ae19d9b8c7078dd26d0fd4"
|
|
70
70
|
}
|