@webiny/api-headless-cms-ddb 0.0.0-mt-2 → 0.0.0-unstable.0156a4c312
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/README.md +6 -20
- package/abstractions/CmsDdbDataLoaders.d.ts +5 -0
- package/abstractions/CmsDdbDataLoaders.js +5 -0
- package/abstractions/CmsDdbDataLoaders.js.map +1 -0
- package/abstractions/CmsDdbEntryEntity.d.ts +5 -0
- package/abstractions/CmsDdbEntryEntity.js +5 -0
- package/abstractions/CmsDdbEntryEntity.js.map +1 -0
- package/abstractions/CmsDdbGroupEntity.d.ts +5 -0
- package/abstractions/CmsDdbGroupEntity.js +5 -0
- package/abstractions/CmsDdbGroupEntity.js.map +1 -0
- package/abstractions/CmsDdbModelEntity.d.ts +5 -0
- package/abstractions/CmsDdbModelEntity.js +5 -0
- package/abstractions/CmsDdbModelEntity.js.map +1 -0
- package/abstractions/CmsDdbTable.d.ts +5 -0
- package/abstractions/CmsDdbTable.js +5 -0
- package/abstractions/CmsDdbTable.js.map +1 -0
- package/definitions/entry.d.ts +6 -6
- package/definitions/entry.js +9 -95
- package/definitions/entry.js.map +1 -0
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +9 -72
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +9 -94
- package/definitions/model.js.map +1 -0
- package/definitions/table.d.ts +6 -7
- package/definitions/table.js +8 -30
- package/definitions/table.js.map +1 -0
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/index.d.ts +10 -2
- package/index.js +45 -123
- package/index.js.map +1 -0
- package/operations/entry/DdbCreateEntry.d.ts +16 -0
- package/operations/entry/DdbCreateEntry.js +77 -0
- package/operations/entry/DdbCreateEntry.js.map +1 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.d.ts +16 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js +85 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js.map +1 -0
- package/operations/entry/DdbDeleteEntry.d.ts +16 -0
- package/operations/entry/DdbDeleteEntry.js +65 -0
- package/operations/entry/DdbDeleteEntry.js.map +1 -0
- package/operations/entry/DdbDeleteEntryRevision.d.ts +17 -0
- package/operations/entry/DdbDeleteEntryRevision.js +91 -0
- package/operations/entry/DdbDeleteEntryRevision.js.map +1 -0
- package/operations/entry/DdbDeleteMultipleEntries.d.ts +16 -0
- package/operations/entry/DdbDeleteMultipleEntries.js +59 -0
- package/operations/entry/DdbDeleteMultipleEntries.js.map +1 -0
- package/operations/entry/DdbGetEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetEntriesByIds.js +31 -0
- package/operations/entry/DdbGetEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetEntry.d.ts +14 -0
- package/operations/entry/DdbGetEntry.js +27 -0
- package/operations/entry/DdbGetEntry.js.map +1 -0
- package/operations/entry/DdbGetLatestEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js +31 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetPreviousRevision.d.ts +14 -0
- package/operations/entry/DdbGetPreviousRevision.js +53 -0
- package/operations/entry/DdbGetPreviousRevision.js.map +1 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js +31 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetRevisionById.d.ts +14 -0
- package/operations/entry/DdbGetRevisionById.js +34 -0
- package/operations/entry/DdbGetRevisionById.js.map +1 -0
- package/operations/entry/DdbGetRevisions.d.ts +14 -0
- package/operations/entry/DdbGetRevisions.js +33 -0
- package/operations/entry/DdbGetRevisions.js.map +1 -0
- package/operations/entry/DdbGetUniqueFieldValues.d.ts +12 -0
- package/operations/entry/DdbGetUniqueFieldValues.js +31 -0
- package/operations/entry/DdbGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/DdbListEntries.d.ts +30 -0
- package/operations/entry/DdbListEntries.js +133 -0
- package/operations/entry/DdbListEntries.js.map +1 -0
- package/operations/entry/DdbMoveEntry.d.ts +16 -0
- package/operations/entry/DdbMoveEntry.js +63 -0
- package/operations/entry/DdbMoveEntry.js.map +1 -0
- package/operations/entry/DdbMoveToBin.d.ts +16 -0
- package/operations/entry/DdbMoveToBin.js +77 -0
- package/operations/entry/DdbMoveToBin.js.map +1 -0
- package/operations/entry/DdbPublishEntry.d.ts +18 -0
- package/operations/entry/DdbPublishEntry.js +162 -0
- package/operations/entry/DdbPublishEntry.js.map +1 -0
- package/operations/entry/DdbRestoreFromBin.d.ts +16 -0
- package/operations/entry/DdbRestoreFromBin.js +78 -0
- package/operations/entry/DdbRestoreFromBin.js.map +1 -0
- package/operations/entry/DdbUnpublishEntry.d.ts +17 -0
- package/operations/entry/DdbUnpublishEntry.js +112 -0
- package/operations/entry/DdbUnpublishEntry.js.map +1 -0
- package/operations/entry/DdbUpdateEntry.d.ts +17 -0
- package/operations/entry/DdbUpdateEntry.js +105 -0
- package/operations/entry/DdbUpdateEntry.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +5 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +40 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +40 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +42 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +18 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +0 -0
- package/operations/entry/dataLoaders.d.ts +20 -31
- package/operations/entry/dataLoaders.js +91 -296
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +55 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/keys.d.ts +46 -2
- package/operations/entry/keys.js +53 -55
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/storageEntryUtils.d.ts +8 -0
- package/operations/entry/storageEntryUtils.js +25 -0
- package/operations/entry/storageEntryUtils.js.map +1 -0
- package/operations/group/DdbCreateGroup.d.ts +12 -0
- package/operations/group/DdbCreateGroup.js +35 -0
- package/operations/group/DdbCreateGroup.js.map +1 -0
- package/operations/group/DdbDeleteGroup.d.ts +12 -0
- package/operations/group/DdbDeleteGroup.js +31 -0
- package/operations/group/DdbDeleteGroup.js.map +1 -0
- package/operations/group/DdbGetGroup.d.ts +12 -0
- package/operations/group/DdbGetGroup.js +31 -0
- package/operations/group/DdbGetGroup.js.map +1 -0
- package/operations/group/DdbListGroups.d.ts +14 -0
- package/operations/group/DdbListGroups.js +52 -0
- package/operations/group/DdbListGroups.js.map +1 -0
- package/operations/group/DdbUpdateGroup.d.ts +12 -0
- package/operations/group/DdbUpdateGroup.js +35 -0
- package/operations/group/DdbUpdateGroup.js.map +1 -0
- package/operations/group/feature.d.ts +4 -0
- package/operations/group/feature.js +19 -0
- package/operations/group/feature.js.map +1 -0
- package/operations/group/keys.d.ts +15 -0
- package/operations/group/keys.js +17 -0
- package/operations/group/keys.js.map +1 -0
- package/operations/model/DdbCreateModel.d.ts +12 -0
- package/operations/model/DdbCreateModel.js +37 -0
- package/operations/model/DdbCreateModel.js.map +1 -0
- package/operations/model/DdbDeleteModel.d.ts +12 -0
- package/operations/model/DdbDeleteModel.js +31 -0
- package/operations/model/DdbDeleteModel.js.map +1 -0
- package/operations/model/DdbGetModel.d.ts +12 -0
- package/operations/model/DdbGetModel.js +30 -0
- package/operations/model/DdbGetModel.js.map +1 -0
- package/operations/model/DdbListModels.d.ts +12 -0
- package/operations/model/DdbListModels.js +36 -0
- package/operations/model/DdbListModels.js.map +1 -0
- package/operations/model/DdbUpdateModel.d.ts +12 -0
- package/operations/model/DdbUpdateModel.js +36 -0
- package/operations/model/DdbUpdateModel.js.map +1 -0
- package/operations/model/feature.d.ts +4 -0
- package/operations/model/feature.js +19 -0
- package/operations/model/feature.js.map +1 -0
- package/operations/model/keys.d.ts +15 -0
- package/operations/model/keys.js +16 -0
- package/operations/model/keys.js.map +1 -0
- package/package.json +30 -34
- package/types.d.ts +12 -76
- package/types.js +8 -15
- package/types.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -50
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -24
- package/dynamoDb/path/plainObject.d.ts +0 -3
- package/dynamoDb/path/plainObject.js +0 -33
- package/dynamoDb/path/ref.d.ts +0 -3
- package/dynamoDb/path/ref.js +0 -27
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/dynamoDb/storage/longText.d.ts +0 -7
- package/dynamoDb/storage/longText.js +0 -83
- package/dynamoDb/storage/richText.d.ts +0 -8
- package/dynamoDb/storage/richText.js +0 -110
- package/dynamoDb/transformValue/datetime.d.ts +0 -3
- package/dynamoDb/transformValue/datetime.js +0 -47
- package/operations/entry/index.d.ts +0 -8
- package/operations/entry/index.js +0 -823
- package/operations/entry/systemFields.d.ts +0 -2
- package/operations/entry/systemFields.js +0 -50
- package/operations/entry/utils.d.ts +0 -31
- package/operations/entry/utils.js +0 -406
- package/operations/group/index.d.ts +0 -8
- package/operations/group/index.js +0 -198
- package/operations/model/index.d.ts +0 -6
- package/operations/model/index.js +0 -161
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -105
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/keys.js","sources":["../../../src/operations/entry/keys.ts"],"sourcesContent":["import { parseIdentifier, zeroPad } from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\n\ninterface BasePartitionKeyParams {\n tenant: string;\n}\nconst createBasePartitionKey = (params: BasePartitionKeyParams): string => {\n const { tenant } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating entry basePartitionKey`);\n }\n return `T#${tenant}#CMS#CME`;\n};\n\nexport interface PartitionKeyParams extends BasePartitionKeyParams {\n id: string;\n}\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { id: initialId } = params;\n const { id } = parseIdentifier(initialId);\n return `${createBasePartitionKey(params)}#${id}`;\n};\n\nexport interface SortKeyParams {\n version: number;\n}\nexport const createRevisionSortKey = (params: SortKeyParams): string => {\n return `REV#${zeroPad(params.version)}`;\n};\n\nexport const createLatestSortKey = (): string => {\n return \"L\";\n};\n\nexport const createPublishedSortKey = (): string => {\n return \"P\";\n};\n\nexport interface GSIPartitionKeyParams {\n tenant: string;\n modelId: string;\n}\nexport const createGSIPartitionKey = (params: GSIPartitionKeyParams, type: \"A\" | \"L\" | \"P\") => {\n const { modelId } = params;\n const partitionKey = createBasePartitionKey(params);\n return `${partitionKey}#M#${modelId}#${type}`;\n};\n\nexport interface GSISortKeyParams {\n id: string;\n}\nexport const createGSISortKey = (params: GSISortKeyParams): string => {\n return params.id;\n};\n\nexport interface ICreateEntryPublishedKeysParams {\n id: string;\n tenant: string;\n modelId: string;\n expiresAt: number | null;\n}\n\nexport const createEntryPublishedKeys = (params: ICreateEntryPublishedKeysParams) => {\n const { tenant, expiresAt } = params;\n return {\n PK: createPartitionKey(params),\n SK: createPublishedSortKey(),\n GSI1_PK: createGSIPartitionKey(params, \"P\"),\n GSI1_SK: createGSISortKey(params),\n TYPE: `cms.entry.p`,\n GSI_TENANT: tenant,\n expiresAt\n };\n};\n\nexport interface ICreateEntryLatestKeysParams {\n id: string;\n tenant: string;\n modelId: string;\n expiresAt: number | null;\n}\n\nexport const createEntryLatestKeys = (params: ICreateEntryLatestKeysParams) => {\n const { tenant, expiresAt } = params;\n return {\n PK: createPartitionKey(params),\n SK: createLatestSortKey(),\n GSI1_PK: createGSIPartitionKey(params, \"L\"),\n GSI1_SK: createGSISortKey(params),\n TYPE: `cms.entry.l`,\n GSI_TENANT: tenant,\n expiresAt\n };\n};\n\nexport interface ICreateRevisionKeysParams {\n id: string;\n tenant: string;\n version: number;\n modelId: string;\n expiresAt: number | null;\n}\n\nexport const createEntryRevisionKeys = (params: ICreateRevisionKeysParams) => {\n const { tenant, expiresAt } = params;\n return {\n PK: createPartitionKey(params),\n SK: createRevisionSortKey(params),\n GSI1_PK: createGSIPartitionKey(params, \"A\"),\n GSI1_SK: createGSISortKey(params),\n TYPE: `cms.entry`,\n GSI_TENANT: tenant,\n expiresAt\n };\n};\n"],"names":["createBasePartitionKey","params","tenant","WebinyError","createPartitionKey","initialId","id","parseIdentifier","createRevisionSortKey","zeroPad","createLatestSortKey","createPublishedSortKey","createGSIPartitionKey","type","modelId","partitionKey","createGSISortKey","createEntryPublishedKeys","expiresAt","createEntryLatestKeys","createEntryRevisionKeys"],"mappings":";;AAMA,MAAMA,yBAAyB,CAACC;IAC5B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,IAAI,CAACC,QACD,MAAM,IAAIC,MAAY;IAE1B,OAAO,CAAC,EAAE,EAAED,OAAO,QAAQ,CAAC;AAChC;AAKO,MAAME,qBAAqB,CAACH;IAC/B,MAAM,EAAE,IAAII,SAAS,EAAE,GAAGJ;IAC1B,MAAM,EAAEK,EAAE,EAAE,GAAGC,gBAAgBF;IAC/B,OAAO,GAAGL,uBAAuBC,QAAQ,CAAC,EAAEK,IAAI;AACpD;AAKO,MAAME,wBAAwB,CAACP,SAC3B,CAAC,IAAI,EAAEQ,QAAQR,OAAO,OAAO,GAAG;AAGpC,MAAMS,sBAAsB,IACxB;AAGJ,MAAMC,yBAAyB,IAC3B;AAOJ,MAAMC,wBAAwB,CAACX,QAA+BY;IACjE,MAAM,EAAEC,OAAO,EAAE,GAAGb;IACpB,MAAMc,eAAef,uBAAuBC;IAC5C,OAAO,GAAGc,aAAa,GAAG,EAAED,QAAQ,CAAC,EAAED,MAAM;AACjD;AAKO,MAAMG,mBAAmB,CAACf,SACtBA,OAAO,EAAE;AAUb,MAAMgB,2BAA2B,CAAChB;IACrC,MAAM,EAAEC,MAAM,EAAEgB,SAAS,EAAE,GAAGjB;IAC9B,OAAO;QACH,IAAIG,mBAAmBH;QACvB,IAAIU;QACJ,SAASC,sBAAsBX,QAAQ;QACvC,SAASe,iBAAiBf;QAC1B,MAAM;QACN,YAAYC;QACZgB;IACJ;AACJ;AASO,MAAMC,wBAAwB,CAAClB;IAClC,MAAM,EAAEC,MAAM,EAAEgB,SAAS,EAAE,GAAGjB;IAC9B,OAAO;QACH,IAAIG,mBAAmBH;QACvB,IAAIS;QACJ,SAASE,sBAAsBX,QAAQ;QACvC,SAASe,iBAAiBf;QAC1B,MAAM;QACN,YAAYC;QACZgB;IACJ;AACJ;AAUO,MAAME,0BAA0B,CAACnB;IACpC,MAAM,EAAEC,MAAM,EAAEgB,SAAS,EAAE,GAAGjB;IAC9B,OAAO;QACH,IAAIG,mBAAmBH;QACvB,IAAIO,sBAAsBP;QAC1B,SAASW,sBAAsBX,QAAQ;QACvC,SAASe,iBAAiBf;QAC1B,MAAM;QACN,YAAYC;QACZgB;IACJ;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CmsEntryValues, CmsStorageEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
interface ConvertStorageEntryParams<T extends CmsEntryValues = CmsEntryValues> {
|
|
3
|
+
storageEntry: CmsStorageEntry<T>;
|
|
4
|
+
model: StorageOperationsCmsModel<T>;
|
|
5
|
+
}
|
|
6
|
+
export declare const convertToStorageEntry: (params: ConvertStorageEntryParams) => CmsStorageEntry;
|
|
7
|
+
export declare const convertFromStorageEntry: <T extends CmsEntryValues = CmsEntryValues>(params: ConvertStorageEntryParams<T>) => CmsStorageEntry<T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const convertToStorageEntry = (params)=>{
|
|
2
|
+
const { model, storageEntry } = params;
|
|
3
|
+
const values = model.convertValueKeyToStorage({
|
|
4
|
+
fields: model.fields,
|
|
5
|
+
values: storageEntry.values
|
|
6
|
+
});
|
|
7
|
+
return {
|
|
8
|
+
...storageEntry,
|
|
9
|
+
values
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const convertFromStorageEntry = (params)=>{
|
|
13
|
+
const { model, storageEntry } = params;
|
|
14
|
+
const values = model.convertValueKeyFromStorage({
|
|
15
|
+
fields: model.fields,
|
|
16
|
+
values: storageEntry.values
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
...storageEntry,
|
|
20
|
+
values
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export { convertFromStorageEntry, convertToStorageEntry };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=storageEntryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/storageEntryUtils.js","sources":["../../../src/operations/entry/storageEntryUtils.ts"],"sourcesContent":["import type {\n CmsEntryValues,\n CmsStorageEntry,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface ConvertStorageEntryParams<T extends CmsEntryValues = CmsEntryValues> {\n storageEntry: CmsStorageEntry<T>;\n model: StorageOperationsCmsModel<T>;\n}\n\nexport const convertToStorageEntry = (params: ConvertStorageEntryParams): CmsStorageEntry => {\n const { model, storageEntry } = params;\n\n const values = model.convertValueKeyToStorage({\n fields: model.fields,\n values: storageEntry.values\n });\n return {\n ...storageEntry,\n values\n };\n};\n\nexport const convertFromStorageEntry = <T extends CmsEntryValues = CmsEntryValues>(\n params: ConvertStorageEntryParams<T>\n): CmsStorageEntry<T> => {\n const { model, storageEntry } = params;\n\n const values = model.convertValueKeyFromStorage({\n fields: model.fields,\n values: storageEntry.values\n });\n return {\n ...storageEntry,\n values\n };\n};\n"],"names":["convertToStorageEntry","params","model","storageEntry","values","convertFromStorageEntry"],"mappings":"AAWO,MAAMA,wBAAwB,CAACC;IAClC,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAE,GAAGF;IAEhC,MAAMG,SAASF,MAAM,wBAAwB,CAAC;QAC1C,QAAQA,MAAM,MAAM;QACpB,QAAQC,aAAa,MAAM;IAC/B;IACA,OAAO;QACH,GAAGA,YAAY;QACfC;IACJ;AACJ;AAEO,MAAMC,0BAA0B,CACnCJ;IAEA,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAE,GAAGF;IAEhC,MAAMG,SAASF,MAAM,0BAA0B,CAAC;QAC5C,QAAQA,MAAM,MAAM;QACpB,QAAQC,aAAa,MAAM;IAC/B;IACA,OAAO;QACH,GAAGA,YAAY;QACfC;IACJ;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsGroupStorageOperationsCreateParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { CreateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/CreateGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
declare class DdbCreateGroupImpl implements CreateGroupStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbGroupEntity.Interface);
|
|
7
|
+
execute(params: CmsGroupStorageOperationsCreateParams): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbCreateGroup: typeof DdbCreateGroupImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/CreateGroupStorageOperation.js").ICreateGroupStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { CreateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/CreateGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
import { createKeys, createType } from "./keys.js";
|
|
5
|
+
class DdbCreateGroupImpl {
|
|
6
|
+
constructor(entity){
|
|
7
|
+
this.entity = entity;
|
|
8
|
+
}
|
|
9
|
+
async execute(params) {
|
|
10
|
+
const { group } = params;
|
|
11
|
+
const keys = createKeys(group);
|
|
12
|
+
try {
|
|
13
|
+
await this.entity.put({
|
|
14
|
+
data: group,
|
|
15
|
+
TYPE: createType(),
|
|
16
|
+
...keys
|
|
17
|
+
});
|
|
18
|
+
} catch (ex) {
|
|
19
|
+
throw new error(ex.message || "Could not create group.", ex.code || "CREATE_GROUP_ERROR", {
|
|
20
|
+
error: ex,
|
|
21
|
+
group,
|
|
22
|
+
keys
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const DdbCreateGroup = CreateGroupStorageOperation.createImplementation({
|
|
28
|
+
implementation: DdbCreateGroupImpl,
|
|
29
|
+
dependencies: [
|
|
30
|
+
CmsDdbGroupEntity
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
export { DdbCreateGroup };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=DdbCreateGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/DdbCreateGroup.js","sources":["../../../src/operations/group/DdbCreateGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { CreateGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/CreateGroupStorageOperation.js\";\nimport { CmsDdbGroupEntity } from \"~/abstractions/CmsDdbGroupEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbCreateGroupImpl implements CreateGroupStorageOperation.Interface {\n constructor(private entity: CmsDdbGroupEntity.Interface) {}\n\n async execute(params: CmsGroupStorageOperationsCreateParams) {\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 create group.\",\n ex.code || \"CREATE_GROUP_ERROR\",\n { error: ex, group, keys }\n );\n }\n }\n}\n\nexport const DdbCreateGroup = CreateGroupStorageOperation.createImplementation({\n implementation: DdbCreateGroupImpl,\n dependencies: [CmsDdbGroupEntity]\n});\n"],"names":["DdbCreateGroupImpl","entity","params","group","keys","createKeys","createType","ex","WebinyError","DdbCreateGroup","CreateGroupStorageOperation","CmsDdbGroupEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMA;gBACN,MAAMG;gBACN,GAAGF,IAAI;YACX;QACJ,EAAE,OAAOG,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBAAE,OAAOA;gBAAIJ;gBAAOC;YAAK;QAEjC;IACJ;AACJ;AAEO,MAAMK,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBV;IAChB,cAAc;QAACW;KAAkB;AACrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsGroupStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
declare class DdbDeleteGroupImpl implements DeleteGroupStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbGroupEntity.Interface);
|
|
7
|
+
execute(params: CmsGroupStorageOperationsDeleteParams): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbDeleteGroup: typeof DdbDeleteGroupImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js").IDeleteGroupStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { DeleteGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
import { createKeys } from "./keys.js";
|
|
5
|
+
class DdbDeleteGroupImpl {
|
|
6
|
+
constructor(entity){
|
|
7
|
+
this.entity = entity;
|
|
8
|
+
}
|
|
9
|
+
async execute(params) {
|
|
10
|
+
const { group } = params;
|
|
11
|
+
const keys = createKeys(group);
|
|
12
|
+
try {
|
|
13
|
+
await this.entity.delete(keys);
|
|
14
|
+
} catch (ex) {
|
|
15
|
+
throw new error(ex.message || "Could not delete group.", ex.code || "DELETE_GROUP_ERROR", {
|
|
16
|
+
error: ex,
|
|
17
|
+
group,
|
|
18
|
+
keys
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const DdbDeleteGroup = DeleteGroupStorageOperation.createImplementation({
|
|
24
|
+
implementation: DdbDeleteGroupImpl,
|
|
25
|
+
dependencies: [
|
|
26
|
+
CmsDdbGroupEntity
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { DdbDeleteGroup };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=DdbDeleteGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/DdbDeleteGroup.js","sources":["../../../src/operations/group/DdbDeleteGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsDeleteParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { DeleteGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js\";\nimport { CmsDdbGroupEntity } from \"~/abstractions/CmsDdbGroupEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbDeleteGroupImpl implements DeleteGroupStorageOperation.Interface {\n constructor(private entity: CmsDdbGroupEntity.Interface) {}\n\n async execute(params: CmsGroupStorageOperationsDeleteParams) {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await this.entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete group.\",\n ex.code || \"DELETE_GROUP_ERROR\",\n { error: ex, group, keys }\n );\n }\n }\n}\n\nexport const DdbDeleteGroup = DeleteGroupStorageOperation.createImplementation({\n implementation: DdbDeleteGroupImpl,\n dependencies: [CmsDdbGroupEntity]\n});\n"],"names":["DdbDeleteGroupImpl","entity","params","group","keys","createKeys","ex","WebinyError","DdbDeleteGroup","DeleteGroupStorageOperation","CmsDdbGroupEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC;QAC7B,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBAAE,OAAOA;gBAAIH;gBAAOC;YAAK;QAEjC;IACJ;AACJ;AAEO,MAAMI,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBT;IAChB,cAAc;QAACU;KAAkB;AACrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsGroupStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
declare class DdbGetGroupImpl implements GetGroupStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbGroupEntity.Interface);
|
|
7
|
+
execute(params: CmsGroupStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/modelGroup.js").CmsGroup | null>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbGetGroup: typeof DdbGetGroupImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js").IGetGroupStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { GetGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
import { createKeys } from "./keys.js";
|
|
5
|
+
class DdbGetGroupImpl {
|
|
6
|
+
constructor(entity){
|
|
7
|
+
this.entity = entity;
|
|
8
|
+
}
|
|
9
|
+
async execute(params) {
|
|
10
|
+
const keys = createKeys(params);
|
|
11
|
+
try {
|
|
12
|
+
const result = await this.entity.get(keys);
|
|
13
|
+
return result?.data || null;
|
|
14
|
+
} catch (ex) {
|
|
15
|
+
throw new error(ex.message || "Could not get group.", ex.code || "GET_GROUP_ERROR", {
|
|
16
|
+
error: ex,
|
|
17
|
+
...params,
|
|
18
|
+
keys
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const DdbGetGroup = GetGroupStorageOperation.createImplementation({
|
|
24
|
+
implementation: DdbGetGroupImpl,
|
|
25
|
+
dependencies: [
|
|
26
|
+
CmsDdbGroupEntity
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { DdbGetGroup };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=DdbGetGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/DdbGetGroup.js","sources":["../../../src/operations/group/DdbGetGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsGetParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { GetGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js\";\nimport { CmsDdbGroupEntity } from \"~/abstractions/CmsDdbGroupEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbGetGroupImpl implements GetGroupStorageOperation.Interface {\n constructor(private entity: CmsDdbGroupEntity.Interface) {}\n\n async execute(params: CmsGroupStorageOperationsGetParams) {\n const keys = createKeys(params);\n try {\n const result = await this.entity.get(keys);\n return result?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get group.\",\n ex.code || \"GET_GROUP_ERROR\",\n { error: ex, ...params, keys }\n );\n }\n }\n}\n\nexport const DdbGetGroup = GetGroupStorageOperation.createImplementation({\n implementation: DdbGetGroupImpl,\n dependencies: [CmsDdbGroupEntity]\n});\n"],"names":["DdbGetGroupImpl","entity","params","keys","createKeys","result","ex","WebinyError","DdbGetGroup","GetGroupStorageOperation","CmsDdbGroupEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA0C,EAAE;QACtD,MAAMC,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACF;YACrC,OAAOE,QAAQ,QAAQ;QAC3B,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBAAE,OAAOA;gBAAI,GAAGJ,MAAM;gBAAEC;YAAK;QAErC;IACJ;AACJ;AAEO,MAAMK,cAAcC,yBAAyB,oBAAoB,CAAC;IACrE,gBAAgBT;IAChB,cAAc;QAACU;KAAkB;AACrC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsGroup, CmsGroupStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { ListGroupsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
import { FilterUtil } from "@webiny/db-dynamodb/feature/FilterUtil/index.js";
|
|
5
|
+
declare class DdbListGroupsImpl implements ListGroupsStorageOperation.Interface {
|
|
6
|
+
private entity;
|
|
7
|
+
private filterUtil;
|
|
8
|
+
constructor(entity: CmsDdbGroupEntity.Interface, filterUtil: FilterUtil.Interface);
|
|
9
|
+
execute(params: CmsGroupStorageOperationsListParams): Promise<CmsGroup[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbListGroups: typeof DdbListGroupsImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js").IListGroupsStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { sortItems } from "@webiny/db-dynamodb";
|
|
3
|
+
import { ListGroupsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js";
|
|
4
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
5
|
+
import { FilterUtil } from "@webiny/db-dynamodb/feature/FilterUtil/index.js";
|
|
6
|
+
import { createPartitionKey } from "./keys.js";
|
|
7
|
+
class DdbListGroupsImpl {
|
|
8
|
+
constructor(entity, filterUtil){
|
|
9
|
+
this.entity = entity;
|
|
10
|
+
this.filterUtil = filterUtil;
|
|
11
|
+
}
|
|
12
|
+
async execute(params) {
|
|
13
|
+
const { sort, where } = params;
|
|
14
|
+
let records = [];
|
|
15
|
+
try {
|
|
16
|
+
const ddbRecords = await this.entity.queryAll({
|
|
17
|
+
partitionKey: createPartitionKey(where),
|
|
18
|
+
options: {
|
|
19
|
+
gte: " "
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
records = ddbRecords.map((item)=>item.data);
|
|
23
|
+
} catch (ex) {
|
|
24
|
+
throw new error(ex.message || "Could not list groups.", ex.code || "LIST_GROUP_ERROR", {
|
|
25
|
+
error: ex,
|
|
26
|
+
...params,
|
|
27
|
+
sort,
|
|
28
|
+
where
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const filteredItems = this.filterUtil.filter({
|
|
32
|
+
items: records,
|
|
33
|
+
where,
|
|
34
|
+
fields: []
|
|
35
|
+
});
|
|
36
|
+
if (!sort || 0 === sort.length) return filteredItems;
|
|
37
|
+
return sortItems({
|
|
38
|
+
items: filteredItems,
|
|
39
|
+
sort
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const DdbListGroups = ListGroupsStorageOperation.createImplementation({
|
|
44
|
+
implementation: DdbListGroupsImpl,
|
|
45
|
+
dependencies: [
|
|
46
|
+
CmsDdbGroupEntity,
|
|
47
|
+
FilterUtil
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
export { DdbListGroups };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=DdbListGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/DdbListGroups.js","sources":["../../../src/operations/group/DdbListGroups.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 { CmsDdbGroupEntity } from \"~/abstractions/CmsDdbGroupEntity.js\";\nimport { FilterUtil } from \"@webiny/db-dynamodb/feature/FilterUtil/index.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbListGroupsImpl implements ListGroupsStorageOperation.Interface {\n constructor(\n private entity: CmsDdbGroupEntity.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(where),\n options: { gte: \" \" }\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 { error: ex, ...params, sort, where }\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({ items: filteredItems, sort });\n }\n}\n\nexport const DdbListGroups = ListGroupsStorageOperation.createImplementation({\n implementation: DdbListGroupsImpl,\n dependencies: [CmsDdbGroupEntity, FilterUtil]\n});\n"],"names":["DdbListGroupsImpl","entity","filterUtil","params","sort","where","records","ddbRecords","createPartitionKey","item","ex","WebinyError","filteredItems","sortItems","DdbListGroups","ListGroupsStorageOperation","CmsDdbGroupEntity","FilterUtil"],"mappings":";;;;;;AAWA,MAAMA;IACF,YACYC,MAAmC,EACnCC,UAAgC,CAC1C;aAFUD,MAAM,GAANA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QAAQC,MAA2C,EAAE;QACvD,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGF;QAExB,IAAIG,UAAsB,EAAE;QAC5B,IAAI;YACA,MAAMC,aAAa,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC1C,cAAcC,mBAAmBH;gBACjC,SAAS;oBAAE,KAAK;gBAAI;YACxB;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;gBAAE,OAAOA;gBAAI,GAAGP,MAAM;gBAAEC;gBAAMC;YAAM;QAE5C;QAEA,MAAMO,gBAAgB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,OAAON;YACPD;YACA,QAAQ,EAAE;QACd;QACA,IAAI,CAACD,QAAQA,AAAgB,MAAhBA,KAAK,MAAM,EACpB,OAAOQ;QAGX,OAAOC,UAAU;YAAE,OAAOD;YAAeR;QAAK;IAClD;AACJ;AAEO,MAAMU,gBAAgBC,2BAA2B,oBAAoB,CAAC;IACzE,gBAAgBf;IAChB,cAAc;QAACgB;QAAmBC;KAAW;AACjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsGroupStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
declare class DdbUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbGroupEntity.Interface);
|
|
7
|
+
execute(params: CmsGroupStorageOperationsUpdateParams): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbUpdateGroup: typeof DdbUpdateGroupImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js").IUpdateGroupStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
|
|
3
|
+
import { CmsDdbGroupEntity } from "../../abstractions/CmsDdbGroupEntity.js";
|
|
4
|
+
import { createKeys, createType } from "./keys.js";
|
|
5
|
+
class DdbUpdateGroupImpl {
|
|
6
|
+
constructor(entity){
|
|
7
|
+
this.entity = entity;
|
|
8
|
+
}
|
|
9
|
+
async execute(params) {
|
|
10
|
+
const { group } = params;
|
|
11
|
+
const keys = createKeys(group);
|
|
12
|
+
try {
|
|
13
|
+
await this.entity.put({
|
|
14
|
+
data: group,
|
|
15
|
+
TYPE: createType(),
|
|
16
|
+
...keys
|
|
17
|
+
});
|
|
18
|
+
} catch (ex) {
|
|
19
|
+
throw new error(ex.message || "Could not update group.", ex.code || "UPDATE_GROUP_ERROR", {
|
|
20
|
+
error: ex,
|
|
21
|
+
group,
|
|
22
|
+
keys
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const DdbUpdateGroup = UpdateGroupStorageOperation.createImplementation({
|
|
28
|
+
implementation: DdbUpdateGroupImpl,
|
|
29
|
+
dependencies: [
|
|
30
|
+
CmsDdbGroupEntity
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
export { DdbUpdateGroup };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=DdbUpdateGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/DdbUpdateGroup.js","sources":["../../../src/operations/group/DdbUpdateGroup.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 { CmsDdbGroupEntity } from \"~/abstractions/CmsDdbGroupEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {\n constructor(private entity: CmsDdbGroupEntity.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 { error: ex, group, keys }\n );\n }\n }\n}\n\nexport const DdbUpdateGroup = UpdateGroupStorageOperation.createImplementation({\n implementation: DdbUpdateGroupImpl,\n dependencies: [CmsDdbGroupEntity]\n});\n"],"names":["DdbUpdateGroupImpl","entity","params","group","keys","createKeys","createType","ex","WebinyError","DdbUpdateGroup","UpdateGroupStorageOperation","CmsDdbGroupEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMA;gBACN,MAAMG;gBACN,GAAGF,IAAI;YACX;QACJ,EAAE,OAAOG,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBAAE,OAAOA;gBAAIJ;gBAAOC;YAAK;QAEjC;IACJ;AACJ;AAEO,MAAMK,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBV;IAChB,cAAc;QAACW;KAAkB;AACrC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api/index.js";
|
|
2
|
+
import { DdbGetGroup } from "./DdbGetGroup.js";
|
|
3
|
+
import { DdbListGroups } from "./DdbListGroups.js";
|
|
4
|
+
import { DdbCreateGroup } from "./DdbCreateGroup.js";
|
|
5
|
+
import { DdbUpdateGroup } from "./DdbUpdateGroup.js";
|
|
6
|
+
import { DdbDeleteGroup } from "./DdbDeleteGroup.js";
|
|
7
|
+
const DdbGroupStorageOpsFeature = createFeature({
|
|
8
|
+
name: "cms.ddb.groupStorageOps",
|
|
9
|
+
register: (container)=>{
|
|
10
|
+
container.register(DdbGetGroup);
|
|
11
|
+
container.register(DdbListGroups);
|
|
12
|
+
container.register(DdbCreateGroup);
|
|
13
|
+
container.register(DdbUpdateGroup);
|
|
14
|
+
container.register(DdbDeleteGroup);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { DdbGroupStorageOpsFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/feature.js","sources":["../../../src/operations/group/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { DdbGetGroup } from \"./DdbGetGroup.js\";\nimport { DdbListGroups } from \"./DdbListGroups.js\";\nimport { DdbCreateGroup } from \"./DdbCreateGroup.js\";\nimport { DdbUpdateGroup } from \"./DdbUpdateGroup.js\";\nimport { DdbDeleteGroup } from \"./DdbDeleteGroup.js\";\n\nexport const DdbGroupStorageOpsFeature = createFeature({\n name: \"cms.ddb.groupStorageOps\",\n register: container => {\n container.register(DdbGetGroup);\n container.register(DdbListGroups);\n container.register(DdbCreateGroup);\n container.register(DdbUpdateGroup);\n container.register(DdbDeleteGroup);\n }\n});\n"],"names":["DdbGroupStorageOpsFeature","createFeature","container","DdbGetGroup","DdbListGroups","DdbCreateGroup","DdbUpdateGroup","DdbDeleteGroup"],"mappings":";;;;;;AAOO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface PartitionKeyParams {
|
|
2
|
+
tenant: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const createPartitionKey: (params: PartitionKeyParams) => string;
|
|
5
|
+
interface SortKeyParams {
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
interface Keys {
|
|
9
|
+
PK: string;
|
|
10
|
+
SK: string;
|
|
11
|
+
GSI_TENANT: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const createKeys: (params: PartitionKeyParams & SortKeyParams) => Keys;
|
|
14
|
+
export declare const createType: () => string;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const createPartitionKey = (params)=>{
|
|
2
|
+
const { tenant } = params;
|
|
3
|
+
return `T#${tenant}#CMS#CMG`;
|
|
4
|
+
};
|
|
5
|
+
const createSortKeys = (params)=>{
|
|
6
|
+
const { id } = params;
|
|
7
|
+
return id;
|
|
8
|
+
};
|
|
9
|
+
const createKeys = (params)=>({
|
|
10
|
+
PK: createPartitionKey(params),
|
|
11
|
+
SK: createSortKeys(params),
|
|
12
|
+
GSI_TENANT: params.tenant
|
|
13
|
+
});
|
|
14
|
+
const createType = ()=>"cms.group";
|
|
15
|
+
export { createKeys, createPartitionKey, createType };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/group/keys.js","sources":["../../../src/operations/group/keys.ts"],"sourcesContent":["interface PartitionKeyParams {\n tenant: string;\n}\n\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant } = params;\n return `T#${tenant}#CMS#CMG`;\n};\n\ninterface SortKeyParams {\n id: string;\n}\n\nconst createSortKeys = (params: SortKeyParams): string => {\n const { id } = params;\n return id;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\n\nexport const createKeys = (params: PartitionKeyParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKeys(params),\n GSI_TENANT: params.tenant\n };\n};\n\nexport const createType = (): string => {\n return \"cms.group\";\n};\n"],"names":["createPartitionKey","params","tenant","createSortKeys","id","createKeys","createType"],"mappings":"AAIO,MAAMA,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,OAAO,CAAC,EAAE,EAAEC,OAAO,QAAQ,CAAC;AAChC;AAMA,MAAMC,iBAAiB,CAACF;IACpB,MAAM,EAAEG,EAAE,EAAE,GAAGH;IACf,OAAOG;AACX;AAQO,MAAMC,aAAa,CAACJ,SAChB;QACH,IAAID,mBAAmBC;QACvB,IAAIE,eAAeF;QACnB,YAAYA,OAAO,MAAM;IAC7B;AAGG,MAAMK,aAAa,IACf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsCreateParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js";
|
|
3
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
4
|
+
declare class DdbCreateModelImpl implements CreateModelStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbModelEntity.Interface);
|
|
7
|
+
execute(params: CmsModelStorageOperationsCreateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbCreateModel: typeof DdbCreateModelImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js").ICreateModelStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { convertException } from "@webiny/utils";
|
|
3
|
+
import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js";
|
|
4
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
5
|
+
import { createKeys, createType } from "./keys.js";
|
|
6
|
+
class DdbCreateModelImpl {
|
|
7
|
+
constructor(entity){
|
|
8
|
+
this.entity = entity;
|
|
9
|
+
}
|
|
10
|
+
async execute(params) {
|
|
11
|
+
const { model } = params;
|
|
12
|
+
const keys = createKeys(model);
|
|
13
|
+
try {
|
|
14
|
+
await this.entity.put({
|
|
15
|
+
data: model,
|
|
16
|
+
...keys,
|
|
17
|
+
TYPE: createType()
|
|
18
|
+
});
|
|
19
|
+
return model;
|
|
20
|
+
} catch (ex) {
|
|
21
|
+
throw new error("Could not create CMS Content Model.", "CREATE_MODEL_ERROR", {
|
|
22
|
+
error: convertException(ex),
|
|
23
|
+
model,
|
|
24
|
+
keys
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const DdbCreateModel = CreateModelStorageOperation.createImplementation({
|
|
30
|
+
implementation: DdbCreateModelImpl,
|
|
31
|
+
dependencies: [
|
|
32
|
+
CmsDdbModelEntity
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
export { DdbCreateModel };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=DdbCreateModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/DdbCreateModel.js","sources":["../../../src/operations/model/DdbCreateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { convertException } from \"@webiny/utils\";\nimport { CreateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js\";\nimport { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createKeys, createType } from \"./keys.js\";\n\nclass DdbCreateModelImpl implements CreateModelStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsCreateParams) {\n const { model } = params;\n const keys = createKeys(model);\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(`Could not create CMS Content Model.`, \"CREATE_MODEL_ERROR\", {\n error: convertException(ex),\n model,\n keys\n });\n }\n }\n}\n\nexport const DdbCreateModel = CreateModelStorageOperation.createImplementation({\n implementation: DdbCreateModelImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbCreateModelImpl","entity","params","model","keys","createKeys","createType","ex","WebinyError","convertException","DdbCreateModel","CreateModelStorageOperation","CmsDdbModelEntity"],"mappings":";;;;;AAOA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClB,MAAMA;gBACN,GAAGC,IAAI;gBACP,MAAME;YACV;YACA,OAAOH;QACX,EAAE,OAAOI,IAAI;YACT,MAAM,IAAIC,MAAY,uCAAuC,sBAAsB;gBAC/E,OAAOC,iBAAiBF;gBACxBJ;gBACAC;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMM,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBX;IAChB,cAAc;QAACY;KAAkB;AACrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
|
|
3
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
4
|
+
declare class DdbDeleteModelImpl implements DeleteModelStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbModelEntity.Interface);
|
|
7
|
+
execute(params: CmsModelStorageOperationsDeleteParams): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbDeleteModel: typeof DdbDeleteModelImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js").IDeleteModelStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
|
|
3
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
4
|
+
import { createKeys } from "./keys.js";
|
|
5
|
+
class DdbDeleteModelImpl {
|
|
6
|
+
constructor(entity){
|
|
7
|
+
this.entity = entity;
|
|
8
|
+
}
|
|
9
|
+
async execute(params) {
|
|
10
|
+
const { model } = params;
|
|
11
|
+
const keys = createKeys(model);
|
|
12
|
+
try {
|
|
13
|
+
await this.entity.delete(keys);
|
|
14
|
+
} catch (ex) {
|
|
15
|
+
throw new error(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
|
|
16
|
+
error: ex,
|
|
17
|
+
model,
|
|
18
|
+
keys
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const DdbDeleteModel = DeleteModelStorageOperation.createImplementation({
|
|
24
|
+
implementation: DdbDeleteModelImpl,
|
|
25
|
+
dependencies: [
|
|
26
|
+
CmsDdbModelEntity
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { DdbDeleteModel };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=DdbDeleteModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/DdbDeleteModel.js","sources":["../../../src/operations/model/DdbDeleteModel.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 { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbDeleteModelImpl implements DeleteModelStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsDeleteParams) {\n const { model } = params;\n const keys = createKeys(model);\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 { error: ex, model, keys }\n );\n }\n }\n}\n\nexport const DdbDeleteModel = DeleteModelStorageOperation.createImplementation({\n implementation: DdbDeleteModelImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbDeleteModelImpl","entity","params","model","keys","createKeys","ex","WebinyError","DdbDeleteModel","DeleteModelStorageOperation","CmsDdbModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA6C,EAAE;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC;QAC7B,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBAAE,OAAOA;gBAAIH;gBAAOC;YAAK;QAEjC;IACJ;AACJ;AAEO,MAAMI,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBT;IAChB,cAAc;QAACU;KAAkB;AACrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
|
|
3
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
4
|
+
declare class DdbGetModelImpl implements GetModelStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbModelEntity.Interface);
|
|
7
|
+
execute(params: CmsModelStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel | null>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbGetModel: typeof DdbGetModelImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js").IGetModelStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
|
|
3
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
4
|
+
import { createKeys } from "./keys.js";
|
|
5
|
+
class DdbGetModelImpl {
|
|
6
|
+
constructor(entity){
|
|
7
|
+
this.entity = entity;
|
|
8
|
+
}
|
|
9
|
+
async execute(params) {
|
|
10
|
+
const keys = createKeys(params);
|
|
11
|
+
try {
|
|
12
|
+
const result = await this.entity.get(keys);
|
|
13
|
+
return result?.data || null;
|
|
14
|
+
} catch (ex) {
|
|
15
|
+
throw new error(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
|
|
16
|
+
error: ex,
|
|
17
|
+
keys
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const DdbGetModel = GetModelStorageOperation.createImplementation({
|
|
23
|
+
implementation: DdbGetModelImpl,
|
|
24
|
+
dependencies: [
|
|
25
|
+
CmsDdbModelEntity
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
export { DdbGetModel };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=DdbGetModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/DdbGetModel.js","sources":["../../../src/operations/model/DdbGetModel.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 { CmsDdbModelEntity } from \"~/abstractions/CmsDdbModelEntity.js\";\nimport { createKeys } from \"./keys.js\";\n\nclass DdbGetModelImpl implements GetModelStorageOperation.Interface {\n constructor(private entity: CmsDdbModelEntity.Interface) {}\n\n async execute(params: CmsModelStorageOperationsGetParams) {\n const keys = createKeys(params);\n try {\n const result = await this.entity.get(keys);\n return result?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n { error: ex, keys }\n );\n }\n }\n}\n\nexport const DdbGetModel = GetModelStorageOperation.createImplementation({\n implementation: DdbGetModelImpl,\n dependencies: [CmsDdbModelEntity]\n});\n"],"names":["DdbGetModelImpl","entity","params","keys","createKeys","result","ex","WebinyError","DdbGetModel","GetModelStorageOperation","CmsDdbModelEntity"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,MAA0C,EAAE;QACtD,MAAMC,OAAOC,WAAWF;QACxB,IAAI;YACA,MAAMG,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACF;YACrC,OAAOE,QAAQ,QAAQ;QAC3B,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBAAE,OAAOA;gBAAIH;YAAK;QAE1B;IACJ;AACJ;AAEO,MAAMK,cAAcC,yBAAyB,oBAAoB,CAAC;IACrE,gBAAgBT;IAChB,cAAc;QAACU;KAAkB;AACrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
|
|
3
|
+
import { CmsDdbModelEntity } from "../../abstractions/CmsDdbModelEntity.js";
|
|
4
|
+
declare class DdbListModelsImpl implements ListModelsStorageOperation.Interface {
|
|
5
|
+
private entity;
|
|
6
|
+
constructor(entity: CmsDdbModelEntity.Interface);
|
|
7
|
+
execute(params: CmsModelStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DdbListModels: typeof DdbListModelsImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js").IListModelsStorageOperation>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|