@webiny/api-headless-cms-ddb 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9
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 +11 -5
- package/definitions/types.js +0 -3
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +6 -3
- 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.d.ts +1 -2
- package/index.js +74 -79
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +22 -29
- 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 -26
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +32 -38
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +32 -38
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.js +34 -44
- 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.d.ts +1 -0
- package/operations/entry/dataLoader/types.js +0 -3
- package/operations/entry/dataLoaders.js +81 -97
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +6 -5
- package/operations/entry/filtering/createExpressions.js +110 -161
- 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.d.ts +5 -4
- package/operations/entry/filtering/filter.js +73 -138
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +2 -2
- 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 -51
- 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 -111
- 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.d.ts +2 -2
- 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.d.ts +2 -0
- package/operations/entry/index.js +896 -1149
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +6 -0
- package/operations/entry/keys.js +57 -77
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.d.ts +2 -3
- package/operations/group/index.js +115 -139
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +100 -122
- package/operations/model/index.js.map +1 -1
- package/package.json +27 -19
- package/plugins/CmsEntryFieldFilterPathPlugin.js +23 -33
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +3 -3
- 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.d.ts +5 -3
- package/types.js +6 -5
- package/types.js.map +1 -1
- package/definitions/types.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -86
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -2
- package/dynamoDb/storage/richText.js +0 -52
- package/dynamoDb/storage/richText.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IEntity, IStandardEntityAttributes } from "@webiny/db-dynamodb";
|
|
2
2
|
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
-
import type { CmsEntryStatus, CmsGroup, CmsIdentity,
|
|
4
|
-
export interface
|
|
3
|
+
import type { CmsEntryStatus, CmsGroup, CmsIdentity, ICmsEntryLive, ICmsEntryLocation, ICmsEntrySystem, StorageCmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
4
|
+
export interface IEntryEntityAttributesData {
|
|
5
5
|
id: string;
|
|
6
6
|
entryId: string;
|
|
7
7
|
modelId: string;
|
|
@@ -51,9 +51,15 @@ export interface IEntryEntityAttirbutesData {
|
|
|
51
51
|
binOriginalFolderId?: string;
|
|
52
52
|
values: GenericRecord;
|
|
53
53
|
meta?: GenericRecord;
|
|
54
|
-
|
|
54
|
+
system?: ICmsEntrySystem;
|
|
55
|
+
live: ICmsEntryLive | null;
|
|
56
|
+
revisionDescription: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* A timestamp of when the entry should be automatically deleted from the database.
|
|
59
|
+
*/
|
|
60
|
+
expiresAt: number | null;
|
|
55
61
|
}
|
|
56
|
-
export type IEntryEntityAttributes = IStandardEntityAttributes<
|
|
57
|
-
export type IModelEntity = IEntity<IStandardEntityAttributes<
|
|
62
|
+
export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;
|
|
63
|
+
export type IModelEntity = IEntity<IStandardEntityAttributes<StorageCmsModel>>;
|
|
58
64
|
export type IGroupEntity = IEntity<IStandardEntityAttributes<CmsGroup>>;
|
|
59
65
|
export type IEntryEntity = IEntity<IEntryEntityAttributes>;
|
package/definitions/types.js
CHANGED
package/dynamoDb/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: () => (import("
|
|
1
|
+
declare const _default: () => (import("../index.js").CmsEntryFieldFilterPathPlugin | import("../types.js").CmsFieldFilterValueTransformPlugin)[];
|
|
2
2
|
export default _default;
|
package/dynamoDb/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { createRichTextStorageTransformPlugin } from "./storage/richText.js";
|
|
2
|
-
import { createLongTextStorageTransformPlugin } from "./storage/longText.js";
|
|
3
1
|
import { createPlainObjectPathPlugin } from "./path/plainObject.js";
|
|
4
2
|
import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
|
|
5
3
|
import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
|
|
6
|
-
|
|
4
|
+
const dynamoDb = ()=>[
|
|
5
|
+
createPlainObjectPathPlugin(),
|
|
6
|
+
createLocationFolderIdPathPlugin(),
|
|
7
|
+
createDatetimeTransformValuePlugin()
|
|
8
|
+
];
|
|
9
|
+
export default dynamoDb;
|
|
7
10
|
|
|
8
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.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { StorageOperationsFactory } from "./types.js";
|
|
2
1
|
export * from "./plugins/index.js";
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const registerDynamoDbStorageOperations: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>[];
|
package/index.js
CHANGED
|
@@ -1,92 +1,87 @@
|
|
|
1
|
-
import
|
|
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";
|
|
6
6
|
import { createEntryEntity } from "./definitions/entry.js";
|
|
7
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
8
7
|
import { createGroupsStorageOperations } from "./operations/group/index.js";
|
|
9
8
|
import { createModelsStorageOperations } from "./operations/model/index.js";
|
|
10
9
|
import { createEntriesStorageOperations } from "./operations/entry/index.js";
|
|
11
10
|
import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/index.js";
|
|
12
|
-
import { CmsEntryFieldFilterPathPlugin, CmsEntryFieldFilterPlugin, CmsEntryFieldSortingPlugin, CmsFieldFilterValueTransformPlugin } from "./plugins/index.js";
|
|
13
|
-
import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js";
|
|
14
|
-
import { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
15
|
-
import { CompressorPlugin } from "@webiny/api";
|
|
16
11
|
import { createTable } from "./definitions/table.js";
|
|
12
|
+
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
13
|
+
import { createFeature } from "@webiny/feature/api/index.js";
|
|
14
|
+
import { StorageOperationsFactory } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
17
15
|
export * from "./plugins/index.js";
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
name: "dynamodb",
|
|
65
|
-
beforeInit: async context => {
|
|
66
|
-
const types = ["cms-model-field-to-graphql", CmsEntryFieldFilterPathPlugin.type, CmsFieldFilterValueTransformPlugin.type, CmsEntryFieldFilterPlugin.type, CmsEntryFieldSortingPlugin.type, ValueFilterPlugin.type, StorageOperationsCmsModelPlugin.type, StorageTransformPlugin.type, CompressorPlugin.type];
|
|
67
|
-
/**
|
|
68
|
-
* Collect all required plugins from parent context.
|
|
69
|
-
*/
|
|
70
|
-
for (const type of types) {
|
|
71
|
-
plugins.mergeByType(context.plugins, type);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Pass the plugins to the parent context.
|
|
75
|
-
*/
|
|
76
|
-
context.plugins.register([dynamoDbPlugins()]);
|
|
77
|
-
entries.dataLoaders.clearAll();
|
|
78
|
-
},
|
|
79
|
-
getEntities: () => entities,
|
|
80
|
-
getTable: () => tableInstance,
|
|
81
|
-
groups: createGroupsStorageOperations({
|
|
82
|
-
entity: entities.groups,
|
|
83
|
-
plugins
|
|
84
|
-
}),
|
|
85
|
-
models: createModelsStorageOperations({
|
|
86
|
-
entity: entities.models
|
|
87
|
-
}),
|
|
88
|
-
entries
|
|
89
|
-
};
|
|
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
|
+
};
|
|
90
61
|
};
|
|
62
|
+
class DynamoDbStorageOperationsFactoryImpl {
|
|
63
|
+
async create(context) {
|
|
64
|
+
return createDynamoDbStorageOperations({
|
|
65
|
+
documentClient: context.db.driver.getClient(),
|
|
66
|
+
plugins: context.plugins,
|
|
67
|
+
container: context.container
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const DynamoDbStorageOperationsFactory = StorageOperationsFactory.createImplementation({
|
|
72
|
+
implementation: DynamoDbStorageOperationsFactoryImpl,
|
|
73
|
+
dependencies: []
|
|
74
|
+
});
|
|
75
|
+
const storageOperationsFeature = createFeature({
|
|
76
|
+
name: "cms.storageOperations.openSearch",
|
|
77
|
+
register: (container)=>{
|
|
78
|
+
container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const registerDynamoDbStorageOperations = ()=>[
|
|
82
|
+
registerExtension(),
|
|
83
|
+
createRegisterExtensionPlugin((context)=>storageOperationsFeature.register(context.container))
|
|
84
|
+
];
|
|
85
|
+
export { registerDynamoDbStorageOperations };
|
|
91
86
|
|
|
92
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"}
|