@webiny/api-audit-logs 6.3.0 → 6.4.0-beta.1

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 (196) hide show
  1. package/abstractions.js +2 -3
  2. package/abstractions.js.map +1 -1
  3. package/config.js +2 -1
  4. package/config.js.map +1 -1
  5. package/context/AuditLogsContextValue.js +115 -125
  6. package/context/AuditLogsContextValue.js.map +1 -1
  7. package/context/index.js +21 -27
  8. package/context/index.js.map +1 -1
  9. package/events/AuditLogAfterCreateEvent.js +8 -5
  10. package/events/AuditLogAfterCreateEvent.js.map +1 -1
  11. package/events/AuditLogAfterUpdateEvent.js +8 -5
  12. package/events/AuditLogAfterUpdateEvent.js.map +1 -1
  13. package/events/AuditLogBeforeCreateEvent.js +8 -5
  14. package/events/AuditLogBeforeCreateEvent.js.map +1 -1
  15. package/events/AuditLogBeforeUpdateEvent.js +8 -5
  16. package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
  17. package/events/abstractions.js +5 -24
  18. package/events/abstractions.js.map +1 -1
  19. package/events/index.js +0 -2
  20. package/graphql/schema.js +37 -48
  21. package/graphql/schema.js.map +1 -1
  22. package/graphql/validation.d.ts +3 -3
  23. package/graphql/validation.js +26 -30
  24. package/graphql/validation.js.map +1 -1
  25. package/index.js +18 -15
  26. package/index.js.map +1 -1
  27. package/package.json +26 -26
  28. package/storage/AccessPatternHandler.js +31 -52
  29. package/storage/AccessPatternHandler.js.map +1 -1
  30. package/storage/Converter.js +45 -48
  31. package/storage/Converter.js.map +1 -1
  32. package/storage/Storage.js +69 -77
  33. package/storage/Storage.js.map +1 -1
  34. package/storage/abstractions/AccessPattern.js +0 -3
  35. package/storage/abstractions/AccessPatternHandler.js +0 -3
  36. package/storage/abstractions/Converter.js +0 -3
  37. package/storage/abstractions/Storage.js +0 -3
  38. package/storage/accessPatterns/AppAccessPattern.js +31 -25
  39. package/storage/accessPatterns/AppAccessPattern.js.map +1 -1
  40. package/storage/accessPatterns/AppCreatedByAccessPattern.js +34 -28
  41. package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +1 -1
  42. package/storage/accessPatterns/AppEntityAccessPattern.js +31 -25
  43. package/storage/accessPatterns/AppEntityAccessPattern.js.map +1 -1
  44. package/storage/accessPatterns/AppEntityActionAccessPattern.js +31 -25
  45. package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +1 -1
  46. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +34 -28
  47. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -1
  48. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +34 -28
  49. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -1
  50. package/storage/accessPatterns/BaseAccessPattern.js +47 -70
  51. package/storage/accessPatterns/BaseAccessPattern.js.map +1 -1
  52. package/storage/accessPatterns/CreatedByAccessPattern.js +34 -28
  53. package/storage/accessPatterns/CreatedByAccessPattern.js.map +1 -1
  54. package/storage/accessPatterns/CreatedOnAccessPattern.js +34 -26
  55. package/storage/accessPatterns/CreatedOnAccessPattern.js.map +1 -1
  56. package/storage/accessPatterns/DefaultAccessPattern.js +31 -32
  57. package/storage/accessPatterns/DefaultAccessPattern.js.map +1 -1
  58. package/storage/accessPatterns/EntityIdAccessPattern.js +32 -27
  59. package/storage/accessPatterns/EntityIdAccessPattern.js.map +1 -1
  60. package/storage/accessPatterns/index.js +44 -34
  61. package/storage/accessPatterns/index.js.map +1 -1
  62. package/storage/cursorSchema.js +15 -18
  63. package/storage/cursorSchema.js.map +1 -1
  64. package/storage/entity.js +115 -122
  65. package/storage/entity.js.map +1 -1
  66. package/storage/results/ListErrorResult.js +9 -8
  67. package/storage/results/ListErrorResult.js.map +1 -1
  68. package/storage/results/ListSuccessResult.js +13 -12
  69. package/storage/results/ListSuccessResult.js.map +1 -1
  70. package/storage/results/index.js +0 -2
  71. package/storage/startKey.js +4 -5
  72. package/storage/startKey.js.map +1 -1
  73. package/storage/types.js +0 -3
  74. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +26 -25
  75. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
  76. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +29 -28
  77. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
  78. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +32 -32
  79. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
  80. package/subscriptions/aco/index.js +5 -4
  81. package/subscriptions/aco/index.js.map +1 -1
  82. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +21 -20
  83. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
  84. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +21 -20
  85. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
  86. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +24 -24
  87. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
  88. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +24 -24
  89. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
  90. package/subscriptions/fileManager/index.js +6 -8
  91. package/subscriptions/fileManager/index.js.map +1 -1
  92. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +21 -23
  93. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
  94. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +26 -29
  95. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
  96. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +21 -23
  97. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
  98. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +21 -23
  99. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
  100. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +21 -23
  101. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
  102. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +24 -27
  103. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
  104. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +21 -23
  105. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
  106. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +21 -23
  107. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
  108. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +21 -20
  109. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
  110. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +21 -20
  111. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
  112. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +24 -24
  113. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
  114. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +21 -20
  115. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
  116. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +21 -20
  117. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
  118. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +24 -24
  119. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
  120. package/subscriptions/headlessCms/index.js +16 -20
  121. package/subscriptions/headlessCms/index.js.map +1 -1
  122. package/subscriptions/index.js +8 -7
  123. package/subscriptions/index.js.map +1 -1
  124. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +23 -22
  125. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
  126. package/subscriptions/mailer/index.js +3 -3
  127. package/subscriptions/mailer/index.js.map +1 -1
  128. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +31 -37
  129. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
  130. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +31 -37
  131. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
  132. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +35 -42
  133. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
  134. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +21 -20
  135. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
  136. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +21 -20
  137. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
  138. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +24 -24
  139. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
  140. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +21 -20
  141. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
  142. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +21 -20
  143. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
  144. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +24 -24
  145. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
  146. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +21 -20
  147. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
  148. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +21 -20
  149. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
  150. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +24 -24
  151. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
  152. package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
  153. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
  154. package/subscriptions/security/index.js +14 -20
  155. package/subscriptions/security/index.js.map +1 -1
  156. package/subscriptions/websiteBuilder/index.js +14 -16
  157. package/subscriptions/websiteBuilder/index.js.map +1 -1
  158. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +20 -19
  159. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
  160. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +20 -19
  161. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
  162. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +20 -19
  163. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
  164. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +23 -23
  165. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
  166. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +20 -19
  167. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
  168. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +20 -19
  169. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
  170. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +20 -19
  171. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
  172. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +23 -23
  173. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
  174. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +20 -19
  175. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
  176. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +20 -19
  177. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
  178. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +20 -19
  179. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
  180. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +23 -23
  181. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
  182. package/types.js +0 -3
  183. package/utils/expiresAt.js +14 -19
  184. package/utils/expiresAt.js.map +1 -1
  185. package/utils/getAuditConfig.js +79 -98
  186. package/utils/getAuditConfig.js.map +1 -1
  187. package/utils/getAuditObject.js +14 -15
  188. package/utils/getAuditObject.js.map +1 -1
  189. package/events/index.js.map +0 -1
  190. package/storage/abstractions/AccessPattern.js.map +0 -1
  191. package/storage/abstractions/AccessPatternHandler.js.map +0 -1
  192. package/storage/abstractions/Converter.js.map +0 -1
  193. package/storage/abstractions/Storage.js.map +0 -1
  194. package/storage/results/index.js.map +0 -1
  195. package/storage/types.js.map +0 -1
  196. package/types.js.map +0 -1
@@ -1,33 +1,38 @@
1
1
  import { BaseAccessPattern } from "./BaseAccessPattern.js";
2
2
  import { parseIdentifier } from "@webiny/utils";
3
- const createPartitionKey = params => {
4
- const {
5
- id
6
- } = parseIdentifier(params.entityId);
7
- return `T#${params.tenant}#AUDIT_LOG#ENTITY_ID#${id}`;
3
+ const createPartitionKey = (params)=>{
4
+ const { id } = parseIdentifier(params.entityId);
5
+ return `T#${params.tenant}#AUDIT_LOG#ENTITY_ID#${id}`;
8
6
  };
9
- export class EntityIdGlobalAccessPattern extends BaseAccessPattern {
10
- handles() {
11
- return {
12
- mustInclude: ["entityId"],
13
- mustNotInclude: ["entity", "createdBy", "action"]
14
- };
15
- }
16
- async list(params) {
17
- const options = this.createOptions(params);
18
- const result = await this.query({
19
- partitionKey: createPartitionKey(params),
20
- options
21
- });
22
- return this.populateResult(result);
23
- }
24
- createKeys(item) {
25
- const time = item.createdOn.getTime();
26
- return {
27
- partitionKey: createPartitionKey(item),
28
- sortKey: time
29
- };
30
- }
7
+ class EntityIdGlobalAccessPattern extends BaseAccessPattern {
8
+ handles() {
9
+ return {
10
+ mustInclude: [
11
+ "entityId"
12
+ ],
13
+ mustNotInclude: [
14
+ "entity",
15
+ "createdBy",
16
+ "action"
17
+ ]
18
+ };
19
+ }
20
+ async list(params) {
21
+ const options = this.createOptions(params);
22
+ const result = await this.query({
23
+ partitionKey: createPartitionKey(params),
24
+ options
25
+ });
26
+ return this.populateResult(result);
27
+ }
28
+ createKeys(item) {
29
+ const time = item.createdOn.getTime();
30
+ return {
31
+ partitionKey: createPartitionKey(item),
32
+ sortKey: time
33
+ };
34
+ }
31
35
  }
36
+ export { EntityIdGlobalAccessPattern };
32
37
 
33
38
  //# sourceMappingURL=EntityIdAccessPattern.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseAccessPattern","parseIdentifier","createPartitionKey","params","id","entityId","tenant","EntityIdGlobalAccessPattern","handles","mustInclude","mustNotInclude","list","options","createOptions","result","query","partitionKey","populateResult","createKeys","item","time","createdOn","getTime","sortKey"],"sources":["EntityIdAccessPattern.ts"],"sourcesContent":["import type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageListByEntityIdParams } from \"~/storage/abstractions/Storage.js\";\nimport { BaseAccessPattern } from \"~/storage/accessPatterns/BaseAccessPattern.js\";\nimport type {\n IAccessPatternCreateKeysResult,\n IAccessPatternHandles,\n IAccessPatternListResult\n} from \"~/storage/abstractions/AccessPattern.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\ninterface ICreatePartitionKeyParams {\n entityId: string;\n tenant: string;\n}\n\nconst createPartitionKey = (params: ICreatePartitionKeyParams) => {\n const { id } = parseIdentifier(params.entityId);\n return `T#${params.tenant}#AUDIT_LOG#ENTITY_ID#${id}`;\n};\n\nexport class EntityIdGlobalAccessPattern<\n T extends IStorageListByEntityIdParams = IStorageListByEntityIdParams\n> extends BaseAccessPattern<T> {\n public override handles(): IAccessPatternHandles {\n return {\n mustInclude: [\"entityId\"],\n mustNotInclude: [\"entity\", \"createdBy\", \"action\"]\n };\n }\n\n public async list(params: T): Promise<IAccessPatternListResult> {\n const options = this.createOptions(params);\n\n const result = await this.query({\n partitionKey: createPartitionKey(params),\n options\n });\n return this.populateResult(result);\n }\n\n public createKeys(item: IAuditLog): IAccessPatternCreateKeysResult {\n const time = item.createdOn.getTime();\n\n return {\n partitionKey: createPartitionKey(item),\n sortKey: time\n };\n }\n}\n"],"mappings":"AAEA,SAASA,iBAAiB;AAM1B,SAASC,eAAe,QAAQ,eAAe;AAO/C,MAAMC,kBAAkB,GAAIC,MAAiC,IAAK;EAC9D,MAAM;IAAEC;EAAG,CAAC,GAAGH,eAAe,CAACE,MAAM,CAACE,QAAQ,CAAC;EAC/C,OAAO,KAAKF,MAAM,CAACG,MAAM,wBAAwBF,EAAE,EAAE;AACzD,CAAC;AAED,OAAO,MAAMG,2BAA2B,SAE9BP,iBAAiB,CAAI;EACXQ,OAAOA,CAAA,EAA0B;IAC7C,OAAO;MACHC,WAAW,EAAE,CAAC,UAAU,CAAC;MACzBC,cAAc,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ;IACpD,CAAC;EACL;EAEA,MAAaC,IAAIA,CAACR,MAAS,EAAqC;IAC5D,MAAMS,OAAO,GAAG,IAAI,CAACC,aAAa,CAACV,MAAM,CAAC;IAE1C,MAAMW,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAAC;MAC5BC,YAAY,EAAEd,kBAAkB,CAACC,MAAM,CAAC;MACxCS;IACJ,CAAC,CAAC;IACF,OAAO,IAAI,CAACK,cAAc,CAACH,MAAM,CAAC;EACtC;EAEOI,UAAUA,CAACC,IAAe,EAAkC;IAC/D,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAACC,OAAO,CAAC,CAAC;IAErC,OAAO;MACHN,YAAY,EAAEd,kBAAkB,CAACiB,IAAI,CAAC;MACtCI,OAAO,EAAEH;IACb,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"storage/accessPatterns/EntityIdAccessPattern.js","sources":["../../../src/storage/accessPatterns/EntityIdAccessPattern.ts"],"sourcesContent":["import type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageListByEntityIdParams } from \"~/storage/abstractions/Storage.js\";\nimport { BaseAccessPattern } from \"~/storage/accessPatterns/BaseAccessPattern.js\";\nimport type {\n IAccessPatternCreateKeysResult,\n IAccessPatternHandles,\n IAccessPatternListResult\n} from \"~/storage/abstractions/AccessPattern.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\ninterface ICreatePartitionKeyParams {\n entityId: string;\n tenant: string;\n}\n\nconst createPartitionKey = (params: ICreatePartitionKeyParams) => {\n const { id } = parseIdentifier(params.entityId);\n return `T#${params.tenant}#AUDIT_LOG#ENTITY_ID#${id}`;\n};\n\nexport class EntityIdGlobalAccessPattern<\n T extends IStorageListByEntityIdParams = IStorageListByEntityIdParams\n> extends BaseAccessPattern<T> {\n public override handles(): IAccessPatternHandles {\n return {\n mustInclude: [\"entityId\"],\n mustNotInclude: [\"entity\", \"createdBy\", \"action\"]\n };\n }\n\n public async list(params: T): Promise<IAccessPatternListResult> {\n const options = this.createOptions(params);\n\n const result = await this.query({\n partitionKey: createPartitionKey(params),\n options\n });\n return this.populateResult(result);\n }\n\n public createKeys(item: IAuditLog): IAccessPatternCreateKeysResult {\n const time = item.createdOn.getTime();\n\n return {\n partitionKey: createPartitionKey(item),\n sortKey: time\n };\n }\n}\n"],"names":["createPartitionKey","params","id","parseIdentifier","EntityIdGlobalAccessPattern","BaseAccessPattern","options","result","item","time"],"mappings":";;AAeA,MAAMA,qBAAqB,CAACC;IACxB,MAAM,EAAEC,EAAE,EAAE,GAAGC,gBAAgBF,OAAO,QAAQ;IAC9C,OAAO,CAAC,EAAE,EAAEA,OAAO,MAAM,CAAC,qBAAqB,EAAEC,IAAI;AACzD;AAEO,MAAME,oCAEHC;IACU,UAAiC;QAC7C,OAAO;YACH,aAAa;gBAAC;aAAW;YACzB,gBAAgB;gBAAC;gBAAU;gBAAa;aAAS;QACrD;IACJ;IAEA,MAAa,KAAKJ,MAAS,EAAqC;QAC5D,MAAMK,UAAU,IAAI,CAAC,aAAa,CAACL;QAEnC,MAAMM,SAAS,MAAM,IAAI,CAAC,KAAK,CAAC;YAC5B,cAAcP,mBAAmBC;YACjCK;QACJ;QACA,OAAO,IAAI,CAAC,cAAc,CAACC;IAC/B;IAEO,WAAWC,IAAe,EAAkC;QAC/D,MAAMC,OAAOD,KAAK,SAAS,CAAC,OAAO;QAEnC,OAAO;YACH,cAAcR,mBAAmBQ;YACjC,SAASC;QACb;IACJ;AACJ"}
@@ -8,40 +8,50 @@ import { AppEntityActionAccessPattern } from "./AppEntityActionAccessPattern.js"
8
8
  import { EntityIdGlobalAccessPattern } from "./EntityIdAccessPattern.js";
9
9
  import { CreatedByAccessPattern } from "./CreatedByAccessPattern.js";
10
10
  import { CreatedOnAccessPattern } from "./CreatedOnAccessPattern.js";
11
- export const createAccessPatterns = params => {
12
- const {
13
- entity
14
- } = params;
15
- return [new DefaultAccessPattern({
16
- entity
17
- }), new AppAccessPattern({
18
- entity,
19
- index: "GSI1"
20
- }), new AppCreatedByAccessPattern({
21
- entity,
22
- index: "GSI2"
23
- }), new AppEntityAccessPattern({
24
- entity,
25
- index: "GSI3"
26
- }), new EntityIdGlobalAccessPattern({
27
- entity,
28
- index: "GSI4"
29
- }), new AppEntityActionCreatedByAccessPattern({
30
- entity,
31
- index: "GSI5"
32
- }), new AppEntityActionAccessPattern({
33
- entity,
34
- index: "GSI6"
35
- }), new AppEntityCreatedByAccessPattern({
36
- entity,
37
- index: "GSI7"
38
- }), new CreatedByAccessPattern({
39
- entity,
40
- index: "GSI8"
41
- }), new CreatedOnAccessPattern({
42
- entity,
43
- index: "GSI9"
44
- })];
11
+ const createAccessPatterns = (params)=>{
12
+ const { entity } = params;
13
+ return [
14
+ new DefaultAccessPattern({
15
+ entity
16
+ }),
17
+ new AppAccessPattern({
18
+ entity,
19
+ index: "GSI1"
20
+ }),
21
+ new AppCreatedByAccessPattern({
22
+ entity,
23
+ index: "GSI2"
24
+ }),
25
+ new AppEntityAccessPattern({
26
+ entity,
27
+ index: "GSI3"
28
+ }),
29
+ new EntityIdGlobalAccessPattern({
30
+ entity,
31
+ index: "GSI4"
32
+ }),
33
+ new AppEntityActionCreatedByAccessPattern({
34
+ entity,
35
+ index: "GSI5"
36
+ }),
37
+ new AppEntityActionAccessPattern({
38
+ entity,
39
+ index: "GSI6"
40
+ }),
41
+ new AppEntityCreatedByAccessPattern({
42
+ entity,
43
+ index: "GSI7"
44
+ }),
45
+ new CreatedByAccessPattern({
46
+ entity,
47
+ index: "GSI8"
48
+ }),
49
+ new CreatedOnAccessPattern({
50
+ entity,
51
+ index: "GSI9"
52
+ })
53
+ ];
45
54
  };
55
+ export { createAccessPatterns };
46
56
 
47
57
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DefaultAccessPattern","AppAccessPattern","AppCreatedByAccessPattern","AppEntityActionCreatedByAccessPattern","AppEntityCreatedByAccessPattern","AppEntityAccessPattern","AppEntityActionAccessPattern","EntityIdGlobalAccessPattern","CreatedByAccessPattern","CreatedOnAccessPattern","createAccessPatterns","params","entity","index"],"sources":["index.ts"],"sourcesContent":["import type { IAccessPattern } from \"../abstractions/AccessPattern.js\";\nimport { DefaultAccessPattern } from \"~/storage/accessPatterns/DefaultAccessPattern.js\";\nimport { AppAccessPattern } from \"~/storage/accessPatterns/AppAccessPattern.js\";\nimport { AppCreatedByAccessPattern } from \"~/storage/accessPatterns/AppCreatedByAccessPattern.js\";\nimport { AppEntityActionCreatedByAccessPattern } from \"~/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js\";\nimport { AppEntityCreatedByAccessPattern } from \"~/storage/accessPatterns/AppEntityCreatedByAccessPattern.js\";\nimport { AppEntityAccessPattern } from \"~/storage/accessPatterns/AppEntityAccessPattern.js\";\nimport { AppEntityActionAccessPattern } from \"~/storage/accessPatterns/AppEntityActionAccessPattern.js\";\nimport { EntityIdGlobalAccessPattern } from \"~/storage/accessPatterns/EntityIdAccessPattern.js\";\nimport { CreatedByAccessPattern } from \"~/storage/accessPatterns/CreatedByAccessPattern.js\";\nimport { CreatedOnAccessPattern } from \"~/storage/accessPatterns/CreatedOnAccessPattern.js\";\nimport type { AuditLogsEntity } from \"~/storage/entity.js\";\n\nexport interface ICreateAccessPatternsParams {\n entity: AuditLogsEntity;\n}\n\nexport const createAccessPatterns = (\n params: ICreateAccessPatternsParams\n): IAccessPattern<unknown>[] => {\n const { entity } = params;\n return [\n new DefaultAccessPattern({\n entity\n }),\n new AppAccessPattern({\n entity,\n index: \"GSI1\"\n }),\n new AppCreatedByAccessPattern({\n entity,\n index: \"GSI2\"\n }),\n new AppEntityAccessPattern({\n entity,\n index: \"GSI3\"\n }),\n new EntityIdGlobalAccessPattern({\n entity,\n index: \"GSI4\"\n }),\n new AppEntityActionCreatedByAccessPattern({\n entity,\n index: \"GSI5\"\n }),\n new AppEntityActionAccessPattern({\n entity,\n index: \"GSI6\"\n }),\n new AppEntityCreatedByAccessPattern({\n entity,\n index: \"GSI7\"\n }),\n new CreatedByAccessPattern({\n entity,\n index: \"GSI8\"\n }),\n new CreatedOnAccessPattern({\n entity,\n index: \"GSI9\"\n })\n ];\n};\n"],"mappings":"AACA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,yBAAyB;AAClC,SAASC,qCAAqC;AAC9C,SAASC,+BAA+B;AACxC,SAASC,sBAAsB;AAC/B,SAASC,4BAA4B;AACrC,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAO/B,OAAO,MAAMC,oBAAoB,GAC7BC,MAAmC,IACP;EAC5B,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EACzB,OAAO,CACH,IAAIX,oBAAoB,CAAC;IACrBY;EACJ,CAAC,CAAC,EACF,IAAIX,gBAAgB,CAAC;IACjBW,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIX,yBAAyB,CAAC;IAC1BU,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIR,sBAAsB,CAAC;IACvBO,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIN,2BAA2B,CAAC;IAC5BK,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIV,qCAAqC,CAAC;IACtCS,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIP,4BAA4B,CAAC;IAC7BM,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIT,+BAA+B,CAAC;IAChCQ,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIL,sBAAsB,CAAC;IACvBI,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIJ,sBAAsB,CAAC;IACvBG,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,CACL;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"storage/accessPatterns/index.js","sources":["../../../src/storage/accessPatterns/index.ts"],"sourcesContent":["import type { IAccessPattern } from \"../abstractions/AccessPattern.js\";\nimport { DefaultAccessPattern } from \"~/storage/accessPatterns/DefaultAccessPattern.js\";\nimport { AppAccessPattern } from \"~/storage/accessPatterns/AppAccessPattern.js\";\nimport { AppCreatedByAccessPattern } from \"~/storage/accessPatterns/AppCreatedByAccessPattern.js\";\nimport { AppEntityActionCreatedByAccessPattern } from \"~/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js\";\nimport { AppEntityCreatedByAccessPattern } from \"~/storage/accessPatterns/AppEntityCreatedByAccessPattern.js\";\nimport { AppEntityAccessPattern } from \"~/storage/accessPatterns/AppEntityAccessPattern.js\";\nimport { AppEntityActionAccessPattern } from \"~/storage/accessPatterns/AppEntityActionAccessPattern.js\";\nimport { EntityIdGlobalAccessPattern } from \"~/storage/accessPatterns/EntityIdAccessPattern.js\";\nimport { CreatedByAccessPattern } from \"~/storage/accessPatterns/CreatedByAccessPattern.js\";\nimport { CreatedOnAccessPattern } from \"~/storage/accessPatterns/CreatedOnAccessPattern.js\";\nimport type { AuditLogsEntity } from \"~/storage/entity.js\";\n\nexport interface ICreateAccessPatternsParams {\n entity: AuditLogsEntity;\n}\n\nexport const createAccessPatterns = (\n params: ICreateAccessPatternsParams\n): IAccessPattern<unknown>[] => {\n const { entity } = params;\n return [\n new DefaultAccessPattern({\n entity\n }),\n new AppAccessPattern({\n entity,\n index: \"GSI1\"\n }),\n new AppCreatedByAccessPattern({\n entity,\n index: \"GSI2\"\n }),\n new AppEntityAccessPattern({\n entity,\n index: \"GSI3\"\n }),\n new EntityIdGlobalAccessPattern({\n entity,\n index: \"GSI4\"\n }),\n new AppEntityActionCreatedByAccessPattern({\n entity,\n index: \"GSI5\"\n }),\n new AppEntityActionAccessPattern({\n entity,\n index: \"GSI6\"\n }),\n new AppEntityCreatedByAccessPattern({\n entity,\n index: \"GSI7\"\n }),\n new CreatedByAccessPattern({\n entity,\n index: \"GSI8\"\n }),\n new CreatedOnAccessPattern({\n entity,\n index: \"GSI9\"\n })\n ];\n};\n"],"names":["createAccessPatterns","params","entity","DefaultAccessPattern","AppAccessPattern","AppCreatedByAccessPattern","AppEntityAccessPattern","EntityIdGlobalAccessPattern","AppEntityActionCreatedByAccessPattern","AppEntityActionAccessPattern","AppEntityCreatedByAccessPattern","CreatedByAccessPattern","CreatedOnAccessPattern"],"mappings":";;;;;;;;;;AAiBO,MAAMA,uBAAuB,CAChCC;IAEA,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,OAAO;QACH,IAAIE,qBAAqB;YACrBD;QACJ;QACA,IAAIE,iBAAiB;YACjBF;YACA,OAAO;QACX;QACA,IAAIG,0BAA0B;YAC1BH;YACA,OAAO;QACX;QACA,IAAII,uBAAuB;YACvBJ;YACA,OAAO;QACX;QACA,IAAIK,4BAA4B;YAC5BL;YACA,OAAO;QACX;QACA,IAAIM,sCAAsC;YACtCN;YACA,OAAO;QACX;QACA,IAAIO,6BAA6B;YAC7BP;YACA,OAAO;QACX;QACA,IAAIQ,gCAAgC;YAChCR;YACA,OAAO;QACX;QACA,IAAIS,uBAAuB;YACvBT;YACA,OAAO;QACX;QACA,IAAIU,uBAAuB;YACvBV;YACA,OAAO;QACX;KACH;AACL"}
@@ -1,25 +1,22 @@
1
1
  import zod from "zod";
2
2
  import { decodeCursor } from "@webiny/db-dynamodb";
3
- const schema = zod.string().transform(value => {
4
- const decoded = decodeCursor(value);
5
- if (!decoded) {
6
- throw new Error("Invalid cursor.");
7
- }
8
- try {
9
- return JSON.parse(decoded);
10
- } catch {
11
- return decoded;
12
- }
3
+ const schema = zod.string().transform((value)=>{
4
+ const decoded = decodeCursor(value);
5
+ if (!decoded) throw new Error("Invalid cursor.");
6
+ try {
7
+ return JSON.parse(decoded);
8
+ } catch {
9
+ return decoded;
10
+ }
13
11
  }).pipe(zod.object({
14
- PK: zod.string(),
15
- SK: zod.string()
12
+ PK: zod.string(),
13
+ SK: zod.string()
16
14
  }));
17
- export const fetchCursor = input => {
18
- const result = schema.safeParse(input);
19
- if (!result.success) {
20
- return undefined;
21
- }
22
- return result.data;
15
+ const fetchCursor = (input)=>{
16
+ const result = schema.safeParse(input);
17
+ if (!result.success) return;
18
+ return result.data;
23
19
  };
20
+ export { fetchCursor };
24
21
 
25
22
  //# sourceMappingURL=cursorSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["zod","decodeCursor","schema","string","transform","value","decoded","Error","JSON","parse","pipe","object","PK","SK","fetchCursor","input","result","safeParse","success","undefined","data"],"sources":["cursorSchema.ts"],"sourcesContent":["import zod from \"zod\";\nimport { decodeCursor } from \"@webiny/db-dynamodb\";\n\nconst schema = zod\n .string()\n .transform(value => {\n const decoded = decodeCursor(value);\n if (!decoded) {\n throw new Error(\"Invalid cursor.\");\n }\n try {\n return JSON.parse(decoded);\n } catch {\n return decoded;\n }\n })\n .pipe(\n zod.object({\n PK: zod.string(),\n SK: zod.string()\n })\n );\n\nexport const fetchCursor = (input: unknown) => {\n const result = schema.safeParse(input);\n if (!result.success) {\n return undefined;\n }\n return result.data;\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,YAAY,QAAQ,qBAAqB;AAElD,MAAMC,MAAM,GAAGF,GAAG,CACbG,MAAM,CAAC,CAAC,CACRC,SAAS,CAACC,KAAK,IAAI;EAChB,MAAMC,OAAO,GAAGL,YAAY,CAACI,KAAK,CAAC;EACnC,IAAI,CAACC,OAAO,EAAE;IACV,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACtC;EACA,IAAI;IACA,OAAOC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAC;EAC9B,CAAC,CAAC,MAAM;IACJ,OAAOA,OAAO;EAClB;AACJ,CAAC,CAAC,CACDI,IAAI,CACDV,GAAG,CAACW,MAAM,CAAC;EACPC,EAAE,EAAEZ,GAAG,CAACG,MAAM,CAAC,CAAC;EAChBU,EAAE,EAAEb,GAAG,CAACG,MAAM,CAAC;AACnB,CAAC,CACL,CAAC;AAEL,OAAO,MAAMW,WAAW,GAAIC,KAAc,IAAK;EAC3C,MAAMC,MAAM,GAAGd,MAAM,CAACe,SAAS,CAACF,KAAK,CAAC;EACtC,IAAI,CAACC,MAAM,CAACE,OAAO,EAAE;IACjB,OAAOC,SAAS;EACpB;EACA,OAAOH,MAAM,CAACI,IAAI;AACtB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"storage/cursorSchema.js","sources":["../../src/storage/cursorSchema.ts"],"sourcesContent":["import zod from \"zod\";\nimport { decodeCursor } from \"@webiny/db-dynamodb\";\n\nconst schema = zod\n .string()\n .transform(value => {\n const decoded = decodeCursor(value);\n if (!decoded) {\n throw new Error(\"Invalid cursor.\");\n }\n try {\n return JSON.parse(decoded);\n } catch {\n return decoded;\n }\n })\n .pipe(\n zod.object({\n PK: zod.string(),\n SK: zod.string()\n })\n );\n\nexport const fetchCursor = (input: unknown) => {\n const result = schema.safeParse(input);\n if (!result.success) {\n return undefined;\n }\n return result.data;\n};\n"],"names":["schema","zod","value","decoded","decodeCursor","Error","JSON","fetchCursor","input","result"],"mappings":";;AAGA,MAAMA,SAASC,IAAAA,MACJ,GACN,SAAS,CAACC,CAAAA;IACP,MAAMC,UAAUC,aAAaF;IAC7B,IAAI,CAACC,SACD,MAAM,IAAIE,MAAM;IAEpB,IAAI;QACA,OAAOC,KAAK,KAAK,CAACH;IACtB,EAAE,OAAM;QACJ,OAAOA;IACX;AACJ,GACC,IAAI,CACDF,IAAI,MAAM,CAAC;IACP,IAAIA,IAAI,MAAM;IACd,IAAIA,IAAI,MAAM;AAClB;AAGD,MAAMM,cAAc,CAACC;IACxB,MAAMC,SAAST,OAAO,SAAS,CAACQ;IAChC,IAAI,CAACC,OAAO,OAAO,EACf;IAEJ,OAAOA,OAAO,IAAI;AACtB"}
package/storage/entity.js CHANGED
@@ -1,127 +1,120 @@
1
- import { createEntity as baseCreateEntity, createTable } from "@webiny/db-dynamodb";
2
- const createTableGSIIndexes = count => {
3
- const result = {};
4
- for (let i = 1; i <= count; i++) {
5
- result[`GSI${i}`] = {
6
- partitionKey: `GSI${i}_PK`,
7
- sortKey: `GSI${i}_SK`
1
+ import { createEntity, createTable } from "@webiny/db-dynamodb";
2
+ const createTableGSIIndexes = (count)=>{
3
+ const result = {};
4
+ for(let i = 1; i <= count; i++)result[`GSI${i}`] = {
5
+ partitionKey: `GSI${i}_PK`,
6
+ sortKey: `GSI${i}_SK`
8
7
  };
9
- }
10
- return result;
8
+ return result;
11
9
  };
12
- export const createEntity = params => {
13
- const {
14
- gsiAmount,
15
- client,
16
- tableName
17
- } = params;
18
- const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;
19
- if (!name) {
20
- throw new Error("Missing env.DB_TABLE_AUDIT_LOGS environment variable.");
21
- }
22
- const table = createTable({
23
- documentClient: client,
24
- name,
25
- indexes: {
26
- ...createTableGSIIndexes(gsiAmount)
27
- }
28
- });
29
- const entity = baseCreateEntity({
30
- name: "AuditLogs",
31
- table: table.table,
32
- attributes: {
33
- PK: {
34
- partitionKey: true
35
- },
36
- SK: {
37
- sortKey: true
38
- },
39
- GSI_TENANT: {
40
- type: "string",
41
- required: true
42
- },
43
- GSI1_PK: {
44
- type: "string",
45
- required: true
46
- },
47
- GSI1_SK: {
48
- type: "number",
49
- required: true
50
- },
51
- GSI2_PK: {
52
- type: "string",
53
- required: true
54
- },
55
- GSI2_SK: {
56
- type: "number",
57
- required: true
58
- },
59
- GSI3_PK: {
60
- type: "string",
61
- required: true
62
- },
63
- GSI3_SK: {
64
- type: "number",
65
- required: true
66
- },
67
- GSI4_PK: {
68
- type: "string",
69
- required: true
70
- },
71
- GSI4_SK: {
72
- type: "number",
73
- required: true
74
- },
75
- GSI5_PK: {
76
- type: "string",
77
- required: true
78
- },
79
- GSI5_SK: {
80
- type: "number",
81
- required: true
82
- },
83
- GSI6_PK: {
84
- type: "string",
85
- required: true
86
- },
87
- GSI6_SK: {
88
- type: "number",
89
- required: true
90
- },
91
- GSI7_PK: {
92
- type: "string",
93
- required: true
94
- },
95
- GSI7_SK: {
96
- type: "number",
97
- required: true
98
- },
99
- GSI8_PK: {
100
- type: "string",
101
- required: true
102
- },
103
- GSI8_SK: {
104
- type: "number",
105
- required: true
106
- },
107
- GSI9_PK: {
108
- type: "string",
109
- required: true
110
- },
111
- GSI9_SK: {
112
- type: "number",
113
- required: true
114
- },
115
- data: {
116
- type: "map",
117
- required: true
118
- }
119
- }
120
- });
121
- return {
122
- entity,
123
- table
124
- };
10
+ const entity_createEntity = (params)=>{
11
+ const { gsiAmount, client, tableName } = params;
12
+ const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;
13
+ if (!name) throw new Error("Missing env.DB_TABLE_AUDIT_LOGS environment variable.");
14
+ const table = createTable({
15
+ documentClient: client,
16
+ name,
17
+ indexes: {
18
+ ...createTableGSIIndexes(gsiAmount)
19
+ }
20
+ });
21
+ const entity = createEntity({
22
+ name: "AuditLogs",
23
+ table: table.table,
24
+ attributes: {
25
+ PK: {
26
+ partitionKey: true
27
+ },
28
+ SK: {
29
+ sortKey: true
30
+ },
31
+ GSI_TENANT: {
32
+ type: "string",
33
+ required: true
34
+ },
35
+ GSI1_PK: {
36
+ type: "string",
37
+ required: true
38
+ },
39
+ GSI1_SK: {
40
+ type: "number",
41
+ required: true
42
+ },
43
+ GSI2_PK: {
44
+ type: "string",
45
+ required: true
46
+ },
47
+ GSI2_SK: {
48
+ type: "number",
49
+ required: true
50
+ },
51
+ GSI3_PK: {
52
+ type: "string",
53
+ required: true
54
+ },
55
+ GSI3_SK: {
56
+ type: "number",
57
+ required: true
58
+ },
59
+ GSI4_PK: {
60
+ type: "string",
61
+ required: true
62
+ },
63
+ GSI4_SK: {
64
+ type: "number",
65
+ required: true
66
+ },
67
+ GSI5_PK: {
68
+ type: "string",
69
+ required: true
70
+ },
71
+ GSI5_SK: {
72
+ type: "number",
73
+ required: true
74
+ },
75
+ GSI6_PK: {
76
+ type: "string",
77
+ required: true
78
+ },
79
+ GSI6_SK: {
80
+ type: "number",
81
+ required: true
82
+ },
83
+ GSI7_PK: {
84
+ type: "string",
85
+ required: true
86
+ },
87
+ GSI7_SK: {
88
+ type: "number",
89
+ required: true
90
+ },
91
+ GSI8_PK: {
92
+ type: "string",
93
+ required: true
94
+ },
95
+ GSI8_SK: {
96
+ type: "number",
97
+ required: true
98
+ },
99
+ GSI9_PK: {
100
+ type: "string",
101
+ required: true
102
+ },
103
+ GSI9_SK: {
104
+ type: "number",
105
+ required: true
106
+ },
107
+ data: {
108
+ type: "map",
109
+ required: true
110
+ }
111
+ }
112
+ });
113
+ return {
114
+ entity,
115
+ table
116
+ };
125
117
  };
118
+ export { entity_createEntity as createEntity };
126
119
 
127
120
  //# sourceMappingURL=entity.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createEntity","baseCreateEntity","createTable","createTableGSIIndexes","count","result","i","partitionKey","sortKey","params","gsiAmount","client","tableName","name","process","env","DB_TABLE_AUDIT_LOGS","Error","table","documentClient","indexes","entity","attributes","PK","SK","GSI_TENANT","type","required","GSI1_PK","GSI1_SK","GSI2_PK","GSI2_SK","GSI3_PK","GSI3_SK","GSI4_PK","GSI4_SK","GSI5_PK","GSI5_SK","GSI6_PK","GSI6_SK","GSI7_PK","GSI7_SK","GSI8_PK","GSI8_SK","GSI9_PK","GSI9_SK","data"],"sources":["entity.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntity, IStandardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport { createEntity as baseCreateEntity, createTable } from \"@webiny/db-dynamodb\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStorageAuditLog } from \"~/storage/types.js\";\n\nexport interface IAuditLogsEntityAttributes extends Omit<\n IStandardEntityAttributes<IStorageAuditLog>,\n \"GSI1_SK\" | \"GSI2_SK\" | \"expiresAt\"\n> {\n GSI1_PK: string;\n GSI1_SK: number;\n GSI2_PK: string;\n GSI2_SK: number;\n GSI3_PK: string;\n GSI3_SK: number;\n GSI4_PK: string;\n GSI4_SK: number;\n GSI5_PK: string;\n GSI5_SK: number;\n GSI6_PK: string;\n GSI6_SK: number;\n GSI7_PK: string;\n GSI7_SK: number;\n GSI8_PK: string;\n GSI8_SK: number;\n GSI9_PK: string;\n GSI9_SK: number;\n expiresAt: number;\n}\n\nexport type AuditLogsEntity = IEntity<IAuditLogsEntityAttributes>;\n\nexport interface ICreateEntityParams {\n client: DynamoDBDocument;\n gsiAmount: number;\n tableName: string | undefined;\n}\n\nexport interface ICreateEntityResult {\n entity: AuditLogsEntity;\n table: ReturnType<typeof createTable>;\n}\n\nconst createTableGSIIndexes = (count: number) => {\n const result: GenericRecord = {};\n for (let i = 1; i <= count; i++) {\n result[`GSI${i}`] = {\n partitionKey: `GSI${i}_PK`,\n sortKey: `GSI${i}_SK`\n };\n }\n return result;\n};\n\nexport const createEntity = (params: ICreateEntityParams): ICreateEntityResult => {\n const { gsiAmount, client, tableName } = params;\n const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;\n if (!name) {\n throw new Error(\"Missing env.DB_TABLE_AUDIT_LOGS environment variable.\");\n }\n const table = createTable({\n documentClient: client,\n name,\n indexes: {\n ...createTableGSIIndexes(gsiAmount)\n }\n });\n\n const entity = baseCreateEntity<IAuditLogsEntityAttributes>({\n name: \"AuditLogs\",\n table: table.table,\n attributes: {\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 required: true\n },\n GSI1_SK: {\n type: \"number\",\n required: true\n },\n GSI2_PK: {\n type: \"string\",\n required: true\n },\n GSI2_SK: {\n type: \"number\",\n required: true\n },\n GSI3_PK: {\n type: \"string\",\n required: true\n },\n GSI3_SK: {\n type: \"number\",\n required: true\n },\n GSI4_PK: {\n type: \"string\",\n required: true\n },\n GSI4_SK: {\n type: \"number\",\n required: true\n },\n GSI5_PK: {\n type: \"string\",\n required: true\n },\n GSI5_SK: {\n type: \"number\",\n required: true\n },\n GSI6_PK: {\n type: \"string\",\n required: true\n },\n GSI6_SK: {\n type: \"number\",\n required: true\n },\n GSI7_PK: {\n type: \"string\",\n required: true\n },\n GSI7_SK: {\n type: \"number\",\n required: true\n },\n GSI8_PK: {\n type: \"string\",\n required: true\n },\n GSI8_SK: {\n type: \"number\",\n required: true\n },\n GSI9_PK: {\n type: \"string\",\n required: true\n },\n GSI9_SK: {\n type: \"number\",\n required: true\n },\n data: {\n type: \"map\",\n required: true\n }\n }\n });\n\n return {\n entity,\n table\n };\n};\n"],"mappings":"AAEA,SAASA,YAAY,IAAIC,gBAAgB,EAAEC,WAAW,QAAQ,qBAAqB;AA0CnF,MAAMC,qBAAqB,GAAIC,KAAa,IAAK;EAC7C,MAAMC,MAAqB,GAAG,CAAC,CAAC;EAChC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIF,KAAK,EAAEE,CAAC,EAAE,EAAE;IAC7BD,MAAM,CAAC,MAAMC,CAAC,EAAE,CAAC,GAAG;MAChBC,YAAY,EAAE,MAAMD,CAAC,KAAK;MAC1BE,OAAO,EAAE,MAAMF,CAAC;IACpB,CAAC;EACL;EACA,OAAOD,MAAM;AACjB,CAAC;AAED,OAAO,MAAML,YAAY,GAAIS,MAA2B,IAA0B;EAC9E,MAAM;IAAEC,SAAS;IAAEC,MAAM;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAC/C,MAAMI,IAAI,GAAGD,SAAS,IAAIE,OAAO,CAACC,GAAG,CAACC,mBAAmB;EACzD,IAAI,CAACH,IAAI,EAAE;IACP,MAAM,IAAII,KAAK,CAAC,uDAAuD,CAAC;EAC5E;EACA,MAAMC,KAAK,GAAGhB,WAAW,CAAC;IACtBiB,cAAc,EAAER,MAAM;IACtBE,IAAI;IACJO,OAAO,EAAE;MACL,GAAGjB,qBAAqB,CAACO,SAAS;IACtC;EACJ,CAAC,CAAC;EAEF,MAAMW,MAAM,GAAGpB,gBAAgB,CAA6B;IACxDY,IAAI,EAAE,WAAW;IACjBK,KAAK,EAAEA,KAAK,CAACA,KAAK;IAClBI,UAAU,EAAE;MACRC,EAAE,EAAE;QACAhB,YAAY,EAAE;MAClB,CAAC;MACDiB,EAAE,EAAE;QACAhB,OAAO,EAAE;MACb,CAAC;MACDiB,UAAU,EAAE;QACRC,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDC,OAAO,EAAE;QACLF,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDE,OAAO,EAAE;QACLH,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDG,OAAO,EAAE;QACLJ,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDI,OAAO,EAAE;QACLL,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDK,OAAO,EAAE;QACLN,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDM,OAAO,EAAE;QACLP,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDO,OAAO,EAAE;QACLR,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDQ,OAAO,EAAE;QACLT,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDS,OAAO,EAAE;QACLV,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDU,OAAO,EAAE;QACLX,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDW,OAAO,EAAE;QACLZ,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDY,OAAO,EAAE;QACLb,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDa,OAAO,EAAE;QACLd,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDc,OAAO,EAAE;QACLf,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDe,OAAO,EAAE;QACLhB,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDgB,OAAO,EAAE;QACLjB,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDiB,OAAO,EAAE;QACLlB,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDkB,OAAO,EAAE;QACLnB,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDmB,IAAI,EAAE;QACFpB,IAAI,EAAE,KAAK;QACXC,QAAQ,EAAE;MACd;IACJ;EACJ,CAAC,CAAC;EAEF,OAAO;IACHN,MAAM;IACNH;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"storage/entity.js","sources":["../../src/storage/entity.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntity, IStandardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport { createEntity as baseCreateEntity, createTable } from \"@webiny/db-dynamodb\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStorageAuditLog } from \"~/storage/types.js\";\n\nexport interface IAuditLogsEntityAttributes extends Omit<\n IStandardEntityAttributes<IStorageAuditLog>,\n \"GSI1_SK\" | \"GSI2_SK\" | \"expiresAt\"\n> {\n GSI1_PK: string;\n GSI1_SK: number;\n GSI2_PK: string;\n GSI2_SK: number;\n GSI3_PK: string;\n GSI3_SK: number;\n GSI4_PK: string;\n GSI4_SK: number;\n GSI5_PK: string;\n GSI5_SK: number;\n GSI6_PK: string;\n GSI6_SK: number;\n GSI7_PK: string;\n GSI7_SK: number;\n GSI8_PK: string;\n GSI8_SK: number;\n GSI9_PK: string;\n GSI9_SK: number;\n expiresAt: number;\n}\n\nexport type AuditLogsEntity = IEntity<IAuditLogsEntityAttributes>;\n\nexport interface ICreateEntityParams {\n client: DynamoDBDocument;\n gsiAmount: number;\n tableName: string | undefined;\n}\n\nexport interface ICreateEntityResult {\n entity: AuditLogsEntity;\n table: ReturnType<typeof createTable>;\n}\n\nconst createTableGSIIndexes = (count: number) => {\n const result: GenericRecord = {};\n for (let i = 1; i <= count; i++) {\n result[`GSI${i}`] = {\n partitionKey: `GSI${i}_PK`,\n sortKey: `GSI${i}_SK`\n };\n }\n return result;\n};\n\nexport const createEntity = (params: ICreateEntityParams): ICreateEntityResult => {\n const { gsiAmount, client, tableName } = params;\n const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;\n if (!name) {\n throw new Error(\"Missing env.DB_TABLE_AUDIT_LOGS environment variable.\");\n }\n const table = createTable({\n documentClient: client,\n name,\n indexes: {\n ...createTableGSIIndexes(gsiAmount)\n }\n });\n\n const entity = baseCreateEntity<IAuditLogsEntityAttributes>({\n name: \"AuditLogs\",\n table: table.table,\n attributes: {\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 required: true\n },\n GSI1_SK: {\n type: \"number\",\n required: true\n },\n GSI2_PK: {\n type: \"string\",\n required: true\n },\n GSI2_SK: {\n type: \"number\",\n required: true\n },\n GSI3_PK: {\n type: \"string\",\n required: true\n },\n GSI3_SK: {\n type: \"number\",\n required: true\n },\n GSI4_PK: {\n type: \"string\",\n required: true\n },\n GSI4_SK: {\n type: \"number\",\n required: true\n },\n GSI5_PK: {\n type: \"string\",\n required: true\n },\n GSI5_SK: {\n type: \"number\",\n required: true\n },\n GSI6_PK: {\n type: \"string\",\n required: true\n },\n GSI6_SK: {\n type: \"number\",\n required: true\n },\n GSI7_PK: {\n type: \"string\",\n required: true\n },\n GSI7_SK: {\n type: \"number\",\n required: true\n },\n GSI8_PK: {\n type: \"string\",\n required: true\n },\n GSI8_SK: {\n type: \"number\",\n required: true\n },\n GSI9_PK: {\n type: \"string\",\n required: true\n },\n GSI9_SK: {\n type: \"number\",\n required: true\n },\n data: {\n type: \"map\",\n required: true\n }\n }\n });\n\n return {\n entity,\n table\n };\n};\n"],"names":["createTableGSIIndexes","count","result","i","createEntity","params","gsiAmount","client","tableName","name","process","Error","table","createTable","entity","baseCreateEntity"],"mappings":";AA4CA,MAAMA,wBAAwB,CAACC;IAC3B,MAAMC,SAAwB,CAAC;IAC/B,IAAK,IAAIC,IAAI,GAAGA,KAAKF,OAAOE,IACxBD,MAAM,CAAC,CAAC,GAAG,EAAEC,GAAG,CAAC,GAAG;QAChB,cAAc,CAAC,GAAG,EAAEA,EAAE,GAAG,CAAC;QAC1B,SAAS,CAAC,GAAG,EAAEA,EAAE,GAAG,CAAC;IACzB;IAEJ,OAAOD;AACX;AAEO,MAAME,sBAAe,CAACC;IACzB,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGH;IACzC,MAAMI,OAAOD,aAAaE,QAAQ,GAAG,CAAC,mBAAmB;IACzD,IAAI,CAACD,MACD,MAAM,IAAIE,MAAM;IAEpB,MAAMC,QAAQC,YAAY;QACtB,gBAAgBN;QAChBE;QACA,SAAS;YACL,GAAGT,sBAAsBM,UAAU;QACvC;IACJ;IAEA,MAAMQ,SAASC,aAA6C;QACxD,MAAM;QACN,OAAOH,MAAM,KAAK;QAClB,YAAY;YACR,IAAI;gBACA,cAAc;YAClB;YACA,IAAI;gBACA,SAAS;YACb;YACA,YAAY;gBACR,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,MAAM;gBACF,MAAM;gBACN,UAAU;YACd;QACJ;IACJ;IAEA,OAAO;QACHE;QACAF;IACJ;AACJ"}
@@ -1,11 +1,12 @@
1
- export class ListErrorResult {
2
- success = false;
3
- constructor(params) {
4
- this.error = params.error;
5
- }
6
- static create(params) {
7
- return new ListErrorResult(params);
8
- }
1
+ class ListErrorResult {
2
+ constructor(params){
3
+ this.success = false;
4
+ this.error = params.error;
5
+ }
6
+ static create(params) {
7
+ return new ListErrorResult(params);
8
+ }
9
9
  }
10
+ export { ListErrorResult };
10
11
 
11
12
  //# sourceMappingURL=ListErrorResult.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ListErrorResult","success","constructor","params","error","create"],"sources":["ListErrorResult.ts"],"sourcesContent":["import type { IStorageListErrorResult } from \"~/storage/abstractions/Storage.js\";\n\nexport interface IListErrorResultParams {\n error: Error;\n}\n\nexport class ListErrorResult implements IStorageListErrorResult {\n public readonly error: Error;\n public readonly success = false;\n\n private constructor(params: IListErrorResultParams) {\n this.error = params.error;\n }\n\n public static create(params: IListErrorResultParams): IStorageListErrorResult {\n return new ListErrorResult(params);\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,eAAe,CAAoC;EAE5CC,OAAO,GAAG,KAAK;EAEvBC,WAAWA,CAACC,MAA8B,EAAE;IAChD,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;EAC7B;EAEA,OAAcC,MAAMA,CAACF,MAA8B,EAA2B;IAC1E,OAAO,IAAIH,eAAe,CAACG,MAAM,CAAC;EACtC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"storage/results/ListErrorResult.js","sources":["../../../src/storage/results/ListErrorResult.ts"],"sourcesContent":["import type { IStorageListErrorResult } from \"~/storage/abstractions/Storage.js\";\n\nexport interface IListErrorResultParams {\n error: Error;\n}\n\nexport class ListErrorResult implements IStorageListErrorResult {\n public readonly error: Error;\n public readonly success = false;\n\n private constructor(params: IListErrorResultParams) {\n this.error = params.error;\n }\n\n public static create(params: IListErrorResultParams): IStorageListErrorResult {\n return new ListErrorResult(params);\n }\n}\n"],"names":["ListErrorResult","params"],"mappings":"AAMO,MAAMA;IAIT,YAAoBC,MAA8B,CAAE;aAFpC,OAAO,GAAG;QAGtB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;IAC7B;IAEA,OAAc,OAAOA,MAA8B,EAA2B;QAC1E,OAAO,IAAID,gBAAgBC;IAC/B;AACJ"}
@@ -1,16 +1,17 @@
1
1
  import { encodeCursor } from "@webiny/db-dynamodb";
2
- export class ListSuccessResult {
3
- success = true;
4
- constructor(params) {
5
- this.data = params.data;
6
- this.meta = {
7
- after: encodeCursor(params.lastEvaluatedKey) || undefined,
8
- hasMoreItems: !!params.lastEvaluatedKey
9
- };
10
- }
11
- static create(params) {
12
- return new ListSuccessResult(params);
13
- }
2
+ class ListSuccessResult {
3
+ constructor(params){
4
+ this.success = true;
5
+ this.data = params.data;
6
+ this.meta = {
7
+ after: encodeCursor(params.lastEvaluatedKey) || void 0,
8
+ hasMoreItems: !!params.lastEvaluatedKey
9
+ };
10
+ }
11
+ static create(params) {
12
+ return new ListSuccessResult(params);
13
+ }
14
14
  }
15
+ export { ListSuccessResult };
15
16
 
16
17
  //# sourceMappingURL=ListSuccessResult.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["encodeCursor","ListSuccessResult","success","constructor","params","data","meta","after","lastEvaluatedKey","undefined","hasMoreItems","create"],"sources":["ListSuccessResult.ts"],"sourcesContent":["import type {\n IStorageListSuccessResult,\n IStorageListSuccessResultMeta\n} from \"~/storage/abstractions/Storage.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { encodeCursor } from \"@webiny/db-dynamodb\";\nimport type { IAuditLog } from \"~/storage/types.js\";\n\nexport interface IListSuccessResultParams {\n data: IAuditLog[];\n lastEvaluatedKey?: GenericRecord;\n}\n\nexport class ListSuccessResult implements IStorageListSuccessResult {\n public readonly data: IAuditLog[];\n public readonly meta: IStorageListSuccessResultMeta;\n public readonly success = true;\n\n protected constructor(params: IListSuccessResultParams) {\n this.data = params.data;\n this.meta = {\n after: encodeCursor(params.lastEvaluatedKey) || undefined,\n hasMoreItems: !!params.lastEvaluatedKey\n };\n }\n\n public static create(params: IListSuccessResultParams): IStorageListSuccessResult {\n return new ListSuccessResult(params);\n }\n}\n"],"mappings":"AAKA,SAASA,YAAY,QAAQ,qBAAqB;AAQlD,OAAO,MAAMC,iBAAiB,CAAsC;EAGhDC,OAAO,GAAG,IAAI;EAEpBC,WAAWA,CAACC,MAAgC,EAAE;IACpD,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,IAAI,GAAG;MACRC,KAAK,EAAEP,YAAY,CAACI,MAAM,CAACI,gBAAgB,CAAC,IAAIC,SAAS;MACzDC,YAAY,EAAE,CAAC,CAACN,MAAM,CAACI;IAC3B,CAAC;EACL;EAEA,OAAcG,MAAMA,CAACP,MAAgC,EAA6B;IAC9E,OAAO,IAAIH,iBAAiB,CAACG,MAAM,CAAC;EACxC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"storage/results/ListSuccessResult.js","sources":["../../../src/storage/results/ListSuccessResult.ts"],"sourcesContent":["import type {\n IStorageListSuccessResult,\n IStorageListSuccessResultMeta\n} from \"~/storage/abstractions/Storage.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { encodeCursor } from \"@webiny/db-dynamodb\";\nimport type { IAuditLog } from \"~/storage/types.js\";\n\nexport interface IListSuccessResultParams {\n data: IAuditLog[];\n lastEvaluatedKey?: GenericRecord;\n}\n\nexport class ListSuccessResult implements IStorageListSuccessResult {\n public readonly data: IAuditLog[];\n public readonly meta: IStorageListSuccessResultMeta;\n public readonly success = true;\n\n protected constructor(params: IListSuccessResultParams) {\n this.data = params.data;\n this.meta = {\n after: encodeCursor(params.lastEvaluatedKey) || undefined,\n hasMoreItems: !!params.lastEvaluatedKey\n };\n }\n\n public static create(params: IListSuccessResultParams): IStorageListSuccessResult {\n return new ListSuccessResult(params);\n }\n}\n"],"names":["ListSuccessResult","params","encodeCursor","undefined"],"mappings":";AAaO,MAAMA;IAKT,YAAsBC,MAAgC,CAAE;aAFxC,OAAO,GAAG;QAGtB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAG;YACR,OAAOC,aAAaD,OAAO,gBAAgB,KAAKE;YAChD,cAAc,CAAC,CAACF,OAAO,gBAAgB;QAC3C;IACJ;IAEA,OAAc,OAAOA,MAAgC,EAA6B;QAC9E,OAAO,IAAID,kBAAkBC;IACjC;AACJ"}
@@ -1,4 +1,2 @@
1
1
  export * from "./ListErrorResult.js";
2
2
  export * from "./ListSuccessResult.js";
3
-
4
- //# sourceMappingURL=index.js.map