@webiny/api-headless-cms-ddb 0.0.0-unstable.615a930a68 → 0.0.0-unstable.61c048f412
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 -5
- package/definitions/entry.js +6 -89
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +4 -5
- package/definitions/group.js +6 -63
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +4 -5
- package/definitions/model.js +6 -85
- package/definitions/model.js.map +1 -1
- package/definitions/table.d.ts +4 -6
- package/definitions/table.js +7 -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 +8 -20
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.d.ts +2 -0
- package/dynamoDb/path/locationFolderId.js +34 -0
- package/dynamoDb/path/locationFolderId.js.map +1 -0
- package/dynamoDb/path/plainObject.d.ts +1 -1
- package/dynamoDb/path/plainObject.js +6 -20
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/storage/longText.d.ts +1 -1
- package/dynamoDb/storage/longText.js +19 -34
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.d.ts +1 -1
- package/dynamoDb/storage/richText.js +27 -88
- package/dynamoDb/storage/richText.js.map +1 -1
- package/dynamoDb/transformValue/datetime.d.ts +1 -1
- package/dynamoDb/transformValue/datetime.js +7 -19
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +47 -105
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +15 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +34 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +4 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +19 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +32 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +46 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +46 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +52 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +19 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +5 -0
- package/operations/entry/dataLoader/types.js +3 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +14 -30
- package/operations/entry/dataLoaders.js +56 -271
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +26 -0
- package/operations/entry/filtering/createExpressions.js +175 -0
- package/operations/entry/filtering/createExpressions.js.map +1 -0
- package/operations/entry/filtering/createFields.d.ts +7 -9
- package/operations/entry/filtering/createFields.js +87 -105
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.d.ts +8 -4
- package/operations/entry/filtering/extractSort.js +60 -31
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.d.ts +6 -7
- package/operations/entry/filtering/filter.js +102 -89
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +4 -8
- package/operations/entry/filtering/fullTextSearch.js +8 -30
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/getValue.js +5 -27
- package/operations/entry/filtering/getValue.js.map +1 -1
- package/operations/entry/filtering/index.d.ts +2 -2
- package/operations/entry/filtering/index.js +3 -20
- package/operations/entry/filtering/index.js.map +1 -1
- package/operations/entry/filtering/mapPlugins.d.ts +2 -2
- package/operations/entry/filtering/mapPlugins.js +4 -18
- package/operations/entry/filtering/mapPlugins.js.map +1 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -2
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +9 -20
- 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 +7 -16
- package/operations/entry/filtering/plugins/index.js.map +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -2
- package/operations/entry/filtering/plugins/objectFilterCreate.js +16 -39
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -2
- package/operations/entry/filtering/plugins/refFilterCreate.js +21 -36
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +57 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
- package/operations/entry/filtering/sort.d.ts +8 -5
- package/operations/entry/filtering/sort.js +23 -36
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.d.ts +2 -4
- package/operations/entry/filtering/systemFields.js +87 -43
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.d.ts +1 -1
- package/operations/entry/filtering/transform.js +2 -10
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.d.ts +2 -2
- package/operations/entry/filtering/types.js +2 -4
- package/operations/entry/filtering/types.js.map +1 -1
- package/operations/entry/filtering/values.d.ts +2 -0
- package/operations/entry/filtering/values.js +16 -0
- package/operations/entry/filtering/values.js.map +1 -0
- package/operations/entry/filtering/where.js +5 -15
- package/operations/entry/filtering/where.js.map +1 -1
- package/operations/entry/index.d.ts +3 -4
- package/operations/entry/index.js +751 -414
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +40 -2
- package/operations/entry/keys.js +54 -47
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.d.ts +4 -4
- package/operations/group/index.js +44 -91
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +3 -3
- package/operations/model/index.js +36 -70
- package/operations/model/index.js.map +1 -1
- package/package.json +22 -29
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +4 -3
- package/plugins/CmsEntryFieldFilterPathPlugin.js +14 -29
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +10 -10
- package/plugins/CmsEntryFieldFilterPlugin.js +9 -19
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
- package/plugins/CmsEntryFieldSortingPlugin.js +19 -0
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.js +16 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
- package/plugins/index.d.ts +4 -1
- package/plugins/index.js +5 -17
- package/plugins/index.js.map +1 -1
- package/types.d.ts +24 -19
- package/types.js +5 -13
- package/types.js.map +1 -1
- package/definitions/settings.d.ts +0 -9
- package/definitions/settings.js +0 -58
- package/definitions/settings.js.map +0 -1
- package/definitions/system.d.ts +0 -9
- package/definitions/system.js +0 -46
- package/definitions/system.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -2
- package/dynamoDb/storage/date.js +0 -109
- package/dynamoDb/storage/date.js.map +0 -1
- package/operations/entry/filtering/createFilters.d.ts +0 -20
- package/operations/entry/filtering/createFilters.js +0 -155
- package/operations/entry/filtering/createFilters.js.map +0 -1
- package/operations/entry/systemFields.d.ts +0 -2
- package/operations/entry/systemFields.js +0 -74
- package/operations/entry/systemFields.js.map +0 -1
- package/operations/entry/utils.d.ts +0 -36
- package/operations/entry/utils.js +0 -684
- package/operations/entry/utils.js.map +0 -1
- package/operations/settings/index.d.ts +0 -7
- package/operations/settings/index.js +0 -135
- package/operations/settings/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -7
- package/operations/system/index.js +0 -99
- package/operations/system/index.js.map +0 -1
package/dynamoDb/storage/date.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createDateStorageTransformPlugin = void 0;
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* File is @internal
|
|
16
|
-
*/
|
|
17
|
-
const excludeTypes = ["time", "dateTimeWithTimezone"];
|
|
18
|
-
|
|
19
|
-
const convertFromStorage = (field, value) => {
|
|
20
|
-
try {
|
|
21
|
-
if (field.multipleValues) {
|
|
22
|
-
const result = [];
|
|
23
|
-
|
|
24
|
-
for (const v of value) {
|
|
25
|
-
if (!v) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
result.push(new Date(v));
|
|
31
|
-
} catch {}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return new Date(value);
|
|
38
|
-
} catch {
|
|
39
|
-
console.log(`Could not transform from storage for field type`);
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const convertValueToStorage = (field, value) => {
|
|
45
|
-
if (value.toISOString) {
|
|
46
|
-
return value.toISOString();
|
|
47
|
-
} else if (typeof value === "string") {
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
|
|
52
|
-
value: value,
|
|
53
|
-
fieldId: field.fieldId,
|
|
54
|
-
storageId: field.storageId
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const createDateStorageTransformPlugin = () => {
|
|
59
|
-
return new _apiHeadlessCms.StorageTransformPlugin({
|
|
60
|
-
fieldType: "datetime",
|
|
61
|
-
fromStorage: async ({
|
|
62
|
-
value,
|
|
63
|
-
field
|
|
64
|
-
}) => {
|
|
65
|
-
const {
|
|
66
|
-
type
|
|
67
|
-
} = field.settings || {};
|
|
68
|
-
|
|
69
|
-
if (!value || !type || excludeTypes.includes(type)) {
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return convertFromStorage(field, value);
|
|
74
|
-
},
|
|
75
|
-
toStorage: async ({
|
|
76
|
-
value,
|
|
77
|
-
field
|
|
78
|
-
}) => {
|
|
79
|
-
const {
|
|
80
|
-
type
|
|
81
|
-
} = field.settings || {};
|
|
82
|
-
|
|
83
|
-
if (!value || !type || excludeTypes.includes(type)) {
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (field.multipleValues) {
|
|
88
|
-
const multipleValues = value;
|
|
89
|
-
return (multipleValues || []).filter(v => !!v).map(v => {
|
|
90
|
-
return convertValueToStorage(field, v);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (value.toISOString) {
|
|
95
|
-
return value.toISOString();
|
|
96
|
-
} else if (typeof value === "string") {
|
|
97
|
-
return value;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
|
|
101
|
-
value,
|
|
102
|
-
fieldId: field.fieldId,
|
|
103
|
-
storageId: field.storageId
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
exports.createDateStorageTransformPlugin = createDateStorageTransformPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["excludeTypes","convertFromStorage","field","value","multipleValues","result","v","push","Date","console","log","convertValueToStorage","toISOString","WebinyError","fieldId","storageId","createDateStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","type","settings","includes","toStorage","filter","map"],"sources":["date.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst excludeTypes = [\"time\", \"dateTimeWithTimezone\"];\n\nconst convertFromStorage = (\n field: Pick<CmsModelField, \"multipleValues\">,\n value: string | string[]\n) => {\n try {\n if (field.multipleValues) {\n const result: Date[] = [];\n for (const v of value) {\n if (!v) {\n continue;\n }\n try {\n result.push(new Date(v));\n } catch {}\n }\n return result;\n }\n return new Date(value as string);\n } catch {\n console.log(`Could not transform from storage for field type`);\n return value;\n }\n};\n\nconst convertValueToStorage = (field: CmsModelField, value: any): any => {\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value: value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n};\n\nexport const createDateStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n fieldType: \"datetime\",\n fromStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n return convertFromStorage(field, value);\n },\n toStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n if (field.multipleValues) {\n const multipleValues = value as (string | Date | null | undefined)[];\n return (multipleValues || [])\n .filter(v => !!v)\n .map(v => {\n return convertValueToStorage(field, v);\n });\n }\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n }\n });\n};\n"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG,CAAC,MAAD,EAAS,sBAAT,CAArB;;AAEA,MAAMC,kBAAkB,GAAG,CACvBC,KADuB,EAEvBC,KAFuB,KAGtB;EACD,IAAI;IACA,IAAID,KAAK,CAACE,cAAV,EAA0B;MACtB,MAAMC,MAAc,GAAG,EAAvB;;MACA,KAAK,MAAMC,CAAX,IAAgBH,KAAhB,EAAuB;QACnB,IAAI,CAACG,CAAL,EAAQ;UACJ;QACH;;QACD,IAAI;UACAD,MAAM,CAACE,IAAP,CAAY,IAAIC,IAAJ,CAASF,CAAT,CAAZ;QACH,CAFD,CAEE,MAAM,CAAE;MACb;;MACD,OAAOD,MAAP;IACH;;IACD,OAAO,IAAIG,IAAJ,CAASL,KAAT,CAAP;EACH,CAdD,CAcE,MAAM;IACJM,OAAO,CAACC,GAAR,CAAa,iDAAb;IACA,OAAOP,KA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AAc,IAAI,EAAnB,EACFoB,MADE,CACKlB,CAAC,IAAI,CAAC,CAACA,CADZ,EAEFmB,GAFE,CAEEnB,CAAC,IAAI;UACN,OAAOK,qBAAqB,CAACT,KAAD,EAAQI,CAAR,CAA5B;QACH,CAJE,CAAP;MAKH;;MACD,IAAKH,KAAD,CAAeS,WAAnB,EAAgC;QAC5B,OAAQT,KAAD,CAAgBS,WAAhB,EAAP;MACH,CAFD,MAEO,IAAI,OAAOT,KAAP,KAAiB,QAArB,EAA+B;QAClC,OAAOA,KAAP;MACH;;MACD,MAAM,IAAIU,cAAJ,CAAgB,2CAAhB,EAA6D,kBAA7D,EAAiF;QACnFV,KADmF;QAEnFW,OAAO,EAAEZ,KAAK,CAACY,OAFoE;QAGnFC,SAAS,EAAEb,KAAK,CAACa;MAHkE,CAAjF,CAAN;IAKH;EAhC6B,CAA3B,CAAP;AAkCH,CAnCM"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
import { Field } from "./types";
|
|
5
|
-
interface CreateFiltersParams {
|
|
6
|
-
plugins: PluginsContainer;
|
|
7
|
-
where: Partial<CmsEntryListWhere>;
|
|
8
|
-
fields: Record<string, Field>;
|
|
9
|
-
}
|
|
10
|
-
export interface ItemFilter {
|
|
11
|
-
field: Field;
|
|
12
|
-
path: string;
|
|
13
|
-
fieldPathId: string;
|
|
14
|
-
plugin: ValueFilterPlugin;
|
|
15
|
-
negate: boolean;
|
|
16
|
-
compareValue: any;
|
|
17
|
-
transformValue: <I = any, O = any>(value: I) => O;
|
|
18
|
-
}
|
|
19
|
-
export declare const createFilters: (params: CreateFiltersParams) => ItemFilter[];
|
|
20
|
-
export {};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createFilters = void 0;
|
|
9
|
-
|
|
10
|
-
var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
|
|
11
|
-
|
|
12
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
var _mapPlugins = require("./mapPlugins");
|
|
15
|
-
|
|
16
|
-
var _where = require("./where");
|
|
17
|
-
|
|
18
|
-
var _transform = require("./transform");
|
|
19
|
-
|
|
20
|
-
var _CmsEntryFieldFilterPlugin = require("../../../plugins/CmsEntryFieldFilterPlugin");
|
|
21
|
-
|
|
22
|
-
const createFilters = params => {
|
|
23
|
-
const {
|
|
24
|
-
where,
|
|
25
|
-
plugins,
|
|
26
|
-
fields
|
|
27
|
-
} = params;
|
|
28
|
-
const filterPlugins = (0, _mapPlugins.getMappedPlugins)({
|
|
29
|
-
plugins,
|
|
30
|
-
type: _ValueFilterPlugin.ValueFilterPlugin.type,
|
|
31
|
-
property: "operation"
|
|
32
|
-
});
|
|
33
|
-
const transformValuePlugins = (0, _mapPlugins.getMappedPlugins)({
|
|
34
|
-
plugins,
|
|
35
|
-
type: "cms-field-filter-value-transform",
|
|
36
|
-
property: "fieldType"
|
|
37
|
-
});
|
|
38
|
-
const fieldFilterCreatePlugins = (0, _mapPlugins.getMappedPlugins)({
|
|
39
|
-
plugins,
|
|
40
|
-
type: _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin.type,
|
|
41
|
-
property: "fieldType"
|
|
42
|
-
});
|
|
43
|
-
const defaultFilterCreatePlugin = fieldFilterCreatePlugins["*"];
|
|
44
|
-
|
|
45
|
-
const getFilterCreatePlugin = type => {
|
|
46
|
-
const filterCreatePlugin = fieldFilterCreatePlugins[type] || defaultFilterCreatePlugin;
|
|
47
|
-
|
|
48
|
-
if (filterCreatePlugin) {
|
|
49
|
-
return filterCreatePlugin;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
throw new _error.default(`There is no filter create plugin for the field type "${type}".`, "MISSING_FILTER_CREATE_PLUGIN", {
|
|
53
|
-
type
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const filters = [];
|
|
58
|
-
|
|
59
|
-
for (const key in where) {
|
|
60
|
-
if (where.hasOwnProperty(key) === false) {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* At the moment we do not allow "OR" and "AND" conditional filtering, so throw an error on it.
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (key === "AND") {
|
|
69
|
-
throw new _error.default(`Conditional "AND" is currently disabled in the DynamoDB only deployment.`, "DISABLED_AND_CONDITIONAL");
|
|
70
|
-
} else if (key === "OR") {
|
|
71
|
-
throw new _error.default(`Conditional "OR" is currently disabled in the DynamoDB only deployment.`, "DISABLED_OR_CONDITIONAL");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const value = where[key];
|
|
75
|
-
|
|
76
|
-
if (value === undefined) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const whereParams = (0, _where.extractWhereParams)(key);
|
|
81
|
-
|
|
82
|
-
if (!whereParams) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const {
|
|
87
|
-
fieldId,
|
|
88
|
-
operation,
|
|
89
|
-
negate
|
|
90
|
-
} = whereParams;
|
|
91
|
-
const field = fields[fieldId];
|
|
92
|
-
|
|
93
|
-
if (!field) {
|
|
94
|
-
throw new _error.default(`There is no field with the fieldId "${fieldId}".`, "FIELD_ERROR", {
|
|
95
|
-
fieldId
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* We need a filter create plugin for this type.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const filterCreatePlugin = getFilterCreatePlugin(field.type);
|
|
104
|
-
const transformValuePlugin = transformValuePlugins[field.type];
|
|
105
|
-
|
|
106
|
-
const transformValueCallable = value => {
|
|
107
|
-
if (!transformValuePlugin) {
|
|
108
|
-
return value;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return transformValuePlugin.transform({
|
|
112
|
-
field,
|
|
113
|
-
value
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const result = filterCreatePlugin.create({
|
|
118
|
-
key,
|
|
119
|
-
value,
|
|
120
|
-
valueFilterPlugins: filterPlugins,
|
|
121
|
-
transformValuePlugins,
|
|
122
|
-
getFilterCreatePlugin,
|
|
123
|
-
operation,
|
|
124
|
-
negate,
|
|
125
|
-
field,
|
|
126
|
-
fields,
|
|
127
|
-
compareValue: (0, _transform.transformValue)({
|
|
128
|
-
value,
|
|
129
|
-
transform: transformValueCallable
|
|
130
|
-
}),
|
|
131
|
-
transformValue: transformValueCallable
|
|
132
|
-
});
|
|
133
|
-
/**
|
|
134
|
-
* There is a possibility of
|
|
135
|
-
* - no result
|
|
136
|
-
* - result being an array
|
|
137
|
-
* - result being an object
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
if (!result) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (Array.isArray(result)) {
|
|
145
|
-
filters.push(...result);
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
filters.push(result);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return filters;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
exports.createFilters = createFilters;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createFilters","params","where","plugins","fields","filterPlugins","getMappedPlugins","type","ValueFilterPlugin","property","transformValuePlugins","fieldFilterCreatePlugins","CmsEntryFieldFilterPlugin","defaultFilterCreatePlugin","getFilterCreatePlugin","filterCreatePlugin","WebinyError","filters","key","hasOwnProperty","value","undefined","whereParams","extractWhereParams","fieldId","operation","negate","field","transformValuePlugin","transformValueCallable","transform","result","create","valueFilterPlugins","compareValue","transformValue","Array","isArray","push"],"sources":["createFilters.ts"],"sourcesContent":["import { CmsEntryListWhere } from \"@webiny/api-headless-cms/types\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { Field } from \"./types\";\nimport { getMappedPlugins } from \"./mapPlugins\";\nimport { extractWhereParams } from \"./where\";\nimport { transformValue } from \"./transform\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\n\ninterface CreateFiltersParams {\n plugins: PluginsContainer;\n where: Partial<CmsEntryListWhere>;\n fields: Record<string, Field>;\n}\n\nexport interface ItemFilter {\n field: Field;\n path: string;\n fieldPathId: string;\n plugin: ValueFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport const createFilters = (params: CreateFiltersParams): ItemFilter[] => {\n const { where, plugins, fields } = params;\n const filterPlugins = getMappedPlugins<ValueFilterPlugin>({\n plugins,\n type: ValueFilterPlugin.type,\n property: \"operation\"\n });\n const transformValuePlugins = getMappedPlugins<CmsFieldFilterValueTransformPlugin>({\n plugins,\n type: \"cms-field-filter-value-transform\",\n property: \"fieldType\"\n });\n const fieldFilterCreatePlugins = getMappedPlugins<CmsEntryFieldFilterPlugin>({\n plugins,\n type: CmsEntryFieldFilterPlugin.type,\n property: \"fieldType\"\n });\n\n const defaultFilterCreatePlugin = fieldFilterCreatePlugins[\"*\"] as CmsEntryFieldFilterPlugin;\n\n const getFilterCreatePlugin = (type: string) => {\n const filterCreatePlugin = fieldFilterCreatePlugins[type] || defaultFilterCreatePlugin;\n if (filterCreatePlugin) {\n return filterCreatePlugin;\n }\n throw new WebinyError(\n `There is no filter create plugin for the field type \"${type}\".`,\n \"MISSING_FILTER_CREATE_PLUGIN\",\n {\n type\n }\n );\n };\n\n const filters: ItemFilter[] = [];\n\n for (const key in where) {\n if (where.hasOwnProperty(key) === false) {\n continue;\n }\n /**\n * At the moment we do not allow \"OR\" and \"AND\" conditional filtering, so throw an error on it.\n */\n if (key === \"AND\") {\n throw new WebinyError(\n `Conditional \"AND\" is currently disabled in the DynamoDB only deployment.`,\n \"DISABLED_AND_CONDITIONAL\"\n );\n } else if (key === \"OR\") {\n throw new WebinyError(\n `Conditional \"OR\" is currently disabled in the DynamoDB only deployment.`,\n \"DISABLED_OR_CONDITIONAL\"\n );\n }\n\n const value = (where as any)[key];\n if (value === undefined) {\n continue;\n }\n\n const whereParams = extractWhereParams(key);\n if (!whereParams) {\n continue;\n }\n\n const { fieldId, operation, negate } = whereParams;\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(\n `There is no field with the fieldId \"${fieldId}\".`,\n \"FIELD_ERROR\",\n {\n fieldId\n }\n );\n }\n\n /**\n * We need a filter create plugin for this type.\n */\n const filterCreatePlugin = getFilterCreatePlugin(field.type);\n\n const transformValuePlugin: CmsFieldFilterValueTransformPlugin =\n transformValuePlugins[field.type];\n\n const transformValueCallable = (value: any) => {\n if (!transformValuePlugin) {\n return value;\n }\n return transformValuePlugin.transform({\n field,\n value\n });\n };\n\n const result = filterCreatePlugin.create({\n key,\n value,\n valueFilterPlugins: filterPlugins,\n transformValuePlugins,\n getFilterCreatePlugin,\n operation,\n negate,\n field,\n fields,\n compareValue: transformValue({\n value,\n transform: transformValueCallable\n }),\n transformValue: transformValueCallable\n });\n /**\n * There is a possibility of\n * - no result\n * - result being an array\n * - result being an object\n */\n if (!result) {\n continue;\n }\n if (Array.isArray(result)) {\n filters.push(...result);\n continue;\n }\n filters.push(result);\n }\n\n return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B;MAcrCM,cAAc,EAAEN;IAdqB,CAA1B,CAAf;IAgBA;AACR;AACA;AACA;AACA;AACA;;IACQ,IAAI,CAACE,MAAL,EAAa;MACT;IACH;;IACD,IAAIK,KAAK,CAACC,OAAN,CAAcN,MAAd,CAAJ,EAA2B;MACvBd,OAAO,CAACqB,IAAR,CAAa,GAAGP,MAAhB;MACA;IACH;;IACDd,OAAO,CAACqB,IAAR,CAAaP,MAAb;EACH;;EAED,OAAOd,OAAP;AACH,CAjIM"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.systemFields = void 0;
|
|
7
|
-
|
|
8
|
-
const createSystemField = field => {
|
|
9
|
-
return field;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const systemFields = {
|
|
13
|
-
id: createSystemField({
|
|
14
|
-
id: "id",
|
|
15
|
-
type: "text",
|
|
16
|
-
storageId: "id",
|
|
17
|
-
fieldId: "id"
|
|
18
|
-
}),
|
|
19
|
-
entryId: createSystemField({
|
|
20
|
-
id: "entryId",
|
|
21
|
-
type: "text",
|
|
22
|
-
storageId: "entryId",
|
|
23
|
-
fieldId: "entryId"
|
|
24
|
-
}),
|
|
25
|
-
createdOn: createSystemField({
|
|
26
|
-
id: "createdOn",
|
|
27
|
-
type: "datetime",
|
|
28
|
-
storageId: "createdOn",
|
|
29
|
-
fieldId: "createdOn"
|
|
30
|
-
}),
|
|
31
|
-
savedOn: createSystemField({
|
|
32
|
-
id: "savedOn",
|
|
33
|
-
type: "datetime",
|
|
34
|
-
storageId: "savedOn",
|
|
35
|
-
fieldId: "savedOn"
|
|
36
|
-
}),
|
|
37
|
-
createdBy: createSystemField({
|
|
38
|
-
id: "createdBy",
|
|
39
|
-
type: "plainObject",
|
|
40
|
-
storageId: "createdBy",
|
|
41
|
-
fieldId: "createdBy",
|
|
42
|
-
settings: {
|
|
43
|
-
path: "createdBy.id"
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
meta: createSystemField({
|
|
47
|
-
id: "meta",
|
|
48
|
-
type: "plainObject",
|
|
49
|
-
storageId: "meta",
|
|
50
|
-
fieldId: "meta"
|
|
51
|
-
}),
|
|
52
|
-
ownedBy: createSystemField({
|
|
53
|
-
id: "ownedBy",
|
|
54
|
-
type: "plainObject",
|
|
55
|
-
storageId: "ownedBy",
|
|
56
|
-
fieldId: "ownedBy",
|
|
57
|
-
settings: {
|
|
58
|
-
path: "ownedBy.id"
|
|
59
|
-
}
|
|
60
|
-
}),
|
|
61
|
-
version: createSystemField({
|
|
62
|
-
id: "version",
|
|
63
|
-
type: "number",
|
|
64
|
-
storageId: "version",
|
|
65
|
-
fieldId: "version"
|
|
66
|
-
}),
|
|
67
|
-
status: createSystemField({
|
|
68
|
-
id: "status",
|
|
69
|
-
type: "string",
|
|
70
|
-
storageId: "status",
|
|
71
|
-
fieldId: "status"
|
|
72
|
-
})
|
|
73
|
-
};
|
|
74
|
-
exports.systemFields = systemFields;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSystemField","field","systemFields","id","type","storageId","fieldId","entryId","createdOn","savedOn","createdBy","settings","path","meta","ownedBy","version","status"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype CmsModelFieldInput = Partial<CmsModelField> &\n Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\">;\nconst createSystemField = (field: CmsModelFieldInput): CmsModelField => {\n return field as CmsModelField;\n};\n\nexport const systemFields: Record<string, CmsModelField> = {\n id: createSystemField({\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\"\n }),\n entryId: createSystemField({\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\"\n }),\n createdOn: createSystemField({\n id: \"createdOn\",\n type: \"datetime\",\n storageId: \"createdOn\",\n fieldId: \"createdOn\"\n }),\n savedOn: createSystemField({\n id: \"savedOn\",\n type: \"datetime\",\n storageId: \"savedOn\",\n fieldId: \"savedOn\"\n }),\n createdBy: createSystemField({\n id: \"createdBy\",\n type: \"plainObject\",\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n settings: {\n path: \"createdBy.id\"\n }\n }),\n meta: createSystemField({\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\"\n }),\n ownedBy: createSystemField({\n id: \"ownedBy\",\n type: \"plainObject\",\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n settings: {\n path: \"ownedBy.id\"\n }\n }),\n version: createSystemField({\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\"\n }),\n status: createSystemField({\n id: \"status\",\n type: \"string\",\n storageId: \"status\",\n fieldId: \"status\"\n })\n};\n"],"mappings":";;;;;;;AAIA,MAAMA,iBAAiB,GAAIC,KAAD,IAA8C;EACpE,OAAOA,KAAP;AACH,CAFD;;AAIO,MAAMC,YAA2C,GAAG;EACvDC,EAAE,EAAEH,iBAAiB,CAAC;IAClBG,EAAE,EAAE,IADc;IAElBC,IAAI,EAAE,MAFY;IAGlBC,SAAS,EAAE,IAHO;IAIlBC,OAAO,EAAE;EAJS,CAAD,CADkC;EAOvDC,OAAO,EAAEP,iBAAiB,CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,MAFiB;IAGvBC,SAAS,EAAE,SAHY;IAIvBC,OAAO,EAAE;EAJc,CAAD,CAP6B;EAavDE,SAAS,EAAER,iBAAiB,CAAC;IACzBG,EAAE,EAAE,WADqB;IAEzBC,IAAI,EAAE,UAFmB;IAGzBC,SAAS,EAAE,WAHc;IAIzBC,OAAO,EAAE;EAJgB,CAAD,CAb2B;EAmBvDG,OAAO,EAAET,iBAAiB,CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,UAFiB;IAGvBC,SAAS,EAAE,SAHY;IAIvBC,OAAO,EAAE;EAJc,CAAD,CAnB6B;EAyBvDI,SAAS,EAAEV,iBAAiB,CAAC;IACzBG,EAAE,EAAE,WADqB;IAEzBC,IAAI,EAAE,aAFmB;IAGzBC,SAAS,EAAE,WAHc;IAIzBC,OAAO,EAAE,WAJgB;IAKzBK,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA;EALe,CAAD,CAzB2B;EAkCvDC,IAAI,EAAEb,iBAAiB,CAAC;IACpBG,EAAE,EAAE,MADgB;IAEpBC,IAAI,EAAE,aAFc;IAGpBC,SAAS,EAAE,MAHS;IAIpBC,OAAO,EAAE;EAJW,CAAD,CAlCgC;EAwCvDQ,OAAO,EAAEd,iBAAiB,CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,aAFiB;IAGvBC,SAAS,EAAE,SAHY;IAIvBC,OAAO,EAAE,SAJc;IAKvBK,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA;EALa,CAAD,CAxC6B;EAiDvDG,OAAO,EAAEf,iBAAiB,CAAC;IACvBG,EAAE,EAAE,SADmB;IAEvBC,IAAI,EAAE,QAFiB;IAGvBC,SAAS,EAAE,SAHY;IAIvBC,OAAO,EAAE;EAJc,CAAD,CAjD6B;EAuDvDU,MAAM,EAAEhB,iBAAiB,CAAC;IACtBG,EAAE,EAAE,QADkB;IAEtBC,IAAI,EAAE,QAFgB;IAGtBC,SAAS,EAAE,QAHW;IAItBC,OAAO,EAAE;EAJa,CAAD;AAvD8B,CAApD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CmsEntry, CmsEntryListWhere, CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { CreatePathCallable as CmsEntryFieldFieldCreatePathCallable } from "../../plugins/CmsEntryFieldFilterPathPlugin";
|
|
4
|
-
interface ModelField {
|
|
5
|
-
def: CmsModelField;
|
|
6
|
-
valueTransformer: (value: any) => any;
|
|
7
|
-
createPath: CmsEntryFieldFieldCreatePathCallable;
|
|
8
|
-
isSystemField?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare type ModelFieldRecords = Record<string, ModelField>;
|
|
11
|
-
export interface FilterItemFromStorage {
|
|
12
|
-
<T = any>(field: CmsModelField, value: any): Promise<T>;
|
|
13
|
-
}
|
|
14
|
-
interface FilterItemsParams {
|
|
15
|
-
items: CmsEntry[];
|
|
16
|
-
where: Partial<CmsEntryListWhere>;
|
|
17
|
-
plugins: PluginsContainer;
|
|
18
|
-
fields: ModelFieldRecords;
|
|
19
|
-
fromStorage: FilterItemFromStorage;
|
|
20
|
-
fullTextSearch?: {
|
|
21
|
-
term?: string;
|
|
22
|
-
fields?: string[];
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export declare const filterItems: (params: FilterItemsParams) => Promise<CmsEntry[]>;
|
|
26
|
-
interface SortEntryItemsArgs {
|
|
27
|
-
items: CmsEntry[];
|
|
28
|
-
sort?: string[];
|
|
29
|
-
fields: ModelFieldRecords;
|
|
30
|
-
}
|
|
31
|
-
export declare const sortEntryItems: (params: SortEntryItemsArgs) => CmsEntry[];
|
|
32
|
-
export declare const buildModelFields: ({ plugins, model }: {
|
|
33
|
-
plugins: PluginsContainer;
|
|
34
|
-
model: CmsModel;
|
|
35
|
-
}) => ModelFieldRecords;
|
|
36
|
-
export {};
|