@webiny/api-headless-cms-ddb 6.0.0-alpha.5 → 6.0.0-rc.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/README.md +6 -20
- package/definitions/entry.d.ts +4 -6
- package/definitions/entry.js +5 -180
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +4 -6
- package/definitions/group.js +5 -58
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +4 -6
- package/definitions/model.js +5 -102
- package/definitions/model.js.map +1 -1
- package/definitions/table.d.ts +3 -5
- package/definitions/table.js +6 -28
- package/definitions/table.js.map +1 -1
- package/definitions/types.d.ts +59 -0
- package/definitions/types.js +3 -0
- package/definitions/types.js.map +1 -0
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +6 -13
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.d.ts +1 -1
- package/dynamoDb/path/locationFolderId.js +5 -14
- package/dynamoDb/path/locationFolderId.js.map +1 -1
- package/dynamoDb/path/plainObject.d.ts +1 -1
- package/dynamoDb/path/plainObject.js +5 -14
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/storage/longText.js +10 -18
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.js +10 -19
- package/dynamoDb/storage/richText.js.map +1 -1
- package/dynamoDb/transformValue/datetime.d.ts +1 -1
- package/dynamoDb/transformValue/datetime.js +5 -12
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +38 -73
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +0 -2
- package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +1 -7
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
- package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +22 -32
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +22 -32
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +24 -34
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +3 -3
- package/operations/entry/dataLoader/index.js +10 -31
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +3 -4
- package/operations/entry/dataLoader/types.js +1 -5
- package/operations/entry/dataLoader/types.js.map +1 -1
- package/operations/entry/dataLoaders.d.ts +11 -12
- package/operations/entry/dataLoaders.js +15 -25
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +3 -3
- package/operations/entry/filtering/createExpressions.js +27 -30
- package/operations/entry/filtering/createExpressions.js.map +1 -1
- package/operations/entry/filtering/createFields.d.ts +2 -2
- package/operations/entry/filtering/createFields.js +20 -22
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.d.ts +5 -5
- package/operations/entry/filtering/extractSort.js +38 -23
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.d.ts +5 -5
- package/operations/entry/filtering/filter.js +13 -21
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
- package/operations/entry/filtering/fullTextSearch.js +6 -14
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/getValue.js +1 -8
- package/operations/entry/filtering/getValue.js.map +1 -1
- package/operations/entry/filtering/index.d.ts +2 -2
- package/operations/entry/filtering/index.js +2 -19
- package/operations/entry/filtering/index.js.map +1 -1
- package/operations/entry/filtering/mapPlugins.d.ts +1 -1
- package/operations/entry/filtering/mapPlugins.js +3 -11
- package/operations/entry/filtering/mapPlugins.js.map +1 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +1 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +6 -14
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/index.d.ts +1 -1
- package/operations/entry/filtering/plugins/index.js +6 -13
- package/operations/entry/filtering/plugins/index.js.map +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.js +13 -19
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -2
- package/operations/entry/filtering/plugins/refFilterCreate.js +12 -18
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +7 -15
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
- package/operations/entry/filtering/sort.d.ts +5 -5
- package/operations/entry/filtering/sort.js +15 -19
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.d.ts +2 -4
- package/operations/entry/filtering/systemFields.js +55 -29
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.d.ts +1 -1
- package/operations/entry/filtering/transform.js +1 -8
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.d.ts +3 -3
- package/operations/entry/filtering/types.js +1 -5
- package/operations/entry/filtering/types.js.map +1 -1
- package/operations/entry/filtering/values.d.ts +1 -1
- package/operations/entry/filtering/values.js +4 -12
- package/operations/entry/filtering/values.js.map +1 -1
- package/operations/entry/filtering/where.js +1 -8
- package/operations/entry/filtering/where.js.map +1 -1
- package/operations/entry/index.d.ts +2 -3
- package/operations/entry/index.js +267 -377
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +40 -2
- package/operations/entry/keys.js +53 -30
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.d.ts +3 -3
- package/operations/group/index.js +35 -64
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +3 -3
- package/operations/model/index.js +36 -58
- package/operations/model/index.js.map +1 -1
- package/package.json +16 -18
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
- package/plugins/CmsEntryFieldFilterPathPlugin.js +4 -12
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +3 -3
- package/plugins/CmsEntryFieldFilterPlugin.js +2 -8
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
- package/plugins/CmsEntryFieldSortingPlugin.js +3 -11
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.js +2 -9
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
- package/plugins/index.d.ts +4 -4
- package/plugins/index.js +4 -49
- package/plugins/index.js.map +1 -1
- package/types.d.ts +17 -19
- package/types.js +1 -8
- package/types.js.map +1 -1
- package/definitions/system.d.ts +0 -10
- package/definitions/system.js +0 -42
- package/definitions/system.js.map +0 -1
- package/operations/system/index.d.ts +0 -7
- package/operations/system/index.js +0 -94
- package/operations/system/index.js.map +0 -1
package/dynamoDb/index.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var _richText = require("./storage/richText");
|
|
8
|
-
var _longText = require("./storage/longText");
|
|
9
|
-
var _plainObject = require("./path/plainObject");
|
|
10
|
-
var _datetime = require("./transformValue/datetime");
|
|
11
|
-
var _locationFolderId = require("./path/locationFolderId");
|
|
12
|
-
var _default = () => [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)(), (0, _plainObject.createPlainObjectPathPlugin)(), (0, _locationFolderId.createLocationFolderIdPathPlugin)(), (0, _datetime.createDatetimeTransformValuePlugin)()];
|
|
13
|
-
exports.default = _default;
|
|
1
|
+
import { createRichTextStorageTransformPlugin } from "./storage/richText.js";
|
|
2
|
+
import { createLongTextStorageTransformPlugin } from "./storage/longText.js";
|
|
3
|
+
import { createPlainObjectPathPlugin } from "./path/plainObject.js";
|
|
4
|
+
import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
|
|
5
|
+
import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
|
|
6
|
+
export default () => [createRichTextStorageTransformPlugin(), createLongTextStorageTransformPlugin(), createPlainObjectPathPlugin(), createLocationFolderIdPathPlugin(), createDatetimeTransformValuePlugin()];
|
|
14
7
|
|
|
15
8
|
//# sourceMappingURL=index.js.map
|
package/dynamoDb/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createPlainObjectPathPlugin","createDatetimeTransformValuePlugin","createLocationFolderIdPathPlugin"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText.js\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText.js\";\nimport { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":"AAAA,SAASA,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,2BAA2B;AACpC,SAASC,kCAAkC;AAC3C,SAASC,gCAAgC;AAEzC,eAAe,MAAM,CACjBJ,oCAAoC,CAAC,CAAC,EACtCC,oCAAoC,CAAC,CAAC,EACtCC,2BAA2B,CAAC,CAAC,EAC7BE,gCAAgC,CAAC,CAAC,EAClCD,kCAAkC,CAAC,CAAC,CACvC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin";
|
|
1
|
+
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
|
|
2
2
|
export declare const createLocationFolderIdPathPlugin: () => CmsEntryFieldFilterPathPlugin;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createLocationFolderIdPathPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _CmsEntryFieldFilterPathPlugin = require("../../plugins/CmsEntryFieldFilterPathPlugin");
|
|
10
1
|
/**
|
|
11
2
|
* File is @internal
|
|
12
3
|
*/
|
|
13
|
-
|
|
4
|
+
import WebinyError from "@webiny/error";
|
|
5
|
+
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
|
|
14
6
|
const createPath = ({
|
|
15
7
|
field
|
|
16
8
|
}) => {
|
|
@@ -18,14 +10,14 @@ const createPath = ({
|
|
|
18
10
|
path
|
|
19
11
|
} = field.settings || {};
|
|
20
12
|
if (!path) {
|
|
21
|
-
throw new
|
|
13
|
+
throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
|
|
22
14
|
field
|
|
23
15
|
});
|
|
24
16
|
}
|
|
25
17
|
return path;
|
|
26
18
|
};
|
|
27
|
-
const createLocationFolderIdPathPlugin = () => {
|
|
28
|
-
return new
|
|
19
|
+
export const createLocationFolderIdPathPlugin = () => {
|
|
20
|
+
return new CmsEntryFieldFilterPathPlugin({
|
|
29
21
|
fieldType: "text",
|
|
30
22
|
path: createPath,
|
|
31
23
|
canUse: (field, parents) => {
|
|
@@ -38,6 +30,5 @@ const createLocationFolderIdPathPlugin = () => {
|
|
|
38
30
|
}
|
|
39
31
|
});
|
|
40
32
|
};
|
|
41
|
-
exports.createLocationFolderIdPathPlugin = createLocationFolderIdPathPlugin;
|
|
42
33
|
|
|
43
34
|
//# sourceMappingURL=locationFolderId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","createLocationFolderIdPathPlugin","fieldType","canUse","parents","fieldId","length"],"sources":["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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,6BAA6B;AAEtC,MAAMC,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIJ,WAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EG;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIL,6BAA6B,CAAC;IACrCM,SAAS,EAAE,MAAM;IACjBH,IAAI,EAAEF,UAAU;IAChBM,MAAM,EAAEA,CAACL,KAAK,EAAEM,OAAO,KAAK;MACxB,IAAIN,KAAK,CAACO,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin";
|
|
1
|
+
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
|
|
2
2
|
export declare const createPlainObjectPathPlugin: () => CmsEntryFieldFilterPathPlugin;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createPlainObjectPathPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _CmsEntryFieldFilterPathPlugin = require("../../plugins/CmsEntryFieldFilterPathPlugin");
|
|
10
1
|
/**
|
|
11
2
|
* File is @internal
|
|
12
3
|
*/
|
|
13
|
-
|
|
4
|
+
import WebinyError from "@webiny/error";
|
|
5
|
+
import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
|
|
14
6
|
const createPath = ({
|
|
15
7
|
field
|
|
16
8
|
}) => {
|
|
@@ -18,18 +10,17 @@ const createPath = ({
|
|
|
18
10
|
path
|
|
19
11
|
} = field.settings || {};
|
|
20
12
|
if (!path) {
|
|
21
|
-
throw new
|
|
13
|
+
throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
|
|
22
14
|
field
|
|
23
15
|
});
|
|
24
16
|
}
|
|
25
17
|
return path;
|
|
26
18
|
};
|
|
27
|
-
const createPlainObjectPathPlugin = () => {
|
|
28
|
-
return new
|
|
19
|
+
export const createPlainObjectPathPlugin = () => {
|
|
20
|
+
return new CmsEntryFieldFilterPathPlugin({
|
|
29
21
|
fieldType: "plainObject",
|
|
30
22
|
path: createPath
|
|
31
23
|
});
|
|
32
24
|
};
|
|
33
|
-
exports.createPlainObjectPathPlugin = createPlainObjectPathPlugin;
|
|
34
25
|
|
|
35
26
|
//# sourceMappingURL=plainObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","createPlainObjectPathPlugin","fieldType"],"sources":["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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,6BAA6B;AAEtC,MAAMC,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIJ,WAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EG;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAED,OAAO,MAAME,2BAA2B,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIL,6BAA6B,CAAC;IACrCM,SAAS,EAAE,aAAa;IACxBH,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createLongTextStorageTransformPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _gzip = require("@webiny/utils/compression/gzip");
|
|
10
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
11
1
|
/**
|
|
12
2
|
* File is @internal
|
|
13
3
|
*/
|
|
14
4
|
|
|
5
|
+
import WebinyError from "@webiny/error";
|
|
6
|
+
import { compress as gzip, decompress as ungzip } from "@webiny/utils/compression/gzip.js";
|
|
7
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
15
8
|
const GZIP = "gzip";
|
|
16
9
|
const TO_STORAGE_ENCODING = "base64";
|
|
17
10
|
const FROM_STORAGE_ENCODING = "utf8";
|
|
@@ -21,8 +14,8 @@ const convertToBuffer = value => {
|
|
|
21
14
|
}
|
|
22
15
|
return value;
|
|
23
16
|
};
|
|
24
|
-
const createLongTextStorageTransformPlugin = () => {
|
|
25
|
-
return new
|
|
17
|
+
export const createLongTextStorageTransformPlugin = () => {
|
|
18
|
+
return new StorageTransformPlugin({
|
|
26
19
|
name: "headless-cms.storage-transform.long-text.default",
|
|
27
20
|
fieldType: "long-text",
|
|
28
21
|
fromStorage: async ({
|
|
@@ -33,7 +26,7 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
33
26
|
if (!storageValue || typeOf === "string" || typeOf === "number" || Array.isArray(storageValue) === true) {
|
|
34
27
|
return storageValue;
|
|
35
28
|
} else if (typeOf !== "object") {
|
|
36
|
-
throw new
|
|
29
|
+
throw new WebinyError(`LongText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
37
30
|
}
|
|
38
31
|
const {
|
|
39
32
|
compression,
|
|
@@ -44,16 +37,16 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
44
37
|
* Check if possibly undefined, null, empty...
|
|
45
38
|
*/
|
|
46
39
|
if (!compression) {
|
|
47
|
-
throw new
|
|
40
|
+
throw new WebinyError(`Missing compression in "fromStorage" function in field "${field.storageId}" - ${field.fieldId}.": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
48
41
|
value: storageValue
|
|
49
42
|
});
|
|
50
43
|
} else if (compression !== GZIP) {
|
|
51
|
-
throw new
|
|
44
|
+
throw new WebinyError(`This plugin cannot transform something not compressed with "GZIP".`, "WRONG_COMPRESSION", {
|
|
52
45
|
compression
|
|
53
46
|
});
|
|
54
47
|
}
|
|
55
48
|
try {
|
|
56
|
-
const buf = await (
|
|
49
|
+
const buf = await ungzip(convertToBuffer(value));
|
|
57
50
|
const result = buf.toString(FROM_STORAGE_ENCODING);
|
|
58
51
|
if (!isArray) {
|
|
59
52
|
return result;
|
|
@@ -76,7 +69,7 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
76
69
|
}
|
|
77
70
|
const isArray = Array.isArray(initialValue);
|
|
78
71
|
const value = isArray ? JSON.stringify(initialValue) : initialValue;
|
|
79
|
-
const compressedValue = await (
|
|
72
|
+
const compressedValue = await gzip(value);
|
|
80
73
|
const result = {
|
|
81
74
|
compression: GZIP,
|
|
82
75
|
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
@@ -89,6 +82,5 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
89
82
|
}
|
|
90
83
|
});
|
|
91
84
|
};
|
|
92
|
-
exports.createLongTextStorageTransformPlugin = createLongTextStorageTransformPlugin;
|
|
93
85
|
|
|
94
86
|
//# sourceMappingURL=longText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","compress","gzip","decompress","ungzip","StorageTransformPlugin","GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","name","fieldType","fromStorage","field","storageValue","typeOf","Array","isArray","storageId","fieldId","compression","JSON","stringify","buf","result","toString","parse","ex","console","log","message","toStorage","initialValue","hasOwnProperty","compressedValue"],"sources":["longText.ts"],"sourcesContent":["/**\n * File is @internal\n */\n\nimport WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip.js\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\nconst FROM_STORAGE_ENCODING = \"utf8\";\n\nconst convertToBuffer = (value: string | Buffer): Buffer => {\n if (typeof value === \"string\") {\n return Buffer.from(value, TO_STORAGE_ENCODING);\n }\n return value;\n};\n\nexport interface StorageValue {\n compression: string;\n value: string;\n isArray?: boolean;\n}\n\nexport const createLongTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin<string | string[], StorageValue>({\n name: \"headless-cms.storage-transform.long-text.default\",\n fieldType: \"long-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n const typeOf = typeof storageValue;\n if (\n !storageValue ||\n typeOf === \"string\" ||\n typeOf === \"number\" ||\n Array.isArray(storageValue) === true\n ) {\n return storageValue as unknown as string | string[];\n } else if (typeOf !== \"object\") {\n throw new WebinyError(\n `LongText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n const { compression, value, isArray } = storageValue;\n /**\n * Check if possibly undefined, null, empty...\n */\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.storageId\n }\" - ${field.fieldId}.\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n } else if (compression !== GZIP) {\n throw new WebinyError(\n `This plugin cannot transform something not compressed with \"GZIP\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n const buf = await ungzip(convertToBuffer(value));\n const result = buf.toString(FROM_STORAGE_ENCODING);\n if (!isArray) {\n return result;\n }\n return JSON.parse(result);\n } catch (ex) {\n console.log(\"Error while transforming long-text.\");\n console.log(ex.message);\n return \"\";\n }\n },\n toStorage: async ({ value: initialValue }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n */\n if (initialValue && initialValue.hasOwnProperty(\"compression\") === true) {\n return initialValue as unknown as StorageValue;\n }\n const isArray = Array.isArray(initialValue);\n const value = isArray ? JSON.stringify(initialValue) : initialValue;\n const compressedValue = await gzip(value);\n\n const result: StorageValue = {\n compression: GZIP,\n value: compressedValue.toString(TO_STORAGE_ENCODING)\n };\n if (!isArray) {\n return result;\n }\n result.isArray = isArray;\n return result;\n }\n });\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createRichTextStorageTransformPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
10
|
-
var _api = require("@webiny/api");
|
|
11
1
|
/**
|
|
12
2
|
* File is @internal
|
|
13
3
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import WebinyError from "@webiny/error";
|
|
5
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
6
|
+
import { CompressorPlugin } from "@webiny/api";
|
|
7
|
+
export const createRichTextStorageTransformPlugin = () => {
|
|
8
|
+
return new StorageTransformPlugin({
|
|
17
9
|
name: "headless-cms.storage-transform.rich-text.default",
|
|
18
10
|
fieldType: "rich-text",
|
|
19
11
|
fromStorage: async ({
|
|
@@ -24,12 +16,12 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
24
16
|
if (!storageValue) {
|
|
25
17
|
return storageValue;
|
|
26
18
|
} else if (typeof storageValue !== "object") {
|
|
27
|
-
throw new
|
|
19
|
+
throw new WebinyError(`RichText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
28
20
|
}
|
|
29
21
|
let compressor;
|
|
30
22
|
try {
|
|
31
|
-
compressor = plugins.oneByType(
|
|
32
|
-
} catch
|
|
23
|
+
compressor = plugins.oneByType(CompressorPlugin.type);
|
|
24
|
+
} catch {
|
|
33
25
|
return storageValue;
|
|
34
26
|
}
|
|
35
27
|
try {
|
|
@@ -44,8 +36,8 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
44
36
|
}) => {
|
|
45
37
|
let compressor;
|
|
46
38
|
try {
|
|
47
|
-
compressor = plugins.oneByType(
|
|
48
|
-
} catch
|
|
39
|
+
compressor = plugins.oneByType(CompressorPlugin.type);
|
|
40
|
+
} catch {
|
|
49
41
|
return value;
|
|
50
42
|
}
|
|
51
43
|
try {
|
|
@@ -56,6 +48,5 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
56
48
|
}
|
|
57
49
|
});
|
|
58
50
|
};
|
|
59
|
-
exports.createRichTextStorageTransformPlugin = createRichTextStorageTransformPlugin;
|
|
60
51
|
|
|
61
52
|
//# sourceMappingURL=richText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","StorageTransformPlugin","CompressorPlugin","createRichTextStorageTransformPlugin","name","fieldType","fromStorage","field","value","storageValue","plugins","storageId","fieldId","compressor","oneByType","type","getCompressor","decompress","toStorage","compress"],"sources":["richText.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport const createRichTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.rich-text.default\",\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue, plugins }) => {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `RichText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch {\n return storageValue;\n }\n\n try {\n return await compressor.getCompressor().decompress(storageValue);\n } catch {\n return storageValue;\n }\n },\n toStorage: async ({ value, plugins }) => {\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch {\n return value;\n }\n try {\n return await compressor.getCompressor().compress(value);\n } catch {\n return value;\n }\n }\n });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,OAAO,MAAMC,oCAAoC,GAAGA,CAAA,KAAM;EACtD,OAAO,IAAIF,sBAAsB,CAAC;IAC9BG,IAAI,EAAE,kDAAkD;IACxDC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,MAAAA,CAAO;MAAEC,KAAK;MAAEC,KAAK,EAAEC,YAAY;MAAEC;IAAQ,CAAC,KAAK;MAC5D,IAAI,CAACD,YAAY,EAAE;QACf,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;QACzC,MAAM,IAAIT,WAAW,CACjB,gFAAgFO,KAAK,CAACI,SAAS,OAAOJ,KAAK,CAACK,OAAO,GACvH,CAAC;MACL;MAEA,IAAIC,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGH,OAAO,CAACI,SAAS,CAAmBZ,gBAAgB,CAACa,IAAI,CAAC;MAC3E,CAAC,CAAC,MAAM;QACJ,OAAON,YAAY;MACvB;MAEA,IAAI;QACA,OAAO,MAAMI,UAAU,CAACG,aAAa,CAAC,CAAC,CAACC,UAAU,CAACR,YAAY,CAAC;MACpE,CAAC,CAAC,MAAM;QACJ,OAAOA,YAAY;MACvB;IACJ,CAAC;IACDS,SAAS,EAAE,MAAAA,CAAO;MAAEV,KAAK;MAAEE;IAAQ,CAAC,KAAK;MACrC,IAAIG,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGH,OAAO,CAACI,SAAS,CAAmBZ,gBAAgB,CAACa,IAAI,CAAC;MAC3E,CAAC,CAAC,MAAM;QACJ,OAAOP,KAAK;MAChB;MACA,IAAI;QACA,OAAO,MAAMK,UAAU,CAACG,aAAa,CAAC,CAAC,CAACG,QAAQ,CAACX,KAAK,CAAC;MAC3D,CAAC,CAAC,MAAM;QACJ,OAAOA,KAAK;MAChB;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File is @internal
|
|
3
3
|
*/
|
|
4
|
-
import type { CmsFieldFilterValueTransformPlugin } from "../../types";
|
|
4
|
+
import type { CmsFieldFilterValueTransformPlugin } from "../../types.js";
|
|
5
5
|
export declare const createDatetimeTransformValuePlugin: () => CmsFieldFilterValueTransformPlugin;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDatetimeTransformValuePlugin = void 0;
|
|
7
|
-
var _TimeTransformPlugin = require("@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin");
|
|
8
|
-
var _DateTimeTransformPlugin = require("@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin");
|
|
9
1
|
/**
|
|
10
2
|
* File is @internal
|
|
11
3
|
*/
|
|
12
4
|
|
|
13
|
-
|
|
5
|
+
import { TimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js";
|
|
6
|
+
import { DateTimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js";
|
|
7
|
+
const timeTransformer = new TimeTransformPlugin({
|
|
14
8
|
fields: ["*"]
|
|
15
9
|
});
|
|
16
|
-
const dateTimeTransformer = new
|
|
10
|
+
const dateTimeTransformer = new DateTimeTransformPlugin({
|
|
17
11
|
fields: ["*"]
|
|
18
12
|
});
|
|
19
|
-
const createDatetimeTransformValuePlugin = () => {
|
|
13
|
+
export const createDatetimeTransformValuePlugin = () => {
|
|
20
14
|
return {
|
|
21
15
|
type: "cms-field-filter-value-transform",
|
|
22
16
|
name: "cms-field-value-filter-transform-datetime",
|
|
@@ -42,6 +36,5 @@ const createDatetimeTransformValuePlugin = () => {
|
|
|
42
36
|
}
|
|
43
37
|
};
|
|
44
38
|
};
|
|
45
|
-
exports.createDatetimeTransformValuePlugin = createDatetimeTransformValuePlugin;
|
|
46
39
|
|
|
47
40
|
//# sourceMappingURL=datetime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["TimeTransformPlugin","DateTimeTransformPlugin","timeTransformer","fields","dateTimeTransformer","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings"],"sources":["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"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,gEAAgE;AACpG,SAASC,uBAAuB,QAAQ,oEAAoE;AAE5G,MAAMC,eAAe,GAAG,IAAIF,mBAAmB,CAAC;EAC5CG,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIH,uBAAuB,CAAC;EACpDE,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEF,OAAO,MAAME,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAOJ,eAAe,CAACO,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOP,mBAAmB,CAACK,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { StorageOperationsFactory } from "./types";
|
|
2
|
-
export * from "./plugins";
|
|
1
|
+
import type { StorageOperationsFactory } from "./types.js";
|
|
2
|
+
export * from "./plugins/index.js";
|
|
3
3
|
export declare const createStorageOperations: StorageOperationsFactory;
|
package/index.js
CHANGED
|
@@ -1,100 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _plugins = require("@webiny/plugins");
|
|
20
|
-
var _system2 = require("./operations/system");
|
|
21
|
-
var _group2 = require("./operations/group");
|
|
22
|
-
var _model2 = require("./operations/model");
|
|
23
|
-
var _entry2 = require("./operations/entry");
|
|
24
|
-
var _plugins2 = require("./operations/entry/filtering/plugins");
|
|
25
|
-
var _plugins3 = require("./plugins");
|
|
26
|
-
Object.keys(_plugins3).forEach(function (key) {
|
|
27
|
-
if (key === "default" || key === "__esModule") return;
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
-
if (key in exports && exports[key] === _plugins3[key]) return;
|
|
30
|
-
Object.defineProperty(exports, key, {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _plugins3[key];
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
|
|
38
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
39
|
-
var _api = require("@webiny/api");
|
|
40
|
-
const createStorageOperations = params => {
|
|
1
|
+
import dynamoDbValueFilters from "@webiny/db-dynamodb/plugins/filters/index.js";
|
|
2
|
+
import dynamoDbPlugins from "./dynamoDb/index.js";
|
|
3
|
+
import { ENTITIES } from "./types.js";
|
|
4
|
+
import { createGroupEntity } from "./definitions/group.js";
|
|
5
|
+
import { createModelEntity } from "./definitions/model.js";
|
|
6
|
+
import { createEntryEntity } from "./definitions/entry.js";
|
|
7
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
8
|
+
import { createGroupsStorageOperations } from "./operations/group/index.js";
|
|
9
|
+
import { createModelsStorageOperations } from "./operations/model/index.js";
|
|
10
|
+
import { createEntriesStorageOperations } from "./operations/entry/index.js";
|
|
11
|
+
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
|
+
import { createTable } from "./definitions/table.js";
|
|
17
|
+
export * from "./plugins/index.js";
|
|
18
|
+
export const createStorageOperations = params => {
|
|
41
19
|
const {
|
|
42
|
-
attributes,
|
|
43
20
|
table,
|
|
44
21
|
documentClient,
|
|
45
22
|
plugins: userPlugins
|
|
46
23
|
} = params;
|
|
47
|
-
const tableInstance =
|
|
48
|
-
table,
|
|
24
|
+
const tableInstance = createTable({
|
|
25
|
+
name: table,
|
|
49
26
|
documentClient
|
|
50
27
|
});
|
|
51
28
|
const entities = {
|
|
52
|
-
|
|
53
|
-
entityName:
|
|
54
|
-
table: tableInstance
|
|
55
|
-
attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
|
|
56
|
-
}),
|
|
57
|
-
groups: (0, _group.createGroupEntity)({
|
|
58
|
-
entityName: _types.ENTITIES.GROUPS,
|
|
59
|
-
table: tableInstance,
|
|
60
|
-
attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
|
|
29
|
+
groups: createGroupEntity({
|
|
30
|
+
entityName: ENTITIES.GROUPS,
|
|
31
|
+
table: tableInstance
|
|
61
32
|
}),
|
|
62
|
-
models:
|
|
63
|
-
entityName:
|
|
64
|
-
table: tableInstance
|
|
65
|
-
attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
|
|
33
|
+
models: createModelEntity({
|
|
34
|
+
entityName: ENTITIES.MODELS,
|
|
35
|
+
table: tableInstance
|
|
66
36
|
}),
|
|
67
|
-
entries:
|
|
68
|
-
entityName:
|
|
69
|
-
table: tableInstance
|
|
70
|
-
attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
|
|
37
|
+
entries: createEntryEntity({
|
|
38
|
+
entityName: ENTITIES.ENTRIES,
|
|
39
|
+
table: tableInstance
|
|
71
40
|
})
|
|
72
41
|
};
|
|
73
|
-
const plugins = new
|
|
42
|
+
const plugins = new PluginsContainer([
|
|
74
43
|
/**
|
|
75
44
|
* DynamoDB filter plugins for the where conditions.
|
|
76
45
|
*/
|
|
77
|
-
(
|
|
46
|
+
dynamoDbValueFilters(),
|
|
78
47
|
/**
|
|
79
48
|
* Field plugins for DynamoDB.
|
|
80
49
|
*/
|
|
81
|
-
(
|
|
50
|
+
dynamoDbPlugins(),
|
|
82
51
|
/**
|
|
83
52
|
* Filter create plugins.
|
|
84
53
|
*/
|
|
85
|
-
|
|
54
|
+
createFilterCreatePlugins(),
|
|
86
55
|
/**
|
|
87
56
|
* User defined custom plugins.
|
|
88
57
|
*/
|
|
89
58
|
...(userPlugins || [])]);
|
|
90
|
-
const entries =
|
|
59
|
+
const entries = createEntriesStorageOperations({
|
|
91
60
|
entity: entities.entries,
|
|
92
61
|
plugins
|
|
93
62
|
});
|
|
94
63
|
return {
|
|
95
64
|
name: "dynamodb",
|
|
96
65
|
beforeInit: async context => {
|
|
97
|
-
const types = ["cms-model-field-to-graphql",
|
|
66
|
+
const types = ["cms-model-field-to-graphql", CmsEntryFieldFilterPathPlugin.type, CmsFieldFilterValueTransformPlugin.type, CmsEntryFieldFilterPlugin.type, CmsEntryFieldSortingPlugin.type, ValueFilterPlugin.type, StorageOperationsCmsModelPlugin.type, StorageTransformPlugin.type, CompressorPlugin.type];
|
|
98
67
|
/**
|
|
99
68
|
* Collect all required plugins from parent context.
|
|
100
69
|
*/
|
|
@@ -104,24 +73,20 @@ const createStorageOperations = params => {
|
|
|
104
73
|
/**
|
|
105
74
|
* Pass the plugins to the parent context.
|
|
106
75
|
*/
|
|
107
|
-
context.plugins.register([(
|
|
76
|
+
context.plugins.register([dynamoDbPlugins()]);
|
|
108
77
|
entries.dataLoaders.clearAll();
|
|
109
78
|
},
|
|
110
79
|
getEntities: () => entities,
|
|
111
80
|
getTable: () => tableInstance,
|
|
112
|
-
|
|
113
|
-
entity: entities.system
|
|
114
|
-
}),
|
|
115
|
-
groups: (0, _group2.createGroupsStorageOperations)({
|
|
81
|
+
groups: createGroupsStorageOperations({
|
|
116
82
|
entity: entities.groups,
|
|
117
83
|
plugins
|
|
118
84
|
}),
|
|
119
|
-
models:
|
|
85
|
+
models: createModelsStorageOperations({
|
|
120
86
|
entity: entities.models
|
|
121
87
|
}),
|
|
122
88
|
entries
|
|
123
89
|
};
|
|
124
90
|
};
|
|
125
|
-
exports.createStorageOperations = createStorageOperations;
|
|
126
91
|
|
|
127
92
|
//# sourceMappingURL=index.js.map
|