@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.
Files changed (222) hide show
  1. package/DynamoDbDriver.d.ts +23 -25
  2. package/DynamoDbDriver.js +232 -240
  3. package/DynamoDbDriver.js.map +1 -0
  4. package/README.md +81 -1
  5. package/index.d.ts +2 -0
  6. package/index.js +18 -3
  7. package/index.js.map +1 -0
  8. package/package.json +19 -22
  9. package/plugins/definitions/AttributePlugin.d.ts +6 -8
  10. package/plugins/definitions/AttributePlugin.js +5 -20
  11. package/plugins/definitions/AttributePlugin.js.map +1 -0
  12. package/plugins/definitions/DateTimeTransformPlugin.d.ts +3 -2
  13. package/plugins/definitions/DateTimeTransformPlugin.js +16 -28
  14. package/plugins/definitions/DateTimeTransformPlugin.js.map +1 -0
  15. package/plugins/definitions/FieldPathPlugin.d.ts +3 -3
  16. package/plugins/definitions/FieldPathPlugin.js +7 -21
  17. package/plugins/definitions/FieldPathPlugin.js.map +1 -0
  18. package/plugins/definitions/FieldPlugin.d.ts +5 -5
  19. package/plugins/definitions/FieldPlugin.js +2 -24
  20. package/plugins/definitions/FieldPlugin.js.map +1 -0
  21. package/plugins/definitions/TimeTransformPlugin.d.ts +3 -2
  22. package/plugins/definitions/TimeTransformPlugin.js +19 -30
  23. package/plugins/definitions/TimeTransformPlugin.js.map +1 -0
  24. package/plugins/definitions/ValueFilterPlugin.d.ts +13 -11
  25. package/plugins/definitions/ValueFilterPlugin.js +10 -16
  26. package/plugins/definitions/ValueFilterPlugin.js.map +1 -0
  27. package/plugins/definitions/ValueTransformPlugin.d.ts +9 -9
  28. package/plugins/definitions/ValueTransformPlugin.js +7 -22
  29. package/plugins/definitions/ValueTransformPlugin.js.map +1 -0
  30. package/plugins/definitions/assignFields.js +3 -10
  31. package/plugins/definitions/assignFields.js.map +1 -0
  32. package/plugins/filters/andIn.d.ts +2 -2
  33. package/plugins/filters/andIn.js +5 -9
  34. package/plugins/filters/andIn.js.map +1 -0
  35. package/plugins/filters/between.d.ts +2 -2
  36. package/plugins/filters/between.js +5 -9
  37. package/plugins/filters/between.js.map +1 -0
  38. package/plugins/filters/contains.d.ts +2 -2
  39. package/plugins/filters/contains.js +44 -17
  40. package/plugins/filters/contains.js.map +1 -0
  41. package/plugins/filters/eq.d.ts +2 -2
  42. package/plugins/filters/eq.js +17 -5
  43. package/plugins/filters/eq.js.map +1 -0
  44. package/plugins/filters/fuzzy.d.ts +2 -2
  45. package/plugins/filters/fuzzy.js +18 -12
  46. package/plugins/filters/fuzzy.js.map +1 -0
  47. package/plugins/filters/gt.d.ts +2 -2
  48. package/plugins/filters/gt.js +4 -4
  49. package/plugins/filters/gt.js.map +1 -0
  50. package/plugins/filters/gte.d.ts +2 -2
  51. package/plugins/filters/gte.js +4 -4
  52. package/plugins/filters/gte.js.map +1 -0
  53. package/plugins/filters/in.d.ts +2 -2
  54. package/plugins/filters/in.js +5 -9
  55. package/plugins/filters/in.js.map +1 -0
  56. package/plugins/filters/index.d.ts +1 -1
  57. package/plugins/filters/index.js +5 -15
  58. package/plugins/filters/index.js.map +1 -0
  59. package/plugins/filters/lt.d.ts +2 -2
  60. package/plugins/filters/lt.js +4 -4
  61. package/plugins/filters/lt.js.map +1 -0
  62. package/plugins/filters/lte.d.ts +2 -2
  63. package/plugins/filters/lte.js +4 -4
  64. package/plugins/filters/lte.js.map +1 -0
  65. package/plugins/filters/startsWith.d.ts +3 -0
  66. package/plugins/filters/startsWith.js +40 -0
  67. package/plugins/filters/startsWith.js.map +1 -0
  68. package/plugins/index.d.ts +1 -1
  69. package/plugins/index.js +3 -5
  70. package/plugins/index.js.map +1 -0
  71. package/store/entity.d.ts +78 -0
  72. package/store/entity.js +41 -0
  73. package/store/entity.js.map +1 -0
  74. package/store/keys.d.ts +6 -0
  75. package/store/keys.js +22 -0
  76. package/store/keys.js.map +1 -0
  77. package/store/types.d.ts +7 -0
  78. package/store/types.js +7 -0
  79. package/store/types.js.map +1 -0
  80. package/toolbox.d.ts +3 -0
  81. package/toolbox.js +20 -0
  82. package/toolbox.js.map +1 -0
  83. package/types.d.ts +37 -21
  84. package/types.js +3 -1
  85. package/types.js.map +1 -0
  86. package/utils/attributes.d.ts +5 -5
  87. package/utils/attributes.js +6 -14
  88. package/utils/attributes.js.map +1 -0
  89. package/utils/batch/batchRead.d.ts +15 -0
  90. package/utils/batch/batchRead.js +72 -0
  91. package/utils/batch/batchRead.js.map +1 -0
  92. package/utils/batch/batchWrite.d.ts +13 -0
  93. package/utils/batch/batchWrite.js +65 -0
  94. package/utils/batch/batchWrite.js.map +1 -0
  95. package/utils/batch/index.d.ts +3 -0
  96. package/utils/batch/index.js +40 -0
  97. package/utils/batch/index.js.map +1 -0
  98. package/utils/batch/types.d.ts +25 -0
  99. package/utils/batch/types.js +7 -0
  100. package/utils/batch/types.js.map +1 -0
  101. package/utils/cleanup.d.ts +3 -3
  102. package/utils/cleanup.js +11 -27
  103. package/utils/cleanup.js.map +1 -0
  104. package/utils/count.d.ts +2 -0
  105. package/utils/count.js +23 -0
  106. package/utils/count.js.map +1 -0
  107. package/utils/createEntity.d.ts +54 -0
  108. package/utils/createEntity.js +61 -0
  109. package/utils/createEntity.js.map +1 -0
  110. package/utils/createTable.d.ts +8 -0
  111. package/utils/createTable.js +29 -0
  112. package/utils/createTable.js.map +1 -0
  113. package/utils/cursor.d.ts +2 -2
  114. package/utils/cursor.js +2 -6
  115. package/utils/cursor.js.map +1 -0
  116. package/utils/delete.d.ts +10 -0
  117. package/utils/delete.js +18 -0
  118. package/utils/delete.js.map +1 -0
  119. package/utils/entity/Entity.d.ts +26 -0
  120. package/utils/entity/Entity.js +77 -0
  121. package/utils/entity/Entity.js.map +1 -0
  122. package/utils/entity/EntityReadBatch.d.ts +17 -0
  123. package/utils/entity/EntityReadBatch.js +41 -0
  124. package/utils/entity/EntityReadBatch.js.map +1 -0
  125. package/utils/entity/EntityReadBatchBuilder.d.ts +10 -0
  126. package/utils/entity/EntityReadBatchBuilder.js +29 -0
  127. package/utils/entity/EntityReadBatchBuilder.js.map +1 -0
  128. package/utils/entity/EntityWriteBatch.d.ts +22 -0
  129. package/utils/entity/EntityWriteBatch.js +59 -0
  130. package/utils/entity/EntityWriteBatch.js.map +1 -0
  131. package/utils/entity/EntityWriteBatchBuilder.d.ts +11 -0
  132. package/utils/entity/EntityWriteBatchBuilder.js +28 -0
  133. package/utils/entity/EntityWriteBatchBuilder.js.map +1 -0
  134. package/utils/entity/getEntity.d.ts +4 -0
  135. package/utils/entity/getEntity.js +19 -0
  136. package/utils/entity/getEntity.js.map +1 -0
  137. package/utils/entity/index.d.ts +7 -0
  138. package/utils/entity/index.js +84 -0
  139. package/utils/entity/index.js.map +1 -0
  140. package/utils/entity/types.d.ts +51 -0
  141. package/utils/entity/types.js +7 -0
  142. package/utils/entity/types.js.map +1 -0
  143. package/utils/filter.d.ts +4 -4
  144. package/utils/filter.js +12 -43
  145. package/utils/filter.js.map +1 -0
  146. package/utils/get.d.ts +10 -8
  147. package/utils/get.js +16 -7
  148. package/utils/get.js.map +1 -0
  149. package/utils/index.d.ts +17 -0
  150. package/utils/index.js +194 -0
  151. package/utils/index.js.map +1 -0
  152. package/utils/listResponse.d.ts +1 -1
  153. package/utils/listResponse.js +8 -7
  154. package/utils/listResponse.js.map +1 -0
  155. package/utils/put.d.ts +12 -0
  156. package/utils/put.js +19 -0
  157. package/utils/put.js.map +1 -0
  158. package/utils/query.d.ts +20 -8
  159. package/utils/query.js +71 -38
  160. package/utils/query.js.map +1 -0
  161. package/utils/scan.d.ts +38 -0
  162. package/utils/scan.js +90 -0
  163. package/utils/scan.js.map +1 -0
  164. package/utils/sort.d.ts +3 -3
  165. package/utils/sort.js +5 -22
  166. package/utils/sort.js.map +1 -0
  167. package/utils/table/Table.d.ts +11 -0
  168. package/utils/table/Table.js +38 -0
  169. package/utils/table/Table.js.map +1 -0
  170. package/utils/table/TableReadBatch.d.ts +19 -0
  171. package/utils/table/TableReadBatch.js +62 -0
  172. package/utils/table/TableReadBatch.js.map +1 -0
  173. package/utils/table/TableWriteBatch.d.ts +21 -0
  174. package/utils/table/TableWriteBatch.js +69 -0
  175. package/utils/table/TableWriteBatch.js.map +1 -0
  176. package/utils/table/index.d.ts +4 -0
  177. package/utils/table/index.js +51 -0
  178. package/utils/table/index.js.map +1 -0
  179. package/utils/table/types.d.ts +39 -0
  180. package/utils/table/types.js +7 -0
  181. package/utils/table/types.js.map +1 -0
  182. package/utils/update.d.ts +12 -0
  183. package/utils/update.js +19 -0
  184. package/utils/update.js.map +1 -0
  185. package/BatchProcess.d.ts +0 -31
  186. package/BatchProcess.js +0 -196
  187. package/QueryGenerator.d.ts +0 -19
  188. package/QueryGenerator.js +0 -79
  189. package/operators/comparison/beginsWith.d.ts +0 -3
  190. package/operators/comparison/beginsWith.js +0 -24
  191. package/operators/comparison/between.d.ts +0 -3
  192. package/operators/comparison/between.js +0 -30
  193. package/operators/comparison/eq.d.ts +0 -3
  194. package/operators/comparison/eq.js +0 -34
  195. package/operators/comparison/gt.d.ts +0 -3
  196. package/operators/comparison/gt.js +0 -24
  197. package/operators/comparison/gte.d.ts +0 -3
  198. package/operators/comparison/gte.js +0 -24
  199. package/operators/comparison/lt.d.ts +0 -3
  200. package/operators/comparison/lt.js +0 -24
  201. package/operators/comparison/lte.d.ts +0 -3
  202. package/operators/comparison/lte.js +0 -24
  203. package/operators/index.d.ts +0 -12
  204. package/operators/index.js +0 -39
  205. package/operators/logical/and.d.ts +0 -3
  206. package/operators/logical/and.js +0 -63
  207. package/operators/logical/or.d.ts +0 -3
  208. package/operators/logical/or.js +0 -63
  209. package/plugins/definitions/NumberTransformPlugin.d.ts +0 -4
  210. package/plugins/definitions/NumberTransformPlugin.js +0 -49
  211. package/statements/createKeyConditionExpressionArgs.d.ts +0 -12
  212. package/statements/createKeyConditionExpressionArgs.js +0 -48
  213. package/statements/processStatement.d.ts +0 -4
  214. package/statements/processStatement.js +0 -39
  215. package/utils/batchRead.d.ts +0 -15
  216. package/utils/batchRead.js +0 -58
  217. package/utils/batchWrite.d.ts +0 -17
  218. package/utils/batchWrite.js +0 -30
  219. package/utils/documentClient.d.ts +0 -8
  220. package/utils/documentClient.js +0 -33
  221. package/utils/table.d.ts +0 -7
  222. package/utils/table.js +0 -27
@@ -1,27 +1,25 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
- import BatchProcess from "./BatchProcess";
3
- import { DbDriver, Args, Result } from "@webiny/db";
4
- declare type ConstructorArgs = {
5
- documentClient?: DocumentClient;
6
- };
7
- declare class DynamoDbDriver implements DbDriver {
8
- batchProcesses: Record<string, BatchProcess>;
9
- documentClient: DocumentClient;
10
- constructor({ documentClient }?: ConstructorArgs);
11
- getClient(): DocumentClient;
12
- create({ table, data, meta, __batch: batch }: Args): Promise<Result>;
13
- update({ query, data, table, meta, __batch: batch }: Args): Promise<Result>;
14
- delete({ query, table, meta, __batch: batch }: Args): Promise<Result>;
15
- read<T>({ table, query, sort, limit, keys, meta, __batch: batch }: Args): Promise<Result<T[]>>;
16
- createLog({ id, operation, data, table }: {
17
- id: any;
18
- operation: any;
19
- data: any;
20
- table: any;
21
- }): Promise<Result>;
22
- readLogs<T>({ table }: {
23
- table: any;
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodb = require("aws-sdk/clients/dynamodb");
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
- (0, _defineProperty2.default)(this, "batchProcesses", void 0);
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
- async create({
48
- table,
49
- data,
50
- meta,
51
- __batch: batch
52
- }) {
53
- if (!batch) {
54
- const result = await this.documentClient.put({
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
- const batchProcess = this.getBatchProcess(batch);
65
- batchProcess.addBatchWrite({
66
- table,
67
- data
68
- });
69
-
70
- if (batchProcess.allOperationsAdded()) {
71
- batchProcess.startExecution();
72
- } else {
73
- await batchProcess.waitStartExecution();
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
- async update({
83
- query,
84
- data,
85
- table,
86
- meta,
87
- __batch: batch
88
- }) {
89
- if (!batch) {
90
- const update = {
91
- UpdateExpression: "SET ",
92
- ExpressionAttributeNames: {},
93
- ExpressionAttributeValues: {}
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
- async delete({
133
- query,
134
- table,
135
- meta,
136
- __batch: batch
137
- }) {
138
- if (!batch) {
139
- const result = await this.documentClient.delete({
140
- TableName: table,
141
- Key: query,
142
- ReturnConsumedCapacity: meta ? "TOTAL" : "NONE"
143
- }).promise();
144
- return [true, {
145
- response: result.$response
146
- }];
147
- }
148
-
149
- const batchProcess = this.getBatchProcess(batch);
150
- batchProcess.addBatchDelete({
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
- async read({
168
- table,
169
- query,
170
- sort,
171
- limit,
172
- keys,
173
- meta,
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
- if (batchProcess.allOperationsAdded()) {
208
- batchProcess.startExecution();
209
- } else {
210
- await batchProcess.waitStartExecution();
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
- await batchProcess.waitExecution();
214
- const result = getResult();
215
-
216
- if (result) {
217
- return [[result], {
218
- response: batchProcess.response
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
- async createLog({
228
- id,
229
- operation,
230
- data,
231
- table
232
- }) {
233
- await this.create({
234
- table: table,
235
- keys: LOG_KEYS,
236
- data: _objectSpread({
237
- PK: "log",
238
- SK: id,
239
- id,
240
- operation
241
- }, data)
242
- });
243
- return [true, {}];
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
- async readLogs({
247
- table
248
- }) {
249
- return this.read({
250
- table,
251
- keys: LOG_KEYS,
252
- query: {
253
- PK: "log",
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
- getBatchProcess(__batch) {
262
- if (!this.batchProcesses[__batch.instance.id]) {
263
- this.batchProcesses[__batch.instance.id] = new _BatchProcess.default(__batch.instance, this.documentClient);
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
- var _default = DynamoDbDriver;
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,GAAAH,OAAA;AAOA,MAAMI,cAAc,CAAuC;EAG/CC,MAAM,GAAsBC,SAAS;EACrCL,OAAO,GAAuBK,SAAS;EAExCC,KAAKA,CAAA,EAAU;IAClB,IAAI,IAAI,CAACF,MAAM,EAAE;MACb,OAAO,IAAI,CAACA,MAAM;IACtB;IACA,IAAI,CAACA,MAAM,GAAG,IAAAG,wBAAW,EAAC;MACtBC,cAAc,EAAE,IAAI,CAACA;IACzB,CAAC,CAAC;IACF,OAAO,IAAI,CAACJ,MAAM;EACtB;EAEOK,MAAMA,CAAA,EAAW;IACpB,IAAI,IAAI,CAACT,OAAO,EAAE;MACd,OAAO,IAAI,CAACA,OAAO;IACvB;IACA,IAAI,CAACA,OAAO,GAAG,IAAAU,oBAAY,EAAC;MACxBJ,KAAK,EAAE,IAAI,CAACA,KAAK,CAAC;IACtB,CAAC,CAAC;IACF,OAAO,IAAI,CAACN,OAAO;EACvB;EAEAW,WAAWA,CAAC;IAAEH;EAAgC,CAAC,EAAE;IAC7C,IAAI,CAACA,cAAc,GAAGA,cAAc;EACxC;EAEOI,SAASA,CAAA,EAAG;IACf,OAAO,IAAI,CAACJ,cAAc;EAC9B;EAEA,MAAaK,UAAUA,CAAIC,GAAW,EAAEC,KAAQ,EAAgC;IAC5E,IAAIC,KAAyB;IAC7B,IAAI;MACAA,KAAK,GAAGC,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC;IACjC,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,OAAO;QACHL,GAAG;QACHM,KAAK,EAAED;MACX,CAAC;IACL;IAEA,IAAI;MACA,MAAM,IAAAE,UAAG,EAAa;QAClBZ,MAAM,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