@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.
- 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/types.js.map +1 -1
|
@@ -3,25 +3,31 @@ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
|
3
3
|
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
4
4
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
5
5
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
6
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
6
7
|
import { createPartitionKey, createRevisionSortKey } from "./keys.js";
|
|
7
8
|
class DdbEsDeleteMultipleEntriesImpl {
|
|
8
|
-
constructor(entity, esEntity, dataLoaders, storageModelProvider){
|
|
9
|
+
constructor(entity, esEntity, dataLoaders, storageModelProvider, scopeTenant){
|
|
9
10
|
this.entity = entity;
|
|
10
11
|
this.esEntity = esEntity;
|
|
11
12
|
this.dataLoaders = dataLoaders;
|
|
12
13
|
this.storageModelProvider = storageModelProvider;
|
|
14
|
+
this.scopeTenant = scopeTenant;
|
|
13
15
|
}
|
|
14
16
|
async execute(initialModel, params) {
|
|
15
17
|
const { entries } = params;
|
|
18
|
+
const tenant = this.scopeTenant.getId();
|
|
16
19
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
17
20
|
const revisions = await this.dataLoaders.getAllEntryRevisions({
|
|
18
|
-
model
|
|
21
|
+
model: {
|
|
22
|
+
tenant,
|
|
23
|
+
modelId: model.modelId
|
|
24
|
+
},
|
|
19
25
|
ids: entries
|
|
20
26
|
});
|
|
21
27
|
const esItems = (await Promise.all(entries.map((id)=>this.esEntity.queryAll({
|
|
22
28
|
partitionKey: createPartitionKey({
|
|
23
29
|
id,
|
|
24
|
-
tenant
|
|
30
|
+
tenant
|
|
25
31
|
}),
|
|
26
32
|
options: {
|
|
27
33
|
gte: " "
|
|
@@ -37,7 +43,7 @@ class DdbEsDeleteMultipleEntriesImpl {
|
|
|
37
43
|
for (const id of entries){
|
|
38
44
|
const partitionKey = createPartitionKey({
|
|
39
45
|
id,
|
|
40
|
-
tenant
|
|
46
|
+
tenant
|
|
41
47
|
});
|
|
42
48
|
entityBatch.delete({
|
|
43
49
|
PK: partitionKey,
|
|
@@ -51,7 +57,7 @@ class DdbEsDeleteMultipleEntriesImpl {
|
|
|
51
57
|
for (const revision of revisions)entityBatch.delete({
|
|
52
58
|
PK: createPartitionKey({
|
|
53
59
|
id: revision.id,
|
|
54
|
-
tenant
|
|
60
|
+
tenant
|
|
55
61
|
}),
|
|
56
62
|
SK: createRevisionSortKey({
|
|
57
63
|
version: revision.version
|
|
@@ -60,7 +66,7 @@ class DdbEsDeleteMultipleEntriesImpl {
|
|
|
60
66
|
await entityBatch.execute();
|
|
61
67
|
await elasticsearchEntityBatch.execute();
|
|
62
68
|
this.dataLoaders.clearAll({
|
|
63
|
-
tenant
|
|
69
|
+
tenant
|
|
64
70
|
});
|
|
65
71
|
}
|
|
66
72
|
}
|
|
@@ -70,7 +76,8 @@ const DdbEsDeleteMultipleEntries = DeleteMultipleEntriesStorageOperation.createI
|
|
|
70
76
|
CmsDdbEsEntryEntity,
|
|
71
77
|
CmsDdbEsEntriesEsEntity,
|
|
72
78
|
CmsDdbEsDataLoaders,
|
|
73
|
-
CmsStorageModelProvider
|
|
79
|
+
CmsStorageModelProvider,
|
|
80
|
+
ScopeTenant
|
|
74
81
|
]
|
|
75
82
|
});
|
|
76
83
|
export { DdbEsDeleteMultipleEntries };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsDeleteMultipleEntries.js","sources":["../../../src/operations/entry/DdbEsDeleteMultipleEntries.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryStorageOperationsDeleteEntriesParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteMultipleEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"./keys.js\";\n\nclass DdbEsDeleteMultipleEntriesImpl implements DeleteMultipleEntriesStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams) {\n const { entries } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n /**\n * First we need all the revisions of the entries we want to delete.\n */\n const revisions = await this.dataLoaders.getAllEntryRevisions({\n model,\n ids: entries\n });\n /**\n * The Elasticsearch records that exist: an entry that was never published (or was\n * unpublished) has no published record, and deleting a missing record is an error in the\n * stream handling. As DdbEsDeleteEntry does, only the stored records are deleted.\n */\n const esItems = (\n await Promise.all(\n entries.map(id =>\n this.esEntity.queryAll({\n partitionKey: createPartitionKey({\n id,\n tenant
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsDeleteMultipleEntries.js","sources":["../../../src/operations/entry/DdbEsDeleteMultipleEntries.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryStorageOperationsDeleteEntriesParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteMultipleEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"./keys.js\";\n\nclass DdbEsDeleteMultipleEntriesImpl implements DeleteMultipleEntriesStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams) {\n const { entries } = params;\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel(initialModel);\n /**\n * First we need all the revisions of the entries we want to delete.\n */\n const revisions = await this.dataLoaders.getAllEntryRevisions({\n model: { tenant, modelId: model.modelId },\n ids: entries\n });\n /**\n * The Elasticsearch records that exist: an entry that was never published (or was\n * unpublished) has no published record, and deleting a missing record is an error in the\n * stream handling. As DdbEsDeleteEntry does, only the stored records are deleted.\n */\n const esItems = (\n await Promise.all(\n entries.map(id =>\n this.esEntity.queryAll({\n partitionKey: createPartitionKey({\n id,\n tenant\n }),\n options: {\n gte: \" \"\n }\n })\n )\n )\n ).flat();\n\n const entityBatch = this.entity.createEntityWriter();\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n delete: esItems.map(item => ({ PK: item.PK, SK: item.SK }))\n });\n for (const id of entries) {\n const partitionKey = createPartitionKey({\n id,\n tenant\n });\n /**\n * Latest and published items.\n */\n entityBatch.delete({ PK: partitionKey, SK: \"L\" });\n entityBatch.delete({ PK: partitionKey, SK: \"P\" });\n }\n /**\n * Exact revisions of all the entries\n */\n for (const revision of revisions) {\n entityBatch.delete({\n PK: createPartitionKey({\n id: revision.id,\n tenant\n }),\n SK: createRevisionSortKey({\n version: revision.version\n })\n });\n }\n\n await entityBatch.execute();\n await elasticsearchEntityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant\n });\n }\n}\n\nexport const DdbEsDeleteMultipleEntries =\n DeleteMultipleEntriesStorageOperation.createImplementation({\n implementation: DdbEsDeleteMultipleEntriesImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n ScopeTenant\n ]\n });\n"],"names":["DdbEsDeleteMultipleEntriesImpl","entity","esEntity","dataLoaders","storageModelProvider","scopeTenant","initialModel","params","entries","tenant","model","revisions","esItems","Promise","id","createPartitionKey","entityBatch","elasticsearchEntityBatch","item","partitionKey","revision","createRevisionSortKey","DdbEsDeleteMultipleEntries","DeleteMultipleEntriesStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;;;AAYA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,EACvDC,WAAkC,CAC5C;aALUJ,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,YAAsB,EAAEC,MAAoD,EAAE;QACxF,MAAM,EAAEC,OAAO,EAAE,GAAGD;QACpB,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACJ;QAIjD,MAAMK,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC;YAC1D,OAAO;gBAAEF;gBAAQ,SAASC,MAAM,OAAO;YAAC;YACxC,KAAKF;QACT;QAMA,MAAMI,UACF,OAAMC,QAAQ,GAAG,CACbL,QAAQ,GAAG,CAACM,CAAAA,KACR,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACnB,cAAcC,mBAAmB;oBAC7BD;oBACAL;gBACJ;gBACA,SAAS;oBACL,KAAK;gBACT;YACJ,MAGV,IAAI;QAEN,MAAMO,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB;QAClD,MAAMC,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC9D,QAAQL,QAAQ,GAAG,CAACM,CAAAA,OAAS;oBAAE,IAAIA,KAAK,EAAE;oBAAE,IAAIA,KAAK,EAAE;gBAAC;QAC5D;QACA,KAAK,MAAMJ,MAAMN,QAAS;YACtB,MAAMW,eAAeJ,mBAAmB;gBACpCD;gBACAL;YACJ;YAIAO,YAAY,MAAM,CAAC;gBAAE,IAAIG;gBAAc,IAAI;YAAI;YAC/CH,YAAY,MAAM,CAAC;gBAAE,IAAIG;gBAAc,IAAI;YAAI;QACnD;QAIA,KAAK,MAAMC,YAAYT,UACnBK,YAAY,MAAM,CAAC;YACf,IAAID,mBAAmB;gBACnB,IAAIK,SAAS,EAAE;gBACfX;YACJ;YACA,IAAIY,sBAAsB;gBACtB,SAASD,SAAS,OAAO;YAC7B;QACJ;QAGJ,MAAMJ,YAAY,OAAO;QACzB,MAAMC,yBAAyB,OAAO;QAEtC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;YACtBR;QACJ;IACJ;AACJ;AAEO,MAAMa,6BACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBvB;IAChB,cAAc;QACVwB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetByIdsParams
|
|
|
2
2
|
import { GetEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetEntriesByIdsImpl implements GetEntriesByIdsStorageOperation.Interface {
|
|
6
7
|
private dataLoaders;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetEntriesByIds: typeof DdbEsGetEntriesByIdsImpl & {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { GetEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js";
|
|
2
2
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
3
3
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
5
6
|
class DdbEsGetEntriesByIdsImpl {
|
|
6
|
-
constructor(dataLoaders, storageModelProvider){
|
|
7
|
+
constructor(dataLoaders, storageModelProvider, scopeTenant){
|
|
7
8
|
this.dataLoaders = dataLoaders;
|
|
8
9
|
this.storageModelProvider = storageModelProvider;
|
|
10
|
+
this.scopeTenant = scopeTenant;
|
|
9
11
|
}
|
|
10
12
|
async execute(initialModel, params) {
|
|
13
|
+
const tenant = this.scopeTenant.getId();
|
|
11
14
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
12
15
|
const entries = await this.dataLoaders.getRevisionById({
|
|
13
|
-
model
|
|
16
|
+
model: {
|
|
17
|
+
tenant,
|
|
18
|
+
modelId: model.modelId
|
|
19
|
+
},
|
|
14
20
|
ids: params.ids
|
|
15
21
|
});
|
|
16
22
|
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
@@ -23,7 +29,8 @@ const DdbEsGetEntriesByIds = GetEntriesByIdsStorageOperation.createImplementatio
|
|
|
23
29
|
implementation: DdbEsGetEntriesByIdsImpl,
|
|
24
30
|
dependencies: [
|
|
25
31
|
CmsDdbEsDataLoaders,
|
|
26
|
-
CmsStorageModelProvider
|
|
32
|
+
CmsStorageModelProvider,
|
|
33
|
+
ScopeTenant
|
|
27
34
|
]
|
|
28
35
|
});
|
|
29
36
|
export { DdbEsGetEntriesByIds };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetEntriesByIdsImpl implements GetEntriesByIdsStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getRevisionById<T>({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetEntriesByIds = GetEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetEntriesByIdsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetEntriesByIds","GetEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetEntriesByIdsImpl implements GetEntriesByIdsStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) {\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getRevisionById<T>({\n model: { tenant, modelId: model.modelId },\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetEntriesByIds = GetEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider, ScopeTenant]\n});\n"],"names":["DdbEsGetEntriesByIdsImpl","dataLoaders","storageModelProvider","scopeTenant","initialModel","params","tenant","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetEntriesByIds","GetEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;AAWA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA+C,EACjD;QACE,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIH;QAEpD,MAAMI,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAI;YACtD,OAAO;gBAAEF;gBAAQ,SAASC,MAAM,OAAO;YAAC;YACxC,KAAKF,OAAO,GAAG;QACnB;QAEA,OAAOG,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,uBAAuBC,gCAAgC,oBAAoB,CAAC;IACrF,gBAAgBZ;IAChB,cAAc;QAACa;QAAqBC;QAAyBC;KAAY;AAC7E"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetParams } fro
|
|
|
2
2
|
import { GetEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.js";
|
|
3
3
|
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetEntryImpl implements GetEntryStorageOperation.Interface {
|
|
6
7
|
private listEntries;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(listEntries: ListEntriesStorageOperation.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/types").CmsEntry<T> | null>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetEntry: typeof DdbEsGetEntryImpl & {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { GetEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.js";
|
|
2
2
|
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
3
3
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
class DdbEsGetEntryImpl {
|
|
5
|
-
constructor(listEntries, storageModelProvider){
|
|
6
|
+
constructor(listEntries, storageModelProvider, scopeTenant){
|
|
6
7
|
this.listEntries = listEntries;
|
|
7
8
|
this.storageModelProvider = storageModelProvider;
|
|
9
|
+
this.scopeTenant = scopeTenant;
|
|
8
10
|
}
|
|
9
11
|
async execute(initialModel, params) {
|
|
12
|
+
this.scopeTenant.getId();
|
|
10
13
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
11
14
|
const { items } = await this.listEntries.execute(model, {
|
|
12
15
|
...params,
|
|
@@ -19,7 +22,8 @@ const DdbEsGetEntry = GetEntryStorageOperation.createImplementation({
|
|
|
19
22
|
implementation: DdbEsGetEntryImpl,
|
|
20
23
|
dependencies: [
|
|
21
24
|
ListEntriesStorageOperation,
|
|
22
|
-
CmsStorageModelProvider
|
|
25
|
+
CmsStorageModelProvider,
|
|
26
|
+
ScopeTenant
|
|
23
27
|
]
|
|
24
28
|
});
|
|
25
29
|
export { DdbEsGetEntry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetEntry.js","sources":["../../../src/operations/entry/DdbEsGetEntry.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.js\";\nimport { ListEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\n\nclass DdbEsGetEntryImpl implements GetEntryStorageOperation.Interface {\n constructor(\n private listEntries: ListEntriesStorageOperation.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) {\n const model = this.storageModelProvider.getModel(initialModel);\n\n const { items } = await this.listEntries.execute<T>(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n }\n}\n\nexport const DdbEsGetEntry = GetEntryStorageOperation.createImplementation({\n implementation: DdbEsGetEntryImpl,\n dependencies: [ListEntriesStorageOperation, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetEntryImpl","listEntries","storageModelProvider","initialModel","params","model","items","DdbEsGetEntry","GetEntryStorageOperation","ListEntriesStorageOperation","CmsStorageModelProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetEntry.js","sources":["../../../src/operations/entry/DdbEsGetEntry.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.js\";\nimport { ListEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\n\nclass DdbEsGetEntryImpl implements GetEntryStorageOperation.Interface {\n constructor(\n private listEntries: ListEntriesStorageOperation.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) {\n /**\n * Only checked here: the listing reads with the scope's tenant itself.\n */\n this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel(initialModel);\n\n const { items } = await this.listEntries.execute<T>(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n }\n}\n\nexport const DdbEsGetEntry = GetEntryStorageOperation.createImplementation({\n implementation: DdbEsGetEntryImpl,\n dependencies: [ListEntriesStorageOperation, CmsStorageModelProvider, ScopeTenant]\n});\n"],"names":["DdbEsGetEntryImpl","listEntries","storageModelProvider","scopeTenant","initialModel","params","model","items","DdbEsGetEntry","GetEntryStorageOperation","ListEntriesStorageOperation","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAAkD,EAClDC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA0C,EAC5C;QAIE,IAAI,CAAC,WAAW,CAAC,KAAK;QACtB,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACF;QAEjD,MAAM,EAAEG,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAID,OAAO;YACvD,GAAGD,MAAM;YACT,OAAO;QACX;QACA,OAAOE,MAAM,KAAK,MAAM;IAC5B;AACJ;AAEO,MAAMC,gBAAgBC,yBAAyB,oBAAoB,CAAC;IACvE,gBAAgBT;IAChB,cAAc;QAACU;QAA6BC;QAAyBC;KAAY;AACrF"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetLatestByIdsP
|
|
|
2
2
|
import { GetLatestEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetLatestEntriesByIdsImpl implements GetLatestEntriesByIdsStorageOperation.Interface {
|
|
6
7
|
private dataLoaders;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetLatestEntriesByIds: typeof DdbEsGetLatestEntriesByIdsImpl & {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { GetLatestEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js";
|
|
2
2
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
3
3
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
5
6
|
class DdbEsGetLatestEntriesByIdsImpl {
|
|
6
|
-
constructor(dataLoaders, storageModelProvider){
|
|
7
|
+
constructor(dataLoaders, storageModelProvider, scopeTenant){
|
|
7
8
|
this.dataLoaders = dataLoaders;
|
|
8
9
|
this.storageModelProvider = storageModelProvider;
|
|
10
|
+
this.scopeTenant = scopeTenant;
|
|
9
11
|
}
|
|
10
12
|
async execute(initialModel, params) {
|
|
13
|
+
const tenant = this.scopeTenant.getId();
|
|
11
14
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
12
15
|
const entries = await this.dataLoaders.getLatestRevisionByEntryId({
|
|
13
|
-
model
|
|
16
|
+
model: {
|
|
17
|
+
tenant,
|
|
18
|
+
modelId: model.modelId
|
|
19
|
+
},
|
|
14
20
|
ids: params.ids
|
|
15
21
|
});
|
|
16
22
|
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
@@ -23,7 +29,8 @@ const DdbEsGetLatestEntriesByIds = GetLatestEntriesByIdsStorageOperation.createI
|
|
|
23
29
|
implementation: DdbEsGetLatestEntriesByIdsImpl,
|
|
24
30
|
dependencies: [
|
|
25
31
|
CmsDdbEsDataLoaders,
|
|
26
|
-
CmsStorageModelProvider
|
|
32
|
+
CmsStorageModelProvider,
|
|
33
|
+
ScopeTenant
|
|
27
34
|
]
|
|
28
35
|
});
|
|
29
36
|
export { DdbEsGetLatestEntriesByIds };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetLatestEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetLatestEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetLatestByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetLatestEntriesByIdsImpl implements GetLatestEntriesByIdsStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getLatestRevisionByEntryId<T>({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetLatestEntriesByIds =\n GetLatestEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetLatestEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetLatestEntriesByIdsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetLatestEntriesByIds","GetLatestEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetLatestEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetLatestEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetLatestByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetLatestEntriesByIdsImpl implements GetLatestEntriesByIdsStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) {\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getLatestRevisionByEntryId<T>({\n model: { tenant, modelId: model.modelId },\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetLatestEntriesByIds =\n GetLatestEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetLatestEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider, ScopeTenant]\n });\n"],"names":["DdbEsGetLatestEntriesByIdsImpl","dataLoaders","storageModelProvider","scopeTenant","initialModel","params","tenant","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetLatestEntriesByIds","GetLatestEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;AAWA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAqD,EACvD;QACE,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIH;QAEpD,MAAMI,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAI;YACjE,OAAO;gBAAEF;gBAAQ,SAASC,MAAM,OAAO;YAAC;YACxC,KAAKF,OAAO,GAAG;QACnB;QAEA,OAAOG,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,6BACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBZ;IAChB,cAAc;QAACa;QAAqBC;QAAyBC;KAAY;AAC7E"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetLatestRevisi
|
|
|
2
2
|
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetLatestRevisionByEntryIdImpl implements GetLatestRevisionByEntryIdStorageOperation.Interface {
|
|
6
7
|
private dataLoaders;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetLatestRevisionByEntryId: typeof DdbEsGetLatestRevisionByEntryIdImpl & {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
|
|
2
2
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
3
3
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
5
6
|
class DdbEsGetLatestRevisionByEntryIdImpl {
|
|
6
|
-
constructor(dataLoaders, storageModelProvider){
|
|
7
|
+
constructor(dataLoaders, storageModelProvider, scopeTenant){
|
|
7
8
|
this.dataLoaders = dataLoaders;
|
|
8
9
|
this.storageModelProvider = storageModelProvider;
|
|
10
|
+
this.scopeTenant = scopeTenant;
|
|
9
11
|
}
|
|
10
12
|
async execute(initialModel, params) {
|
|
13
|
+
const tenant = this.scopeTenant.getId();
|
|
11
14
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
12
15
|
const [entry] = await this.dataLoaders.getLatestRevisionByEntryId({
|
|
13
|
-
model
|
|
16
|
+
model: {
|
|
17
|
+
tenant,
|
|
18
|
+
modelId: model.modelId
|
|
19
|
+
},
|
|
14
20
|
ids: [
|
|
15
21
|
params.id
|
|
16
22
|
]
|
|
@@ -26,7 +32,8 @@ const DdbEsGetLatestRevisionByEntryId = GetLatestRevisionByEntryIdStorageOperati
|
|
|
26
32
|
implementation: DdbEsGetLatestRevisionByEntryIdImpl,
|
|
27
33
|
dependencies: [
|
|
28
34
|
CmsDdbEsDataLoaders,
|
|
29
|
-
CmsStorageModelProvider
|
|
35
|
+
CmsStorageModelProvider,
|
|
36
|
+
ScopeTenant
|
|
30
37
|
]
|
|
31
38
|
});
|
|
32
39
|
export { DdbEsGetLatestRevisionByEntryId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetLatestRevisionByEntryId.js","sources":["../../../src/operations/entry/DdbEsGetLatestRevisionByEntryId.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetLatestRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetLatestRevisionByEntryIdImpl\n implements GetLatestRevisionByEntryIdStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getLatestRevisionByEntryId<T>({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetLatestRevisionByEntryId =\n GetLatestRevisionByEntryIdStorageOperation.createImplementation({\n implementation: DdbEsGetLatestRevisionByEntryIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetLatestRevisionByEntryIdImpl","dataLoaders","storageModelProvider","initialModel","params","model","entry","convertEntryKeysFromStorage","DdbEsGetLatestRevisionByEntryId","GetLatestRevisionByEntryIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetLatestRevisionByEntryId.js","sources":["../../../src/operations/entry/DdbEsGetLatestRevisionByEntryId.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetLatestRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetLatestRevisionByEntryIdImpl\n implements GetLatestRevisionByEntryIdStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) {\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getLatestRevisionByEntryId<T>({\n model: { tenant, modelId: model.modelId },\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetLatestRevisionByEntryId =\n GetLatestRevisionByEntryIdStorageOperation.createImplementation({\n implementation: DdbEsGetLatestRevisionByEntryIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider, ScopeTenant]\n });\n"],"names":["DdbEsGetLatestRevisionByEntryIdImpl","dataLoaders","storageModelProvider","scopeTenant","initialModel","params","tenant","model","entry","convertEntryKeysFromStorage","DdbEsGetLatestRevisionByEntryId","GetLatestRevisionByEntryIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;AAWA,MAAMA;IAGF,YACYC,WAA0C,EAC1CC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAwD,EAC1D;QACE,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIH;QAEpD,MAAM,CAACI,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAI;YACjE,OAAO;gBAAEF;gBAAQ,SAASC,MAAM,OAAO;YAAC;YACxC,KAAK;gBAACF,OAAO,EAAE;aAAC;QACpB;QACA,IAAI,CAACG,OACD,OAAO;QAEX,OAAOC,4BAA+B;YAClCF;YACAC;QACJ;IACJ;AACJ;AAEO,MAAME,kCACTC,2CAA2C,oBAAoB,CAAC;IAC5D,gBAAgBX;IAChB,cAAc;QAACY;QAAqBC;QAAyBC;KAAY;AAC7E"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetPreviousRevi
|
|
|
2
2
|
import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {
|
|
6
7
|
private entity;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetPreviousRevision: typeof DdbEsGetPreviousRevisionImpl & {
|
|
@@ -3,15 +3,17 @@ import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/fe
|
|
|
3
3
|
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
5
|
import { createPartitionKey } from "./keys.js";
|
|
6
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
6
7
|
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
7
8
|
class DdbEsGetPreviousRevisionImpl {
|
|
8
|
-
constructor(entity, storageModelProvider){
|
|
9
|
+
constructor(entity, storageModelProvider, scopeTenant){
|
|
9
10
|
this.entity = entity;
|
|
10
11
|
this.storageModelProvider = storageModelProvider;
|
|
12
|
+
this.scopeTenant = scopeTenant;
|
|
11
13
|
}
|
|
12
14
|
async execute(initialModel, params) {
|
|
15
|
+
const tenant = this.scopeTenant.getId();
|
|
13
16
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
14
|
-
const { tenant } = model;
|
|
15
17
|
const { entryId, version } = params;
|
|
16
18
|
const partitionKey = createPartitionKey({
|
|
17
19
|
tenant,
|
|
@@ -48,7 +50,8 @@ const DdbEsGetPreviousRevision = GetPreviousRevisionStorageOperation.createImple
|
|
|
48
50
|
implementation: DdbEsGetPreviousRevisionImpl,
|
|
49
51
|
dependencies: [
|
|
50
52
|
CmsDdbEsEntryEntity,
|
|
51
|
-
CmsStorageModelProvider
|
|
53
|
+
CmsStorageModelProvider,
|
|
54
|
+
ScopeTenant
|
|
52
55
|
]
|
|
53
56
|
});
|
|
54
57
|
export { DdbEsGetPreviousRevision };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetPreviousRevision.js","sources":["../../../src/operations/entry/DdbEsGetPreviousRevision.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPreviousRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPreviousRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { createPartitionKey } from \"./keys.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\nimport type { IEntityQueryAllParams } from \"@webiny/db-dynamodb\";\n\nclass DdbEsGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const {
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetPreviousRevision.js","sources":["../../../src/operations/entry/DdbEsGetPreviousRevision.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPreviousRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPreviousRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { createPartitionKey } from \"./keys.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\nimport type { IEntityQueryAllParams } from \"@webiny/db-dynamodb\";\n\nclass DdbEsGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) {\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const { entryId, version } = params;\n\n const partitionKey = createPartitionKey({\n tenant,\n id: entryId\n });\n const options: IEntityQueryAllParams[\"options\"] = {\n beginsWith: `REV#`,\n reverse: true\n };\n\n try {\n const unfilteredEntries = (\n await this.entity.queryAll({\n partitionKey,\n options\n })\n ).map(item => {\n return item.data;\n });\n\n /**\n * The partition key does not include the model, so filter by it as well.\n */\n const entries = unfilteredEntries.filter(item => {\n return item.modelId === model.modelId && item.version < version;\n });\n\n const entry = entries[0];\n\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n entry,\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get previous version of given entry.\",\n ex.code || \"GET_PREVIOUS_VERSION_ERROR\",\n {\n ...params,\n error: ex,\n partitionKey,\n options,\n model\n }\n );\n }\n }\n}\n\nexport const DdbEsGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({\n implementation: DdbEsGetPreviousRevisionImpl,\n dependencies: [CmsDdbEsEntryEntity, CmsStorageModelProvider, ScopeTenant]\n});\n"],"names":["DdbEsGetPreviousRevisionImpl","entity","storageModelProvider","scopeTenant","initialModel","params","tenant","model","entryId","version","partitionKey","createPartitionKey","options","unfilteredEntries","item","entries","entry","convertEntryKeysFromStorage","ex","WebinyError","DdbEsGetPreviousRevision","GetPreviousRevisionStorageOperation","CmsDdbEsEntryEntity","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;;;AAcA,MAAMA;IACF,YACYC,MAAqC,EACrCC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,MAAM,GAANA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA0D,EAC5D;QACE,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIH;QAEpD,MAAM,EAAEI,OAAO,EAAEC,OAAO,EAAE,GAAGJ;QAE7B,MAAMK,eAAeC,mBAAmB;YACpCL;YACA,IAAIE;QACR;QACA,MAAMI,UAA4C;YAC9C,YAAY;YACZ,SAAS;QACb;QAEA,IAAI;YACA,MAAMC,oBACF,OAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACvBH;gBACAE;YACJ,EAAC,EACH,GAAG,CAACE,CAAAA,OACKA,KAAK,IAAI;YAMpB,MAAMC,UAAUF,kBAAkB,MAAM,CAACC,CAAAA,OAC9BA,KAAK,OAAO,KAAKP,MAAM,OAAO,IAAIO,KAAK,OAAO,GAAGL;YAG5D,MAAMO,QAAQD,OAAO,CAAC,EAAE;YAExB,IAAI,CAACC,OACD,OAAO;YAEX,OAAOC,4BAA+B;gBAClCD;gBACAT;YACJ;QACJ,EAAE,OAAOW,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,kDACdA,GAAG,IAAI,IAAI,8BACX;gBACI,GAAGb,MAAM;gBACT,OAAOa;gBACPR;gBACAE;gBACAL;YACJ;QAER;IACJ;AACJ;AAEO,MAAMa,2BAA2BC,oCAAoC,oBAAoB,CAAC;IAC7F,gBAAgBrB;IAChB,cAAc;QAACsB;QAAqBC;QAAyBC;KAAY;AAC7E"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetPublishedByI
|
|
|
2
2
|
import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetPublishedEntriesByIdsImpl implements GetPublishedEntriesByIdsStorageOperation.Interface {
|
|
6
7
|
private dataLoaders;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetPublishedEntriesByIds: typeof DdbEsGetPublishedEntriesByIdsImpl & {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
|
|
2
2
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
3
3
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
5
6
|
class DdbEsGetPublishedEntriesByIdsImpl {
|
|
6
|
-
constructor(dataLoaders, storageModelProvider){
|
|
7
|
+
constructor(dataLoaders, storageModelProvider, scopeTenant){
|
|
7
8
|
this.dataLoaders = dataLoaders;
|
|
8
9
|
this.storageModelProvider = storageModelProvider;
|
|
10
|
+
this.scopeTenant = scopeTenant;
|
|
9
11
|
}
|
|
10
12
|
async execute(initialModel, params) {
|
|
13
|
+
const tenant = this.scopeTenant.getId();
|
|
11
14
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
12
15
|
const entries = await this.dataLoaders.getPublishedRevisionByEntryId({
|
|
13
|
-
model
|
|
16
|
+
model: {
|
|
17
|
+
tenant,
|
|
18
|
+
modelId: model.modelId
|
|
19
|
+
},
|
|
14
20
|
ids: params.ids
|
|
15
21
|
});
|
|
16
22
|
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
@@ -23,7 +29,8 @@ const DdbEsGetPublishedEntriesByIds = GetPublishedEntriesByIdsStorageOperation.c
|
|
|
23
29
|
implementation: DdbEsGetPublishedEntriesByIdsImpl,
|
|
24
30
|
dependencies: [
|
|
25
31
|
CmsDdbEsDataLoaders,
|
|
26
|
-
CmsStorageModelProvider
|
|
32
|
+
CmsStorageModelProvider,
|
|
33
|
+
ScopeTenant
|
|
27
34
|
]
|
|
28
35
|
});
|
|
29
36
|
export { DdbEsGetPublishedEntriesByIds };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetPublishedEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetPublishedEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPublishedByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetPublishedEntriesByIdsImpl\n implements GetPublishedEntriesByIdsStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getPublishedRevisionByEntryId<T>({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetPublishedEntriesByIds =\n GetPublishedEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetPublishedEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetPublishedEntriesByIdsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetPublishedEntriesByIds","GetPublishedEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetPublishedEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetPublishedEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPublishedByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetPublishedEntriesByIdsImpl\n implements GetPublishedEntriesByIdsStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) {\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getPublishedRevisionByEntryId<T>({\n model: { tenant, modelId: model.modelId },\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetPublishedEntriesByIds =\n GetPublishedEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetPublishedEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider, ScopeTenant]\n });\n"],"names":["DdbEsGetPublishedEntriesByIdsImpl","dataLoaders","storageModelProvider","scopeTenant","initialModel","params","tenant","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetPublishedEntriesByIds","GetPublishedEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;AAWA,MAAMA;IAGF,YACYC,WAA0C,EAC1CC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAwD,EAC1D;QACE,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIH;QAEpD,MAAMI,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAI;YACpE,OAAO;gBAAEF;gBAAQ,SAASC,MAAM,OAAO;YAAC;YACxC,KAAKF,OAAO,GAAG;QACnB;QAEA,OAAOG,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,gCACTC,yCAAyC,oBAAoB,CAAC;IAC1D,gBAAgBZ;IAChB,cAAc;QAACa;QAAqBC;QAAyBC;KAAY;AAC7E"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetPublishedRev
|
|
|
2
2
|
import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetPublishedRevisionByEntryIdImpl implements GetPublishedRevisionByEntryIdStorageOperation.Interface {
|
|
6
7
|
private dataLoaders;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetPublishedRevisionByEntryId: typeof DdbEsGetPublishedRevisionByEntryIdImpl & {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
|
|
2
2
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
3
3
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
4
5
|
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
5
6
|
class DdbEsGetPublishedRevisionByEntryIdImpl {
|
|
6
|
-
constructor(dataLoaders, storageModelProvider){
|
|
7
|
+
constructor(dataLoaders, storageModelProvider, scopeTenant){
|
|
7
8
|
this.dataLoaders = dataLoaders;
|
|
8
9
|
this.storageModelProvider = storageModelProvider;
|
|
10
|
+
this.scopeTenant = scopeTenant;
|
|
9
11
|
}
|
|
10
12
|
async execute(initialModel, params) {
|
|
13
|
+
const tenant = this.scopeTenant.getId();
|
|
11
14
|
const model = this.storageModelProvider.getModel(initialModel);
|
|
12
15
|
const [entry] = await this.dataLoaders.getPublishedRevisionByEntryId({
|
|
13
|
-
model
|
|
16
|
+
model: {
|
|
17
|
+
tenant,
|
|
18
|
+
modelId: model.modelId
|
|
19
|
+
},
|
|
14
20
|
ids: [
|
|
15
21
|
params.id
|
|
16
22
|
]
|
|
@@ -26,7 +32,8 @@ const DdbEsGetPublishedRevisionByEntryId = GetPublishedRevisionByEntryIdStorageO
|
|
|
26
32
|
implementation: DdbEsGetPublishedRevisionByEntryIdImpl,
|
|
27
33
|
dependencies: [
|
|
28
34
|
CmsDdbEsDataLoaders,
|
|
29
|
-
CmsStorageModelProvider
|
|
35
|
+
CmsStorageModelProvider,
|
|
36
|
+
ScopeTenant
|
|
30
37
|
]
|
|
31
38
|
});
|
|
32
39
|
export { DdbEsGetPublishedRevisionByEntryId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/DdbEsGetPublishedRevisionByEntryId.js","sources":["../../../src/operations/entry/DdbEsGetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPublishedRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetPublishedRevisionByEntryIdImpl\n implements GetPublishedRevisionByEntryIdStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getPublishedRevisionByEntryId<T>({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetPublishedRevisionByEntryId =\n GetPublishedRevisionByEntryIdStorageOperation.createImplementation({\n implementation: DdbEsGetPublishedRevisionByEntryIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetPublishedRevisionByEntryIdImpl","dataLoaders","storageModelProvider","initialModel","params","model","entry","convertEntryKeysFromStorage","DdbEsGetPublishedRevisionByEntryId","GetPublishedRevisionByEntryIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetPublishedRevisionByEntryId.js","sources":["../../../src/operations/entry/DdbEsGetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPublishedRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ScopeTenant } from \"@webiny/api-core/features/tenancy/ScopeTenant/index.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetPublishedRevisionByEntryIdImpl\n implements GetPublishedRevisionByEntryIdStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private scopeTenant: ScopeTenant.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) {\n const tenant = this.scopeTenant.getId();\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getPublishedRevisionByEntryId<T>({\n model: { tenant, modelId: model.modelId },\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetPublishedRevisionByEntryId =\n GetPublishedRevisionByEntryIdStorageOperation.createImplementation({\n implementation: DdbEsGetPublishedRevisionByEntryIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider, ScopeTenant]\n });\n"],"names":["DdbEsGetPublishedRevisionByEntryIdImpl","dataLoaders","storageModelProvider","scopeTenant","initialModel","params","tenant","model","entry","convertEntryKeysFromStorage","DdbEsGetPublishedRevisionByEntryId","GetPublishedRevisionByEntryIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider","ScopeTenant"],"mappings":";;;;;AAWA,MAAMA;IAGF,YACYC,WAA0C,EAC1CC,oBAAuD,EACvDC,WAAkC,CAC5C;aAHUF,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA2D,EAC7D;QACE,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK;QACrC,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIH;QAEpD,MAAM,CAACI,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAI;YACpE,OAAO;gBAAEF;gBAAQ,SAASC,MAAM,OAAO;YAAC;YACxC,KAAK;gBAACF,OAAO,EAAE;aAAC;QACpB;QACA,IAAI,CAACG,OACD,OAAO;QAEX,OAAOC,4BAA+B;YAClCF;YACAC;QACJ;IACJ;AACJ;AAEO,MAAME,qCACTC,8CAA8C,oBAAoB,CAAC;IAC/D,gBAAgBX;IAChB,cAAc;QAACY;QAAqBC;QAAyBC;KAAY;AAC7E"}
|
|
@@ -2,10 +2,12 @@ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetRevisionPara
|
|
|
2
2
|
import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
|
|
3
3
|
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
4
|
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { ScopeTenant } from "@webiny/api-core/features/tenancy/ScopeTenant/index.js";
|
|
5
6
|
declare class DdbEsGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {
|
|
6
7
|
private dataLoaders;
|
|
7
8
|
private storageModelProvider;
|
|
8
|
-
|
|
9
|
+
private scopeTenant;
|
|
10
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, scopeTenant: ScopeTenant.Interface);
|
|
9
11
|
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
12
|
}
|
|
11
13
|
export declare const DdbEsGetRevisionById: typeof DdbEsGetRevisionByIdImpl & {
|