@webiny/api-headless-cms-ddb-es 6.6.0-alpha.12 → 6.6.0-alpha.14
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.
- package/feature.d.ts +4 -4
- package/feature.js +4 -60
- package/feature.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/operations/entry/DdbEsCreateEntry.d.ts +3 -1
- package/operations/entry/DdbEsCreateEntry.js +18 -8
- package/operations/entry/DdbEsCreateEntry.js.map +1 -1
- package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +3 -1
- package/operations/entry/DdbEsCreateEntryRevisionFrom.js +23 -10
- package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -1
- package/operations/entry/DdbEsDeleteEntry.d.ts +3 -3
- package/operations/entry/DdbEsDeleteEntry.js +7 -7
- package/operations/entry/DdbEsDeleteEntry.js.map +1 -1
- package/operations/entry/DdbEsDeleteEntryRevision.d.ts +3 -1
- package/operations/entry/DdbEsDeleteEntryRevision.js +27 -11
- package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -1
- package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +3 -1
- package/operations/entry/DdbEsDeleteMultipleEntries.js +14 -7
- package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -1
- package/operations/entry/DdbEsGetEntriesByIds.d.ts +3 -1
- package/operations/entry/DdbEsGetEntriesByIds.js +10 -3
- package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -1
- package/operations/entry/DdbEsGetEntry.d.ts +3 -1
- package/operations/entry/DdbEsGetEntry.js +6 -2
- package/operations/entry/DdbEsGetEntry.js.map +1 -1
- package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +3 -1
- package/operations/entry/DdbEsGetLatestEntriesByIds.js +10 -3
- package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -1
- package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +3 -1
- package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +10 -3
- package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/DdbEsGetPreviousRevision.d.ts +3 -1
- package/operations/entry/DdbEsGetPreviousRevision.js +6 -3
- package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -1
- package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +3 -1
- package/operations/entry/DdbEsGetPublishedEntriesByIds.js +10 -3
- package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -1
- package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +3 -1
- package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +10 -3
- package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/DdbEsGetRevisionById.d.ts +3 -1
- package/operations/entry/DdbEsGetRevisionById.js +10 -3
- package/operations/entry/DdbEsGetRevisionById.js.map +1 -1
- package/operations/entry/DdbEsGetRevisions.d.ts +3 -1
- package/operations/entry/DdbEsGetRevisions.js +10 -3
- package/operations/entry/DdbEsGetRevisions.js.map +1 -1
- package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +3 -1
- package/operations/entry/DdbEsGetUniqueFieldValues.js +6 -2
- package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -1
- package/operations/entry/DdbEsListEntries.d.ts +3 -1
- package/operations/entry/DdbEsListEntries.js +6 -2
- package/operations/entry/DdbEsListEntries.js.map +1 -1
- package/operations/entry/DdbEsMoveEntry.d.ts +3 -3
- package/operations/entry/DdbEsMoveEntry.js +8 -8
- package/operations/entry/DdbEsMoveEntry.js.map +1 -1
- package/operations/entry/DdbEsMoveToBin.d.ts +3 -1
- package/operations/entry/DdbEsMoveToBin.js +8 -4
- package/operations/entry/DdbEsMoveToBin.js.map +1 -1
- package/operations/entry/DdbEsPublishEntry.d.ts +3 -1
- package/operations/entry/DdbEsPublishEntry.js +31 -15
- package/operations/entry/DdbEsPublishEntry.js.map +1 -1
- package/operations/entry/DdbEsRestoreFromBin.d.ts +3 -1
- package/operations/entry/DdbEsRestoreFromBin.js +8 -4
- package/operations/entry/DdbEsRestoreFromBin.js.map +1 -1
- package/operations/entry/DdbEsUnpublishEntry.d.ts +3 -1
- package/operations/entry/DdbEsUnpublishEntry.js +22 -9
- package/operations/entry/DdbEsUnpublishEntry.js.map +1 -1
- package/operations/entry/DdbEsUpdateEntry.d.ts +3 -1
- package/operations/entry/DdbEsUpdateEntry.js +27 -11
- package/operations/entry/DdbEsUpdateEntry.js.map +1 -1
- package/operations/entry/keys.d.ts +7 -6
- package/operations/entry/keys.js +6 -6
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/DdbEsCreateGroup.d.ts +3 -1
- package/operations/group/DdbEsCreateGroup.js +14 -4
- package/operations/group/DdbEsCreateGroup.js.map +1 -1
- package/operations/group/DdbEsDeleteGroup.d.ts +3 -1
- package/operations/group/DdbEsDeleteGroup.js +10 -3
- package/operations/group/DdbEsDeleteGroup.js.map +1 -1
- package/operations/group/DdbEsGetGroup.d.ts +3 -1
- package/operations/group/DdbEsGetGroup.js +10 -3
- package/operations/group/DdbEsGetGroup.js.map +1 -1
- package/operations/group/DdbEsListGroups.d.ts +3 -1
- package/operations/group/DdbEsListGroups.js +9 -3
- package/operations/group/DdbEsListGroups.js.map +1 -1
- package/operations/group/DdbEsUpdateGroup.d.ts +3 -1
- package/operations/group/DdbEsUpdateGroup.js +14 -4
- package/operations/group/DdbEsUpdateGroup.js.map +1 -1
- package/operations/model/DdbEsCreateModel.d.ts +3 -1
- package/operations/model/DdbEsCreateModel.js +14 -4
- package/operations/model/DdbEsCreateModel.js.map +1 -1
- package/operations/model/DdbEsDeleteModel.d.ts +3 -1
- package/operations/model/DdbEsDeleteModel.js +10 -3
- package/operations/model/DdbEsDeleteModel.js.map +1 -1
- package/operations/model/DdbEsGetModel.d.ts +3 -1
- package/operations/model/DdbEsGetModel.js +10 -3
- package/operations/model/DdbEsGetModel.js.map +1 -1
- package/operations/model/DdbEsListModels.d.ts +4 -2
- package/operations/model/DdbEsListModels.js +10 -5
- package/operations/model/DdbEsListModels.js.map +1 -1
- package/operations/model/DdbEsUpdateModel.d.ts +3 -1
- package/operations/model/DdbEsUpdateModel.js +14 -4
- package/operations/model/DdbEsUpdateModel.js.map +1 -1
- package/package.json +26 -26
- package/registry/CmsEntitiesDbRegistryDecorator.d.ts +4 -4
- package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -1
- package/storageFeature.d.ts +12 -0
- package/storageFeature.js +25 -0
- package/storageFeature.js.map +1 -0
- package/tablesFeature.d.ts +8 -0
- package/tablesFeature.js +53 -0
- package/tablesFeature.js.map +1 -0
- package/types.js.map +1 -1
|
@@ -2,10 +2,12 @@ import type { CmsGroup, CmsGroupStorageOperationsListParams } from "@webiny/api-
|
|
|
2
2
|
import { ListGroupsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsGroupEntity } from "../../abstractions/CmsDdbEsGroupEntity.js";
|
|
4
4
|
import { FilterUtil } from "@webiny/db-dynamodb/exports/api/db.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsListGroupsImpl implements ListGroupsStorageOperation.Interface {
|
|
6
7
|
private entity;
|
|
7
8
|
private filterUtil;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(entity: CmsDdbEsGroupEntity.Interface, filterUtil: FilterUtil.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute(params: CmsGroupStorageOperationsListParams): Promise<CmsGroup[]>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsListGroups: typeof DdbEsListGroupsImpl & {
|
|
@@ -4,17 +4,22 @@ import { ListGroupsStorageOperation } from "@webiny/api-headless-cms/features/sh
|
|
|
4
4
|
import { CmsDdbEsGroupEntity } from "../../abstractions/CmsDdbEsGroupEntity.js";
|
|
5
5
|
import { FilterUtil } from "@webiny/db-dynamodb/exports/api/db.js";
|
|
6
6
|
import { createPartitionKey } from "./keys.js";
|
|
7
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
7
8
|
class DdbEsListGroupsImpl {
|
|
8
|
-
constructor(entity, filterUtil){
|
|
9
|
+
constructor(entity, filterUtil, scopeTenant){
|
|
9
10
|
this.entity = entity;
|
|
10
11
|
this.filterUtil = filterUtil;
|
|
12
|
+
this.scopeTenant = scopeTenant;
|
|
11
13
|
}
|
|
12
14
|
async execute(params) {
|
|
13
15
|
const { sort, where } = params;
|
|
16
|
+
const tenant = this.scopeTenant.getId();
|
|
14
17
|
let records = [];
|
|
15
18
|
try {
|
|
16
19
|
const ddbRecords = await this.entity.queryAll({
|
|
17
|
-
partitionKey: createPartitionKey(
|
|
20
|
+
partitionKey: createPartitionKey({
|
|
21
|
+
tenant
|
|
22
|
+
}),
|
|
18
23
|
options: {
|
|
19
24
|
gte: " "
|
|
20
25
|
}
|
|
@@ -44,7 +49,8 @@ const DdbEsListGroups = ListGroupsStorageOperation.createImplementation({
|
|
|
44
49
|
implementation: DdbEsListGroupsImpl,
|
|
45
50
|
dependencies: [
|
|
46
51
|
CmsDdbEsGroupEntity,
|
|
47
|
-
FilterUtil
|
|
52
|
+
FilterUtil,
|
|
53
|
+
ScopeTenant
|
|
48
54
|
]
|
|
49
55
|
});
|
|
50
56
|
export { DdbEsListGroups };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/group/DdbEsListGroups.js","sources":["../../../src/operations/group/DdbEsListGroups.ts"],"sourcesContent":["import type {\n CmsGroup,\n CmsGroupStorageOperationsListParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { sortItems } from \"@webiny/db-dynamodb\";\nimport { ListGroupsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { FilterUtil } from \"@webiny/db-dynamodb/exports/api/db.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbEsListGroupsImpl implements ListGroupsStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsGroupEntity.Interface,\n private filterUtil: FilterUtil.Interface\n ) {}\n\n async execute(params: CmsGroupStorageOperationsListParams) {\n const { sort, where } = params;\n\n let records: CmsGroup[] = [];\n try {\n const ddbRecords = await this.entity.queryAll({\n partitionKey: createPartitionKey(
|
|
1
|
+
{"version":3,"file":"operations/group/DdbEsListGroups.js","sources":["../../../src/operations/group/DdbEsListGroups.ts"],"sourcesContent":["import type {\n CmsGroup,\n CmsGroupStorageOperationsListParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { sortItems } from \"@webiny/db-dynamodb\";\nimport { ListGroupsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { FilterUtil } from \"@webiny/db-dynamodb/exports/api/db.js\";\nimport { createPartitionKey } from \"./keys.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\n\nclass DdbEsListGroupsImpl implements ListGroupsStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsGroupEntity.Interface,\n private filterUtil: FilterUtil.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(params: CmsGroupStorageOperationsListParams) {\n const { sort, where } = params;\n const tenant = this.scopeTenant.getId();\n\n let records: CmsGroup[] = [];\n try {\n const ddbRecords = await this.entity.queryAll({\n partitionKey: createPartitionKey({ tenant }),\n options: {\n gte: \" \"\n }\n });\n records = ddbRecords.map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list groups.\",\n ex.code || \"LIST_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n sort,\n where\n }\n );\n }\n\n const filteredItems = this.filterUtil.filter({\n items: records,\n where,\n fields: []\n });\n if (!sort || sort.length === 0) {\n return filteredItems;\n }\n\n return sortItems({\n items: filteredItems,\n sort\n });\n }\n}\n\nexport const DdbEsListGroups = ListGroupsStorageOperation.createImplementation({\n implementation: DdbEsListGroupsImpl,\n dependencies: [CmsDdbEsGroupEntity, FilterUtil, ScopeTenant]\n});\n"],"names":["DdbEsListGroupsImpl","entity","filterUtil","scopeTenant","params","sort","where","tenant","records","ddbRecords","createPartitionKey","item","ex","WebinyError","filteredItems","sortItems","DdbEsListGroups","ListGroupsStorageOperation","CmsDdbEsGroupEntity","FilterUtil","ScopeTenant"],"mappings":";;;;;;;AAYA,MAAMA;IACF,YACYC,MAAqC,EACrCC,UAAgC,EAChCC,WAAkC,CAC5C;aAHUF,MAAM,GAANA;aACAC,UAAU,GAAVA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,MAA2C,EAAE;QACvD,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGF;QACxB,MAAMG,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QAErC,IAAIC,UAAsB,EAAE;QAC5B,IAAI;YACA,MAAMC,aAAa,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC1C,cAAcC,mBAAmB;oBAAEH;gBAAO;gBAC1C,SAAS;oBACL,KAAK;gBACT;YACJ;YACAC,UAAUC,WAAW,GAAG,CAACE,CAAAA,OAAQA,KAAK,IAAI;QAC9C,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,0BACdA,GAAG,IAAI,IAAI,oBACX;gBACI,OAAOA;gBACP,GAAGR,MAAM;gBACTC;gBACAC;YACJ;QAER;QAEA,MAAMQ,gBAAgB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,OAAON;YACPF;YACA,QAAQ,EAAE;QACd;QACA,IAAI,CAACD,QAAQA,AAAgB,MAAhBA,KAAK,MAAM,EACpB,OAAOS;QAGX,OAAOC,UAAU;YACb,OAAOD;YACPT;QACJ;IACJ;AACJ;AAEO,MAAMW,kBAAkBC,2BAA2B,oBAAoB,CAAC;IAC3E,gBAAgBjB;IAChB,cAAc;QAACkB;QAAqBC;QAAYC;KAAY;AAChE"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { CmsGroupStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
2
|
import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsGroupEntity } from "../../abstractions/CmsDdbEsGroupEntity.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
declare class DdbEsUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {
|
|
5
6
|
private entity;
|
|
6
|
-
|
|
7
|
+
private scopeTenant;
|
|
8
|
+
constructor(entity: CmsDdbEsGroupEntity.Interface, scopeTenant: ScopeTenant.Interface);
|
|
7
9
|
execute(params: CmsGroupStorageOperationsUpdateParams): Promise<void>;
|
|
8
10
|
}
|
|
9
11
|
export declare const DdbEsUpdateGroup: typeof DdbEsUpdateGroupImpl & {
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import error from "@webiny/error";
|
|
2
2
|
import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsGroupEntity } from "../../abstractions/CmsDdbEsGroupEntity.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
import { createKeys, createType } from "./keys.js";
|
|
5
6
|
class DdbEsUpdateGroupImpl {
|
|
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 { group } = params;
|
|
11
|
-
const
|
|
13
|
+
const tenant = this.scopeTenant.getId();
|
|
14
|
+
const keys = createKeys({
|
|
15
|
+
tenant,
|
|
16
|
+
id: group.id
|
|
17
|
+
});
|
|
12
18
|
try {
|
|
13
19
|
await this.entity.put({
|
|
14
|
-
data:
|
|
20
|
+
data: {
|
|
21
|
+
...group,
|
|
22
|
+
tenant
|
|
23
|
+
},
|
|
15
24
|
TYPE: createType(),
|
|
16
25
|
...keys
|
|
17
26
|
});
|
|
@@ -27,7 +36,8 @@ class DdbEsUpdateGroupImpl {
|
|
|
27
36
|
const DdbEsUpdateGroup = UpdateGroupStorageOperation.createImplementation({
|
|
28
37
|
implementation: DdbEsUpdateGroupImpl,
|
|
29
38
|
dependencies: [
|
|
30
|
-
CmsDdbEsGroupEntity
|
|
39
|
+
CmsDdbEsGroupEntity,
|
|
40
|
+
ScopeTenant
|
|
31
41
|
]
|
|
32
42
|
});
|
|
33
43
|
export { DdbEsUpdateGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/group/DdbEsUpdateGroup.js","sources":["../../../src/operations/group/DdbEsUpdateGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { UpdateGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbEsUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {\n constructor(private entity: CmsDdbEsGroupEntity.Interface) {}\n\n async execute(params: CmsGroupStorageOperationsUpdateParams) {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await this.entity.put({\n data: group,\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsUpdateGroup = UpdateGroupStorageOperation.createImplementation({\n implementation: DdbEsUpdateGroupImpl,\n dependencies: [CmsDdbEsGroupEntity]\n});\n"],"names":["DdbEsUpdateGroupImpl","entity","params","group","keys","createKeys","createType","ex","WebinyError","DdbEsUpdateGroup","UpdateGroupStorageOperation","CmsDdbEsGroupEntity"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/group/DdbEsUpdateGroup.js","sources":["../../../src/operations/group/DdbEsUpdateGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { UpdateGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbEsUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsGroupEntity.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(params: CmsGroupStorageOperationsUpdateParams) {\n const { group } = params;\n const tenant = this.scopeTenant.getId();\n const keys = createKeys({ tenant, id: group.id });\n try {\n await this.entity.put({\n data: { ...group, tenant },\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n }\n}\n\nexport const DdbEsUpdateGroup = UpdateGroupStorageOperation.createImplementation({\n implementation: DdbEsUpdateGroupImpl,\n dependencies: [CmsDdbEsGroupEntity, ScopeTenant]\n});\n"],"names":["DdbEsUpdateGroupImpl","entity","scopeTenant","params","group","tenant","keys","createKeys","createType","ex","WebinyError","DdbEsUpdateGroup","UpdateGroupStorageOperation","CmsDdbEsGroupEntity","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;QAClB,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,OAAOC,WAAW;YAAEF;YAAQ,IAAID,MAAM,EAAE;QAAC;QAC/C,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAM;oBAAE,GAAGA,KAAK;oBAAEC;gBAAO;gBACzB,MAAMG;gBACN,GAAGF,IAAI;YACX;QACJ,EAAE,OAAOG,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"}
|
|
@@ -2,12 +2,14 @@ import type { CmsModelStorageOperationsCreateParams } from "@webiny/api-headless
|
|
|
2
2
|
import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsModelEntity } from "../../abstractions/CmsDdbEsModelEntity.js";
|
|
4
4
|
import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
import { CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
6
7
|
declare class DdbEsCreateModelImpl implements CreateModelStorageOperation.Interface {
|
|
7
8
|
private entity;
|
|
8
9
|
private indexProvider;
|
|
10
|
+
private scopeTenant;
|
|
9
11
|
private elasticsearch;
|
|
10
|
-
constructor(entity: CmsDdbEsModelEntity.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface);
|
|
12
|
+
constructor(entity: CmsDdbEsModelEntity.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
11
13
|
execute(params: CmsModelStorageOperationsCreateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
|
|
12
14
|
}
|
|
13
15
|
export declare const DdbEsCreateModel: typeof DdbEsCreateModelImpl & {
|
|
@@ -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(
|
|
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:
|
|
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
|
|
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
|
-
|
|
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
|
|
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":"
|
|
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
|
-
|
|
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
|
|
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":"
|
|
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
|
-
|
|
7
|
-
|
|
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(
|
|
10
|
-
const
|
|
11
|
-
const partitionKey = createPartitionKey(
|
|
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(
|
|
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
|
-
|
|
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
|
|
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:
|
|
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":"
|
|
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.
|
|
3
|
+
"version": "6.6.0-alpha.14",
|
|
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.
|
|
34
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
35
|
-
"@webiny/api-headless-cms": "6.6.0-alpha.
|
|
36
|
-
"@webiny/api-headless-cms-storage": "6.6.0-alpha.
|
|
37
|
-
"@webiny/api-headless-cms-utils-os": "6.6.0-alpha.
|
|
38
|
-
"@webiny/api-opensearch": "6.6.0-alpha.
|
|
39
|
-
"@webiny/api-opensearch-aws": "6.6.0-alpha.
|
|
40
|
-
"@webiny/api-search-index-tasks": "6.6.0-alpha.
|
|
41
|
-
"@webiny/db": "6.6.0-alpha.
|
|
42
|
-
"@webiny/db-dynamodb": "6.6.0-alpha.
|
|
43
|
-
"@webiny/error": "6.6.0-alpha.
|
|
44
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
45
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
33
|
+
"@webiny/api": "6.6.0-alpha.14",
|
|
34
|
+
"@webiny/api-core": "6.6.0-alpha.14",
|
|
35
|
+
"@webiny/api-headless-cms": "6.6.0-alpha.14",
|
|
36
|
+
"@webiny/api-headless-cms-storage": "6.6.0-alpha.14",
|
|
37
|
+
"@webiny/api-headless-cms-utils-os": "6.6.0-alpha.14",
|
|
38
|
+
"@webiny/api-opensearch": "6.6.0-alpha.14",
|
|
39
|
+
"@webiny/api-opensearch-aws": "6.6.0-alpha.14",
|
|
40
|
+
"@webiny/api-search-index-tasks": "6.6.0-alpha.14",
|
|
41
|
+
"@webiny/db": "6.6.0-alpha.14",
|
|
42
|
+
"@webiny/db-dynamodb": "6.6.0-alpha.14",
|
|
43
|
+
"@webiny/error": "6.6.0-alpha.14",
|
|
44
|
+
"@webiny/feature": "6.6.0-alpha.14",
|
|
45
|
+
"@webiny/plugins": "6.6.0-alpha.14",
|
|
46
46
|
"@webiny/stdlib": "0.0.21",
|
|
47
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
47
|
+
"@webiny/utils": "6.6.0-alpha.14",
|
|
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.
|
|
54
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
55
|
-
"@webiny/api-
|
|
56
|
-
"@webiny/api-
|
|
57
|
-
"@webiny/
|
|
58
|
-
"@webiny/
|
|
53
|
+
"@webiny/api-core-testing": "6.6.0-alpha.14",
|
|
54
|
+
"@webiny/api-graphql": "6.6.0-alpha.14",
|
|
55
|
+
"@webiny/api-kernel-core": "6.6.0-alpha.14",
|
|
56
|
+
"@webiny/api-search-index-tasks-ddb-os": "6.6.0-alpha.14",
|
|
57
|
+
"@webiny/api-sync-ddb-to-opensearch": "6.6.0-alpha.14",
|
|
58
|
+
"@webiny/background-tasks": "6.6.0-alpha.14",
|
|
59
|
+
"@webiny/build-tools": "6.6.0-alpha.14",
|
|
59
60
|
"@webiny/di": "2.0.0",
|
|
60
|
-
"@webiny/
|
|
61
|
-
"@webiny/
|
|
62
|
-
"@webiny/wcp": "6.6.0-alpha.12",
|
|
61
|
+
"@webiny/handler": "6.6.0-alpha.14",
|
|
62
|
+
"@webiny/wcp": "6.6.0-alpha.14",
|
|
63
63
|
"jest-dynalite": "3.6.1",
|
|
64
|
-
"rimraf": "6.1.
|
|
64
|
+
"rimraf": "6.1.4",
|
|
65
65
|
"typescript": "7.0.2",
|
|
66
|
-
"vitest": "5.
|
|
66
|
+
"vitest": "5.1.1"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
@@ -8,10 +8,10 @@ import { CmsDdbEsEntriesEsEntity } from "../abstractions/CmsDdbEsEntriesEsEntity
|
|
|
8
8
|
* DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the
|
|
9
9
|
* OpenSearch entries entity), so every one of those registries needs them.
|
|
10
10
|
*
|
|
11
|
-
* The CMS storage
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The CMS storage registers this decorator in each tenant scope on its storage (a scope on another
|
|
12
|
+
* storage gets none). Decorators on a container-scoped registration apply to every instance as it is
|
|
13
|
+
* built, so this constructor runs once per scope's registry and adds the two entities. Every other
|
|
14
|
+
* call passes through to the registry.
|
|
15
15
|
*/
|
|
16
16
|
declare class CmsEntitiesDbRegistryDecoratorImpl implements DbRegistry.Interface {
|
|
17
17
|
private readonly decoratee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry/CmsEntitiesDbRegistryDecorator.js","sources":["../../src/registry/CmsEntitiesDbRegistryDecorator.ts"],"sourcesContent":["import { DbRegistry } from \"@webiny/db/exports/api/db.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\n\n/**\n * Adds the CMS entities to every request's DbRegistry.\n *\n * DbRegistry is container scoped: each request (child) container builds its own, empty registry. The\n * DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the\n * OpenSearch entries entity), so every one of those registries needs them.\n *\n * The CMS storage
|
|
1
|
+
{"version":3,"file":"registry/CmsEntitiesDbRegistryDecorator.js","sources":["../../src/registry/CmsEntitiesDbRegistryDecorator.ts"],"sourcesContent":["import { DbRegistry } from \"@webiny/db/exports/api/db.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\n\n/**\n * Adds the CMS entities to every request's DbRegistry.\n *\n * DbRegistry is container scoped: each request (child) container builds its own, empty registry. The\n * DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the\n * OpenSearch entries entity), so every one of those registries needs them.\n *\n * The CMS storage registers this decorator in each tenant scope on its storage (a scope on another\n * storage gets none). Decorators on a container-scoped registration apply to every instance as it is\n * built, so this constructor runs once per scope's registry and adds the two entities. Every other\n * call passes through to the registry.\n */\nclass CmsEntitiesDbRegistryDecoratorImpl implements DbRegistry.Interface {\n public constructor(\n entryEntity: CmsDdbEsEntryEntity.Interface,\n entriesEsEntity: CmsDdbEsEntriesEsEntity.Interface,\n private readonly decoratee: DbRegistry.Interface\n ) {\n decoratee.register({\n item: entryEntity,\n app: \"cms\",\n tags: [\"regular\", entryEntity.name]\n });\n decoratee.register({\n item: entriesEsEntity,\n app: \"cms\",\n tags: [\"es\", entriesEsEntity.name]\n });\n }\n\n public register<T = unknown>(params: DbRegistry.RegisterParams<T>): void {\n this.decoratee.register(params);\n }\n\n public getOneItem<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T> {\n return this.decoratee.getOneItem(cb);\n }\n\n public getItem<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T> | null {\n return this.decoratee.getItem(cb);\n }\n\n public getItems<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T>[] {\n return this.decoratee.getItems(cb);\n }\n}\n\nexport const CmsEntitiesDbRegistryDecorator = DbRegistry.createDecorator({\n decorator: CmsEntitiesDbRegistryDecoratorImpl,\n dependencies: [CmsDdbEsEntryEntity, CmsDdbEsEntriesEsEntity]\n});\n"],"names":["CmsEntitiesDbRegistryDecoratorImpl","entryEntity","entriesEsEntity","decoratee","params","cb","CmsEntitiesDbRegistryDecorator","DbRegistry","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity"],"mappings":";;;AAgBA,MAAMA;IACF,YACIC,WAA0C,EAC1CC,eAAkD,EACjCC,SAA+B,CAClD;aADmBA,SAAS,GAATA;QAEjBA,UAAU,QAAQ,CAAC;YACf,MAAMF;YACN,KAAK;YACL,MAAM;gBAAC;gBAAWA,YAAY,IAAI;aAAC;QACvC;QACAE,UAAU,QAAQ,CAAC;YACf,MAAMD;YACN,KAAK;YACL,MAAM;gBAAC;gBAAMA,gBAAgB,IAAI;aAAC;QACtC;IACJ;IAEO,SAAsBE,MAAoC,EAAQ;QACrE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAACA;IAC5B;IAEO,WACHC,EAAiD,EACvB;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAACA;IACrC;IAEO,QACHA,EAAiD,EAChB;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA;IAClC;IAEO,SACHA,EAAiD,EACrB;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAACA;IACnC;AACJ;AAEO,MAAMC,iCAAiCC,WAAW,eAAe,CAAC;IACrE,WAAWP;IACX,cAAc;QAACQ;QAAqBC;KAAwB;AAChE"}
|