@webiny/db-dynamodb 6.0.0-alpha.5 → 6.0.0-rc.0

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 (177) hide show
  1. package/DynamoDbDriver.d.ts +4 -8
  2. package/DynamoDbDriver.js +71 -102
  3. package/DynamoDbDriver.js.map +1 -1
  4. package/README.md +6 -142
  5. package/index.d.ts +4 -3
  6. package/index.js +4 -28
  7. package/index.js.map +1 -1
  8. package/package.json +18 -20
  9. package/plugins/definitions/AttributePlugin.d.ts +1 -1
  10. package/plugins/definitions/AttributePlugin.js +4 -12
  11. package/plugins/definitions/AttributePlugin.js.map +1 -1
  12. package/plugins/definitions/DateTimeTransformPlugin.d.ts +2 -2
  13. package/plugins/definitions/DateTimeTransformPlugin.js +6 -14
  14. package/plugins/definitions/DateTimeTransformPlugin.js.map +1 -1
  15. package/plugins/definitions/FieldPathPlugin.js +6 -14
  16. package/plugins/definitions/FieldPathPlugin.js.map +1 -1
  17. package/plugins/definitions/FieldPlugin.d.ts +1 -1
  18. package/plugins/definitions/FieldPlugin.js +2 -9
  19. package/plugins/definitions/FieldPlugin.js.map +1 -1
  20. package/plugins/definitions/TimeTransformPlugin.d.ts +2 -2
  21. package/plugins/definitions/TimeTransformPlugin.js +7 -15
  22. package/plugins/definitions/TimeTransformPlugin.js.map +1 -1
  23. package/plugins/definitions/ValueFilterPlugin.js +5 -13
  24. package/plugins/definitions/ValueFilterPlugin.js.map +1 -1
  25. package/plugins/definitions/ValueTransformPlugin.js +6 -14
  26. package/plugins/definitions/ValueTransformPlugin.js.map +1 -1
  27. package/plugins/definitions/assignFields.js +4 -12
  28. package/plugins/definitions/assignFields.js.map +1 -1
  29. package/plugins/filters/andIn.d.ts +1 -1
  30. package/plugins/filters/andIn.js +5 -12
  31. package/plugins/filters/andIn.js.map +1 -1
  32. package/plugins/filters/between.d.ts +1 -1
  33. package/plugins/filters/between.js +5 -12
  34. package/plugins/filters/between.js.map +1 -1
  35. package/plugins/filters/contains.d.ts +1 -1
  36. package/plugins/filters/contains.js +3 -9
  37. package/plugins/filters/contains.js.map +1 -1
  38. package/plugins/filters/eq.d.ts +1 -1
  39. package/plugins/filters/eq.js +3 -9
  40. package/plugins/filters/eq.js.map +1 -1
  41. package/plugins/filters/fuzzy.d.ts +1 -1
  42. package/plugins/filters/fuzzy.js +5 -12
  43. package/plugins/filters/fuzzy.js.map +1 -1
  44. package/plugins/filters/gt.d.ts +1 -1
  45. package/plugins/filters/gt.js +3 -9
  46. package/plugins/filters/gt.js.map +1 -1
  47. package/plugins/filters/gte.d.ts +1 -1
  48. package/plugins/filters/gte.js +3 -9
  49. package/plugins/filters/gte.js.map +1 -1
  50. package/plugins/filters/in.d.ts +1 -1
  51. package/plugins/filters/in.js +5 -12
  52. package/plugins/filters/in.js.map +1 -1
  53. package/plugins/filters/index.d.ts +1 -1
  54. package/plugins/filters/index.js +12 -20
  55. package/plugins/filters/index.js.map +1 -1
  56. package/plugins/filters/lt.d.ts +1 -1
  57. package/plugins/filters/lt.js +3 -9
  58. package/plugins/filters/lt.js.map +1 -1
  59. package/plugins/filters/lte.d.ts +1 -1
  60. package/plugins/filters/lte.js +3 -9
  61. package/plugins/filters/lte.js.map +1 -1
  62. package/plugins/filters/startsWith.d.ts +1 -1
  63. package/plugins/filters/startsWith.js +3 -9
  64. package/plugins/filters/startsWith.js.map +1 -1
  65. package/plugins/index.d.ts +9 -1
  66. package/plugins/index.js +11 -11
  67. package/plugins/index.js.map +1 -1
  68. package/store/entity.d.ts +4 -76
  69. package/store/entity.js +5 -35
  70. package/store/entity.js.map +1 -1
  71. package/store/keys.d.ts +1 -1
  72. package/store/keys.js +7 -13
  73. package/store/keys.js.map +1 -1
  74. package/store/types.d.ts +3 -4
  75. package/store/types.js +1 -5
  76. package/store/types.js.map +1 -1
  77. package/toolbox.d.ts +7 -2
  78. package/toolbox.js +2 -17
  79. package/toolbox.js.map +1 -1
  80. package/types.js +1 -5
  81. package/utils/attributes.d.ts +2 -2
  82. package/utils/attributes.js +4 -12
  83. package/utils/attributes.js.map +1 -1
  84. package/utils/batch/batchRead.d.ts +2 -2
  85. package/utils/batch/batchRead.js +5 -13
  86. package/utils/batch/batchRead.js.map +1 -1
  87. package/utils/batch/batchWrite.d.ts +2 -2
  88. package/utils/batch/batchWrite.js +3 -11
  89. package/utils/batch/batchWrite.js.map +1 -1
  90. package/utils/batch/index.d.ts +3 -3
  91. package/utils/batch/index.js +3 -38
  92. package/utils/batch/index.js.map +1 -1
  93. package/utils/batch/types.d.ts +7 -2
  94. package/utils/batch/types.js +1 -5
  95. package/utils/batch/types.js.map +1 -1
  96. package/utils/cleanup.d.ts +1 -1
  97. package/utils/cleanup.js +3 -10
  98. package/utils/cleanup.js.map +1 -1
  99. package/utils/count.d.ts +1 -1
  100. package/utils/count.js +1 -8
  101. package/utils/count.js.map +1 -1
  102. package/utils/createEntity.d.ts +36 -54
  103. package/utils/createEntity.js +75 -51
  104. package/utils/createEntity.js.map +1 -1
  105. package/utils/createTable.d.ts +10 -7
  106. package/utils/createTable.js +25 -15
  107. package/utils/createTable.js.map +1 -1
  108. package/utils/cursor.js +2 -10
  109. package/utils/cursor.js.map +1 -1
  110. package/utils/delete.d.ts +1 -1
  111. package/utils/delete.js +1 -8
  112. package/utils/delete.js.map +1 -1
  113. package/utils/entity/Entity.d.ts +23 -21
  114. package/utils/entity/Entity.js +56 -34
  115. package/utils/entity/Entity.js.map +1 -1
  116. package/utils/entity/EntityReadBatch.d.ts +9 -8
  117. package/utils/entity/EntityReadBatch.js +14 -16
  118. package/utils/entity/EntityReadBatch.js.map +1 -1
  119. package/utils/entity/EntityReadBatchBuilder.d.ts +4 -4
  120. package/utils/entity/EntityReadBatchBuilder.js +7 -15
  121. package/utils/entity/EntityReadBatchBuilder.js.map +1 -1
  122. package/utils/entity/EntityWriteBatch.d.ts +9 -8
  123. package/utils/entity/EntityWriteBatch.js +10 -18
  124. package/utils/entity/EntityWriteBatch.js.map +1 -1
  125. package/utils/entity/EntityWriteBatchBuilder.d.ts +4 -4
  126. package/utils/entity/EntityWriteBatchBuilder.js +4 -12
  127. package/utils/entity/EntityWriteBatchBuilder.js.map +1 -1
  128. package/utils/entity/getEntity.d.ts +2 -2
  129. package/utils/entity/getEntity.js +3 -10
  130. package/utils/entity/getEntity.js.map +1 -1
  131. package/utils/entity/index.d.ts +7 -7
  132. package/utils/entity/index.js +7 -82
  133. package/utils/entity/index.js.map +1 -1
  134. package/utils/entity/types.d.ts +46 -22
  135. package/utils/entity/types.js +2 -5
  136. package/utils/entity/types.js.map +1 -1
  137. package/utils/filter.d.ts +1 -1
  138. package/utils/filter.js +7 -14
  139. package/utils/filter.js.map +1 -1
  140. package/utils/get.d.ts +1 -1
  141. package/utils/get.js +4 -12
  142. package/utils/get.js.map +1 -1
  143. package/utils/index.d.ts +17 -17
  144. package/utils/index.js +17 -192
  145. package/utils/index.js.map +1 -1
  146. package/utils/listResponse.js +4 -10
  147. package/utils/listResponse.js.map +1 -1
  148. package/utils/put.d.ts +2 -2
  149. package/utils/put.js +1 -8
  150. package/utils/put.js.map +1 -1
  151. package/utils/query.d.ts +5 -12
  152. package/utils/query.js +13 -27
  153. package/utils/query.js.map +1 -1
  154. package/utils/scan.d.ts +2 -2
  155. package/utils/scan.js +5 -13
  156. package/utils/scan.js.map +1 -1
  157. package/utils/sort.d.ts +1 -1
  158. package/utils/sort.js +7 -14
  159. package/utils/sort.js.map +1 -1
  160. package/utils/table/Table.d.ts +4 -5
  161. package/utils/table/Table.js +9 -20
  162. package/utils/table/Table.js.map +1 -1
  163. package/utils/table/TableReadBatch.d.ts +4 -4
  164. package/utils/table/TableReadBatch.js +8 -16
  165. package/utils/table/TableReadBatch.js.map +1 -1
  166. package/utils/table/TableWriteBatch.d.ts +3 -3
  167. package/utils/table/TableWriteBatch.js +6 -14
  168. package/utils/table/TableWriteBatch.js.map +1 -1
  169. package/utils/table/index.d.ts +4 -4
  170. package/utils/table/index.js +4 -49
  171. package/utils/table/index.js.map +1 -1
  172. package/utils/table/types.d.ts +8 -8
  173. package/utils/table/types.js +1 -5
  174. package/utils/table/types.js.map +1 -1
  175. package/utils/update.d.ts +1 -1
  176. package/utils/update.js +1 -8
  177. package/utils/update.js.map +1 -1
@@ -1,54 +1,36 @@
1
- import type { AttributeDefinitions, Table } from "../toolbox";
2
- import { Entity } from "../toolbox";
3
- interface CreateStandardEntityParams {
4
- table: Table<string, string, string>;
5
- name: string;
6
- }
7
- export declare const createStandardEntity: (params: CreateStandardEntityParams) => Entity<any>;
8
- interface CreateLegacyEntityParams {
9
- table: Table<string, string, string>;
10
- name: string;
11
- attributes?: AttributeDefinitions;
12
- }
13
- export declare const createLegacyEntity: (params: CreateLegacyEntityParams) => Entity<string, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, Table<string, string, string>, boolean, boolean, boolean, string, string, string, boolean, {
14
- PK: {
15
- partitionKey: true;
16
- };
17
- SK: {
18
- sortKey: true;
19
- };
20
- GSI1_PK: {
21
- type: "string";
22
- };
23
- GSI1_SK: {
24
- type: "string";
25
- };
26
- TYPE: {
27
- type: "string";
28
- };
29
- }, {
30
- PK: {
31
- partitionKey: true;
32
- };
33
- SK: {
34
- sortKey: true;
35
- };
36
- GSI1_PK: {
37
- type: "string";
38
- };
39
- GSI1_SK: {
40
- type: "string";
41
- };
42
- TYPE: {
43
- type: "string";
44
- };
45
- }, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
46
- [x: string]: any;
47
- [x: number]: any;
48
- [x: symbol]: any;
49
- }, {
50
- [x: string]: any;
51
- [x: number]: any;
52
- [x: symbol]: any;
53
- }>;
54
- export {};
1
+ import type { AttributeDefinitions } from "../toolbox.js";
2
+ import { type EntityConstructor } from "../utils/entity/index.js";
3
+ import type { GenericRecord } from "@webiny/api/types.js";
4
+ export type IGlobalEntityAttributes<T = undefined> = {
5
+ PK: string;
6
+ SK: string;
7
+ TYPE: string;
8
+ GSI1_PK?: string;
9
+ GSI1_SK?: string;
10
+ GSI2_PK?: string;
11
+ GSI2_SK?: string;
12
+ expiresAt?: string | null;
13
+ } & (T extends undefined ? {
14
+ data?: undefined;
15
+ } : {
16
+ data: T;
17
+ });
18
+ export declare const globalEntityAttributes: AttributeDefinitions;
19
+ export declare const createGlobalEntity: <T extends GenericRecord = GenericRecord>(params: Omit<EntityConstructor, "attributes"> & Partial<Pick<EntityConstructor, "attributes">>) => import("~/utils/entity/index.js").IEntity<IGlobalEntityAttributes<T>>;
20
+ export type IStandardEntityAttributes<T = undefined> = {
21
+ PK: string;
22
+ SK: string;
23
+ GSI_TENANT: string;
24
+ TYPE: string;
25
+ GSI1_PK?: string;
26
+ GSI1_SK?: string;
27
+ GSI2_PK?: string;
28
+ GSI2_SK?: string;
29
+ expiresAt?: number | null;
30
+ } & (T extends undefined ? {
31
+ data?: undefined;
32
+ } : {
33
+ data: T;
34
+ });
35
+ export declare const standardEntityAttributes: AttributeDefinitions;
36
+ export declare const createStandardEntity: <T extends GenericRecord = GenericRecord>(params: Omit<EntityConstructor, "attributes"> & Partial<Pick<EntityConstructor, "attributes">>) => import("~/utils/entity/index.js").IEntity<IStandardEntityAttributes<T>>;
@@ -1,61 +1,85 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createStandardEntity = exports.createLegacyEntity = void 0;
7
- var _toolbox = require("../toolbox");
8
- const createStandardEntity = params => {
9
- return new _toolbox.Entity({
10
- name: params.name,
11
- table: params.table,
1
+ import { createEntity } from "./entity/index.js";
2
+ export const globalEntityAttributes = {
3
+ PK: {
4
+ partitionKey: true
5
+ },
6
+ SK: {
7
+ sortKey: true
8
+ },
9
+ GSI1_PK: {
10
+ type: "string"
11
+ },
12
+ GSI1_SK: {
13
+ type: "string"
14
+ },
15
+ GSI2_PK: {
16
+ type: "string"
17
+ },
18
+ GSI2_SK: {
19
+ type: "string"
20
+ },
21
+ TYPE: {
22
+ type: "string",
23
+ required: true
24
+ },
25
+ data: {
26
+ type: "map"
27
+ },
28
+ expiresAt: {
29
+ type: "number"
30
+ }
31
+ };
32
+ export const createGlobalEntity = params => {
33
+ return createEntity({
34
+ ...params,
12
35
  attributes: {
13
- PK: {
14
- partitionKey: true
15
- },
16
- SK: {
17
- sortKey: true
18
- },
19
- GSI1_PK: {
20
- type: "string"
21
- },
22
- GSI1_SK: {
23
- type: "string"
24
- },
25
- TYPE: {
26
- type: "string"
27
- },
28
- data: {
29
- type: "map"
30
- }
36
+ ...globalEntityAttributes,
37
+ ...params.attributes
31
38
  }
32
39
  });
33
40
  };
34
- exports.createStandardEntity = createStandardEntity;
35
- const createLegacyEntity = params => {
36
- return new _toolbox.Entity({
37
- table: params.table,
38
- name: params.name,
41
+ export const standardEntityAttributes = {
42
+ PK: {
43
+ partitionKey: true
44
+ },
45
+ SK: {
46
+ sortKey: true
47
+ },
48
+ GSI_TENANT: {
49
+ type: "string",
50
+ required: true
51
+ },
52
+ GSI1_PK: {
53
+ type: "string"
54
+ },
55
+ GSI1_SK: {
56
+ type: "string"
57
+ },
58
+ GSI2_PK: {
59
+ type: "string"
60
+ },
61
+ GSI2_SK: {
62
+ type: "string"
63
+ },
64
+ TYPE: {
65
+ type: "string",
66
+ required: true
67
+ },
68
+ data: {
69
+ type: "map"
70
+ },
71
+ expiresAt: {
72
+ type: "number"
73
+ }
74
+ };
75
+ export const createStandardEntity = params => {
76
+ return createEntity({
77
+ ...params,
39
78
  attributes: {
40
- PK: {
41
- partitionKey: true
42
- },
43
- SK: {
44
- sortKey: true
45
- },
46
- GSI1_PK: {
47
- type: "string"
48
- },
49
- GSI1_SK: {
50
- type: "string"
51
- },
52
- TYPE: {
53
- type: "string"
54
- },
55
- ...(params.attributes || {})
79
+ ...standardEntityAttributes,
80
+ ...params.attributes
56
81
  }
57
82
  });
58
83
  };
59
- exports.createLegacyEntity = createLegacyEntity;
60
84
 
61
85
  //# sourceMappingURL=createEntity.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createStandardEntity","params","Entity","name","table","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","data","exports","createLegacyEntity"],"sources":["createEntity.ts"],"sourcesContent":["import type { AttributeDefinitions, Table } from \"~/toolbox\";\nimport { Entity } from \"~/toolbox\";\n\ninterface CreateStandardEntityParams {\n table: Table<string, string, string>;\n name: string;\n}\n\nexport const createStandardEntity = (params: CreateStandardEntityParams): Entity<any> => {\n return new Entity({\n name: params.name,\n table: params.table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n }\n }\n });\n};\n\ninterface CreateLegacyEntityParams {\n table: Table<string, string, string>;\n name: string;\n attributes?: AttributeDefinitions;\n}\n\nexport const createLegacyEntity = (params: CreateLegacyEntityParams) => {\n return new Entity({\n table: params.table,\n name: params.name,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n ...(params.attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,oBAAoB,GAAIC,MAAkC,IAAkB;EACrF,OAAO,IAAIC,eAAM,CAAC;IACdC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,KAAK,EAAEH,MAAM,CAACG,KAAK;IACnBC,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAf,oBAAA,GAAAA,oBAAA;AAQK,MAAMgB,kBAAkB,GAAIf,MAAgC,IAAK;EACpE,OAAO,IAAIC,eAAM,CAAC;IACdE,KAAK,EAAEH,MAAM,CAACG,KAAK;IACnBD,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBE,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACD,IAAIV,MAAM,CAACI,UAAU,IAAI,CAAC,CAAC;IAC/B;EACJ,CAAC,CAAC;AACN,CAAC;AAACU,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createEntity","globalEntityAttributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","GSI2_PK","GSI2_SK","TYPE","required","data","expiresAt","createGlobalEntity","params","attributes","standardEntityAttributes","GSI_TENANT","createStandardEntity"],"sources":["createEntity.ts"],"sourcesContent":["import type { AttributeDefinitions } from \"~/toolbox.js\";\nimport { createEntity, type EntityConstructor } from \"~/utils/entity/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport type IGlobalEntityAttributes<T = undefined> = {\n PK: string;\n SK: string;\n TYPE: string;\n GSI1_PK?: string;\n GSI1_SK?: string;\n GSI2_PK?: string;\n GSI2_SK?: string;\n expiresAt?: string | null;\n} & (T extends undefined ? { data?: undefined } : { data: T });\n\nexport const globalEntityAttributes: AttributeDefinitions = {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n GSI2_PK: {\n type: \"string\"\n },\n GSI2_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\",\n required: true\n },\n data: {\n type: \"map\"\n },\n expiresAt: {\n type: \"number\"\n }\n};\n\nexport const createGlobalEntity = <T extends GenericRecord = GenericRecord>(\n params: Omit<EntityConstructor, \"attributes\"> & Partial<Pick<EntityConstructor, \"attributes\">>\n) => {\n return createEntity<IGlobalEntityAttributes<T>>({\n ...params,\n attributes: {\n ...globalEntityAttributes,\n ...params.attributes\n }\n });\n};\n\nexport type IStandardEntityAttributes<T = undefined> = {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n TYPE: string;\n GSI1_PK?: string;\n GSI1_SK?: string;\n GSI2_PK?: string;\n GSI2_SK?: string;\n expiresAt?: number | null;\n} & (T extends undefined ? { data?: undefined } : { data: T });\n\nexport const standardEntityAttributes: AttributeDefinitions = {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI_TENANT: {\n type: \"string\",\n required: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n GSI2_PK: {\n type: \"string\"\n },\n GSI2_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\",\n required: true\n },\n data: {\n type: \"map\"\n },\n expiresAt: {\n type: \"number\"\n }\n};\n\nexport const createStandardEntity = <T extends GenericRecord = GenericRecord>(\n params: Omit<EntityConstructor, \"attributes\"> & Partial<Pick<EntityConstructor, \"attributes\">>\n) => {\n return createEntity<IStandardEntityAttributes<T>>({\n ...params,\n attributes: {\n ...standardEntityAttributes,\n ...params.attributes\n }\n });\n};\n"],"mappings":"AACA,SAASA,YAAY;AAcrB,OAAO,MAAMC,sBAA4C,GAAG;EACxDC,EAAE,EAAE;IACAC,YAAY,EAAE;EAClB,CAAC;EACDC,EAAE,EAAE;IACAC,OAAO,EAAE;EACb,CAAC;EACDC,OAAO,EAAE;IACLC,IAAI,EAAE;EACV,CAAC;EACDC,OAAO,EAAE;IACLD,IAAI,EAAE;EACV,CAAC;EACDE,OAAO,EAAE;IACLF,IAAI,EAAE;EACV,CAAC;EACDG,OAAO,EAAE;IACLH,IAAI,EAAE;EACV,CAAC;EACDI,IAAI,EAAE;IACFJ,IAAI,EAAE,QAAQ;IACdK,QAAQ,EAAE;EACd,CAAC;EACDC,IAAI,EAAE;IACFN,IAAI,EAAE;EACV,CAAC;EACDO,SAAS,EAAE;IACPP,IAAI,EAAE;EACV;AACJ,CAAC;AAED,OAAO,MAAMQ,kBAAkB,GAC3BC,MAA8F,IAC7F;EACD,OAAOhB,YAAY,CAA6B;IAC5C,GAAGgB,MAAM;IACTC,UAAU,EAAE;MACR,GAAGhB,sBAAsB;MACzB,GAAGe,MAAM,CAACC;IACd;EACJ,CAAC,CAAC;AACN,CAAC;AAcD,OAAO,MAAMC,wBAA8C,GAAG;EAC1DhB,EAAE,EAAE;IACAC,YAAY,EAAE;EAClB,CAAC;EACDC,EAAE,EAAE;IACAC,OAAO,EAAE;EACb,CAAC;EACDc,UAAU,EAAE;IACRZ,IAAI,EAAE,QAAQ;IACdK,QAAQ,EAAE;EACd,CAAC;EACDN,OAAO,EAAE;IACLC,IAAI,EAAE;EACV,CAAC;EACDC,OAAO,EAAE;IACLD,IAAI,EAAE;EACV,CAAC;EACDE,OAAO,EAAE;IACLF,IAAI,EAAE;EACV,CAAC;EACDG,OAAO,EAAE;IACLH,IAAI,EAAE;EACV,CAAC;EACDI,IAAI,EAAE;IACFJ,IAAI,EAAE,QAAQ;IACdK,QAAQ,EAAE;EACd,CAAC;EACDC,IAAI,EAAE;IACFN,IAAI,EAAE;EACV,CAAC;EACDO,SAAS,EAAE;IACPP,IAAI,EAAE;EACV;AACJ,CAAC;AAED,OAAO,MAAMa,oBAAoB,GAC7BJ,MAA8F,IAC7F;EACD,OAAOhB,YAAY,CAA+B;IAC9C,GAAGgB,MAAM;IACTC,UAAU,EAAE;MACR,GAAGC,wBAAwB;MAC3B,GAAGF,MAAM,CAACC;IACd;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,8 +1,11 @@
1
- import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
2
- import { Table as BaseTable } from "../toolbox";
3
- export interface CreateTableParams {
4
- name?: string;
5
- documentClient: DynamoDBDocument;
1
+ import type { ITable } from "../utils/table/index.js";
2
+ import type { TableConstructor } from "../toolbox.js";
3
+ export interface ICreateTableParamsIndexDefinition {
4
+ partitionKey: string;
5
+ sortKey?: string;
6
6
  }
7
- export type Table = BaseTable<string, "PK", "SK">;
8
- export declare const createTable: ({ name, documentClient }: CreateTableParams) => Table;
7
+ export type ICreateTableParams = Partial<Omit<TableConstructor<string, string, string>, "DocumentClient">> & {
8
+ name: string;
9
+ documentClient: Pick<TableConstructor<string, string, string>, "DocumentClient">["DocumentClient"];
10
+ };
11
+ export declare const createTable: (params: ICreateTableParams) => ITable<string, "PK", "SK">;
@@ -1,29 +1,39 @@
1
- "use strict";
1
+ import { Table } from "./table/index.js";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createTable = void 0;
7
- var _toolbox = require("../toolbox");
8
- const createTable = ({
9
- name,
10
- documentClient
11
- }) => {
12
- return new _toolbox.Table({
13
- name: name || String(process.env.DB_TABLE),
3
+ // export interface ICreateTableParams {
4
+ // name?: string;
5
+ // documentClient: DynamoDBDocument;
6
+ // indexes?: GenericRecord<string, ICreateTableParamsIndexDefinition>;
7
+ // }
8
+
9
+ export const createTable = params => {
10
+ const {
11
+ documentClient,
12
+ indexes = {},
13
+ ...rest
14
+ } = params;
15
+ return new Table({
14
16
  partitionKey: "PK",
15
17
  sortKey: "SK",
16
18
  DocumentClient: documentClient,
17
19
  indexes: {
20
+ GSI_TENANT: {
21
+ partitionKey: "GSI_TENANT"
22
+ },
18
23
  GSI1: {
19
24
  partitionKey: "GSI1_PK",
20
25
  sortKey: "GSI1_SK"
21
- }
26
+ },
27
+ GSI2: {
28
+ partitionKey: "GSI2_PK",
29
+ sortKey: "GSI2_SK"
30
+ },
31
+ ...indexes
22
32
  },
23
33
  autoExecute: true,
24
- autoParse: true
34
+ autoParse: true,
35
+ ...rest
25
36
  });
26
37
  };
27
- exports.createTable = createTable;
28
38
 
29
39
  //# sourceMappingURL=createTable.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createTable","name","documentClient","BaseTable","String","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","exports"],"sources":["createTable.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table as BaseTable } from \"~/toolbox\";\n\nexport interface CreateTableParams {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport type Table = BaseTable<string, \"PK\", \"SK\">;\n\nexport const createTable = ({ name, documentClient }: CreateTableParams): Table => {\n return new BaseTable({\n name: name || String(process.env.DB_TABLE),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\n autoExecute: true,\n autoParse: true\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAAkC,CAAC,KAAY;EAC/E,OAAO,IAAIC,cAAS,CAAC;IACjBF,IAAI,EAAEA,IAAI,IAAIG,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,QAAQ,CAAC;IAC1CC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER,cAAc;IAC9BS,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAf,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["Table","createTable","params","documentClient","indexes","rest","partitionKey","sortKey","DocumentClient","GSI_TENANT","GSI1","GSI2","autoExecute","autoParse"],"sources":["createTable.ts"],"sourcesContent":["import type { ITable } from \"~/utils/table/index.js\";\nimport { Table } from \"~/utils/table/index.js\";\nimport type { TableConstructor } from \"~/toolbox.js\";\n\nexport interface ICreateTableParamsIndexDefinition {\n partitionKey: string;\n sortKey?: string;\n}\n\n// export interface ICreateTableParams {\n// name?: string;\n// documentClient: DynamoDBDocument;\n// indexes?: GenericRecord<string, ICreateTableParamsIndexDefinition>;\n// }\n\nexport type ICreateTableParams = Partial<\n Omit<TableConstructor<string, string, string>, \"DocumentClient\">\n> & {\n name: string;\n documentClient: Pick<\n TableConstructor<string, string, string>,\n \"DocumentClient\"\n >[\"DocumentClient\"];\n};\n\nexport const createTable = (params: ICreateTableParams): ITable<string, \"PK\", \"SK\"> => {\n const { documentClient, indexes = {}, ...rest } = params;\n return new Table({\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI_TENANT: {\n partitionKey: \"GSI_TENANT\"\n },\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n },\n GSI2: {\n partitionKey: \"GSI2_PK\",\n sortKey: \"GSI2_SK\"\n },\n ...indexes\n },\n autoExecute: true,\n autoParse: true,\n ...rest\n });\n};\n"],"mappings":"AACA,SAASA,KAAK;;AAQd;AACA;AACA;AACA;AACA;;AAYA,OAAO,MAAMC,WAAW,GAAIC,MAA0B,IAAiC;EACnF,MAAM;IAAEC,cAAc;IAAEC,OAAO,GAAG,CAAC,CAAC;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACxD,OAAO,IAAIF,KAAK,CAAC;IACbM,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAEL,cAAc;IAC9BC,OAAO,EAAE;MACLK,UAAU,EAAE;QACRH,YAAY,EAAE;MAClB,CAAC;MACDI,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb,CAAC;MACDI,IAAI,EAAE;QACFL,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb,CAAC;MACD,GAAGH;IACP,CAAC;IACDQ,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE,IAAI;IACf,GAAGR;EACP,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
package/utils/cursor.js CHANGED
@@ -1,22 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.encodeCursor = exports.decodeCursor = void 0;
7
- const encodeCursor = cursor => {
1
+ export const encodeCursor = cursor => {
8
2
  if (!cursor) {
9
3
  return null;
10
4
  }
11
5
  return Buffer.from(JSON.stringify(cursor)).toString("base64");
12
6
  };
13
- exports.encodeCursor = encodeCursor;
14
- const decodeCursor = cursor => {
7
+ export const decodeCursor = cursor => {
15
8
  if (!cursor) {
16
9
  return null;
17
10
  }
18
11
  return JSON.parse(Buffer.from(cursor, "base64").toString("ascii"));
19
12
  };
20
- exports.decodeCursor = decodeCursor;
21
13
 
22
14
  //# sourceMappingURL=cursor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["encodeCursor","cursor","Buffer","from","JSON","stringify","toString","exports","decodeCursor","parse"],"sources":["cursor.ts"],"sourcesContent":["export const encodeCursor = (cursor?: any): string | null => {\n if (!cursor) {\n return null;\n }\n\n return Buffer.from(JSON.stringify(cursor)).toString(\"base64\");\n};\n\nexport const decodeCursor = (cursor?: string | null): string | null => {\n if (!cursor) {\n return null;\n }\n\n return JSON.parse(Buffer.from(cursor, \"base64\").toString(\"ascii\"));\n};\n"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAIC,MAAY,IAAoB;EACzD,IAAI,CAACA,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,OAAOC,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACJ,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC,QAAQ,CAAC;AACjE,CAAC;AAACC,OAAA,CAAAP,YAAA,GAAAA,YAAA;AAEK,MAAMQ,YAAY,GAAIP,MAAsB,IAAoB;EACnE,IAAI,CAACA,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,OAAOG,IAAI,CAACK,KAAK,CAACP,MAAM,CAACC,IAAI,CAACF,MAAM,EAAE,QAAQ,CAAC,CAACK,QAAQ,CAAC,OAAO,CAAC,CAAC;AACtE,CAAC;AAACC,OAAA,CAAAC,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["encodeCursor","cursor","Buffer","from","JSON","stringify","toString","decodeCursor","parse"],"sources":["cursor.ts"],"sourcesContent":["export const encodeCursor = (cursor?: any): string | null => {\n if (!cursor) {\n return null;\n }\n\n return Buffer.from(JSON.stringify(cursor)).toString(\"base64\");\n};\n\nexport const decodeCursor = (cursor?: string | null): string | null => {\n if (!cursor) {\n return null;\n }\n\n return JSON.parse(Buffer.from(cursor, \"base64\").toString(\"ascii\"));\n};\n"],"mappings":"AAAA,OAAO,MAAMA,YAAY,GAAIC,MAAY,IAAoB;EACzD,IAAI,CAACA,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,OAAOC,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACJ,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC,QAAQ,CAAC;AACjE,CAAC;AAED,OAAO,MAAMC,YAAY,GAAIN,MAAsB,IAAoB;EACnE,IAAI,CAACA,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,OAAOG,IAAI,CAACI,KAAK,CAACN,MAAM,CAACC,IAAI,CAACF,MAAM,EAAE,QAAQ,CAAC,CAACK,QAAQ,CAAC,OAAO,CAAC,CAAC;AACtE,CAAC","ignoreList":[]}
package/utils/delete.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Entity } from "../toolbox";
1
+ import type { Entity } from "../toolbox.js";
2
2
  export interface IDeleteItemKeys {
3
3
  PK: string;
4
4
  SK: string;
package/utils/delete.js CHANGED
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deleteItem = void 0;
7
- const deleteItem = async params => {
1
+ export const deleteItem = async params => {
8
2
  const {
9
3
  entity,
10
4
  keys
@@ -13,6 +7,5 @@ const deleteItem = async params => {
13
7
  execute: true
14
8
  });
15
9
  };
16
- exports.deleteItem = deleteItem;
17
10
 
18
11
  //# sourceMappingURL=delete.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["deleteItem","params","entity","keys","delete","execute","exports"],"sources":["delete.ts"],"sourcesContent":["import type { Entity } from \"~/toolbox\";\nexport interface IDeleteItemKeys {\n PK: string;\n SK: string;\n}\nexport interface IDeleteItemParams {\n entity: Entity;\n keys: IDeleteItemKeys;\n}\n\nexport const deleteItem = async (params: IDeleteItemParams) => {\n const { entity, keys } = params;\n\n return await entity.delete(keys, {\n execute: true\n });\n};\n"],"mappings":";;;;;;AAUO,MAAMA,UAAU,GAAG,MAAOC,MAAyB,IAAK;EAC3D,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAE/B,OAAO,MAAMC,MAAM,CAACE,MAAM,CAACD,IAAI,EAAE;IAC7BE,OAAO,EAAE;EACb,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAN,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["deleteItem","params","entity","keys","delete","execute"],"sources":["delete.ts"],"sourcesContent":["import type { Entity } from \"~/toolbox.js\";\nexport interface IDeleteItemKeys {\n PK: string;\n SK: string;\n}\nexport interface IDeleteItemParams {\n entity: Entity;\n keys: IDeleteItemKeys;\n}\n\nexport const deleteItem = async (params: IDeleteItemParams) => {\n const { entity, keys } = params;\n\n return await entity.delete(keys, {\n execute: true\n });\n};\n"],"mappings":"AAUA,OAAO,MAAMA,UAAU,GAAG,MAAOC,MAAyB,IAAK;EAC3D,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAE/B,OAAO,MAAMC,MAAM,CAACE,MAAM,CAACD,IAAI,EAAE;IAC7BE,OAAO,EAAE;EACb,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,26 +1,28 @@
1
- import type { AttributeDefinitions, EntityConstructor as BaseEntityConstructor, Readonly, TableDef } from "../../toolbox";
2
- import { Entity as BaseEntity } from "../../toolbox";
3
- import type { ITableWriteBatch } from "../table/types";
4
- import type { IEntity, IEntityQueryAllParams, IEntityQueryOneParams, IEntityReadBatch, IEntityWriteBatch } from "./types";
5
- import type { IPutParamsItem } from "../put";
6
- import { put } from "../put";
7
- import type { GetRecordParamsKeys } from "../get";
8
- import { get, getClean } from "../get";
9
- import type { IDeleteItemKeys } from "../delete";
10
- import { deleteItem } from "../delete";
11
- import type { GenericRecord } from "@webiny/api/types";
1
+ import type { AttributeDefinitions, EntityConstructor as BaseEntityConstructor, Readonly, TableDef } from "../../toolbox.js";
2
+ import { Entity as BaseEntity } from "../../toolbox.js";
3
+ import type { ITableWriteBatch } from "../table/types.js";
4
+ import type { IEntity, IEntityCreateEntityReaderParams, IEntityCreateEntityWriterParams, IEntityDeleteResult, IEntityGetCleanResult, IEntityGetResult, IEntityPutResult, IEntityQueryAllCleanResult, IEntityQueryAllParams, IEntityQueryAllResult, IEntityQueryOneCleanResult, IEntityQueryOneParams, IEntityQueryOneResult, IEntityQueryPerPageParams, IEntityReadBatch, IEntityWriteBatch } from "./types.js";
5
+ import type { IPutParamsItem } from "../put.js";
6
+ import type { GetRecordParamsKeys } from "../get.js";
7
+ import type { IDeleteItemKeys } from "../delete.js";
8
+ import type { GenericRecord } from "@webiny/api/types.js";
12
9
  export type EntityConstructor<T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>> = BaseEntityConstructor<TableDef, string, true, true, true, "created", "modified", "entity", false, T>;
13
- export declare class Entity implements IEntity {
10
+ export declare class Entity<T extends GenericRecord = GenericRecord> implements IEntity<T> {
14
11
  readonly entity: BaseEntity;
12
+ get name(): string;
13
+ get table(): TableDef;
15
14
  constructor(params: EntityConstructor);
16
- createEntityReader(): IEntityReadBatch;
17
- createEntityWriter(): IEntityWriteBatch;
15
+ createEntityReader(params?: IEntityCreateEntityReaderParams): IEntityReadBatch<T>;
16
+ createEntityWriter(params?: IEntityCreateEntityWriterParams): IEntityWriteBatch<T>;
18
17
  createTableWriter(): ITableWriteBatch;
19
- put<T extends GenericRecord = GenericRecord>(item: IPutParamsItem<T>): ReturnType<typeof put>;
20
- get<T>(keys: GetRecordParamsKeys): ReturnType<typeof get<T>>;
21
- getClean<T>(keys: GetRecordParamsKeys): ReturnType<typeof getClean<T>>;
22
- delete(keys: IDeleteItemKeys): ReturnType<typeof deleteItem>;
23
- queryOne<T>(params: IEntityQueryOneParams): Promise<T | null>;
24
- queryAll<T>(params: IEntityQueryAllParams): Promise<T[]>;
18
+ put<T extends GenericRecord = GenericRecord>(item: IPutParamsItem<T>): IEntityPutResult;
19
+ get<T>(keys: GetRecordParamsKeys): IEntityGetResult<T>;
20
+ getClean<T>(keys: GetRecordParamsKeys): IEntityGetCleanResult<T>;
21
+ delete(keys: IDeleteItemKeys): IEntityDeleteResult;
22
+ queryOne<T>(params: IEntityQueryOneParams): IEntityQueryOneResult<T>;
23
+ queryOneClean<T>(params: IEntityQueryOneParams): IEntityQueryOneCleanResult<T>;
24
+ queryAll<T>(params: IEntityQueryAllParams): IEntityQueryAllResult<T>;
25
+ queryAllClean<T>(params: IEntityQueryAllParams): IEntityQueryAllCleanResult<T>;
26
+ queryPerPage<T>(params: IEntityQueryPerPageParams): Promise<import("../query.js").IQueryPageResponse<T>>;
25
27
  }
26
- export declare const createEntity: (params: EntityConstructor) => IEntity;
28
+ export declare const createEntity: <T extends GenericRecord = GenericRecord>(params: EntityConstructor) => IEntity<T>;
@@ -1,77 +1,99 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createEntity = exports.Entity = void 0;
7
- var _toolbox = require("../../toolbox");
8
- var _put = require("../put");
9
- var _get = require("../get");
10
- var _delete = require("../delete");
11
- var _EntityReadBatch = require("./EntityReadBatch");
12
- var _EntityWriteBatch = require("./EntityWriteBatch");
13
- var _TableWriteBatch = require("../table/TableWriteBatch");
14
- var _query = require("../query");
15
- class Entity {
1
+ import { Entity as BaseEntity } from "../../toolbox.js";
2
+ import { put } from "../put.js";
3
+ import { get, getClean } from "../get.js";
4
+ import { deleteItem } from "../delete.js";
5
+ import { createEntityReadBatch } from "./EntityReadBatch.js";
6
+ import { createEntityWriteBatch } from "./EntityWriteBatch.js";
7
+ import { createTableWriteBatch } from "../table/TableWriteBatch.js";
8
+ import { queryAll, queryAllClean, queryOne, queryOneClean, queryPerPage } from "../query.js";
9
+ export class Entity {
10
+ get name() {
11
+ return this.entity.name;
12
+ }
13
+ get table() {
14
+ /**
15
+ * Not possible to be undefined.
16
+ */
17
+ return this.entity.table;
18
+ }
16
19
  constructor(params) {
17
- this.entity = new _toolbox.Entity(params);
20
+ this.entity = new BaseEntity(params);
18
21
  }
19
- createEntityReader() {
20
- return (0, _EntityReadBatch.createEntityReadBatch)({
21
- entity: this.entity
22
+ createEntityReader(params) {
23
+ return createEntityReadBatch({
24
+ entity: this.entity,
25
+ read: params?.read
22
26
  });
23
27
  }
24
- createEntityWriter() {
25
- return (0, _EntityWriteBatch.createEntityWriteBatch)({
26
- entity: this.entity
28
+ createEntityWriter(params) {
29
+ return createEntityWriteBatch({
30
+ entity: this.entity,
31
+ put: params?.put,
32
+ delete: params?.delete
27
33
  });
28
34
  }
29
35
  createTableWriter() {
30
- return (0, _TableWriteBatch.createTableWriteBatch)({
36
+ return createTableWriteBatch({
31
37
  table: this.entity.table
32
38
  });
33
39
  }
34
40
  async put(item) {
35
- return (0, _put.put)({
41
+ return put({
36
42
  entity: this.entity,
37
43
  item
38
44
  });
39
45
  }
40
46
  async get(keys) {
41
- return (0, _get.get)({
47
+ return get({
42
48
  entity: this.entity,
43
49
  keys
44
50
  });
45
51
  }
46
52
  async getClean(keys) {
47
- return (0, _get.getClean)({
53
+ return getClean({
48
54
  entity: this.entity,
49
55
  keys
50
56
  });
51
57
  }
52
58
  async delete(keys) {
53
- return (0, _delete.deleteItem)({
59
+ return deleteItem({
54
60
  entity: this.entity,
55
61
  keys
56
62
  });
57
63
  }
58
- queryOne(params) {
59
- return (0, _query.queryOneClean)({
64
+ async queryOne(params) {
65
+ return queryOne({
66
+ ...params,
67
+ entity: this.entity
68
+ });
69
+ }
70
+ async queryOneClean(params) {
71
+ return queryOneClean({
72
+ ...params,
73
+ entity: this.entity
74
+ });
75
+ }
76
+ async queryAll(params) {
77
+ return queryAll({
78
+ ...params,
79
+ entity: this.entity
80
+ });
81
+ }
82
+ async queryAllClean(params) {
83
+ return queryAllClean({
60
84
  ...params,
61
85
  entity: this.entity
62
86
  });
63
87
  }
64
- queryAll(params) {
65
- return (0, _query.queryAllClean)({
88
+ async queryPerPage(params) {
89
+ return queryPerPage({
66
90
  ...params,
67
91
  entity: this.entity
68
92
  });
69
93
  }
70
94
  }
71
- exports.Entity = Entity;
72
- const createEntity = params => {
95
+ export const createEntity = params => {
73
96
  return new Entity(params);
74
97
  };
75
- exports.createEntity = createEntity;
76
98
 
77
99
  //# sourceMappingURL=Entity.js.map