@webiny/api-headless-cms-ddb 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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 +61 -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 +4 -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/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 -3
- package/index.js +62 -92
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
- package/operations/entry/dataLoader/DataLoaderCache.js +3 -13
- 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 +16 -26
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +27 -33
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +27 -33
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +29 -35
- 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 +4 -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 +16 -24
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +7 -6
- package/operations/entry/filtering/createExpressions.js +29 -35
- 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 +7 -6
- package/operations/entry/filtering/filter.js +22 -27
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +4 -4
- package/operations/entry/filtering/fullTextSearch.js +7 -15
- 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 +10 -18
- 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 +15 -21
- 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 +16 -22
- 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 +14 -17
- 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 +70 -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 +4 -4
- 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 +4 -3
- package/operations/entry/index.js +279 -388
- 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 +4 -5
- package/operations/group/index.js +37 -69
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +3 -3
- package/operations/model/index.js +36 -59
- package/operations/model/index.js.map +1 -1
- package/package.json +24 -20
- 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 +5 -5
- 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 +20 -20
- 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/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -94
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -2
- package/dynamoDb/storage/richText.js +0 -61
- package/dynamoDb/storage/richText.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,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
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 { createPlainObjectPathPlugin } from "./path/plainObject.js";
|
|
2
|
+
import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
|
|
3
|
+
import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
|
|
4
|
+
export default () => [createPlainObjectPathPlugin(), createLocationFolderIdPathPlugin(), createDatetimeTransformValuePlugin()];
|
|
14
5
|
|
|
15
6
|
//# sourceMappingURL=index.js.map
|
package/dynamoDb/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createPlainObjectPathPlugin","createDatetimeTransformValuePlugin","createLocationFolderIdPathPlugin"],"sources":["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"],"mappings":"AAAA,SAASA,2BAA2B;AACpC,SAASC,kCAAkC;AAC3C,SAASC,gCAAgC;AAEzC,eAAe,MAAM,CACjBF,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,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,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare const createStorageOperations: StorageOperationsFactory;
|
|
1
|
+
export * from "./plugins/index.js";
|
|
2
|
+
export declare const registerDynamoDbStorageOperations: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>[];
|
package/index.js
CHANGED
|
@@ -1,127 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _model = require("./definitions/model");
|
|
18
|
-
var _entry = require("./definitions/entry");
|
|
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 { registerExtension as registerDynamoDbExtension } from "@webiny/db-dynamodb";
|
|
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 { createGroupsStorageOperations } from "./operations/group/index.js";
|
|
8
|
+
import { createModelsStorageOperations } from "./operations/model/index.js";
|
|
9
|
+
import { createEntriesStorageOperations } from "./operations/entry/index.js";
|
|
10
|
+
import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/index.js";
|
|
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 as StorageOperationsFactoryAbstraction } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
15
|
+
export * from "./plugins/index.js";
|
|
16
|
+
const createDynamoDbStorageOperations = params => {
|
|
41
17
|
const {
|
|
42
|
-
attributes,
|
|
43
18
|
table,
|
|
44
19
|
documentClient,
|
|
45
|
-
plugins
|
|
20
|
+
plugins,
|
|
21
|
+
container
|
|
46
22
|
} = params;
|
|
47
|
-
const tableInstance =
|
|
48
|
-
table,
|
|
23
|
+
const tableInstance = createTable({
|
|
24
|
+
name: table,
|
|
49
25
|
documentClient
|
|
50
26
|
});
|
|
51
27
|
const entities = {
|
|
52
|
-
|
|
53
|
-
entityName:
|
|
54
|
-
table: tableInstance
|
|
55
|
-
attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
|
|
28
|
+
groups: createGroupEntity({
|
|
29
|
+
entityName: ENTITIES.GROUPS,
|
|
30
|
+
table: tableInstance
|
|
56
31
|
}),
|
|
57
|
-
|
|
58
|
-
entityName:
|
|
59
|
-
table: tableInstance
|
|
60
|
-
attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
|
|
32
|
+
models: createModelEntity({
|
|
33
|
+
entityName: ENTITIES.MODELS,
|
|
34
|
+
table: tableInstance
|
|
61
35
|
}),
|
|
62
|
-
|
|
63
|
-
entityName:
|
|
64
|
-
table: tableInstance
|
|
65
|
-
attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
|
|
66
|
-
}),
|
|
67
|
-
entries: (0, _entry.createEntryEntity)({
|
|
68
|
-
entityName: _types.ENTITIES.ENTRIES,
|
|
69
|
-
table: tableInstance,
|
|
70
|
-
attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
|
|
36
|
+
entries: createEntryEntity({
|
|
37
|
+
entityName: ENTITIES.ENTRIES,
|
|
38
|
+
table: tableInstance
|
|
71
39
|
})
|
|
72
40
|
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* DynamoDB filter plugins for the where conditions.
|
|
76
|
-
*/
|
|
77
|
-
(0, _filters.default)(),
|
|
41
|
+
plugins.register([
|
|
78
42
|
/**
|
|
79
43
|
* Field plugins for DynamoDB.
|
|
80
44
|
*/
|
|
81
|
-
(
|
|
45
|
+
dynamoDbPlugins(),
|
|
82
46
|
/**
|
|
83
47
|
* Filter create plugins.
|
|
84
48
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* User defined custom plugins.
|
|
88
|
-
*/
|
|
89
|
-
...(userPlugins || [])]);
|
|
90
|
-
const entries = (0, _entry2.createEntriesStorageOperations)({
|
|
49
|
+
createFilterCreatePlugins()]);
|
|
50
|
+
const entries = createEntriesStorageOperations({
|
|
91
51
|
entity: entities.entries,
|
|
52
|
+
container,
|
|
92
53
|
plugins
|
|
93
54
|
});
|
|
94
55
|
return {
|
|
95
56
|
name: "dynamodb",
|
|
96
|
-
beforeInit: async
|
|
97
|
-
const types = ["cms-model-field-to-graphql", _plugins3.CmsEntryFieldFilterPathPlugin.type, _plugins3.CmsFieldFilterValueTransformPlugin.type, _plugins3.CmsEntryFieldFilterPlugin.type, _plugins3.CmsEntryFieldSortingPlugin.type, _ValueFilterPlugin.ValueFilterPlugin.type, _apiHeadlessCms.StorageOperationsCmsModelPlugin.type, _apiHeadlessCms.StorageTransformPlugin.type, _api.CompressorPlugin.type];
|
|
98
|
-
/**
|
|
99
|
-
* Collect all required plugins from parent context.
|
|
100
|
-
*/
|
|
101
|
-
for (const type of types) {
|
|
102
|
-
plugins.mergeByType(context.plugins, type);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Pass the plugins to the parent context.
|
|
106
|
-
*/
|
|
107
|
-
context.plugins.register([(0, _dynamoDb.default)()]);
|
|
57
|
+
beforeInit: async () => {
|
|
108
58
|
entries.dataLoaders.clearAll();
|
|
109
59
|
},
|
|
110
60
|
getEntities: () => entities,
|
|
111
61
|
getTable: () => tableInstance,
|
|
112
|
-
|
|
113
|
-
entity: entities.system
|
|
114
|
-
}),
|
|
115
|
-
groups: (0, _group2.createGroupsStorageOperations)({
|
|
62
|
+
groups: createGroupsStorageOperations({
|
|
116
63
|
entity: entities.groups,
|
|
117
|
-
|
|
64
|
+
container
|
|
118
65
|
}),
|
|
119
|
-
models:
|
|
66
|
+
models: createModelsStorageOperations({
|
|
120
67
|
entity: entities.models
|
|
121
68
|
}),
|
|
122
69
|
entries
|
|
123
70
|
};
|
|
124
71
|
};
|
|
125
|
-
|
|
72
|
+
class DynamoDbStorageOperationsFactoryImpl {
|
|
73
|
+
async create(context) {
|
|
74
|
+
return createDynamoDbStorageOperations({
|
|
75
|
+
documentClient: context.db.driver.getClient(),
|
|
76
|
+
plugins: context.plugins,
|
|
77
|
+
container: context.container
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({
|
|
82
|
+
implementation: DynamoDbStorageOperationsFactoryImpl,
|
|
83
|
+
dependencies: []
|
|
84
|
+
});
|
|
85
|
+
const storageOperationsFeature = createFeature({
|
|
86
|
+
name: "cms.storageOperations.openSearch",
|
|
87
|
+
register: container => {
|
|
88
|
+
container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
export const registerDynamoDbStorageOperations = () => {
|
|
92
|
+
return [registerDynamoDbExtension(), createRegisterExtensionPlugin(context => {
|
|
93
|
+
return storageOperationsFeature.register(context.container);
|
|
94
|
+
})];
|
|
95
|
+
};
|
|
126
96
|
|
|
127
97
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["registerExtension","registerDynamoDbExtension","dynamoDbPlugins","ENTITIES","createGroupEntity","createModelEntity","createEntryEntity","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","createFilterCreatePlugins","createTable","createRegisterExtensionPlugin","createFeature","StorageOperationsFactory","StorageOperationsFactoryAbstraction","createDynamoDbStorageOperations","params","table","documentClient","plugins","container","tableInstance","name","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","register","entity","beforeInit","dataLoaders","clearAll","getEntities","getTable","DynamoDbStorageOperationsFactoryImpl","create","context","db","driver","getClient","DynamoDbStorageOperationsFactory","createImplementation","implementation","dependencies","storageOperationsFeature","inSingletonScope","registerDynamoDbStorageOperations"],"sources":["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"],"mappings":"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","ignoreList":[]}
|
|
@@ -2,11 +2,10 @@ import type DataLoader from "dataloader";
|
|
|
2
2
|
export interface CacheKeyParams {
|
|
3
3
|
name: string;
|
|
4
4
|
tenant: string;
|
|
5
|
-
|
|
5
|
+
modelId: string;
|
|
6
6
|
}
|
|
7
7
|
export interface ClearAllParams {
|
|
8
8
|
tenant: string;
|
|
9
|
-
locale: string;
|
|
10
9
|
}
|
|
11
10
|
export declare class DataLoaderCache {
|
|
12
11
|
private readonly cache;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DataLoaderCache = void 0;
|
|
7
|
-
class DataLoaderCache {
|
|
1
|
+
export class DataLoaderCache {
|
|
8
2
|
cache = {};
|
|
9
3
|
getDataLoader(params) {
|
|
10
4
|
const key = this.createKey(params);
|
|
@@ -21,10 +15,7 @@ class DataLoaderCache {
|
|
|
21
15
|
}
|
|
22
16
|
return;
|
|
23
17
|
}
|
|
24
|
-
const key =
|
|
25
|
-
...params,
|
|
26
|
-
name: ""
|
|
27
|
-
});
|
|
18
|
+
const key = `${params.tenant}_`;
|
|
28
19
|
for (const current in this.cache) {
|
|
29
20
|
if (current.startsWith(key) === false) {
|
|
30
21
|
continue;
|
|
@@ -33,9 +24,8 @@ class DataLoaderCache {
|
|
|
33
24
|
}
|
|
34
25
|
}
|
|
35
26
|
createKey(params) {
|
|
36
|
-
return `${params.tenant}_${params.
|
|
27
|
+
return `${params.tenant}_${params.modelId}_${params.name}`;
|
|
37
28
|
}
|
|
38
29
|
}
|
|
39
|
-
exports.DataLoaderCache = DataLoaderCache;
|
|
40
30
|
|
|
41
31
|
//# sourceMappingURL=DataLoaderCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","
|
|
1
|
+
{"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","tenant","startsWith","modelId","name"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n modelId: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = `${params.tenant}_`;\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.modelId}_${params.name}`;\n }\n}\n"],"mappings":"AAYA,OAAO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,GAAGD,MAAM,CAACO,MAAM,GAAG;IAC/B,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACO,MAAM,IAAIP,MAAM,CAACS,OAAO,IAAIT,MAAM,CAACU,IAAI,EAAE;EAC9D;AACJ","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CMS_ENTRY_BATCH_SCHEDULE_WAIT = void 0;
|
|
7
1
|
const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || "0");
|
|
8
|
-
const CMS_ENTRY_BATCH_SCHEDULE_WAIT =
|
|
2
|
+
export const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
|
|
9
3
|
|
|
10
4
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","
|
|
1
|
+
{"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","isNaN"],"sources":["constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"mappings":"AAAA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,wCAAwC,IAAI,GAAG,CAAC;AAChG,OAAO,MAAMC,6BAA6B,GAAGC,KAAK,CAACN,oBAAoB,CAAC,GAAG,CAAC,GAAGA,oBAAoB","ignoreList":[]}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createBatchScheduleFn = void 0;
|
|
7
|
-
var _constants = require("./constants");
|
|
8
3
|
/**
|
|
9
4
|
* This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
|
|
10
5
|
* Intended to be used internally or for a specific user case.
|
|
@@ -12,14 +7,13 @@ var _constants = require("./constants");
|
|
|
12
7
|
*
|
|
13
8
|
* https://github.com/graphql/dataloader#batch-scheduling
|
|
14
9
|
*/
|
|
15
|
-
const createBatchScheduleFn = () => {
|
|
16
|
-
if (
|
|
10
|
+
export const createBatchScheduleFn = () => {
|
|
11
|
+
if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
|
|
17
12
|
return undefined;
|
|
18
13
|
}
|
|
19
14
|
return callback => {
|
|
20
|
-
setTimeout(callback,
|
|
15
|
+
setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
|
|
21
16
|
};
|
|
22
17
|
};
|
|
23
|
-
exports.createBatchScheduleFn = createBatchScheduleFn;
|
|
24
18
|
|
|
25
19
|
//# sourceMappingURL=createBatchScheduleFn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CMS_ENTRY_BATCH_SCHEDULE_WAIT","createBatchScheduleFn","undefined","callback","setTimeout"],"sources":["createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants.js\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"mappings":"AAAA,SAASA,6BAA6B;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,IAAID,6BAA6B,IAAI,CAAC,EAAE;IACpC,OAAOE,SAAS;EACpB;EACA,OAAQC,QAAoB,IAAK;IAC7BC,UAAU,CAACD,QAAQ,EAAEH,6BAA6B,CAAC;EACvD,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const createGetAllEntryRevisions: (params:
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { IDataLoaderParams } from "./types.js";
|
|
4
|
+
export declare const createGetAllEntryRevisions: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
|