@webiny/db-dynamodb 0.0.0-mt-2 → 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
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","createNext","result","LastEvaluatedKey","next","undefined","response","convertResult","items","Items","count","Count","scannedCount","ScannedCount","lastEvaluatedKey","error","requestId","$response","scan","params","options","table","entity","Error","JSON","stringify","execute","exports","scanWithCallback","callback","usingRetry","Boolean","retry","retryOptions","executeScan","getInitialResult","executeWithRetry","length","callbackResult","mustBreak","executeNext","getNextResult"],"sources":["scan.ts"],"sourcesContent":["import type { ScanInput, ScanOutput } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { Entity, ScanOptions, TableDef } from \"~/toolbox\";\nimport type { ExecuteWithRetryOptions } from \"@webiny/utils\";\nimport { executeWithRetry } from \"@webiny/utils\";\n\nexport type { ScanOptions, ScanInput, ScanOutput };\n\nexport interface BaseScanParams {\n options?: ScanOptions;\n params?: Partial<ScanInput>;\n}\n\nexport interface ScanWithTable extends BaseScanParams {\n table: TableDef;\n entity?: never;\n}\n\nexport interface ScanWithEntity extends BaseScanParams {\n entity: Entity;\n table?: never;\n}\n\nexport type ScanParams = ScanWithTable | ScanWithEntity;\n\nexport interface ScanResponse<T = any> {\n items: T[];\n count?: number;\n scannedCount?: number;\n lastEvaluatedKey?: ScanOutput[\"LastEvaluatedKey\"];\n next?: () => Promise<ScanResponse<T>>;\n requestId: string;\n error: any;\n}\n\ninterface DdbScanResult<T> {\n Items?: T[];\n Count?: number;\n ScannedCount?: number;\n LastEvaluatedKey?: ScanOutput[\"LastEvaluatedKey\"];\n next?: () => Promise<DdbScanResult<T>>;\n error?: any;\n $response?: {\n requestId: string;\n };\n}\n\ntype NextCb<T> = () => Promise<ScanResponse<T>>;\n\nconst createNext = <T>(result: DdbScanResult<T>): NextCb<T> | undefined => {\n if (!result?.LastEvaluatedKey || !result.next) {\n return undefined;\n }\n return async () => {\n const response = await result!.next!();\n return convertResult(response);\n };\n};\n\nconst convertResult = <T>(result: DdbScanResult<T>): ScanResponse<T> => {\n return {\n items: result.Items || [],\n count: result.Count,\n scannedCount: result.ScannedCount,\n lastEvaluatedKey: result.LastEvaluatedKey || undefined,\n next: createNext<T>(result),\n error: result.error,\n requestId: result.$response?.requestId || \"\"\n };\n};\n\nexport type ScanDbItem<T> = T & {\n PK: string;\n SK: string;\n GSI1_PK: string;\n GSI1_SK: string;\n TYPE: string;\n};\n\nexport const scan = async <T>(params: ScanParams): Promise<ScanResponse<T>> => {\n const { options } = params;\n\n const table = params.table ? params.table : params.entity.table;\n if (!table) {\n throw new Error(`Missing table for scan: ${JSON.stringify(options)}`);\n }\n\n const result = await table.scan(\n {\n ...options,\n execute: true\n },\n params.params\n );\n\n return convertResult(result) as ScanResponse<T>;\n};\n\ninterface ScanWithCallbackOptions {\n retry?: true | ExecuteWithRetryOptions;\n}\n\nexport const scanWithCallback = async <T>(\n params: ScanParams,\n callback: (result: ScanResponse<ScanDbItem<T>>) => Promise<void | boolean>,\n options?: ScanWithCallbackOptions\n): Promise<void> => {\n // For backwards compatibility, we still allow for executing the scan without retries.\n const usingRetry = Boolean(options?.retry);\n const retryOptions = options?.retry === true ? {} : options?.retry;\n\n const executeScan = () => scan<ScanDbItem<T>>(params);\n const getInitialResult = () => {\n if (usingRetry) {\n return executeWithRetry(executeScan, retryOptions);\n }\n return executeScan();\n };\n\n let result = await getInitialResult();\n\n if (!result.items?.length && !result.lastEvaluatedKey) {\n return;\n }\n\n // If the result of the callback was `false`, that means the\n // user's intention was to stop further table scanning.\n const callbackResult = await callback(result);\n const mustBreak = callbackResult === false;\n if (mustBreak) {\n return;\n }\n\n while (result.next) {\n const executeNext = () => result.next!();\n const getNextResult = () => {\n if (usingRetry) {\n return executeWithRetry(executeNext, retryOptions);\n }\n return executeNext();\n };\n\n result = await getNextResult();\n\n // If the result of the callback was `false`, that means the\n // user's intention was to stop further table scanning.\n const callbackResult = await callback(result);\n const mustBreak = callbackResult === false;\n if (mustBreak) {\n break;\n }\n\n if (!result.next) {\n return;\n }\n }\n};\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AA6CA,MAAMC,UAAU,GAAOC,MAAwB,IAA4B;EACvE,IAAI,CAACA,MAAM,EAAEC,gBAAgB,IAAI,CAACD,MAAM,CAACE,IAAI,EAAE;IAC3C,OAAOC,SAAS;EACpB;EACA,OAAO,YAAY;IACf,MAAMC,QAAQ,GAAG,MAAMJ,MAAM,CAAEE,IAAI,CAAE,CAAC;IACtC,OAAOG,aAAa,CAACD,QAAQ,CAAC;EAClC,CAAC;AACL,CAAC;AAED,MAAMC,aAAa,GAAOL,MAAwB,IAAsB;EACpE,OAAO;IACHM,KAAK,EAAEN,MAAM,CAACO,KAAK,IAAI,EAAE;IACzBC,KAAK,EAAER,MAAM,CAACS,KAAK;IACnBC,YAAY,EAAEV,MAAM,CAACW,YAAY;IACjCC,gBAAgB,EAAEZ,MAAM,CAACC,gBAAgB,IAAIE,SAAS;IACtDD,IAAI,EAAEH,UAAU,CAAIC,MAAM,CAAC;IAC3Ba,KAAK,EAAEb,MAAM,CAACa,KAAK;IACnBC,SAAS,EAAEd,MAAM,CAACe,SAAS,EAAED,SAAS,IAAI;EAC9C,CAAC;AACL,CAAC;AAUM,MAAME,IAAI,GAAG,MAAUC,MAAkB,IAA+B;EAC3E,MAAM;IAAEC;EAAQ,CAAC,GAAGD,MAAM;EAE1B,MAAME,KAAK,GAAGF,MAAM,CAACE,KAAK,GAAGF,MAAM,CAACE,KAAK,GAAGF,MAAM,CAACG,MAAM,CAACD,KAAK;EAC/D,IAAI,CAACA,KAAK,EAAE;IACR,MAAM,IAAIE,KAAK,CAAC,2BAA2BC,IAAI,CAACC,SAAS,CAACL,OAAO,CAAC,EAAE,CAAC;EACzE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AM,uBAAgB,EAACI,WAAW,EAAEP,YAAY,CAAC;MACtD;MACA,OAAOO,WAAW,CAAC,CAAC;IACxB,CAAC;IAEDtC,MAAM,GAAG,MAAMuC,aAAa,CAAC,CAAC;;IAE9B;IACA;IACA,MAAMH,cAAc,GAAG,MAAMT,QAAQ,CAAC3B,MAAM,CAAC;IAC7C,MAAMqC,SAAS,GAAGD,cAAc,KAAK,KAAK;IAC1C,IAAIC,SAAS,EAAE;MACX;IACJ;IAEA,IAAI,CAACrC,MAAM,CAACE,IAAI,EAAE;MACd;IACJ;EACJ;AACJ,CAAC;AAACuB,OAAA,CAAAC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
package/utils/sort.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FieldPlugin } from "../plugins/definitions/FieldPlugin";
1
+ import type { FieldPlugin } from "../plugins/definitions/FieldPlugin";
2
2
  interface Params<T> {
3
3
  /**
4
4
  * The items we are sorting.
@@ -7,11 +7,11 @@ interface Params<T> {
7
7
  /**
8
8
  * Sort options. For example: ["id_ASC"]
9
9
  */
10
- sort: string[];
10
+ sort?: string[];
11
11
  /**
12
12
  * Fields we can sort by.
13
13
  */
14
14
  fields?: FieldPlugin[];
15
15
  }
16
- export declare const sortItems: <T extends unknown = any>(params: Params<T>) => T[];
16
+ export declare function sortItems<T = any>(params: Params<T>): T[];
17
17
  export {};
package/utils/sort.js CHANGED
@@ -1,27 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.sortItems = void 0;
9
-
7
+ exports.sortItems = sortItems;
10
8
  var _orderBy = _interopRequireDefault(require("lodash/orderBy"));
11
-
12
9
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
10
  const extractSort = (sortBy, fields) => {
15
11
  const result = sortBy.split("_");
16
-
17
12
  if (result.length !== 2) {
18
13
  throw new _error.default("Problem in determining the sorting for the entry items.", "SORT_ERROR", {
19
14
  sortBy
20
15
  });
21
16
  }
22
-
23
17
  const [field, order] = result;
24
-
25
18
  if (!field) {
26
19
  throw new _error.default("Sorting field does not exist.", "SORTING_FIELD_ERROR", {
27
20
  field,
@@ -29,24 +22,20 @@ const extractSort = (sortBy, fields) => {
29
22
  fields
30
23
  });
31
24
  }
32
-
33
25
  const fieldPlugin = fields.find(f => f.getField() === field);
34
26
  const isSortable = fieldPlugin ? fieldPlugin.isSortable() : true;
35
-
36
27
  if (isSortable === false) {
37
28
  throw new _error.default(`Cannot sort by given field: "${field}".`, "UNSUPPORTED_SORT_ERROR", {
38
29
  fields,
39
30
  field
40
31
  });
41
32
  }
42
-
43
33
  return {
44
34
  field,
45
35
  reverse: order.toUpperCase() === "DESC"
46
36
  };
47
37
  };
48
-
49
- const sortItems = params => {
38
+ function sortItems(params) {
50
39
  const {
51
40
  items,
52
41
  sort: initialSort = [],
@@ -55,16 +44,13 @@ const sortItems = params => {
55
44
  /**
56
45
  * Skip sorting if nothing was passed to sort by or nothing to sort.
57
46
  */
58
-
59
47
  if (items.length <= 1 || Array.isArray(initialSort) === false || initialSort.length === 0) {
60
48
  return items;
61
49
  }
62
-
63
50
  const info = {
64
51
  sorters: [],
65
52
  orders: []
66
53
  };
67
-
68
54
  for (const sort of initialSort) {
69
55
  /**
70
56
  * Possibly empty array item was passed.
@@ -72,7 +58,6 @@ const sortItems = params => {
72
58
  if (!sort) {
73
59
  continue;
74
60
  }
75
-
76
61
  const {
77
62
  field,
78
63
  reverse
@@ -82,12 +67,10 @@ const sortItems = params => {
82
67
  info.sorters.push(path);
83
68
  info.orders.push(reverse === true ? "desc" : "asc");
84
69
  }
85
-
86
70
  if (info.sorters.length === 0) {
87
71
  return items;
88
72
  }
89
-
90
73
  return (0, _orderBy.default)(items, info.sorters, info.orders);
91
- };
74
+ }
92
75
 
93
- exports.sortItems = sortItems;
76
+ //# sourceMappingURL=sort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_orderBy","_interopRequireDefault","require","_error","extractSort","sortBy","fields","result","split","length","WebinyError","field","order","fieldPlugin","find","f","getField","isSortable","reverse","toUpperCase","sortItems","params","items","sort","initialSort","Array","isArray","info","sorters","orders","path","getPath","push","lodashOrderBy"],"sources":["sort.ts"],"sourcesContent":["import lodashOrderBy from \"lodash/orderBy\";\nimport WebinyError from \"@webiny/error\";\nimport type { FieldPlugin } from \"~/plugins/definitions/FieldPlugin\";\n\ninterface Info {\n sorters: string[];\n orders: (boolean | \"asc\" | \"desc\")[];\n}\n\ninterface Response {\n reverse: boolean;\n field: string;\n}\n\nconst extractSort = (sortBy: string, fields: FieldPlugin[]): Response => {\n const result = sortBy.split(\"_\");\n if (result.length !== 2) {\n throw new WebinyError(\n \"Problem in determining the sorting for the entry items.\",\n \"SORT_ERROR\",\n {\n sortBy\n }\n );\n }\n const [field, order] = result;\n\n if (!field) {\n throw new WebinyError(\"Sorting field does not exist.\", \"SORTING_FIELD_ERROR\", {\n field,\n order,\n fields\n });\n }\n const fieldPlugin = fields.find(f => f.getField() === field);\n const isSortable = fieldPlugin ? fieldPlugin.isSortable() : true;\n if (isSortable === false) {\n throw new WebinyError(`Cannot sort by given field: \"${field}\".`, \"UNSUPPORTED_SORT_ERROR\", {\n fields,\n field\n });\n }\n\n return {\n field,\n reverse: order.toUpperCase() === \"DESC\"\n };\n};\n\ninterface Params<T> {\n /**\n * The items we are sorting.\n */\n items: T[];\n /**\n * Sort options. For example: [\"id_ASC\"]\n */\n sort?: string[];\n /**\n * Fields we can sort by.\n */\n fields?: FieldPlugin[];\n}\n\nexport function sortItems<T = any>(params: Params<T>): T[] {\n const { items, sort: initialSort = [], fields = [] } = params;\n /**\n * Skip sorting if nothing was passed to sort by or nothing to sort.\n */\n if (items.length <= 1 || Array.isArray(initialSort) === false || initialSort.length === 0) {\n return items;\n }\n\n const info: Info = {\n sorters: [],\n orders: []\n };\n\n for (const sort of initialSort) {\n /**\n * Possibly empty array item was passed.\n */\n if (!sort) {\n continue;\n }\n const { field, reverse } = extractSort(sort, fields);\n const fieldPlugin = fields.find(f => f.getField() === field);\n const path = fieldPlugin ? fieldPlugin.getPath() : field;\n\n info.sorters.push(path);\n info.orders.push(reverse === true ? \"desc\" : \"asc\");\n }\n\n if (info.sorters.length === 0) {\n return items;\n }\n\n return lodashOrderBy(items, info.sorters, info.orders);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAaA,MAAME,WAAW,GAAGA,CAACC,MAAc,EAAEC,MAAqB,KAAe;EACrE,MAAMC,MAAM,GAAGF,MAAM,CAACG,KAAK,CAAC,GAAG,CAAC;EAChC,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,cAAW,CACjB,yDAAyD,EACzD,YAAY,EACZ;MACIL;IACJ,CACJ,CAAC;EACL;EACA,MAAM,CAACM,KAAK,EAAEC,KAAK,CAAC,GAAGL,MAAM;EAE7B,IAAI,CAACI,KAAK,EAAE;IACR,MAAM,IAAID,cAAW,CAAC,+BAA+B,EAAE,qBAAqB,EAAE;MAC1EC,KAAK;MACLC,KAAK;MACLN;IACJ,CAAC,CAAC;EACN;EACA,MAAMO,WAAW,GAAGP,MAAM,CAACQ,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAAC,CAAC,KAAKL,KAAK,CAAC;EAC5D,MAAMM,UAAU,GAAGJ,WAAW,GAAGA,WAAW,CAACI,UAAU,CAAC,CAAC,GAAG,IAAI;EAChE,IAAIA,UAAU,KAAK,KAAK,EAAE;IACtB,MAAM,IAAIP,cAAW,CAAC,gCAAgCC,KAAK,IAAI,EAAE,wBAAwB,EAAE;MACvFL,MAAM;MACNK;IACJ,CAAC,CAAC;EACN;EAEA,OAAO;IACHA,KAA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1D","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import type { TableConstructor } from "../../toolbox";
2
+ import { Table as BaseTable } from "../../toolbox";
3
+ import type { ITable, ITableReadBatch, ITableScanParams, ITableScanResponse, ITableWriteBatch } from "./types";
4
+ export declare class TableDefinition<Name extends string = string, PartitionKey extends string = string, SortKey extends string = string> implements ITable {
5
+ readonly table: BaseTable<Name, PartitionKey, SortKey>;
6
+ constructor(params: TableConstructor<Name, PartitionKey, SortKey>);
7
+ createWriter(): ITableWriteBatch;
8
+ createReader(): ITableReadBatch;
9
+ scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>>;
10
+ }
11
+ export declare const defineTable: <Name extends string = string, PartitionKey extends string = string, SortKey extends string = string>(params: TableConstructor<Name, PartitionKey, SortKey>) => TableDefinition<Name, PartitionKey, SortKey>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineTable = exports.TableDefinition = void 0;
7
+ var _toolbox = require("../../toolbox");
8
+ var _TableWriteBatch = require("./TableWriteBatch");
9
+ var _TableReadBatch = require("./TableReadBatch");
10
+ var _scan = require("../scan");
11
+ class TableDefinition {
12
+ constructor(params) {
13
+ this.table = new _toolbox.Table(params);
14
+ }
15
+ createWriter() {
16
+ return (0, _TableWriteBatch.createTableWriteBatch)({
17
+ table: this.table
18
+ });
19
+ }
20
+ createReader() {
21
+ return (0, _TableReadBatch.createTableReadBatch)({
22
+ table: this.table
23
+ });
24
+ }
25
+ async scan(params) {
26
+ return (0, _scan.scan)({
27
+ ...params,
28
+ table: this.table
29
+ });
30
+ }
31
+ }
32
+ exports.TableDefinition = TableDefinition;
33
+ const defineTable = params => {
34
+ return new TableDefinition(params);
35
+ };
36
+ exports.defineTable = defineTable;
37
+
38
+ //# sourceMappingURL=Table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_toolbox","require","_TableWriteBatch","_TableReadBatch","_scan","TableDefinition","constructor","params","table","BaseTable","createWriter","createTableWriteBatch","createReader","createTableReadBatch","scan","exports","defineTable"],"sources":["Table.ts"],"sourcesContent":["import type { TableConstructor } from \"~/toolbox\";\nimport { Table as BaseTable } from \"~/toolbox\";\nimport type {\n ITable,\n ITableReadBatch,\n ITableScanParams,\n ITableScanResponse,\n ITableWriteBatch\n} from \"./types\";\nimport { createTableWriteBatch } from \"./TableWriteBatch\";\nimport { createTableReadBatch } from \"./TableReadBatch\";\nimport { scan } from \"../scan\";\n\nexport class TableDefinition<\n Name extends string = string,\n PartitionKey extends string = string,\n SortKey extends string = string\n> implements ITable\n{\n public readonly table: BaseTable<Name, PartitionKey, SortKey>;\n\n public constructor(params: TableConstructor<Name, PartitionKey, SortKey>) {\n this.table = new BaseTable(params);\n }\n\n public createWriter(): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.table\n });\n }\n\n public createReader(): ITableReadBatch {\n return createTableReadBatch({\n table: this.table\n });\n }\n\n public async scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>> {\n return scan<T>({\n ...params,\n table: this.table\n });\n }\n}\n\nexport const defineTable = <\n Name extends string = string,\n PartitionKey extends string = string,\n SortKey extends string = string\n>(\n params: TableConstructor<Name, PartitionKey, SortKey>\n) => {\n return new TableDefinition<Name, PartitionKey, SortKey>(params);\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEO,MAAMI,eAAe,CAK5B;EAGWC,WAAWA,CAACC,MAAqD,EAAE;IACtE,IAAI,CAACC,KAAK,GAAG,IAAIC,cAAS,CAACF,MAAM,CAAC;EACtC;EAEOG,YAAYA,CAAA,EAAqB;IACpC,OAAO,IAAAC,sCAAqB,EAAC;MACzBH,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEOI,YAAYA,CAAA,EAAoB;IACnC,OAAO,IAAAC,oCAAoB,EAAC;MACxBL,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEA,MAAaM,IAAIA,CAAIP,MAAwB,EAAkC;IAC3E,OAAO,IAAAO,UAAI,EAAI;MACX,GAAGP,MAAM;MACTC,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;AACJ;AAACO,OAAA,CAAAV,eAAA,GAAAA,eAAA;AAEM,MAAMW,WAAW,GAKpBT,MAAqD,IACpD;EACD,OAAO,IAAIF,eAAe,CAA8BE,MAAM,CAAC;AACnE,CAAC;AAACQ,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import type { Entity, TableDef } from "../../toolbox";
2
+ import type { IEntityReadBatchBuilderGetResponse } from "../entity/types";
3
+ import type { GenericRecord } from "@webiny/api/types";
4
+ import type { ITableReadBatch, ITableReadBatchKey } from "./types";
5
+ export interface ITableReadBatchParams {
6
+ table: TableDef;
7
+ }
8
+ export declare class TableReadBatch implements ITableReadBatch {
9
+ private readonly table;
10
+ private readonly _items;
11
+ private readonly builders;
12
+ constructor(params: ITableReadBatchParams);
13
+ get total(): number;
14
+ get items(): IEntityReadBatchBuilderGetResponse[];
15
+ get(entity: Entity, input: ITableReadBatchKey): void;
16
+ execute<T = GenericRecord>(): Promise<T[]>;
17
+ private getBuilder;
18
+ }
19
+ export declare const createTableReadBatch: (params: ITableReadBatchParams) => ITableReadBatch;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createTableReadBatch = exports.TableReadBatch = void 0;
7
+ var _batchRead = require("../batch/batchRead");
8
+ var _EntityReadBatchBuilder = require("../entity/EntityReadBatchBuilder");
9
+ var _error = require("@webiny/error");
10
+ class TableReadBatch {
11
+ _items = [];
12
+ builders = new Map();
13
+ constructor(params) {
14
+ this.table = params.table;
15
+ }
16
+ get total() {
17
+ return this._items.length;
18
+ }
19
+ get items() {
20
+ return Array.from(this._items);
21
+ }
22
+ get(entity, input) {
23
+ const builder = this.getBuilder(entity);
24
+ const items = Array.isArray(input) ? input : [input];
25
+ for (const item of items) {
26
+ /**
27
+ * We cannot read from two tables at the same time, so check for that.
28
+ */
29
+ if (this.table.name !== entity.table.name) {
30
+ throw new _error.WebinyError(`Cannot read from two different tables at the same time.`);
31
+ }
32
+ this._items.push(builder.get(item));
33
+ }
34
+ }
35
+ async execute() {
36
+ if (this._items.length === 0) {
37
+ return [];
38
+ }
39
+ const items = Array.from(this._items);
40
+ this._items.length = 0;
41
+ return await (0, _batchRead.batchReadAll)({
42
+ items,
43
+ table: this.table
44
+ });
45
+ }
46
+ getBuilder(entity) {
47
+ const builder = this.builders.get(entity.name);
48
+ if (builder) {
49
+ return builder;
50
+ }
51
+ const newBuilder = (0, _EntityReadBatchBuilder.createEntityReadBatchBuilder)(entity);
52
+ this.builders.set(entity.name, newBuilder);
53
+ return newBuilder;
54
+ }
55
+ }
56
+ exports.TableReadBatch = TableReadBatch;
57
+ const createTableReadBatch = params => {
58
+ return new TableReadBatch(params);
59
+ };
60
+ exports.createTableReadBatch = createTableReadBatch;
61
+
62
+ //# sourceMappingURL=TableReadBatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_batchRead","require","_EntityReadBatchBuilder","_error","TableReadBatch","_items","builders","Map","constructor","params","table","total","length","items","Array","from","get","entity","input","builder","getBuilder","isArray","item","name","WebinyError","push","execute","batchReadAll","newBuilder","createEntityReadBatchBuilder","set","exports","createTableReadBatch"],"sources":["TableReadBatch.ts"],"sourcesContent":["import type { Entity, TableDef } from \"~/toolbox\";\nimport type {\n IEntityReadBatchBuilder,\n IEntityReadBatchBuilderGetResponse\n} from \"~/utils/entity/types\";\nimport { batchReadAll } from \"~/utils/batch/batchRead\";\nimport { createEntityReadBatchBuilder } from \"~/utils/entity/EntityReadBatchBuilder\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { ITableReadBatch, ITableReadBatchKey } from \"./types\";\n\nexport interface ITableReadBatchParams {\n table: TableDef;\n}\n\nexport class TableReadBatch implements ITableReadBatch {\n private readonly table: TableDef;\n\n private readonly _items: IEntityReadBatchBuilderGetResponse[] = [];\n private readonly builders: Map<string, IEntityReadBatchBuilder> = new Map();\n\n public constructor(params: ITableReadBatchParams) {\n this.table = params.table;\n }\n\n public get total(): number {\n return this._items.length;\n }\n\n public get items(): IEntityReadBatchBuilderGetResponse[] {\n return Array.from(this._items);\n }\n\n public get(entity: Entity, input: ITableReadBatchKey): void {\n const builder = this.getBuilder(entity);\n\n const items = Array.isArray(input) ? input : [input];\n for (const item of items) {\n /**\n * We cannot read from two tables at the same time, so check for that.\n */\n if (this.table.name !== entity.table!.name) {\n throw new WebinyError(`Cannot read from two different tables at the same time.`);\n }\n\n this._items.push(builder.get(item));\n }\n }\n\n public async execute<T = GenericRecord>(): Promise<T[]> {\n if (this._items.length === 0) {\n return [];\n }\n const items = Array.from(this._items);\n this._items.length = 0;\n return await batchReadAll<T>({\n items,\n table: this.table\n });\n }\n\n private getBuilder(entity: Entity): IEntityReadBatchBuilder {\n const builder = this.builders.get(entity.name);\n if (builder) {\n return builder;\n }\n const newBuilder = createEntityReadBatchBuilder(entity);\n this.builders.set(entity.name, newBuilder);\n return newBuilder;\n }\n}\n\nexport const createTableReadBatch = (params: ITableReadBatchParams): ITableReadBatch => {\n return new TableReadBatch(params);\n};\n"],"mappings":";;;;;;AAKA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAOO,MAAMG,cAAc,CAA4B;EAGlCC,MAAM,GAAyC,EAAE;EACjDC,QAAQ,GAAyC,IAAIC,GAAG,CAAC,CAAC;EAEpEC,WAAWA,CAACC,MAA6B,EAAE;IAC9C,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;EAC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AAG,IAAAC,oDAA4B,EAACZ,MAAM,CAAC;IACvD,IAAI,CAACX,QAAQ,CAACwB,GAAG,CAACb,MAAM,CAACM,IAAI,EAAEK,UAAU,CAAC;IAC1C,OAAOA,UAAU;EACrB;AACJ;AAACG,OAAA,CAAA3B,cAAA,GAAAA,cAAA;AAEM,MAAM4B,oBAAoB,GAAIvB,MAA6B,IAAsB;EACpF,OAAO,IAAIL,cAAc,CAACK,MAAM,CAAC;AACrC,CAAC;AAACsB,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import type { Entity, TableDef } from "../../toolbox";
2
+ import type { BatchWriteItem, BatchWriteResult, IDeleteBatchItem, IPutBatchItem } from "../batch/types";
3
+ import type { ITableWriteBatch } from "./types";
4
+ export interface ITableWriteBatchParams {
5
+ table: TableDef;
6
+ items?: BatchWriteItem[];
7
+ }
8
+ export declare class TableWriteBatch implements ITableWriteBatch {
9
+ private readonly table;
10
+ private readonly _items;
11
+ private readonly builders;
12
+ get total(): number;
13
+ get items(): BatchWriteItem[];
14
+ constructor(params: ITableWriteBatchParams);
15
+ put(entity: Entity, item: IPutBatchItem): void;
16
+ delete(entity: Entity, item: IDeleteBatchItem): void;
17
+ combine(items: BatchWriteItem[]): ITableWriteBatch;
18
+ execute(): Promise<BatchWriteResult>;
19
+ private getBuilder;
20
+ }
21
+ export declare const createTableWriteBatch: (params: ITableWriteBatchParams) => ITableWriteBatch;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createTableWriteBatch = exports.TableWriteBatch = void 0;
7
+ var _batchWrite = require("../batch/batchWrite");
8
+ var _EntityWriteBatchBuilder = require("../entity/EntityWriteBatchBuilder");
9
+ class TableWriteBatch {
10
+ _items = [];
11
+ builders = new Map();
12
+ get total() {
13
+ return this._items.length;
14
+ }
15
+ get items() {
16
+ return Array.from(this._items);
17
+ }
18
+ constructor(params) {
19
+ this.table = params.table;
20
+ if (!params.items?.length) {
21
+ return;
22
+ }
23
+ this._items.push(...params.items);
24
+ }
25
+ put(entity, item) {
26
+ const builder = this.getBuilder(entity);
27
+ this._items.push(builder.put(item));
28
+ }
29
+ delete(entity, item) {
30
+ const builder = this.getBuilder(entity);
31
+ this._items.push(builder.delete(item));
32
+ }
33
+ combine(items) {
34
+ return createTableWriteBatch({
35
+ table: this.table,
36
+ items: this._items.concat(items)
37
+ });
38
+ }
39
+ async execute() {
40
+ if (this._items.length === 0) {
41
+ return [];
42
+ }
43
+ const items = Array.from(this._items);
44
+ this._items.length = 0;
45
+ return await (0, _batchWrite.batchWriteAll)({
46
+ items,
47
+ table: this.table
48
+ });
49
+ }
50
+ getBuilder(entity) {
51
+ if (!entity.name) {
52
+ throw new Error("Entity must have a name.");
53
+ }
54
+ const builder = this.builders.get(entity.name);
55
+ if (builder) {
56
+ return builder;
57
+ }
58
+ const newBuilder = (0, _EntityWriteBatchBuilder.createEntityWriteBatchBuilder)(entity);
59
+ this.builders.set(entity.name, newBuilder);
60
+ return newBuilder;
61
+ }
62
+ }
63
+ exports.TableWriteBatch = TableWriteBatch;
64
+ const createTableWriteBatch = params => {
65
+ return new TableWriteBatch(params);
66
+ };
67
+ exports.createTableWriteBatch = createTableWriteBatch;
68
+
69
+ //# sourceMappingURL=TableWriteBatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_batchWrite","require","_EntityWriteBatchBuilder","TableWriteBatch","_items","builders","Map","total","length","items","Array","from","constructor","params","table","push","put","entity","item","builder","getBuilder","delete","combine","createTableWriteBatch","concat","execute","batchWriteAll","name","Error","get","newBuilder","createEntityWriteBatchBuilder","set","exports"],"sources":["TableWriteBatch.ts"],"sourcesContent":["import type { Entity, TableDef } from \"~/toolbox\";\nimport type {\n BatchWriteItem,\n BatchWriteResult,\n IDeleteBatchItem,\n IPutBatchItem\n} from \"~/utils/batch/types\";\nimport type { IEntityWriteBatchBuilder } from \"~/utils/entity/types\";\nimport { batchWriteAll } from \"~/utils/batch/batchWrite\";\nimport { createEntityWriteBatchBuilder } from \"~/utils/entity/EntityWriteBatchBuilder\";\nimport type { ITableWriteBatch } from \"./types\";\n\nexport interface ITableWriteBatchParams {\n table: TableDef;\n items?: BatchWriteItem[];\n}\n\nexport class TableWriteBatch implements ITableWriteBatch {\n private readonly table: TableDef;\n private readonly _items: BatchWriteItem[] = [];\n private readonly builders: Map<string, IEntityWriteBatchBuilder> = new Map();\n\n public get total(): number {\n return this._items.length;\n }\n\n public get items(): BatchWriteItem[] {\n return Array.from(this._items);\n }\n\n public constructor(params: ITableWriteBatchParams) {\n this.table = params.table;\n if (!params.items?.length) {\n return;\n }\n this._items.push(...params.items);\n }\n\n public put(entity: Entity, item: IPutBatchItem): void {\n const builder = this.getBuilder(entity);\n this._items.push(builder.put(item));\n }\n\n public delete(entity: Entity, item: IDeleteBatchItem): void {\n const builder = this.getBuilder(entity);\n this._items.push(builder.delete(item));\n }\n\n public combine(items: BatchWriteItem[]): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.table,\n items: this._items.concat(items)\n });\n }\n\n public async execute(): Promise<BatchWriteResult> {\n if (this._items.length === 0) {\n return [];\n }\n const items = Array.from(this._items);\n this._items.length = 0;\n return await batchWriteAll({\n items,\n table: this.table\n });\n }\n\n private getBuilder(entity: Entity): IEntityWriteBatchBuilder {\n if (!entity.name) {\n throw new Error(\"Entity must have a name.\");\n }\n const builder = this.builders.get(entity.name);\n if (builder) {\n return builder;\n }\n const newBuilder = createEntityWriteBatchBuilder(entity);\n this.builders.set(entity.name, newBuilder);\n return newBuilder;\n }\n}\n\nexport const createTableWriteBatch = (params: ITableWriteBatchParams): ITableWriteBatch => {\n return new TableWriteBatch(params);\n};\n"],"mappings":";;;;;;AAQA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AAQO,MAAME,eAAe,CAA6B;EAEpCC,MAAM,GAAqB,EAAE;EAC7BC,QAA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C;IACrC,IAAI,CAACA,MAAM,CAACI,MAAM,GAAG,CAAC;IACtB,OAAO,MAAM,IAAAkB,yBAAa,EAAC;MACvBjB,KAAK;MACLK,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEQM,UAAUA,CAACH,MAAc,EAA4B;IACzD,IAAI,CAACA,MAAM,CAACU,IAAI,EAAE;MACd,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;IAC/C;IACA,MAAMT,OAAO,GAAG,IAAI,CAACd,QAAQ,CAACwB,GAAG,CAACZ,MAAM,CAACU,IAAI,CAAC;IAC9C,IAAIR,OAAO,EAAE;MACT,OAAOA,OAAO;IAClB;IACA,MAAMW,UAAU,GAAG,IAAAC,sDAA6B,EAACd,MAAM,CAAC;IACxD,IAAI,CAACZ,QAAQ,CAAC2B,GAAG,CAACf,MAAM,CAACU,IAAI,EAAEG,UAAU,CAAC;IAC1C,OAAOA,UAAU;EACrB;AACJ;AAACG,OAAA,CAAA9B,eAAA,GAAAA,eAAA;AAEM,MAAMoB,qBAAqB,GAAIV,MAA8B,IAAuB;EACvF,OAAO,IAAIV,eAAe,CAACU,MAAM,CAAC;AACtC,CAAC;AAACoB,OAAA,CAAAV,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export * from "./Table";
2
+ export * from "./TableReadBatch";
3
+ export * from "./TableWriteBatch";
4
+ export * from "./types";
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Table = require("./Table");
7
+ Object.keys(_Table).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Table[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Table[key];
14
+ }
15
+ });
16
+ });
17
+ var _TableReadBatch = require("./TableReadBatch");
18
+ Object.keys(_TableReadBatch).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _TableReadBatch[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _TableReadBatch[key];
25
+ }
26
+ });
27
+ });
28
+ var _TableWriteBatch = require("./TableWriteBatch");
29
+ Object.keys(_TableWriteBatch).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _TableWriteBatch[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _TableWriteBatch[key];
36
+ }
37
+ });
38
+ });
39
+ var _types = require("./types");
40
+ Object.keys(_types).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _types[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _types[key];
47
+ }
48
+ });
49
+ });
50
+
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Table","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_TableReadBatch","_TableWriteBatch","_types"],"sources":["index.ts"],"sourcesContent":["export * from \"./Table\";\nexport * from \"./TableReadBatch\";\nexport * from \"./TableWriteBatch\";\nexport * from \"./types\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,eAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,eAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,eAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,eAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,gBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,gBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,gBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,gBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,MAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,MAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,MAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ import type { TableDef } from "dynamodb-toolbox/dist/cjs/classes/Table/types";
2
+ import type { BatchWriteItem, BatchWriteResult, IDeleteBatchItem, IPutBatchItem } from "../batch/types";
3
+ import type { BaseScanParams, ScanResponse } from "../scan";
4
+ import type { Entity } from "../../toolbox";
5
+ import type { GenericRecord } from "@webiny/api/types";
6
+ export type ITableScanParams = BaseScanParams;
7
+ export type ITableScanResponse<T> = ScanResponse<T>;
8
+ export interface ITable {
9
+ table: TableDef;
10
+ createWriter(): ITableWriteBatch;
11
+ createReader(): ITableReadBatch;
12
+ scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>>;
13
+ }
14
+ export interface ITableWriteBatch {
15
+ readonly total: number;
16
+ readonly items: BatchWriteItem[];
17
+ put(entity: Entity, item: IPutBatchItem): void;
18
+ delete(entity: Entity, item: IDeleteBatchItem): void;
19
+ execute(): Promise<BatchWriteResult>;
20
+ combine(items: BatchWriteItem[]): ITableWriteBatch;
21
+ }
22
+ export interface ITableReadBatchKey {
23
+ PK: string;
24
+ SK: string;
25
+ }
26
+ export interface ITableReadBatchBuilderGetResponse {
27
+ Table: TableDef;
28
+ Key: ITableReadBatchKey;
29
+ }
30
+ export interface ITableReadBatchKey {
31
+ PK: string;
32
+ SK: string;
33
+ }
34
+ export interface ITableReadBatch {
35
+ readonly total: number;
36
+ readonly items: ITableReadBatchBuilderGetResponse[];
37
+ get(entity: Entity, input: ITableReadBatchKey | ITableReadBatchKey[]): void;
38
+ execute<T = GenericRecord>(): Promise<T[]>;
39
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { TableDef } from \"dynamodb-toolbox/dist/cjs/classes/Table/types\";\nimport type {\n BatchWriteItem,\n BatchWriteResult,\n IDeleteBatchItem,\n IPutBatchItem\n} from \"~/utils/batch/types\";\nimport type { BaseScanParams, ScanResponse } from \"../scan\";\nimport type { Entity } from \"~/toolbox\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nexport type ITableScanParams = BaseScanParams;\n\nexport type ITableScanResponse<T> = ScanResponse<T>;\n\nexport interface ITable {\n table: TableDef;\n createWriter(): ITableWriteBatch;\n createReader(): ITableReadBatch;\n scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>>;\n}\n\nexport interface ITableWriteBatch {\n readonly total: number;\n // readonly table: TableDef;\n readonly items: BatchWriteItem[];\n put(entity: Entity, item: IPutBatchItem): void;\n delete(entity: Entity, item: IDeleteBatchItem): void;\n execute(): Promise<BatchWriteResult>;\n combine(items: BatchWriteItem[]): ITableWriteBatch;\n}\n\nexport interface ITableReadBatchKey {\n PK: string;\n SK: string;\n}\n\nexport interface ITableReadBatchBuilderGetResponse {\n Table: TableDef;\n Key: ITableReadBatchKey;\n}\n\nexport interface ITableReadBatchKey {\n PK: string;\n SK: string;\n}\n\nexport interface ITableReadBatch {\n readonly total: number;\n readonly items: ITableReadBatchBuilderGetResponse[];\n get(entity: Entity, input: ITableReadBatchKey | ITableReadBatchKey[]): void;\n execute<T = GenericRecord>(): Promise<T[]>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import type { Entity } from "../toolbox";
2
+ interface Params {
3
+ entity: Entity;
4
+ item: {
5
+ PK: string;
6
+ SK: string;
7
+ TYPE?: string;
8
+ [key: string]: any;
9
+ };
10
+ }
11
+ export declare const update: (params: Params) => Promise<import("@aws-sdk/lib-dynamodb").UpdateCommandOutput>;
12
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.update = void 0;
7
+ const update = async params => {
8
+ const {
9
+ entity,
10
+ item
11
+ } = params;
12
+ return await entity.update(item, {
13
+ execute: true,
14
+ strictSchemaCheck: false
15
+ });
16
+ };
17
+ exports.update = update;
18
+
19
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["update","params","entity","item","execute","strictSchemaCheck","exports"],"sources":["update.ts"],"sourcesContent":["import type { Entity } from \"~/toolbox\";\n\ninterface Params {\n entity: Entity;\n item: {\n PK: string;\n SK: string;\n TYPE?: string;\n [key: string]: any;\n };\n}\n\nexport const update = async (params: Params) => {\n const { entity, item } = params;\n\n return await entity.update(item, {\n execute: true,\n strictSchemaCheck: false\n });\n};\n"],"mappings":";;;;;;AAYO,MAAMA,MAAM,GAAG,MAAOC,MAAc,IAAK;EAC5C,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAE/B,OAAO,MAAMC,MAAM,CAACF,MAAM,CAACG,IAAI,EAAE;IAC7BC,OAAO,EAAE,IAAI;IACbC,iBAAiB,EAAE;EACvB,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAN,MAAA,GAAAA,MAAA","ignoreList":[]}
package/BatchProcess.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
- import { Batch } from "@webiny/db";
3
- declare type BatchType = "batchWrite" | "batchGet";
4
- declare class BatchProcess {
5
- documentClient: DocumentClient;
6
- batch: Batch;
7
- resolveBuild: () => void;
8
- rejectBuild: ({ message: string }: {
9
- message: any;
10
- }) => void;
11
- queryBuild: Promise<void>;
12
- resolveExecution: () => void;
13
- rejectExecution: ({ message: string }: {
14
- message: any;
15
- }) => void;
16
- queryExecution: Promise<void>;
17
- operations: [Record<string, any>, Record<string, any>][];
18
- batchType: BatchType;
19
- results: Record<string, any>[];
20
- response: Record<string, any>;
21
- constructor(batch: Batch, documentClient: DocumentClient);
22
- waitStartExecution(): Promise<void>;
23
- waitExecution(): Promise<void>;
24
- addBatchOperation(type: BatchType, args: any, meta?: {}): () => any;
25
- addBatchWrite(args: any): () => any;
26
- addBatchDelete(args: any): () => any;
27
- addBatchGet(args: any): () => any;
28
- allOperationsAdded(): boolean;
29
- startExecution(): import("aws-sdk/lib/request").Request<DocumentClient.BatchWriteItemOutput, import("aws-sdk/lib/error").AWSError> | import("aws-sdk/lib/request").Request<DocumentClient.BatchGetItemOutput, import("aws-sdk/lib/error").AWSError>;
30
- }
31
- export default BatchProcess;