@webiny/api-headless-cms-ddb 6.3.0 → 6.4.0-beta.0
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/definitions/entry.js +7 -9
- package/definitions/entry.js.map +1 -1
- package/definitions/group.js +7 -9
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +7 -9
- package/definitions/model.js.map +1 -1
- package/definitions/table.js +6 -7
- package/definitions/table.js.map +1 -1
- package/definitions/types.d.ts +1 -0
- package/definitions/types.js +0 -3
- package/dynamoDb/index.js +6 -1
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.js +16 -29
- package/dynamoDb/path/locationFolderId.js.map +1 -1
- package/dynamoDb/path/plainObject.js +11 -21
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/transformValue/datetime.js +21 -32
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.js +67 -77
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +2 -1
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +31 -41
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +31 -41
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.js +33 -47
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.js +8 -9
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.js +0 -3
- package/operations/entry/dataLoaders.js +81 -99
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.js +109 -157
- package/operations/entry/filtering/createExpressions.js.map +1 -1
- package/operations/entry/filtering/createFields.js +83 -96
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.js +50 -74
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.js +72 -140
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.js +21 -38
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/getValue.js +31 -53
- package/operations/entry/filtering/getValue.js.map +1 -1
- package/operations/entry/filtering/index.js +0 -2
- package/operations/entry/filtering/mapPlugins.js +15 -22
- package/operations/entry/filtering/mapPlugins.js.map +1 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +29 -33
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/index.js +7 -3
- package/operations/entry/filtering/plugins/index.js.map +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.js +60 -76
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.js +55 -66
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +43 -56
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
- package/operations/entry/filtering/sort.js +34 -60
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.js +144 -126
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.js +4 -8
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.js +0 -3
- package/operations/entry/filtering/values.js +11 -12
- package/operations/entry/filtering/values.js.map +1 -1
- package/operations/entry/filtering/where.js +17 -23
- package/operations/entry/filtering/where.js.map +1 -1
- package/operations/entry/index.js +894 -1148
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +54 -77
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.js +113 -134
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +100 -121
- package/operations/model/index.js.map +1 -1
- package/package.json +15 -15
- package/plugins/CmsEntryFieldFilterPathPlugin.js +23 -33
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.js +16 -17
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.js +16 -15
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.js +15 -12
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
- package/plugins/index.js +0 -2
- package/types.js +6 -5
- package/types.js.map +1 -1
- package/definitions/types.js.map +0 -1
- package/operations/entry/dataLoader/types.js.map +0 -1
- package/operations/entry/filtering/index.js.map +0 -1
- package/operations/entry/filtering/types.js.map +0 -1
- package/plugins/index.js.map +0 -1
package/definitions/entry.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createStandardEntity } from "@webiny/db-dynamodb";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
name: entityName,
|
|
9
|
-
table: table.table
|
|
10
|
-
});
|
|
2
|
+
const createEntryEntity = (params)=>{
|
|
3
|
+
const { table, entityName } = params;
|
|
4
|
+
return createStandardEntity({
|
|
5
|
+
name: entityName,
|
|
6
|
+
table: table.table
|
|
7
|
+
});
|
|
11
8
|
};
|
|
9
|
+
export { createEntryEntity };
|
|
12
10
|
|
|
13
11
|
//# sourceMappingURL=entry.js.map
|
package/definitions/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"definitions/entry.js","sources":["../../src/definitions/entry.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IEntryEntity, IEntryEntityAttributesData } from \"./types.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createEntryEntity = (params: Params): IEntryEntity => {\n const { table, entityName } = params;\n return createStandardEntity<IEntryEntityAttributesData>({\n name: entityName,\n table: table.table\n });\n};\n"],"names":["createEntryEntity","params","table","entityName","createStandardEntity"],"mappings":";AAQO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAAiD;QACpD,MAAMD;QACN,OAAOD,MAAM,KAAK;IACtB;AACJ"}
|
package/definitions/group.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createStandardEntity } from "@webiny/db-dynamodb";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
table: table.table,
|
|
9
|
-
name: entityName
|
|
10
|
-
});
|
|
2
|
+
const createGroupEntity = (params)=>{
|
|
3
|
+
const { table, entityName } = params;
|
|
4
|
+
return createStandardEntity({
|
|
5
|
+
table: table.table,
|
|
6
|
+
name: entityName
|
|
7
|
+
});
|
|
11
8
|
};
|
|
9
|
+
export { createGroupEntity };
|
|
12
10
|
|
|
13
11
|
//# sourceMappingURL=group.js.map
|
package/definitions/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"definitions/group.js","sources":["../../src/definitions/group.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IGroupEntity } from \"./types.js\";\nimport type { CmsGroup } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createGroupEntity = (params: Params): IGroupEntity => {\n const { table, entityName } = params;\n return createStandardEntity<CmsGroup>({\n table: table.table,\n name: entityName\n });\n};\n"],"names":["createGroupEntity","params","table","entityName","createStandardEntity"],"mappings":";AASO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAA+B;QAClC,OAAOF,MAAM,KAAK;QAClB,MAAMC;IACV;AACJ"}
|
package/definitions/model.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createStandardEntity } from "@webiny/db-dynamodb";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
table: table.table,
|
|
9
|
-
name: entityName
|
|
10
|
-
});
|
|
2
|
+
const createModelEntity = (params)=>{
|
|
3
|
+
const { table, entityName } = params;
|
|
4
|
+
return createStandardEntity({
|
|
5
|
+
table: table.table,
|
|
6
|
+
name: entityName
|
|
7
|
+
});
|
|
11
8
|
};
|
|
9
|
+
export { createModelEntity };
|
|
12
10
|
|
|
13
11
|
//# sourceMappingURL=model.js.map
|
package/definitions/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"definitions/model.js","sources":["../../src/definitions/model.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IModelEntity } from \"./types.js\";\nimport type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createModelEntity = (params: Params): IModelEntity => {\n const { table, entityName } = params;\n return createStandardEntity<StorageCmsModel>({\n table: table.table,\n name: entityName\n });\n};\n"],"names":["createModelEntity","params","table","entityName","createStandardEntity"],"mappings":";AASO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAAsC;QACzC,OAAOF,MAAM,KAAK;QAClB,MAAMC;IACV;AACJ"}
|
package/definitions/table.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { createTable
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
1
|
+
import { createTable } from "@webiny/db-dynamodb";
|
|
2
|
+
const table_createTable = (params)=>createTable({
|
|
3
|
+
name: params.name || process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
|
|
4
|
+
documentClient: params.documentClient
|
|
5
|
+
});
|
|
6
|
+
export { table_createTable as createTable };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=table.js.map
|
package/definitions/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"definitions/table.js","sources":["../../src/definitions/table.ts"],"sourcesContent":["import { createTable as baseCreateTable } from \"@webiny/db-dynamodb\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\ninterface Params {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = (params: Params) => {\n return baseCreateTable({\n name: params.name || process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n documentClient: params.documentClient\n });\n};\n"],"names":["createTable","params","baseCreateTable","process"],"mappings":";AAQO,MAAMA,oBAAc,CAACC,SACjBC,YAAgB;QACnB,MAAMD,OAAO,IAAI,IAAIE,QAAQ,GAAG,CAAC,qBAAqB,IAAKA,QAAQ,GAAG,CAAC,QAAQ;QAC/E,gBAAgBF,OAAO,cAAc;IACzC"}
|
package/definitions/types.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export interface IEntryEntityAttributesData {
|
|
|
53
53
|
meta?: GenericRecord;
|
|
54
54
|
system?: ICmsEntrySystem;
|
|
55
55
|
live: ICmsEntryLive | null;
|
|
56
|
+
revisionDescription: string | undefined;
|
|
56
57
|
}
|
|
57
58
|
export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;
|
|
58
59
|
export type IModelEntity = IEntity<IStandardEntityAttributes<StorageCmsModel>>;
|
package/definitions/types.js
CHANGED
package/dynamoDb/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { createPlainObjectPathPlugin } from "./path/plainObject.js";
|
|
2
2
|
import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
|
|
3
3
|
import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
|
|
4
|
-
|
|
4
|
+
const dynamoDb = ()=>[
|
|
5
|
+
createPlainObjectPathPlugin(),
|
|
6
|
+
createLocationFolderIdPathPlugin(),
|
|
7
|
+
createDatetimeTransformValuePlugin()
|
|
8
|
+
];
|
|
9
|
+
export default dynamoDb;
|
|
5
10
|
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
package/dynamoDb/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dynamoDb/index.js","sources":["../../src/dynamoDb/index.ts"],"sourcesContent":["import { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"names":["createPlainObjectPathPlugin","createLocationFolderIdPathPlugin","createDatetimeTransformValuePlugin"],"mappings":";;;AAIA,iBAAgB,IAAK;QACjBA;QACAC;QACAC;KACJ"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
* File is @internal
|
|
3
|
-
*/
|
|
4
|
-
import WebinyError from "@webiny/error";
|
|
1
|
+
import error from "@webiny/error";
|
|
5
2
|
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
|
|
6
|
-
const createPath = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
path
|
|
11
|
-
} = field.settings || {};
|
|
12
|
-
if (!path) {
|
|
13
|
-
throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
|
|
14
|
-
field
|
|
3
|
+
const createPath = ({ field })=>{
|
|
4
|
+
const { path } = field.settings || {};
|
|
5
|
+
if (!path) throw new error("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
|
|
6
|
+
field
|
|
15
7
|
});
|
|
16
|
-
|
|
17
|
-
return path;
|
|
18
|
-
};
|
|
19
|
-
export const createLocationFolderIdPathPlugin = () => {
|
|
20
|
-
return new CmsEntryFieldFilterPathPlugin({
|
|
21
|
-
fieldType: "text",
|
|
22
|
-
path: createPath,
|
|
23
|
-
canUse: (field, parents) => {
|
|
24
|
-
if (field.fieldId !== "folderId") {
|
|
25
|
-
return false;
|
|
26
|
-
} else if (!parents?.length) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return parents[0] === "wbyAco_location";
|
|
30
|
-
}
|
|
31
|
-
});
|
|
8
|
+
return path;
|
|
32
9
|
};
|
|
10
|
+
const createLocationFolderIdPathPlugin = ()=>new CmsEntryFieldFilterPathPlugin({
|
|
11
|
+
fieldType: "text",
|
|
12
|
+
path: createPath,
|
|
13
|
+
canUse: (field, parents)=>{
|
|
14
|
+
if ("folderId" !== field.fieldId) return false;
|
|
15
|
+
if (!parents?.length) return false;
|
|
16
|
+
return "wbyAco_location" === parents[0];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export { createLocationFolderIdPathPlugin };
|
|
33
20
|
|
|
34
21
|
//# sourceMappingURL=locationFolderId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dynamoDb/path/locationFolderId.js","sources":["../../../src/dynamoDb/path/locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"names":["createPath","field","path","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","parents"],"mappings":";;AAOA,MAAMA,aAAiC,CAAC,EAAEC,KAAK,EAAE;IAC7C,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,QAAQ,IAAI,CAAC;IACpC,IAAI,CAACC,MACD,MAAM,IAAIC,MAAY,gCAAgC,wBAAwB;QAC1EF;IACJ;IAEJ,OAAOC;AACX;AAEO,MAAME,mCAAmC,IACrC,IAAIC,8BAA8B;QACrC,WAAW;QACX,MAAML;QACN,QAAQ,CAACC,OAAOK;YACZ,IAAIL,AAAkB,eAAlBA,MAAM,OAAO,EACb,OAAO;YACJ,IAAI,CAACK,SAAS,QACjB,OAAO;YAEX,OAAOA,AAAe,sBAAfA,OAAO,CAAC,EAAE;QACrB;IACJ"}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
* File is @internal
|
|
3
|
-
*/
|
|
4
|
-
import WebinyError from "@webiny/error";
|
|
1
|
+
import error from "@webiny/error";
|
|
5
2
|
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
|
|
6
|
-
const createPath = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
path
|
|
11
|
-
} = field.settings || {};
|
|
12
|
-
if (!path) {
|
|
13
|
-
throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
|
|
14
|
-
field
|
|
3
|
+
const createPath = ({ field })=>{
|
|
4
|
+
const { path } = field.settings || {};
|
|
5
|
+
if (!path) throw new error("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
|
|
6
|
+
field
|
|
15
7
|
});
|
|
16
|
-
|
|
17
|
-
return path;
|
|
18
|
-
};
|
|
19
|
-
export const createPlainObjectPathPlugin = () => {
|
|
20
|
-
return new CmsEntryFieldFilterPathPlugin({
|
|
21
|
-
fieldType: "plainObject",
|
|
22
|
-
path: createPath
|
|
23
|
-
});
|
|
8
|
+
return path;
|
|
24
9
|
};
|
|
10
|
+
const createPlainObjectPathPlugin = ()=>new CmsEntryFieldFilterPathPlugin({
|
|
11
|
+
fieldType: "plainObject",
|
|
12
|
+
path: createPath
|
|
13
|
+
});
|
|
14
|
+
export { createPlainObjectPathPlugin };
|
|
25
15
|
|
|
26
16
|
//# sourceMappingURL=plainObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dynamoDb/path/plainObject.js","sources":["../../../src/dynamoDb/path/plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"names":["createPath","field","path","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin"],"mappings":";;AAOA,MAAMA,aAAiC,CAAC,EAAEC,KAAK,EAAE;IAC7C,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,QAAQ,IAAI,CAAC;IACpC,IAAI,CAACC,MACD,MAAM,IAAIC,MAAY,gCAAgC,wBAAwB;QAC1EF;IACJ;IAEJ,OAAOC;AACX;AAEO,MAAME,8BAA8B,IAChC,IAAIC,8BAA8B;QACrC,WAAW;QACX,MAAML;IACV"}
|
|
@@ -1,40 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File is @internal
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
import { TimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js";
|
|
6
2
|
import { DateTimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js";
|
|
7
3
|
const timeTransformer = new TimeTransformPlugin({
|
|
8
|
-
|
|
4
|
+
fields: [
|
|
5
|
+
"*"
|
|
6
|
+
]
|
|
9
7
|
});
|
|
10
8
|
const dateTimeTransformer = new DateTimeTransformPlugin({
|
|
11
|
-
|
|
9
|
+
fields: [
|
|
10
|
+
"*"
|
|
11
|
+
]
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (type === "time") {
|
|
29
|
-
return timeTransformer.transform({
|
|
30
|
-
value
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return dateTimeTransformer.transform({
|
|
34
|
-
value
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
};
|
|
13
|
+
const createDatetimeTransformValuePlugin = ()=>({
|
|
14
|
+
type: "cms-field-filter-value-transform",
|
|
15
|
+
name: "cms-field-value-filter-transform-datetime",
|
|
16
|
+
fieldType: "datetime",
|
|
17
|
+
transform: ({ field, value })=>{
|
|
18
|
+
const { type } = field.settings || {};
|
|
19
|
+
if ("time" === type) return timeTransformer.transform({
|
|
20
|
+
value
|
|
21
|
+
});
|
|
22
|
+
return dateTimeTransformer.transform({
|
|
23
|
+
value
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export { createDatetimeTransformValuePlugin };
|
|
39
28
|
|
|
40
29
|
//# sourceMappingURL=datetime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dynamoDb/transformValue/datetime.js","sources":["../../../src/dynamoDb/transformValue/datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"names":["timeTransformer","TimeTransformPlugin","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","field","value","type"],"mappings":";;AAOA,MAAMA,kBAAkB,IAAIC,oBAAoB;IAC5C,QAAQ;QAAC;KAAI;AACjB;AACA,MAAMC,sBAAsB,IAAIC,wBAAwB;IACpD,QAAQ;QAAC;KAAI;AACjB;AAEO,MAAMC,qCAAqC,IACvC;QACH,MAAM;QACN,MAAM;QACN,WAAW;QAIX,WAAW,CAAC,EAAEC,KAAK,EAAEC,KAAK,EAAE;YACxB,MAAM,EAAEC,IAAI,EAAE,GAAGF,MAAM,QAAQ,IAAI,CAAC;YACpC,IAAIE,AAAS,WAATA,MACA,OAAOP,gBAAgB,SAAS,CAAC;gBAC7BM;YACJ;YAEJ,OAAOJ,oBAAoB,SAAS,CAAC;gBACjCI;YACJ;QACJ;IACJ"}
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { registerExtension
|
|
2
|
-
import
|
|
1
|
+
import { registerExtension } from "@webiny/db-dynamodb";
|
|
2
|
+
import dynamoDb from "./dynamoDb/index.js";
|
|
3
3
|
import { ENTITIES } from "./types.js";
|
|
4
4
|
import { createGroupEntity } from "./definitions/group.js";
|
|
5
5
|
import { createModelEntity } from "./definitions/model.js";
|
|
@@ -11,87 +11,77 @@ import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/
|
|
|
11
11
|
import { createTable } from "./definitions/table.js";
|
|
12
12
|
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
13
13
|
import { createFeature } from "@webiny/feature/api/index.js";
|
|
14
|
-
import { StorageOperationsFactory
|
|
14
|
+
import { StorageOperationsFactory } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
15
15
|
export * from "./plugins/index.js";
|
|
16
|
-
const createDynamoDbStorageOperations = params
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
getTable: () => tableInstance,
|
|
62
|
-
groups: createGroupsStorageOperations({
|
|
63
|
-
entity: entities.groups,
|
|
64
|
-
container
|
|
65
|
-
}),
|
|
66
|
-
models: createModelsStorageOperations({
|
|
67
|
-
entity: entities.models
|
|
68
|
-
}),
|
|
69
|
-
entries
|
|
70
|
-
};
|
|
16
|
+
const createDynamoDbStorageOperations = (params)=>{
|
|
17
|
+
const { table, documentClient, plugins, container } = params;
|
|
18
|
+
const tableInstance = createTable({
|
|
19
|
+
name: table,
|
|
20
|
+
documentClient
|
|
21
|
+
});
|
|
22
|
+
const entities = {
|
|
23
|
+
groups: createGroupEntity({
|
|
24
|
+
entityName: ENTITIES.GROUPS,
|
|
25
|
+
table: tableInstance
|
|
26
|
+
}),
|
|
27
|
+
models: createModelEntity({
|
|
28
|
+
entityName: ENTITIES.MODELS,
|
|
29
|
+
table: tableInstance
|
|
30
|
+
}),
|
|
31
|
+
entries: createEntryEntity({
|
|
32
|
+
entityName: ENTITIES.ENTRIES,
|
|
33
|
+
table: tableInstance
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
plugins.register([
|
|
37
|
+
dynamoDb(),
|
|
38
|
+
createFilterCreatePlugins()
|
|
39
|
+
]);
|
|
40
|
+
const entries = createEntriesStorageOperations({
|
|
41
|
+
entity: entities.entries,
|
|
42
|
+
container,
|
|
43
|
+
plugins
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
name: "dynamodb",
|
|
47
|
+
beforeInit: async ()=>{
|
|
48
|
+
entries.dataLoaders.clearAll();
|
|
49
|
+
},
|
|
50
|
+
getEntities: ()=>entities,
|
|
51
|
+
getTable: ()=>tableInstance,
|
|
52
|
+
groups: createGroupsStorageOperations({
|
|
53
|
+
entity: entities.groups,
|
|
54
|
+
container
|
|
55
|
+
}),
|
|
56
|
+
models: createModelsStorageOperations({
|
|
57
|
+
entity: entities.models
|
|
58
|
+
}),
|
|
59
|
+
entries
|
|
60
|
+
};
|
|
71
61
|
};
|
|
72
62
|
class DynamoDbStorageOperationsFactoryImpl {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
async create(context) {
|
|
64
|
+
return createDynamoDbStorageOperations({
|
|
65
|
+
documentClient: context.db.driver.getClient(),
|
|
66
|
+
plugins: context.plugins,
|
|
67
|
+
container: context.container
|
|
68
|
+
});
|
|
69
|
+
}
|
|
80
70
|
}
|
|
81
|
-
const DynamoDbStorageOperationsFactory =
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
const DynamoDbStorageOperationsFactory = StorageOperationsFactory.createImplementation({
|
|
72
|
+
implementation: DynamoDbStorageOperationsFactoryImpl,
|
|
73
|
+
dependencies: []
|
|
84
74
|
});
|
|
85
75
|
const storageOperationsFeature = createFeature({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
name: "cms.storageOperations.openSearch",
|
|
77
|
+
register: (container)=>{
|
|
78
|
+
container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
|
|
79
|
+
}
|
|
90
80
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
81
|
+
const registerDynamoDbStorageOperations = ()=>[
|
|
82
|
+
registerExtension(),
|
|
83
|
+
createRegisterExtensionPlugin((context)=>storageOperationsFeature.register(context.container))
|
|
84
|
+
];
|
|
85
|
+
export { registerDynamoDbStorageOperations };
|
|
96
86
|
|
|
97
87
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { CmsContext, StorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport { createTable } from \"~/definitions/table.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\nexport * from \"./plugins/index.js\";\n\nconst createDynamoDbStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n };\n\n plugins.register([\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins()\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n container,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async () => {\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n\nclass DynamoDbStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createDynamoDbStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({\n implementation: DynamoDbStorageOperationsFactoryImpl,\n dependencies: []\n});\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n container.register(DynamoDbStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerDynamoDbStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"names":["createDynamoDbStorageOperations","params","table","documentClient","plugins","container","tableInstance","createTable","entities","createGroupEntity","ENTITIES","createModelEntity","createEntryEntity","dynamoDbPlugins","createFilterCreatePlugins","entries","createEntriesStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","DynamoDbStorageOperationsFactoryImpl","context","DynamoDbStorageOperationsFactory","StorageOperationsFactoryAbstraction","storageOperationsFeature","createFeature","registerDynamoDbStorageOperations","registerDynamoDbExtension","createRegisterExtensionPlugin"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAMA,kCAA4DC,CAAAA;IAC9D,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGJ;IAEtD,MAAMK,gBAAgBC,YAAY;QAC9B,MAAML;QACNC;IACJ;IAEA,MAAMK,WAAW;QACb,QAAQC,kBAAkB;YACtB,YAAYC,SAAS,MAAM;YAC3B,OAAOJ;QACX;QACA,QAAQK,kBAAkB;YACtB,YAAYD,SAAS,MAAM;YAC3B,OAAOJ;QACX;QACA,SAASM,kBAAkB;YACvB,YAAYF,SAAS,OAAO;YAC5B,OAAOJ;QACX;IACJ;IAEAF,QAAQ,QAAQ,CAAC;QAIbS;QAIAC;KACH;IAED,MAAMC,UAAUC,+BAA+B;QAC3C,QAAQR,SAAS,OAAO;QACxBH;QACAD;IACJ;IAEA,OAAO;QACH,MAAM;QACN,YAAY;YACRW,QAAQ,WAAW,CAAC,QAAQ;QAChC;QACA,aAAa,IAAMP;QACnB,UAAU,IAAMF;QAChB,QAAQW,8BAA8B;YAClC,QAAQT,SAAS,MAAM;YACvBH;QACJ;QACA,QAAQa,8BAA8B;YAClC,QAAQV,SAAS,MAAM;QAC3B;QACAO;IACJ;AACJ;AAEA,MAAMI;IAGF,MAAa,OAAOC,OAAmB,EAAE;QACrC,OAAOpB,gCAAgC;YACnC,gBAAgBoB,QAAQ,EAAE,CAAC,MAAM,CAAC,SAAS;YAC3C,SAASA,QAAQ,OAAO;YACxB,WAAWA,QAAQ,SAAS;QAChC;IACJ;AACJ;AAEA,MAAMC,mCAAmCC,yBAAAA,oBAAwD,CAAC;IAC9F,gBAAgBH;IAChB,cAAc,EAAE;AACpB;AAEA,MAAMI,2BAA2BC,cAAc;IAC3C,MAAM;IACN,UAAUnB,CAAAA;QACNA,UAAU,QAAQ,CAACgB,kCAAkC,gBAAgB;IACzE;AACJ;AAEO,MAAMI,oCAAoC,IACtC;QACHC;QACAC,8BAA8BP,CAAAA,UACnBG,yBAAyB,QAAQ,CAACH,QAAQ,SAAS;KAEjE"}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return this.cache[key] || null;
|
|
6
|
-
}
|
|
7
|
-
setDataLoader(params, dataLoader) {
|
|
8
|
-
const key = this.createKey(params);
|
|
9
|
-
this.cache[key] = dataLoader;
|
|
10
|
-
}
|
|
11
|
-
clearAll(params) {
|
|
12
|
-
if (!params) {
|
|
13
|
-
for (const current in this.cache) {
|
|
14
|
-
this.cache[current].clearAll();
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
1
|
+
class DataLoaderCache {
|
|
2
|
+
getDataLoader(params) {
|
|
3
|
+
const key = this.createKey(params);
|
|
4
|
+
return this.cache[key] || null;
|
|
17
5
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
setDataLoader(params, dataLoader) {
|
|
7
|
+
const key = this.createKey(params);
|
|
8
|
+
this.cache[key] = dataLoader;
|
|
9
|
+
}
|
|
10
|
+
clearAll(params) {
|
|
11
|
+
if (!params) {
|
|
12
|
+
for(const current in this.cache)this.cache[current].clearAll();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const key = `${params.tenant}_`;
|
|
16
|
+
for(const current in this.cache)if (false !== current.startsWith(key)) this.cache[current].clearAll();
|
|
17
|
+
}
|
|
18
|
+
createKey(params) {
|
|
19
|
+
return `${params.tenant}_${params.modelId}_${params.name}`;
|
|
20
|
+
}
|
|
21
|
+
constructor(){
|
|
22
|
+
this.cache = {};
|
|
24
23
|
}
|
|
25
|
-
}
|
|
26
|
-
createKey(params) {
|
|
27
|
-
return `${params.tenant}_${params.modelId}_${params.name}`;
|
|
28
|
-
}
|
|
29
24
|
}
|
|
25
|
+
export { DataLoaderCache };
|
|
30
26
|
|
|
31
27
|
//# sourceMappingURL=DataLoaderCache.js.map
|