@webiny/api-headless-cms-ddb-es 6.6.0-alpha.12 → 6.6.0-alpha.13

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 (101) hide show
  1. package/operations/entry/DdbEsCreateEntry.d.ts +3 -1
  2. package/operations/entry/DdbEsCreateEntry.js +18 -8
  3. package/operations/entry/DdbEsCreateEntry.js.map +1 -1
  4. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +3 -1
  5. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +23 -10
  6. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -1
  7. package/operations/entry/DdbEsDeleteEntry.d.ts +3 -3
  8. package/operations/entry/DdbEsDeleteEntry.js +7 -7
  9. package/operations/entry/DdbEsDeleteEntry.js.map +1 -1
  10. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +3 -1
  11. package/operations/entry/DdbEsDeleteEntryRevision.js +27 -11
  12. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -1
  13. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +3 -1
  14. package/operations/entry/DdbEsDeleteMultipleEntries.js +14 -7
  15. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -1
  16. package/operations/entry/DdbEsGetEntriesByIds.d.ts +3 -1
  17. package/operations/entry/DdbEsGetEntriesByIds.js +10 -3
  18. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -1
  19. package/operations/entry/DdbEsGetEntry.d.ts +3 -1
  20. package/operations/entry/DdbEsGetEntry.js +6 -2
  21. package/operations/entry/DdbEsGetEntry.js.map +1 -1
  22. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +3 -1
  23. package/operations/entry/DdbEsGetLatestEntriesByIds.js +10 -3
  24. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -1
  25. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +3 -1
  26. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +10 -3
  27. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -1
  28. package/operations/entry/DdbEsGetPreviousRevision.d.ts +3 -1
  29. package/operations/entry/DdbEsGetPreviousRevision.js +6 -3
  30. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -1
  31. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +3 -1
  32. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +10 -3
  33. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -1
  34. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +3 -1
  35. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +10 -3
  36. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -1
  37. package/operations/entry/DdbEsGetRevisionById.d.ts +3 -1
  38. package/operations/entry/DdbEsGetRevisionById.js +10 -3
  39. package/operations/entry/DdbEsGetRevisionById.js.map +1 -1
  40. package/operations/entry/DdbEsGetRevisions.d.ts +3 -1
  41. package/operations/entry/DdbEsGetRevisions.js +10 -3
  42. package/operations/entry/DdbEsGetRevisions.js.map +1 -1
  43. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +3 -1
  44. package/operations/entry/DdbEsGetUniqueFieldValues.js +6 -2
  45. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -1
  46. package/operations/entry/DdbEsListEntries.d.ts +3 -1
  47. package/operations/entry/DdbEsListEntries.js +6 -2
  48. package/operations/entry/DdbEsListEntries.js.map +1 -1
  49. package/operations/entry/DdbEsMoveEntry.d.ts +3 -3
  50. package/operations/entry/DdbEsMoveEntry.js +8 -8
  51. package/operations/entry/DdbEsMoveEntry.js.map +1 -1
  52. package/operations/entry/DdbEsMoveToBin.d.ts +3 -1
  53. package/operations/entry/DdbEsMoveToBin.js +8 -4
  54. package/operations/entry/DdbEsMoveToBin.js.map +1 -1
  55. package/operations/entry/DdbEsPublishEntry.d.ts +3 -1
  56. package/operations/entry/DdbEsPublishEntry.js +31 -15
  57. package/operations/entry/DdbEsPublishEntry.js.map +1 -1
  58. package/operations/entry/DdbEsRestoreFromBin.d.ts +3 -1
  59. package/operations/entry/DdbEsRestoreFromBin.js +8 -4
  60. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -1
  61. package/operations/entry/DdbEsUnpublishEntry.d.ts +3 -1
  62. package/operations/entry/DdbEsUnpublishEntry.js +22 -9
  63. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -1
  64. package/operations/entry/DdbEsUpdateEntry.d.ts +3 -1
  65. package/operations/entry/DdbEsUpdateEntry.js +27 -11
  66. package/operations/entry/DdbEsUpdateEntry.js.map +1 -1
  67. package/operations/entry/keys.d.ts +7 -6
  68. package/operations/entry/keys.js +6 -6
  69. package/operations/entry/keys.js.map +1 -1
  70. package/operations/group/DdbEsCreateGroup.d.ts +3 -1
  71. package/operations/group/DdbEsCreateGroup.js +14 -4
  72. package/operations/group/DdbEsCreateGroup.js.map +1 -1
  73. package/operations/group/DdbEsDeleteGroup.d.ts +3 -1
  74. package/operations/group/DdbEsDeleteGroup.js +10 -3
  75. package/operations/group/DdbEsDeleteGroup.js.map +1 -1
  76. package/operations/group/DdbEsGetGroup.d.ts +3 -1
  77. package/operations/group/DdbEsGetGroup.js +10 -3
  78. package/operations/group/DdbEsGetGroup.js.map +1 -1
  79. package/operations/group/DdbEsListGroups.d.ts +3 -1
  80. package/operations/group/DdbEsListGroups.js +9 -3
  81. package/operations/group/DdbEsListGroups.js.map +1 -1
  82. package/operations/group/DdbEsUpdateGroup.d.ts +3 -1
  83. package/operations/group/DdbEsUpdateGroup.js +14 -4
  84. package/operations/group/DdbEsUpdateGroup.js.map +1 -1
  85. package/operations/model/DdbEsCreateModel.d.ts +3 -1
  86. package/operations/model/DdbEsCreateModel.js +14 -4
  87. package/operations/model/DdbEsCreateModel.js.map +1 -1
  88. package/operations/model/DdbEsDeleteModel.d.ts +3 -1
  89. package/operations/model/DdbEsDeleteModel.js +10 -3
  90. package/operations/model/DdbEsDeleteModel.js.map +1 -1
  91. package/operations/model/DdbEsGetModel.d.ts +3 -1
  92. package/operations/model/DdbEsGetModel.js +10 -3
  93. package/operations/model/DdbEsGetModel.js.map +1 -1
  94. package/operations/model/DdbEsListModels.d.ts +4 -2
  95. package/operations/model/DdbEsListModels.js +10 -5
  96. package/operations/model/DdbEsListModels.js.map +1 -1
  97. package/operations/model/DdbEsUpdateModel.d.ts +3 -1
  98. package/operations/model/DdbEsUpdateModel.js +14 -4
  99. package/operations/model/DdbEsUpdateModel.js.map +1 -1
  100. package/package.json +26 -26
  101. package/types.js.map +1 -1
@@ -4,24 +4,33 @@ import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/s
4
4
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
5
5
  import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
6
6
  import { createKeys, createType } from "./keys.js";
7
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
7
8
  import { CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
8
9
  class DdbEsCreateModelImpl {
9
- constructor(entity, openSearchClient, indexProvider){
10
+ constructor(entity, openSearchClient, indexProvider, scopeTenant){
10
11
  this.entity = entity;
11
12
  this.indexProvider = indexProvider;
13
+ this.scopeTenant = scopeTenant;
12
14
  this.elasticsearch = openSearchClient.use();
13
15
  }
14
16
  async execute(params) {
15
17
  const { model } = params;
18
+ const tenant = this.scopeTenant.getId();
16
19
  const configurations = createConfigurations(this.indexProvider);
17
20
  const { index } = await configurations.es({
18
21
  model
19
22
  });
20
- const keys = createKeys(model);
23
+ const keys = createKeys({
24
+ tenant,
25
+ modelId: model.modelId
26
+ });
21
27
  let error;
22
28
  try {
23
29
  await this.entity.put({
24
- data: model,
30
+ data: {
31
+ ...model,
32
+ tenant
33
+ },
25
34
  ...keys,
26
35
  TYPE: createType()
27
36
  });
@@ -48,7 +57,8 @@ const DdbEsCreateModel = CreateModelStorageOperation.createImplementation({
48
57
  dependencies: [
49
58
  CmsDdbEsModelEntity,
50
59
  OpenSearchClient,
51
- CmsModelOpenSearchIndexProvider
60
+ CmsModelOpenSearchIndexProvider,
61
+ ScopeTenant
52
62
  ]
53
63
  });
54
64
  export { DdbEsCreateModel };
@@ -1 +1 @@
1
- {"version":3,"file":"operations/model/DdbEsCreateModel.js","sources":["../../../src/operations/model/DdbEsCreateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { CreateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport { createKeys, createType } from \"./keys.js\";\nimport { CmsModelOpenSearchIndexProvider } from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\n\nclass DdbEsCreateModelImpl implements CreateModelStorageOperation.Interface {\n private elasticsearch;\n\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute(params: CmsModelStorageOperationsCreateParams) {\n const { model } = params;\n\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const keys = createKeys(model);\n\n let error;\n try {\n await this.entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n error = ex;\n }\n try {\n await this.elasticsearch.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not delete elasticsearch index \"${index}\" after model record failed to be created.`,\n \"DELETE_MODEL_INDEX_ERROR\",\n {\n dynamodbError: error,\n elasticsearchError: ex\n }\n );\n }\n throw error;\n }\n}\n\nexport const DdbEsCreateModel = CreateModelStorageOperation.createImplementation({\n implementation: DdbEsCreateModelImpl,\n dependencies: [CmsDdbEsModelEntity, OpenSearchClient, CmsModelOpenSearchIndexProvider]\n});\n"],"names":["DdbEsCreateModelImpl","entity","openSearchClient","indexProvider","params","model","configurations","createConfigurations","index","keys","createKeys","error","createType","ex","WebinyError","DdbEsCreateModel","CreateModelStorageOperation","CmsDdbEsModelEntity","OpenSearchClient","CmsModelOpenSearchIndexProvider"],"mappings":";;;;;;;AASA,MAAMA;IAGF,YACYC,MAAqC,EAC7CC,gBAA4C,EACpCC,aAAwD,CAClE;aAHUF,MAAM,GAANA;aAEAE,aAAa,GAAbA;QAER,IAAI,CAAC,aAAa,GAAGD,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QAAQE,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCD;QACJ;QAEA,MAAMI,OAAOC,WAAWL;QAExB,IAAIM;QACJ,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMN;gBACN,GAAGI,IAAI;gBACP,MAAMG;YACV;YACA,OAAOP;QACX,EAAE,OAAOQ,IAAI;YACTF,QAAQE;QACZ;QACA,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;gBACpCL;gBACA,oBAAoB;YACxB;QACJ,EAAE,OAAOK,IAAI;YACT,MAAM,IAAIC,cACN,CAAC,sCAAsC,EAAEN,MAAM,0CAA0C,CAAC,EAC1F,4BACA;gBACI,eAAeG;gBACf,oBAAoBE;YACxB;QAER;QACA,MAAMF;IACV;AACJ;AAEO,MAAMI,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBhB;IAChB,cAAc;QAACiB;QAAqBC;QAAkBC;KAAgC;AAC1F"}
1
+ {"version":3,"file":"operations/model/DdbEsCreateModel.js","sources":["../../../src/operations/model/DdbEsCreateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { CreateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport { createKeys, createType } from \"./keys.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { CmsModelOpenSearchIndexProvider } from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\n\nclass DdbEsCreateModelImpl implements CreateModelStorageOperation.Interface {\n private elasticsearch;\n\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute(params: CmsModelStorageOperationsCreateParams) {\n const { model } = params;\n const tenant = this.scopeTenant.getId();\n\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const keys = createKeys({ tenant, modelId: model.modelId });\n\n let error;\n try {\n await this.entity.put({\n data: { ...model, tenant },\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n error = ex;\n }\n try {\n await this.elasticsearch.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not delete elasticsearch index \"${index}\" after model record failed to be created.`,\n \"DELETE_MODEL_INDEX_ERROR\",\n {\n dynamodbError: error,\n elasticsearchError: ex\n }\n );\n }\n throw error;\n }\n}\n\nexport const DdbEsCreateModel = CreateModelStorageOperation.createImplementation({\n implementation: DdbEsCreateModelImpl,\n dependencies: [\n CmsDdbEsModelEntity,\n OpenSearchClient,\n CmsModelOpenSearchIndexProvider,\n ScopeTenant\n ]\n});\n"],"names":["DdbEsCreateModelImpl","entity","openSearchClient","indexProvider","scopeTenant","params","model","tenant","configurations","createConfigurations","index","keys","createKeys","error","createType","ex","WebinyError","DdbEsCreateModel","CreateModelStorageOperation","CmsDdbEsModelEntity","OpenSearchClient","CmsModelOpenSearchIndexProvider","ScopeTenant"],"mappings":";;;;;;;;AAUA,MAAMA;IAGF,YACYC,MAAqC,EAC7CC,gBAA4C,EACpCC,aAAwD,EACxDC,WAAkC,CAC5C;aAJUH,MAAM,GAANA;aAEAE,aAAa,GAAbA;aACAC,WAAW,GAAXA;QAER,IAAI,CAAC,aAAa,GAAGF,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QAAQG,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QAErC,MAAMC,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCF;QACJ;QAEA,MAAMK,OAAOC,WAAW;YAAEL;YAAQ,SAASD,MAAM,OAAO;QAAC;QAEzD,IAAIO;QACJ,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAM;oBAAE,GAAGP,KAAK;oBAAEC;gBAAO;gBACzB,GAAGI,IAAI;gBACP,MAAMG;YACV;YACA,OAAOR;QACX,EAAE,OAAOS,IAAI;YACTF,QAAQE;QACZ;QACA,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;gBACpCL;gBACA,oBAAoB;YACxB;QACJ,EAAE,OAAOK,IAAI;YACT,MAAM,IAAIC,cACN,CAAC,sCAAsC,EAAEN,MAAM,0CAA0C,CAAC,EAC1F,4BACA;gBACI,eAAeG;gBACf,oBAAoBE;YACxB;QAER;QACA,MAAMF;IACV;AACJ;AAEO,MAAMI,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBlB;IAChB,cAAc;QACVmB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -1,9 +1,11 @@
1
1
  import type { CmsModelStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
2
2
  import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  declare class DdbEsDeleteModelImpl implements DeleteModelStorageOperation.Interface {
5
6
  private entity;
6
- constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ private scopeTenant;
8
+ constructor(entity: CmsDdbEsModelEntity.Interface, scopeTenant: ScopeTenant.Interface);
7
9
  execute(params: CmsModelStorageOperationsDeleteParams): Promise<void>;
8
10
  }
9
11
  export declare const DdbEsDeleteModel: typeof DdbEsDeleteModelImpl & {
@@ -1,14 +1,20 @@
1
1
  import error from "@webiny/error";
2
2
  import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  import { createKeys } from "./keys.js";
5
6
  class DdbEsDeleteModelImpl {
6
- constructor(entity){
7
+ constructor(entity, scopeTenant){
7
8
  this.entity = entity;
9
+ this.scopeTenant = scopeTenant;
8
10
  }
9
11
  async execute(params) {
10
12
  const { model } = params;
11
- const keys = createKeys(model);
13
+ const tenant = this.scopeTenant.getId();
14
+ const keys = createKeys({
15
+ tenant,
16
+ modelId: model.modelId
17
+ });
12
18
  try {
13
19
  await this.entity.delete(keys);
14
20
  } catch (ex) {
@@ -23,7 +29,8 @@ class DdbEsDeleteModelImpl {
23
29
  const DdbEsDeleteModel = DeleteModelStorageOperation.createImplementation({
24
30
  implementation: DdbEsDeleteModelImpl,
25
31
  dependencies: [
26
- CmsDdbEsModelEntity
32
+ CmsDdbEsModelEntity,
33
+ ScopeTenant
27
34
  ]
28
35
  });
29
36
  export { DdbEsDeleteModel };
@@ -1 +1 @@
1
- {"version":3,"file":"operations/model/DdbEsDeleteModel.js","sources":["../../../src/operations/model/DdbEsDeleteModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsDeleteParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { DeleteModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbEsDeleteModelImpl implements DeleteModelStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsDeleteParams): Promise<void> {\n const { model } = params;\n const keys = createKeys(model);\n\n try {\n await this.entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteModel = DeleteModelStorageOperation.createImplementation({\n implementation: DdbEsDeleteModelImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsDeleteModelImpl","entity","params","model","keys","createKeys","ex","WebinyError","DdbEsDeleteModel","DeleteModelStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA6C,EAAiB;QACxE,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QAExB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC;QAC7B,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPH;gBACAC;YACJ;QAER;IACJ;AACJ;AAEO,MAAMI,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBT;IAChB,cAAc;QAACU;KAAoB;AACvC"}
1
+ {"version":3,"file":"operations/model/DdbEsDeleteModel.js","sources":["../../../src/operations/model/DdbEsDeleteModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsDeleteParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { DeleteModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbEsDeleteModelImpl implements DeleteModelStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(params: CmsModelStorageOperationsDeleteParams): Promise<void> {\n const { model } = params;\n const tenant = this.scopeTenant.getId();\n const keys = createKeys({ tenant, modelId: model.modelId });\n\n try {\n await this.entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteModel = DeleteModelStorageOperation.createImplementation({\n implementation: DdbEsDeleteModelImpl,\n dependencies: [CmsDdbEsModelEntity, ScopeTenant]\n});\n"],"names":["DdbEsDeleteModelImpl","entity","scopeTenant","params","model","tenant","keys","createKeys","ex","WebinyError","DdbEsDeleteModel","DeleteModelStorageOperation","CmsDdbEsModelEntity","ScopeTenant"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,MAAqC,EACrCC,WAAkC,CAC5C;aAFUD,MAAM,GAANA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,MAA6C,EAAiB;QACxE,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,OAAOC,WAAW;YAAEF;YAAQ,SAASD,MAAM,OAAO;QAAC;QAEzD,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAACE;QAC7B,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPJ;gBACAE;YACJ;QAER;IACJ;AACJ;AAEO,MAAMI,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBX;IAChB,cAAc;QAACY;QAAqBC;KAAY;AACpD"}
@@ -1,9 +1,11 @@
1
1
  import type { CmsModelStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
2
2
  import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  declare class DdbEsGetModelImpl implements GetModelStorageOperation.Interface {
5
6
  private entity;
6
- constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ private scopeTenant;
8
+ constructor(entity: CmsDdbEsModelEntity.Interface, scopeTenant: ScopeTenant.Interface);
7
9
  execute(params: CmsModelStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel | null>;
8
10
  }
9
11
  export declare const DdbEsGetModel: typeof DdbEsGetModelImpl & {
@@ -1,13 +1,19 @@
1
1
  import error from "@webiny/error";
2
2
  import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  import { createKeys } from "./keys.js";
5
6
  class DdbEsGetModelImpl {
6
- constructor(entity){
7
+ constructor(entity, scopeTenant){
7
8
  this.entity = entity;
9
+ this.scopeTenant = scopeTenant;
8
10
  }
9
11
  async execute(params) {
10
- const keys = createKeys(params);
12
+ const tenant = this.scopeTenant.getId();
13
+ const keys = createKeys({
14
+ tenant,
15
+ modelId: params.modelId
16
+ });
11
17
  try {
12
18
  const result = await this.entity.get(keys);
13
19
  return result ? result.data : null;
@@ -22,7 +28,8 @@ class DdbEsGetModelImpl {
22
28
  const DdbEsGetModel = GetModelStorageOperation.createImplementation({
23
29
  implementation: DdbEsGetModelImpl,
24
30
  dependencies: [
25
- CmsDdbEsModelEntity
31
+ CmsDdbEsModelEntity,
32
+ ScopeTenant
26
33
  ]
27
34
  });
28
35
  export { DdbEsGetModel };
@@ -1 +1 @@
1
- {"version":3,"file":"operations/model/DdbEsGetModel.js","sources":["../../../src/operations/model/DdbEsGetModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsGetParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { GetModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbEsGetModelImpl implements GetModelStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsGetParams) {\n const keys = createKeys(params);\n\n try {\n const result = await this.entity.get(keys);\n\n return result ? result.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsGetModel = GetModelStorageOperation.createImplementation({\n implementation: DdbEsGetModelImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsGetModelImpl","entity","params","keys","createKeys","result","ex","WebinyError","DdbEsGetModel","GetModelStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA0C,EAAE;QACtD,MAAMC,OAAOC,WAAWF;QAExB,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACF;YAErC,OAAOE,SAASA,OAAO,IAAI,GAAG;QAClC,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBACI,OAAOA;gBACPH;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,gBAAgBC,yBAAyB,oBAAoB,CAAC;IACvE,gBAAgBT;IAChB,cAAc;QAACU;KAAoB;AACvC"}
1
+ {"version":3,"file":"operations/model/DdbEsGetModel.js","sources":["../../../src/operations/model/DdbEsGetModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsGetParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { GetModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbEsGetModelImpl implements GetModelStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(params: CmsModelStorageOperationsGetParams) {\n const tenant = this.scopeTenant.getId();\n const keys = createKeys({ tenant, modelId: params.modelId });\n\n try {\n const result = await this.entity.get(keys);\n\n return result ? result.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsGetModel = GetModelStorageOperation.createImplementation({\n implementation: DdbEsGetModelImpl,\n dependencies: [CmsDdbEsModelEntity, ScopeTenant]\n});\n"],"names":["DdbEsGetModelImpl","entity","scopeTenant","params","tenant","keys","createKeys","result","ex","WebinyError","DdbEsGetModel","GetModelStorageOperation","CmsDdbEsModelEntity","ScopeTenant"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,MAAqC,EACrCC,WAAkC,CAC5C;aAFUD,MAAM,GAANA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,MAA0C,EAAE;QACtD,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,OAAOC,WAAW;YAAEF;YAAQ,SAASD,OAAO,OAAO;QAAC;QAE1D,IAAI;YACA,MAAMI,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACF;YAErC,OAAOE,SAASA,OAAO,IAAI,GAAG;QAClC,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBACI,OAAOA;gBACPH;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,gBAAgBC,yBAAyB,oBAAoB,CAAC;IACvE,gBAAgBX;IAChB,cAAc;QAACY;QAAqBC;KAAY;AACpD"}
@@ -1,10 +1,12 @@
1
1
  import type { CmsModelStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
2
2
  import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  declare class DdbEsListModelsImpl implements ListModelsStorageOperation.Interface {
5
6
  private entity;
6
- constructor(entity: CmsDdbEsModelEntity.Interface);
7
- execute(params: CmsModelStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel[]>;
7
+ private scopeTenant;
8
+ constructor(entity: CmsDdbEsModelEntity.Interface, scopeTenant: ScopeTenant.Interface);
9
+ execute(_params: CmsModelStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel[]>;
8
10
  }
9
11
  export declare const DdbEsListModels: typeof DdbEsListModelsImpl & {
10
12
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js").IListModelsStorageOperation>;
@@ -1,14 +1,18 @@
1
1
  import error from "@webiny/error";
2
2
  import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  import { createPartitionKey } from "./keys.js";
5
6
  class DdbEsListModelsImpl {
6
- constructor(entity){
7
+ constructor(entity, scopeTenant){
7
8
  this.entity = entity;
9
+ this.scopeTenant = scopeTenant;
8
10
  }
9
- async execute(params) {
10
- const { where } = params;
11
- const partitionKey = createPartitionKey(where);
11
+ async execute(_params) {
12
+ const tenant = this.scopeTenant.getId();
13
+ const partitionKey = createPartitionKey({
14
+ tenant
15
+ });
12
16
  try {
13
17
  const result = await this.entity.queryAll({
14
18
  partitionKey,
@@ -28,7 +32,8 @@ class DdbEsListModelsImpl {
28
32
  const DdbEsListModels = ListModelsStorageOperation.createImplementation({
29
33
  implementation: DdbEsListModelsImpl,
30
34
  dependencies: [
31
- CmsDdbEsModelEntity
35
+ CmsDdbEsModelEntity,
36
+ ScopeTenant
32
37
  ]
33
38
  });
34
39
  export { DdbEsListModels };
@@ -1 +1 @@
1
- {"version":3,"file":"operations/model/DdbEsListModels.js","sources":["../../../src/operations/model/DdbEsListModels.ts"],"sourcesContent":["import type { CmsModelStorageOperationsListParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { ListModelsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbEsListModelsImpl implements ListModelsStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsListParams) {\n const { where } = params;\n const partitionKey = createPartitionKey(where);\n try {\n const result = await this.entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n return result ? result.map(item => item.data) : [];\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey\n }\n );\n }\n }\n}\n\nexport const DdbEsListModels = ListModelsStorageOperation.createImplementation({\n implementation: DdbEsListModelsImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsListModelsImpl","entity","params","where","partitionKey","createPartitionKey","result","item","ex","WebinyError","DdbEsListModels","ListModelsStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA2C,EAAE;QACvD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,eAAeC,mBAAmBF;QACxC,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACtCF;gBACA,SAAS;oBACL,KAAK;gBACT;YACJ;YACA,OAAOE,SAASA,OAAO,GAAG,CAACC,CAAAA,OAAQA,KAAK,IAAI,IAAI,EAAE;QACtD,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,0BACdA,GAAG,IAAI,IAAI,oBACX;gBACI,OAAOA;gBACPJ;YACJ;QAER;IACJ;AACJ;AAEO,MAAMM,kBAAkBC,2BAA2B,oBAAoB,CAAC;IAC3E,gBAAgBX;IAChB,cAAc;QAACY;KAAoB;AACvC"}
1
+ {"version":3,"file":"operations/model/DdbEsListModels.js","sources":["../../../src/operations/model/DdbEsListModels.ts"],"sourcesContent":["import type { CmsModelStorageOperationsListParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { ListModelsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbEsListModelsImpl implements ListModelsStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(_params: CmsModelStorageOperationsListParams) {\n const tenant = this.scopeTenant.getId();\n const partitionKey = createPartitionKey({ tenant });\n try {\n const result = await this.entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n return result ? result.map(item => item.data) : [];\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey\n }\n );\n }\n }\n}\n\nexport const DdbEsListModels = ListModelsStorageOperation.createImplementation({\n implementation: DdbEsListModelsImpl,\n dependencies: [CmsDdbEsModelEntity, ScopeTenant]\n});\n"],"names":["DdbEsListModelsImpl","entity","scopeTenant","_params","tenant","partitionKey","createPartitionKey","result","item","ex","WebinyError","DdbEsListModels","ListModelsStorageOperation","CmsDdbEsModelEntity","ScopeTenant"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,MAAqC,EACrCC,WAAkC,CAC5C;aAFUD,MAAM,GAANA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,OAA4C,EAAE;QACxD,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,eAAeC,mBAAmB;YAAEF;QAAO;QACjD,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACtCF;gBACA,SAAS;oBACL,KAAK;gBACT;YACJ;YACA,OAAOE,SAASA,OAAO,GAAG,CAACC,CAAAA,OAAQA,KAAK,IAAI,IAAI,EAAE;QACtD,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,0BACdA,GAAG,IAAI,IAAI,oBACX;gBACI,OAAOA;gBACPJ;YACJ;QAER;IACJ;AACJ;AAEO,MAAMM,kBAAkBC,2BAA2B,oBAAoB,CAAC;IAC3E,gBAAgBZ;IAChB,cAAc;QAACa;QAAqBC;KAAY;AACpD"}
@@ -1,9 +1,11 @@
1
1
  import type { CmsModelStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
2
2
  import { UpdateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  declare class DdbEsUpdateModelImpl implements UpdateModelStorageOperation.Interface {
5
6
  private entity;
6
- constructor(entity: CmsDdbEsModelEntity.Interface);
7
+ private scopeTenant;
8
+ constructor(entity: CmsDdbEsModelEntity.Interface, scopeTenant: ScopeTenant.Interface);
7
9
  execute(params: CmsModelStorageOperationsUpdateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
8
10
  }
9
11
  export declare const DdbEsUpdateModel: typeof DdbEsUpdateModelImpl & {
@@ -1,17 +1,26 @@
1
1
  import error from "@webiny/error";
2
2
  import { UpdateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js";
3
3
  import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
4
+ import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
4
5
  import { createKeys, createType } from "./keys.js";
5
6
  class DdbEsUpdateModelImpl {
6
- constructor(entity){
7
+ constructor(entity, scopeTenant){
7
8
  this.entity = entity;
9
+ this.scopeTenant = scopeTenant;
8
10
  }
9
11
  async execute(params) {
10
12
  const { model } = params;
11
- const keys = createKeys(model);
13
+ const tenant = this.scopeTenant.getId();
14
+ const keys = createKeys({
15
+ tenant,
16
+ modelId: model.modelId
17
+ });
12
18
  try {
13
19
  await this.entity.put({
14
- data: model,
20
+ data: {
21
+ ...model,
22
+ tenant
23
+ },
15
24
  ...keys,
16
25
  TYPE: createType()
17
26
  });
@@ -28,7 +37,8 @@ class DdbEsUpdateModelImpl {
28
37
  const DdbEsUpdateModel = UpdateModelStorageOperation.createImplementation({
29
38
  implementation: DdbEsUpdateModelImpl,
30
39
  dependencies: [
31
- CmsDdbEsModelEntity
40
+ CmsDdbEsModelEntity,
41
+ ScopeTenant
32
42
  ]
33
43
  });
34
44
  export { DdbEsUpdateModel };
@@ -1 +1 @@
1
- {"version":3,"file":"operations/model/DdbEsUpdateModel.js","sources":["../../../src/operations/model/DdbEsUpdateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { UpdateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbEsUpdateModelImpl implements UpdateModelStorageOperation.Interface {\n constructor(private entity: CmsDdbEsModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsUpdateParams) {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await this.entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsUpdateModel = UpdateModelStorageOperation.createImplementation({\n implementation: DdbEsUpdateModelImpl,\n dependencies: [CmsDdbEsModelEntity]\n});\n"],"names":["DdbEsUpdateModelImpl","entity","params","model","keys","createKeys","createType","ex","WebinyError","DdbEsUpdateModel","UpdateModelStorageOperation","CmsDdbEsModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAqC,CAAE;aAAvCA,MAAM,GAANA;IAAwC;IAE5D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,OAAOC,WAAWF;QAExB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMA;gBACN,GAAGC,IAAI;gBACP,MAAME;YACV;YACA,OAAOH;QACX,EAAE,OAAOI,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPJ;gBACAC;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBV;IAChB,cAAc;QAACW;KAAoB;AACvC"}
1
+ {"version":3,"file":"operations/model/DdbEsUpdateModel.js","sources":["../../../src/operations/model/DdbEsUpdateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { UpdateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbEsUpdateModelImpl implements UpdateModelStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsModelEntity.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(params: CmsModelStorageOperationsUpdateParams) {\n const { model } = params;\n\n const tenant = this.scopeTenant.getId();\n const keys = createKeys({ tenant, modelId: model.modelId });\n\n try {\n await this.entity.put({\n data: { ...model, tenant },\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsUpdateModel = UpdateModelStorageOperation.createImplementation({\n implementation: DdbEsUpdateModelImpl,\n dependencies: [CmsDdbEsModelEntity, ScopeTenant]\n});\n"],"names":["DdbEsUpdateModelImpl","entity","scopeTenant","params","model","tenant","keys","createKeys","createType","ex","WebinyError","DdbEsUpdateModel","UpdateModelStorageOperation","CmsDdbEsModelEntity","ScopeTenant"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,MAAqC,EACrCC,WAAkC,CAC5C;aAFUD,MAAM,GAANA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,OAAOC,WAAW;YAAEF;YAAQ,SAASD,MAAM,OAAO;QAAC;QAEzD,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAM;oBAAE,GAAGA,KAAK;oBAAEC;gBAAO;gBACzB,GAAGC,IAAI;gBACP,MAAME;YACV;YACA,OAAOJ;QACX,EAAE,OAAOK,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPL;gBACAE;YACJ;QAER;IACJ;AACJ;AAEO,MAAMK,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBZ;IAChB,cAAc;QAACa;QAAqBC;KAAY;AACpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "6.6.0-alpha.12",
3
+ "version": "6.6.0-alpha.13",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -30,40 +30,40 @@
30
30
  ],
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@webiny/api": "6.6.0-alpha.12",
34
- "@webiny/api-core": "6.6.0-alpha.12",
35
- "@webiny/api-headless-cms": "6.6.0-alpha.12",
36
- "@webiny/api-headless-cms-storage": "6.6.0-alpha.12",
37
- "@webiny/api-headless-cms-utils-os": "6.6.0-alpha.12",
38
- "@webiny/api-opensearch": "6.6.0-alpha.12",
39
- "@webiny/api-opensearch-aws": "6.6.0-alpha.12",
40
- "@webiny/api-search-index-tasks": "6.6.0-alpha.12",
41
- "@webiny/db": "6.6.0-alpha.12",
42
- "@webiny/db-dynamodb": "6.6.0-alpha.12",
43
- "@webiny/error": "6.6.0-alpha.12",
44
- "@webiny/feature": "6.6.0-alpha.12",
45
- "@webiny/plugins": "6.6.0-alpha.12",
33
+ "@webiny/api": "6.6.0-alpha.13",
34
+ "@webiny/api-core": "6.6.0-alpha.13",
35
+ "@webiny/api-headless-cms": "6.6.0-alpha.13",
36
+ "@webiny/api-headless-cms-storage": "6.6.0-alpha.13",
37
+ "@webiny/api-headless-cms-utils-os": "6.6.0-alpha.13",
38
+ "@webiny/api-opensearch": "6.6.0-alpha.13",
39
+ "@webiny/api-opensearch-aws": "6.6.0-alpha.13",
40
+ "@webiny/api-search-index-tasks": "6.6.0-alpha.13",
41
+ "@webiny/db": "6.6.0-alpha.13",
42
+ "@webiny/db-dynamodb": "6.6.0-alpha.13",
43
+ "@webiny/error": "6.6.0-alpha.13",
44
+ "@webiny/feature": "6.6.0-alpha.13",
45
+ "@webiny/plugins": "6.6.0-alpha.13",
46
46
  "@webiny/stdlib": "0.0.21",
47
- "@webiny/utils": "6.6.0-alpha.12",
47
+ "@webiny/utils": "6.6.0-alpha.13",
48
48
  "dataloader": "2.2.3",
49
49
  "lodash": "4.18.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/jsonpack": "1.1.6",
53
- "@webiny/api-core-testing": "6.6.0-alpha.12",
54
- "@webiny/api-graphql": "6.6.0-alpha.12",
55
- "@webiny/api-search-index-tasks-ddb-os": "6.6.0-alpha.12",
56
- "@webiny/api-sync-ddb-to-opensearch": "6.6.0-alpha.12",
57
- "@webiny/background-tasks": "6.6.0-alpha.12",
58
- "@webiny/build-tools": "6.6.0-alpha.12",
53
+ "@webiny/api-core-testing": "6.6.0-alpha.13",
54
+ "@webiny/api-graphql": "6.6.0-alpha.13",
55
+ "@webiny/api-kernel-core": "6.6.0-alpha.13",
56
+ "@webiny/api-search-index-tasks-ddb-os": "6.6.0-alpha.13",
57
+ "@webiny/api-sync-ddb-to-opensearch": "6.6.0-alpha.13",
58
+ "@webiny/background-tasks": "6.6.0-alpha.13",
59
+ "@webiny/build-tools": "6.6.0-alpha.13",
59
60
  "@webiny/di": "2.0.0",
60
- "@webiny/event-handler-core": "6.6.0-alpha.12",
61
- "@webiny/handler": "6.6.0-alpha.12",
62
- "@webiny/wcp": "6.6.0-alpha.12",
61
+ "@webiny/handler": "6.6.0-alpha.13",
62
+ "@webiny/wcp": "6.6.0-alpha.13",
63
63
  "jest-dynalite": "3.6.1",
64
- "rimraf": "6.1.3",
64
+ "rimraf": "6.1.4",
65
65
  "typescript": "7.0.2",
66
- "vitest": "5.0.5"
66
+ "vitest": "5.1.1"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\n\nexport { CmsContext };\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n tenant: string;\n}\n\nexport interface DataLoadersHandlerDataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n ids: readonly string[];\n}\n\nexport interface IDataLoadersHandler {\n getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getRevisionById<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AASO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;;WAARA"}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\n\nexport { CmsContext };\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n tenant: string;\n}\n\nexport interface DataLoadersHandlerDataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n ids: readonly string[];\n}\n\nexport interface IDataLoadersHandler {\n getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getRevisionById<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AASO,IAAKA,iBAAQA,WAAAA,GAAAA,SAAAA,QAAAA"}