@webiny/db-dynamodb 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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/DynamoDbDriver.d.ts +23 -25
- package/DynamoDbDriver.js +232 -240
- package/DynamoDbDriver.js.map +1 -0
- package/README.md +81 -1
- package/index.d.ts +2 -0
- package/index.js +18 -3
- package/index.js.map +1 -0
- package/package.json +19 -22
- package/plugins/definitions/AttributePlugin.d.ts +6 -8
- package/plugins/definitions/AttributePlugin.js +5 -20
- package/plugins/definitions/AttributePlugin.js.map +1 -0
- package/plugins/definitions/DateTimeTransformPlugin.d.ts +3 -2
- package/plugins/definitions/DateTimeTransformPlugin.js +16 -28
- package/plugins/definitions/DateTimeTransformPlugin.js.map +1 -0
- package/plugins/definitions/FieldPathPlugin.d.ts +3 -3
- package/plugins/definitions/FieldPathPlugin.js +7 -21
- package/plugins/definitions/FieldPathPlugin.js.map +1 -0
- package/plugins/definitions/FieldPlugin.d.ts +5 -5
- package/plugins/definitions/FieldPlugin.js +2 -24
- package/plugins/definitions/FieldPlugin.js.map +1 -0
- package/plugins/definitions/TimeTransformPlugin.d.ts +3 -2
- package/plugins/definitions/TimeTransformPlugin.js +19 -30
- package/plugins/definitions/TimeTransformPlugin.js.map +1 -0
- package/plugins/definitions/ValueFilterPlugin.d.ts +13 -11
- package/plugins/definitions/ValueFilterPlugin.js +10 -16
- package/plugins/definitions/ValueFilterPlugin.js.map +1 -0
- package/plugins/definitions/ValueTransformPlugin.d.ts +9 -9
- package/plugins/definitions/ValueTransformPlugin.js +7 -22
- package/plugins/definitions/ValueTransformPlugin.js.map +1 -0
- package/plugins/definitions/assignFields.js +3 -10
- package/plugins/definitions/assignFields.js.map +1 -0
- package/plugins/filters/andIn.d.ts +2 -2
- package/plugins/filters/andIn.js +5 -9
- package/plugins/filters/andIn.js.map +1 -0
- package/plugins/filters/between.d.ts +2 -2
- package/plugins/filters/between.js +5 -9
- package/plugins/filters/between.js.map +1 -0
- package/plugins/filters/contains.d.ts +2 -2
- package/plugins/filters/contains.js +44 -17
- package/plugins/filters/contains.js.map +1 -0
- package/plugins/filters/eq.d.ts +2 -2
- package/plugins/filters/eq.js +17 -5
- package/plugins/filters/eq.js.map +1 -0
- package/plugins/filters/fuzzy.d.ts +2 -2
- package/plugins/filters/fuzzy.js +18 -12
- package/plugins/filters/fuzzy.js.map +1 -0
- package/plugins/filters/gt.d.ts +2 -2
- package/plugins/filters/gt.js +4 -4
- package/plugins/filters/gt.js.map +1 -0
- package/plugins/filters/gte.d.ts +2 -2
- package/plugins/filters/gte.js +4 -4
- package/plugins/filters/gte.js.map +1 -0
- package/plugins/filters/in.d.ts +2 -2
- package/plugins/filters/in.js +5 -9
- package/plugins/filters/in.js.map +1 -0
- package/plugins/filters/index.d.ts +1 -1
- package/plugins/filters/index.js +5 -15
- package/plugins/filters/index.js.map +1 -0
- package/plugins/filters/lt.d.ts +2 -2
- package/plugins/filters/lt.js +4 -4
- package/plugins/filters/lt.js.map +1 -0
- package/plugins/filters/lte.d.ts +2 -2
- package/plugins/filters/lte.js +4 -4
- package/plugins/filters/lte.js.map +1 -0
- package/plugins/filters/startsWith.d.ts +3 -0
- package/plugins/filters/startsWith.js +40 -0
- package/plugins/filters/startsWith.js.map +1 -0
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +3 -5
- package/plugins/index.js.map +1 -0
- package/store/entity.d.ts +78 -0
- package/store/entity.js +41 -0
- package/store/entity.js.map +1 -0
- package/store/keys.d.ts +6 -0
- package/store/keys.js +22 -0
- package/store/keys.js.map +1 -0
- package/store/types.d.ts +7 -0
- package/store/types.js +7 -0
- package/store/types.js.map +1 -0
- package/toolbox.d.ts +3 -0
- package/toolbox.js +20 -0
- package/toolbox.js.map +1 -0
- package/types.d.ts +37 -21
- package/types.js +3 -1
- package/types.js.map +1 -0
- package/utils/attributes.d.ts +5 -5
- package/utils/attributes.js +6 -14
- package/utils/attributes.js.map +1 -0
- package/utils/batch/batchRead.d.ts +15 -0
- package/utils/batch/batchRead.js +72 -0
- package/utils/batch/batchRead.js.map +1 -0
- package/utils/batch/batchWrite.d.ts +13 -0
- package/utils/batch/batchWrite.js +65 -0
- package/utils/batch/batchWrite.js.map +1 -0
- package/utils/batch/index.d.ts +3 -0
- package/utils/batch/index.js +40 -0
- package/utils/batch/index.js.map +1 -0
- package/utils/batch/types.d.ts +25 -0
- package/utils/batch/types.js +7 -0
- package/utils/batch/types.js.map +1 -0
- package/utils/cleanup.d.ts +3 -3
- package/utils/cleanup.js +11 -27
- package/utils/cleanup.js.map +1 -0
- package/utils/count.d.ts +2 -0
- package/utils/count.js +23 -0
- package/utils/count.js.map +1 -0
- package/utils/createEntity.d.ts +54 -0
- package/utils/createEntity.js +61 -0
- package/utils/createEntity.js.map +1 -0
- package/utils/createTable.d.ts +8 -0
- package/utils/createTable.js +29 -0
- package/utils/createTable.js.map +1 -0
- package/utils/cursor.d.ts +2 -2
- package/utils/cursor.js +2 -6
- package/utils/cursor.js.map +1 -0
- package/utils/delete.d.ts +10 -0
- package/utils/delete.js +18 -0
- package/utils/delete.js.map +1 -0
- package/utils/entity/Entity.d.ts +26 -0
- package/utils/entity/Entity.js +77 -0
- package/utils/entity/Entity.js.map +1 -0
- package/utils/entity/EntityReadBatch.d.ts +17 -0
- package/utils/entity/EntityReadBatch.js +41 -0
- package/utils/entity/EntityReadBatch.js.map +1 -0
- package/utils/entity/EntityReadBatchBuilder.d.ts +10 -0
- package/utils/entity/EntityReadBatchBuilder.js +29 -0
- package/utils/entity/EntityReadBatchBuilder.js.map +1 -0
- package/utils/entity/EntityWriteBatch.d.ts +22 -0
- package/utils/entity/EntityWriteBatch.js +59 -0
- package/utils/entity/EntityWriteBatch.js.map +1 -0
- package/utils/entity/EntityWriteBatchBuilder.d.ts +11 -0
- package/utils/entity/EntityWriteBatchBuilder.js +28 -0
- package/utils/entity/EntityWriteBatchBuilder.js.map +1 -0
- package/utils/entity/getEntity.d.ts +4 -0
- package/utils/entity/getEntity.js +19 -0
- package/utils/entity/getEntity.js.map +1 -0
- package/utils/entity/index.d.ts +7 -0
- package/utils/entity/index.js +84 -0
- package/utils/entity/index.js.map +1 -0
- package/utils/entity/types.d.ts +51 -0
- package/utils/entity/types.js +7 -0
- package/utils/entity/types.js.map +1 -0
- package/utils/filter.d.ts +4 -4
- package/utils/filter.js +12 -43
- package/utils/filter.js.map +1 -0
- package/utils/get.d.ts +10 -8
- package/utils/get.js +16 -7
- package/utils/get.js.map +1 -0
- package/utils/index.d.ts +17 -0
- package/utils/index.js +194 -0
- package/utils/index.js.map +1 -0
- package/utils/listResponse.d.ts +1 -1
- package/utils/listResponse.js +8 -7
- package/utils/listResponse.js.map +1 -0
- package/utils/put.d.ts +12 -0
- package/utils/put.js +19 -0
- package/utils/put.js.map +1 -0
- package/utils/query.d.ts +20 -8
- package/utils/query.js +71 -38
- package/utils/query.js.map +1 -0
- package/utils/scan.d.ts +38 -0
- package/utils/scan.js +90 -0
- package/utils/scan.js.map +1 -0
- package/utils/sort.d.ts +3 -3
- package/utils/sort.js +5 -22
- package/utils/sort.js.map +1 -0
- package/utils/table/Table.d.ts +11 -0
- package/utils/table/Table.js +38 -0
- package/utils/table/Table.js.map +1 -0
- package/utils/table/TableReadBatch.d.ts +19 -0
- package/utils/table/TableReadBatch.js +62 -0
- package/utils/table/TableReadBatch.js.map +1 -0
- package/utils/table/TableWriteBatch.d.ts +21 -0
- package/utils/table/TableWriteBatch.js +69 -0
- package/utils/table/TableWriteBatch.js.map +1 -0
- package/utils/table/index.d.ts +4 -0
- package/utils/table/index.js +51 -0
- package/utils/table/index.js.map +1 -0
- package/utils/table/types.d.ts +39 -0
- package/utils/table/types.js +7 -0
- package/utils/table/types.js.map +1 -0
- package/utils/update.d.ts +12 -0
- package/utils/update.js +19 -0
- package/utils/update.js.map +1 -0
- package/BatchProcess.d.ts +0 -31
- package/BatchProcess.js +0 -196
- package/QueryGenerator.d.ts +0 -19
- package/QueryGenerator.js +0 -79
- package/operators/comparison/beginsWith.d.ts +0 -3
- package/operators/comparison/beginsWith.js +0 -24
- package/operators/comparison/between.d.ts +0 -3
- package/operators/comparison/between.js +0 -30
- package/operators/comparison/eq.d.ts +0 -3
- package/operators/comparison/eq.js +0 -34
- package/operators/comparison/gt.d.ts +0 -3
- package/operators/comparison/gt.js +0 -24
- package/operators/comparison/gte.d.ts +0 -3
- package/operators/comparison/gte.js +0 -24
- package/operators/comparison/lt.d.ts +0 -3
- package/operators/comparison/lt.js +0 -24
- package/operators/comparison/lte.d.ts +0 -3
- package/operators/comparison/lte.js +0 -24
- package/operators/index.d.ts +0 -12
- package/operators/index.js +0 -39
- package/operators/logical/and.d.ts +0 -3
- package/operators/logical/and.js +0 -63
- package/operators/logical/or.d.ts +0 -3
- package/operators/logical/or.js +0 -63
- package/plugins/definitions/NumberTransformPlugin.d.ts +0 -4
- package/plugins/definitions/NumberTransformPlugin.js +0 -49
- package/statements/createKeyConditionExpressionArgs.d.ts +0 -12
- package/statements/createKeyConditionExpressionArgs.js +0 -48
- package/statements/processStatement.d.ts +0 -4
- package/statements/processStatement.js +0 -39
- package/utils/batchRead.d.ts +0 -15
- package/utils/batchRead.js +0 -58
- package/utils/batchWrite.d.ts +0 -17
- package/utils/batchWrite.js +0 -30
- package/utils/documentClient.d.ts +0 -8
- package/utils/documentClient.js +0 -33
- package/utils/table.d.ts +0 -7
- package/utils/table.js +0 -27
package/DynamoDbDriver.d.ts
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}): Promise<Result<T[]>>;
|
|
25
|
-
getBatchProcess(__batch: any): BatchProcess;
|
|
1
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
2
|
+
import type { DbDriver, GetValueResult, GetValuesResult, IListValuesParams, ListValuesResult, RemoveValueResult, RemoveValuesResult, StorageKey, StoreValueResult, StoreValuesResult } from "@webiny/db";
|
|
3
|
+
import type { Entity } from "dynamodb-toolbox";
|
|
4
|
+
import type { Table } from "./utils/createTable";
|
|
5
|
+
import type { GenericRecord } from "@webiny/api/types";
|
|
6
|
+
interface ConstructorArgs {
|
|
7
|
+
documentClient: DynamoDBDocument;
|
|
8
|
+
}
|
|
9
|
+
declare class DynamoDbDriver implements DbDriver<DynamoDBDocument> {
|
|
10
|
+
readonly documentClient: DynamoDBDocument;
|
|
11
|
+
private _table;
|
|
12
|
+
private _entity;
|
|
13
|
+
table(): Table;
|
|
14
|
+
entity(): Entity;
|
|
15
|
+
constructor({ documentClient }: ConstructorArgs);
|
|
16
|
+
getClient(): DynamoDBDocument;
|
|
17
|
+
storeValue<V>(key: string, input: V): Promise<StoreValueResult<V>>;
|
|
18
|
+
storeValues<V extends GenericRecord<StorageKey>>(values: V): Promise<StoreValuesResult<V>>;
|
|
19
|
+
getValue<V>(key: StorageKey): Promise<GetValueResult<V>>;
|
|
20
|
+
getValues<V extends GenericRecord<StorageKey>>(input: (keyof V)[]): Promise<GetValuesResult<V>>;
|
|
21
|
+
listValues<V extends GenericRecord<StorageKey>>(params?: IListValuesParams): Promise<ListValuesResult<V>>;
|
|
22
|
+
removeValue<V>(key: StorageKey): Promise<RemoveValueResult<V>>;
|
|
23
|
+
removeValues<V extends GenericRecord<StorageKey>>(input: (keyof V)[]): Promise<RemoveValuesResult<V>>;
|
|
26
24
|
}
|
|
27
25
|
export default DynamoDbDriver;
|
package/DynamoDbDriver.js
CHANGED
|
@@ -1,272 +1,264 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _BatchProcess = _interopRequireDefault(require("./BatchProcess"));
|
|
15
|
-
|
|
16
|
-
var _QueryGenerator = _interopRequireDefault(require("./QueryGenerator"));
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
-
|
|
22
|
-
const LOG_KEYS = [{
|
|
23
|
-
primary: true,
|
|
24
|
-
unique: true,
|
|
25
|
-
name: "primary",
|
|
26
|
-
fields: [{
|
|
27
|
-
name: "PK"
|
|
28
|
-
}, {
|
|
29
|
-
name: "SK"
|
|
30
|
-
}]
|
|
31
|
-
}];
|
|
32
|
-
|
|
7
|
+
var _createTable = require("./utils/createTable");
|
|
8
|
+
var _entity = require("./store/entity");
|
|
9
|
+
var _utils = require("./utils");
|
|
10
|
+
var _keys = require("./store/keys");
|
|
33
11
|
class DynamoDbDriver {
|
|
12
|
+
_table = undefined;
|
|
13
|
+
_entity = undefined;
|
|
14
|
+
table() {
|
|
15
|
+
if (this._table) {
|
|
16
|
+
return this._table;
|
|
17
|
+
}
|
|
18
|
+
this._table = (0, _createTable.createTable)({
|
|
19
|
+
documentClient: this.documentClient
|
|
20
|
+
});
|
|
21
|
+
return this._table;
|
|
22
|
+
}
|
|
23
|
+
entity() {
|
|
24
|
+
if (this._entity) {
|
|
25
|
+
return this._entity;
|
|
26
|
+
}
|
|
27
|
+
this._entity = (0, _entity.createEntity)({
|
|
28
|
+
table: this.table()
|
|
29
|
+
});
|
|
30
|
+
return this._entity;
|
|
31
|
+
}
|
|
34
32
|
constructor({
|
|
35
33
|
documentClient
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
(0, _defineProperty2.default)(this, "documentClient", void 0);
|
|
39
|
-
this.batchProcesses = {};
|
|
40
|
-
this.documentClient = documentClient || new _dynamodb.DocumentClient();
|
|
34
|
+
}) {
|
|
35
|
+
this.documentClient = documentClient;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
getClient() {
|
|
44
38
|
return this.documentClient;
|
|
45
39
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
TableName: table,
|
|
56
|
-
Item: data,
|
|
57
|
-
ReturnConsumedCapacity: meta ? "TOTAL" : "NONE"
|
|
58
|
-
}).promise();
|
|
59
|
-
return [true, {
|
|
60
|
-
response: result.$response
|
|
61
|
-
}];
|
|
40
|
+
async storeValue(key, input) {
|
|
41
|
+
let value;
|
|
42
|
+
try {
|
|
43
|
+
value = JSON.stringify(input);
|
|
44
|
+
} catch (ex) {
|
|
45
|
+
return {
|
|
46
|
+
key,
|
|
47
|
+
error: ex
|
|
48
|
+
};
|
|
62
49
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
50
|
+
try {
|
|
51
|
+
await (0, _utils.put)({
|
|
52
|
+
entity: this.entity(),
|
|
53
|
+
item: {
|
|
54
|
+
PK: (0, _keys.createPartitionKey)(),
|
|
55
|
+
SK: (0, _keys.createSortKey)({
|
|
56
|
+
key
|
|
57
|
+
}),
|
|
58
|
+
TYPE: (0, _keys.createType)(),
|
|
59
|
+
key,
|
|
60
|
+
value
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
key,
|
|
65
|
+
data: input
|
|
66
|
+
};
|
|
67
|
+
} catch (ex) {
|
|
68
|
+
return {
|
|
69
|
+
key,
|
|
70
|
+
error: ex
|
|
71
|
+
};
|
|
74
72
|
}
|
|
75
|
-
|
|
76
|
-
await batchProcess.waitExecution();
|
|
77
|
-
return [true, {
|
|
78
|
-
response: batchProcess.response
|
|
79
|
-
}];
|
|
80
73
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
74
|
+
async storeValues(values) {
|
|
75
|
+
const keys = Object.keys(values);
|
|
76
|
+
try {
|
|
77
|
+
const batch = keys.map(key => {
|
|
78
|
+
const input = values[key];
|
|
79
|
+
let value;
|
|
80
|
+
try {
|
|
81
|
+
value = JSON.stringify(input);
|
|
82
|
+
} catch (ex) {
|
|
83
|
+
throw ex;
|
|
84
|
+
}
|
|
85
|
+
const item = {
|
|
86
|
+
PK: (0, _keys.createPartitionKey)(),
|
|
87
|
+
SK: (0, _keys.createSortKey)({
|
|
88
|
+
key
|
|
89
|
+
}),
|
|
90
|
+
TYPE: (0, _keys.createType)(),
|
|
91
|
+
key,
|
|
92
|
+
value
|
|
93
|
+
};
|
|
94
|
+
return this.entity().putBatch(item);
|
|
95
|
+
});
|
|
96
|
+
await (0, _utils.batchWriteAll)({
|
|
97
|
+
table: this.table(),
|
|
98
|
+
items: batch
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
keys,
|
|
102
|
+
data: values
|
|
103
|
+
};
|
|
104
|
+
} catch (ex) {
|
|
105
|
+
return {
|
|
106
|
+
keys,
|
|
107
|
+
error: ex
|
|
94
108
|
};
|
|
95
|
-
const updateExpression = [];
|
|
96
|
-
|
|
97
|
-
for (const key in data) {
|
|
98
|
-
updateExpression.push(`#${key} = :${key}`);
|
|
99
|
-
update.ExpressionAttributeNames[`#${key}`] = key;
|
|
100
|
-
update.ExpressionAttributeValues[`:${key}`] = data[key];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
update.UpdateExpression += updateExpression.join(", ");
|
|
104
|
-
const result = await this.documentClient.update(_objectSpread({
|
|
105
|
-
TableName: table,
|
|
106
|
-
Key: query,
|
|
107
|
-
ReturnConsumedCapacity: meta ? "TOTAL" : "NONE"
|
|
108
|
-
}, update)).promise();
|
|
109
|
-
return [true, {
|
|
110
|
-
response: result.$response
|
|
111
|
-
}];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const batchProcess = this.getBatchProcess(batch);
|
|
115
|
-
batchProcess.addBatchWrite({
|
|
116
|
-
table,
|
|
117
|
-
data
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
if (batchProcess.allOperationsAdded()) {
|
|
121
|
-
batchProcess.startExecution();
|
|
122
|
-
} else {
|
|
123
|
-
await batchProcess.waitStartExecution();
|
|
124
109
|
}
|
|
125
|
-
|
|
126
|
-
await batchProcess.waitExecution();
|
|
127
|
-
return [true, {
|
|
128
|
-
response: batchProcess.response
|
|
129
|
-
}];
|
|
130
110
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
table,
|
|
152
|
-
query
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (batchProcess.allOperationsAdded()) {
|
|
156
|
-
batchProcess.startExecution();
|
|
157
|
-
} else {
|
|
158
|
-
await batchProcess.waitStartExecution();
|
|
111
|
+
async getValue(key) {
|
|
112
|
+
try {
|
|
113
|
+
const result = await (0, _utils.get)({
|
|
114
|
+
entity: this.entity(),
|
|
115
|
+
keys: {
|
|
116
|
+
PK: (0, _keys.createPartitionKey)(),
|
|
117
|
+
SK: (0, _keys.createSortKey)({
|
|
118
|
+
key
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
key,
|
|
124
|
+
data: result ? JSON.parse(result.value) : null
|
|
125
|
+
};
|
|
126
|
+
} catch (ex) {
|
|
127
|
+
return {
|
|
128
|
+
key,
|
|
129
|
+
error: ex
|
|
130
|
+
};
|
|
159
131
|
}
|
|
160
|
-
|
|
161
|
-
await batchProcess.waitExecution();
|
|
162
|
-
return [true, {
|
|
163
|
-
response: batchProcess.response
|
|
164
|
-
}];
|
|
165
132
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
__batch: batch
|
|
175
|
-
}) {
|
|
176
|
-
if (!batch) {
|
|
177
|
-
const queryGenerator = new _QueryGenerator.default();
|
|
178
|
-
const queryParams = queryGenerator.generate({
|
|
179
|
-
query,
|
|
180
|
-
keys,
|
|
181
|
-
sort,
|
|
182
|
-
limit,
|
|
183
|
-
tableName: table
|
|
133
|
+
async getValues(input) {
|
|
134
|
+
const keys = [...input];
|
|
135
|
+
const batch = keys.map(key => {
|
|
136
|
+
return this.entity().getBatch({
|
|
137
|
+
PK: (0, _keys.createPartitionKey)(),
|
|
138
|
+
SK: (0, _keys.createSortKey)({
|
|
139
|
+
key
|
|
140
|
+
})
|
|
184
141
|
});
|
|
185
|
-
const response = await this.documentClient.query(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
186
|
-
ReturnConsumedCapacity: meta ? "TOTAL" : "NONE"
|
|
187
|
-
})).promise();
|
|
188
|
-
|
|
189
|
-
if (Array.isArray(response.Items)) {
|
|
190
|
-
return [response.Items, {
|
|
191
|
-
response: response.$response
|
|
192
|
-
}];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return [[], {
|
|
196
|
-
response: response.$response
|
|
197
|
-
}];
|
|
198
|
-
} // DynamoDb doesn't support batch queries, so we can immediately assume the GetRequest operation.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const batchProcess = this.getBatchProcess(batch);
|
|
202
|
-
const getResult = batchProcess.addBatchGet({
|
|
203
|
-
table,
|
|
204
|
-
query
|
|
205
142
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
143
|
+
try {
|
|
144
|
+
const results = await (0, _utils.batchReadAll)({
|
|
145
|
+
table: this.table(),
|
|
146
|
+
items: batch
|
|
147
|
+
});
|
|
148
|
+
const data = keys.reduce((collection, key) => {
|
|
149
|
+
const result = results.find(item => {
|
|
150
|
+
return item.PK === (0, _keys.createPartitionKey)() && item.SK === (0, _keys.createSortKey)({
|
|
151
|
+
key
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
if (!result?.value) {
|
|
155
|
+
// @ts-expect-error
|
|
156
|
+
collection[key] = null;
|
|
157
|
+
return collection;
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
// @ts-expect-error
|
|
161
|
+
collection[key] = JSON.parse(result.value);
|
|
162
|
+
} catch {
|
|
163
|
+
// @ts-expect-error
|
|
164
|
+
collection[key] = null;
|
|
165
|
+
}
|
|
166
|
+
return collection;
|
|
167
|
+
}, {});
|
|
168
|
+
return {
|
|
169
|
+
keys,
|
|
170
|
+
data
|
|
171
|
+
};
|
|
172
|
+
} catch (ex) {
|
|
173
|
+
return {
|
|
174
|
+
keys,
|
|
175
|
+
error: ex
|
|
176
|
+
};
|
|
211
177
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
178
|
+
}
|
|
179
|
+
async listValues(params) {
|
|
180
|
+
try {
|
|
181
|
+
const partitionKey = (0, _keys.createPartitionKey)();
|
|
182
|
+
const options = {
|
|
183
|
+
...params
|
|
184
|
+
};
|
|
185
|
+
const results = await (0, _utils.queryAll)({
|
|
186
|
+
entity: this.entity(),
|
|
187
|
+
partitionKey,
|
|
188
|
+
options
|
|
189
|
+
});
|
|
190
|
+
const data = results.reduce((collection, item) => {
|
|
191
|
+
try {
|
|
192
|
+
// @ts-expect-error
|
|
193
|
+
collection[item.key] = JSON.parse(item.value);
|
|
194
|
+
} catch (ex) {
|
|
195
|
+
// @ts-expect-error
|
|
196
|
+
collection[item.key] = null;
|
|
197
|
+
}
|
|
198
|
+
return collection;
|
|
199
|
+
}, {});
|
|
200
|
+
return {
|
|
201
|
+
keys: Object.keys(data),
|
|
202
|
+
data
|
|
203
|
+
};
|
|
204
|
+
} catch (ex) {
|
|
205
|
+
return {
|
|
206
|
+
error: ex
|
|
207
|
+
};
|
|
220
208
|
}
|
|
221
|
-
|
|
222
|
-
return [[], {
|
|
223
|
-
response: batchProcess.response
|
|
224
|
-
}];
|
|
225
209
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
210
|
+
async removeValue(key) {
|
|
211
|
+
const result = await this.getValue(key);
|
|
212
|
+
if (result.error) {
|
|
213
|
+
return {
|
|
214
|
+
key,
|
|
215
|
+
error: result.error
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
await this.entity().delete({
|
|
220
|
+
PK: (0, _keys.createPartitionKey)(),
|
|
221
|
+
SK: (0, _keys.createSortKey)({
|
|
222
|
+
key
|
|
223
|
+
})
|
|
224
|
+
});
|
|
225
|
+
return {
|
|
226
|
+
key,
|
|
227
|
+
data: result.data
|
|
228
|
+
};
|
|
229
|
+
} catch (ex) {
|
|
230
|
+
return {
|
|
231
|
+
key,
|
|
232
|
+
error: ex
|
|
233
|
+
};
|
|
234
|
+
}
|
|
244
235
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
SK: {
|
|
255
|
-
$gte: " "
|
|
256
|
-
}
|
|
257
|
-
}
|
|
236
|
+
async removeValues(input) {
|
|
237
|
+
const keys = [...input];
|
|
238
|
+
const batch = keys.map(key => {
|
|
239
|
+
return this.entity().deleteBatch({
|
|
240
|
+
PK: (0, _keys.createPartitionKey)(),
|
|
241
|
+
SK: (0, _keys.createSortKey)({
|
|
242
|
+
key
|
|
243
|
+
})
|
|
244
|
+
});
|
|
258
245
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
246
|
+
try {
|
|
247
|
+
await (0, _utils.batchWriteAll)({
|
|
248
|
+
table: this.table(),
|
|
249
|
+
items: batch
|
|
250
|
+
});
|
|
251
|
+
return {
|
|
252
|
+
keys
|
|
253
|
+
};
|
|
254
|
+
} catch (ex) {
|
|
255
|
+
return {
|
|
256
|
+
keys,
|
|
257
|
+
error: ex
|
|
258
|
+
};
|
|
264
259
|
}
|
|
265
|
-
|
|
266
|
-
return this.batchProcesses[__batch.instance.id];
|
|
267
260
|
}
|
|
268
|
-
|
|
269
261
|
}
|
|
262
|
+
var _default = exports.default = DynamoDbDriver;
|
|
270
263
|
|
|
271
|
-
|
|
272
|
-
exports.default = _default;
|
|
264
|
+
//# sourceMappingURL=DynamoDbDriver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_createTable","require","_entity","_utils","_keys","DynamoDbDriver","_table","undefined","table","createTable","documentClient","entity","createEntity","constructor","getClient","storeValue","key","input","value","JSON","stringify","ex","error","put","item","PK","createPartitionKey","SK","createSortKey","TYPE","createType","data","storeValues","values","keys","Object","batch","map","putBatch","batchWriteAll","items","getValue","result","get","parse","getValues","getBatch","results","batchReadAll","reduce","collection","find","listValues","params","partitionKey","options","queryAll","removeValue","delete","removeValues","deleteBatch","_default","exports","default"],"sources":["DynamoDbDriver.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type {\n DbDriver,\n GetValueResult,\n GetValuesResult,\n IListValuesParams,\n ListValuesResult,\n RemoveValueResult,\n RemoveValuesResult,\n StorageKey,\n StoreValueResult,\n StoreValuesResult\n} from \"@webiny/db\";\nimport type { Entity } from \"dynamodb-toolbox\";\nimport type { Table } from \"~/utils/createTable\";\nimport { createTable } from \"~/utils/createTable\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport { createEntity } from \"~/store/entity\";\nimport { batchReadAll, batchWriteAll, get, put, queryAll } from \"~/utils\";\nimport { createPartitionKey, createSortKey, createType } from \"~/store/keys\";\nimport type { IStoreItem } from \"~/store/types\";\n\ninterface ConstructorArgs {\n documentClient: DynamoDBDocument;\n}\n\nclass DynamoDbDriver implements DbDriver<DynamoDBDocument> {\n public readonly documentClient: DynamoDBDocument;\n\n private _table: Table | undefined = undefined;\n private _entity: Entity | undefined = undefined;\n\n public table(): Table {\n if (this._table) {\n return this._table;\n }\n this._table = createTable({\n documentClient: this.documentClient\n });\n return this._table;\n }\n\n public entity(): Entity {\n if (this._entity) {\n return this._entity;\n }\n this._entity = createEntity({\n table: this.table()\n });\n return this._entity;\n }\n\n constructor({ documentClient }: ConstructorArgs) {\n this.documentClient = documentClient;\n }\n\n public getClient() {\n return this.documentClient;\n }\n\n public async storeValue<V>(key: string, input: V): Promise<StoreValueResult<V>> {\n let value: string | undefined;\n try {\n value = JSON.stringify(input);\n } catch (ex) {\n return {\n key,\n error: ex\n };\n }\n\n try {\n await put<IStoreItem>({\n entity: this.entity(),\n item: {\n PK: createPartitionKey(),\n SK: createSortKey({ key }),\n TYPE: createType(),\n key,\n value\n }\n });\n\n return {\n key,\n data: input\n };\n } catch (ex) {\n return {\n key,\n error: ex\n };\n }\n }\n public async storeValues<V extends GenericRecord<StorageKey>>(\n values: V\n ): Promise<StoreValuesResult<V>> {\n const keys = Object.keys(values);\n try {\n const batch = keys.map(key => {\n const input = values[key];\n let value: string | undefined;\n try {\n value = JSON.stringify(input);\n } catch (ex) {\n throw ex;\n }\n const item: IStoreItem = {\n PK: createPartitionKey(),\n SK: createSortKey({ key }),\n TYPE: createType(),\n key,\n value\n };\n return this.entity().putBatch(item);\n });\n\n await batchWriteAll({\n table: this.table(),\n items: batch\n });\n return {\n keys,\n data: values\n };\n } catch (ex) {\n return {\n keys,\n error: ex\n };\n }\n }\n public async getValue<V>(key: StorageKey): Promise<GetValueResult<V>> {\n try {\n const result = await get<IStoreItem>({\n entity: this.entity(),\n keys: {\n PK: createPartitionKey(),\n SK: createSortKey({ key })\n }\n });\n return {\n key,\n data: result ? JSON.parse(result.value) : null\n };\n } catch (ex) {\n return {\n key,\n error: ex\n };\n }\n }\n public async getValues<V extends GenericRecord<StorageKey>>(\n input: (keyof V)[]\n ): Promise<GetValuesResult<V>> {\n const keys = [...input] as string[];\n const batch = keys.map(key => {\n return this.entity().getBatch({\n PK: createPartitionKey(),\n SK: createSortKey({ key })\n });\n });\n\n try {\n const results = await batchReadAll<IStoreItem>({\n table: this.table(),\n items: batch\n });\n const data = keys.reduce((collection, key) => {\n const result = results.find(item => {\n return item.PK === createPartitionKey() && item.SK === createSortKey({ key });\n });\n if (!result?.value) {\n // @ts-expect-error\n collection[key] = null;\n return collection;\n }\n try {\n // @ts-expect-error\n collection[key] = JSON.parse(result.value);\n } catch {\n // @ts-expect-error\n collection[key] = null;\n }\n\n return collection;\n }, {} as V);\n return {\n keys,\n data\n };\n } catch (ex) {\n return {\n keys,\n error: ex\n };\n }\n }\n public async listValues<V extends GenericRecord<StorageKey>>(\n params?: IListValuesParams\n ): Promise<ListValuesResult<V>> {\n try {\n const partitionKey = createPartitionKey();\n const options = {\n ...params\n };\n const results = await queryAll<IStoreItem>({\n entity: this.entity(),\n partitionKey,\n options\n });\n\n const data = results.reduce((collection, item) => {\n try {\n // @ts-expect-error\n collection[item.key] = JSON.parse(item.value);\n } catch (ex) {\n // @ts-expect-error\n collection[item.key] = null;\n }\n\n return collection;\n }, {} as V);\n\n return {\n keys: Object.keys(data),\n data\n };\n } catch (ex) {\n return {\n error: ex\n };\n }\n }\n\n public async removeValue<V>(key: StorageKey): Promise<RemoveValueResult<V>> {\n const result = await this.getValue<V>(key);\n if (result.error) {\n return {\n key,\n error: result.error\n };\n }\n try {\n await this.entity().delete({\n PK: createPartitionKey(),\n SK: createSortKey({ key })\n });\n return {\n key,\n data: result.data\n };\n } catch (ex) {\n return {\n key,\n error: ex\n };\n }\n }\n\n public async removeValues<V extends GenericRecord<StorageKey>>(\n input: (keyof V)[]\n ): Promise<RemoveValuesResult<V>> {\n const keys = [...input] as string[];\n const batch = keys.map(key => {\n return this.entity().deleteBatch({\n PK: createPartitionKey(),\n SK: createSortKey({ key })\n });\n });\n\n try {\n await batchWriteAll({\n table: this.table(),\n items: batch\n });\n return {\n keys\n };\n } catch (ex) {\n return {\n keys,\n error: ex\n };\n }\n }\n}\n\nexport default DynamoDbDriver;\n"],"mappings":";;;;;;AAeA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,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