@webiny/api-headless-cms-ddb 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/definitions/entry.d.ts +6 -4
- package/definitions/entry.js +111 -20
- package/definitions/entry.js.map +1 -0
- package/definitions/group.d.ts +6 -4
- package/definitions/group.js +8 -16
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -4
- package/definitions/model.js +30 -16
- package/definitions/model.js.map +1 -0
- package/definitions/system.d.ts +6 -4
- package/definitions/system.js +8 -16
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +7 -6
- package/definitions/table.js +7 -6
- package/definitions/table.js.map +1 -0
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +9 -18
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/path/locationFolderId.d.ts +2 -0
- package/dynamoDb/path/locationFolderId.js +43 -0
- package/dynamoDb/path/locationFolderId.js.map +1 -0
- package/dynamoDb/path/plainObject.d.ts +2 -3
- package/dynamoDb/path/plainObject.js +26 -24
- package/dynamoDb/path/plainObject.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +7 -4
- package/dynamoDb/storage/longText.js +74 -63
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +2 -8
- package/dynamoDb/storage/richText.js +49 -98
- package/dynamoDb/storage/richText.js.map +1 -0
- package/dynamoDb/transformValue/datetime.d.ts +5 -3
- package/dynamoDb/transformValue/datetime.js +29 -29
- package/dynamoDb/transformValue/datetime.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +56 -54
- package/index.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +41 -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 +10 -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 +25 -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 +45 -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 +56 -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 +56 -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 +62 -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 +40 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +7 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +18 -29
- package/operations/entry/dataLoaders.js +59 -246
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/filtering/createExpressions.d.ts +26 -0
- package/operations/entry/filtering/createExpressions.js +178 -0
- package/operations/entry/filtering/createExpressions.js.map +1 -0
- package/operations/entry/filtering/createFields.d.ts +16 -0
- package/operations/entry/filtering/createFields.js +108 -0
- package/operations/entry/filtering/createFields.js.map +1 -0
- package/operations/entry/filtering/extractSort.d.ts +17 -0
- package/operations/entry/filtering/extractSort.js +69 -0
- package/operations/entry/filtering/extractSort.js.map +1 -0
- package/operations/entry/filtering/filter.d.ts +15 -0
- package/operations/entry/filtering/filter.js +158 -0
- package/operations/entry/filtering/filter.js.map +1 -0
- package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
- package/operations/entry/filtering/fullTextSearch.js +50 -0
- package/operations/entry/filtering/fullTextSearch.js.map +1 -0
- package/operations/entry/filtering/getValue.d.ts +5 -0
- package/operations/entry/filtering/getValue.js +66 -0
- package/operations/entry/filtering/getValue.js.map +1 -0
- package/operations/entry/filtering/index.d.ts +2 -0
- package/operations/entry/filtering/index.js +21 -0
- package/operations/entry/filtering/index.js.map +1 -0
- package/operations/entry/filtering/mapPlugins.d.ts +8 -0
- package/operations/entry/filtering/mapPlugins.js +33 -0
- package/operations/entry/filtering/mapPlugins.js.map +1 -0
- package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +45 -0
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
- package/operations/entry/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/filtering/plugins/index.js +16 -0
- package/operations/entry/filtering/plugins/index.js.map +1 -0
- package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/objectFilterCreate.js +90 -0
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -0
- package/operations/entry/filtering/plugins/refFilterCreate.js +80 -0
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +65 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
- package/operations/entry/filtering/sort.d.ts +12 -0
- package/operations/entry/filtering/sort.js +71 -0
- package/operations/entry/filtering/sort.js.map +1 -0
- package/operations/entry/filtering/systemFields.d.ts +4 -0
- package/operations/entry/filtering/systemFields.js +90 -0
- package/operations/entry/filtering/systemFields.js.map +1 -0
- package/operations/entry/filtering/transform.d.ts +6 -0
- package/operations/entry/filtering/transform.js +18 -0
- package/operations/entry/filtering/transform.js.map +1 -0
- package/operations/entry/filtering/types.d.ts +40 -0
- package/operations/entry/filtering/types.js +7 -0
- package/operations/entry/filtering/types.js.map +1 -0
- package/operations/entry/filtering/values.d.ts +2 -0
- package/operations/entry/filtering/values.js +24 -0
- package/operations/entry/filtering/values.js.map +1 -0
- package/operations/entry/filtering/where.d.ts +5 -0
- package/operations/entry/filtering/where.js +35 -0
- package/operations/entry/filtering/where.js.map +1 -0
- package/operations/entry/index.d.ts +5 -5
- package/operations/entry/index.js +920 -437
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.js +9 -14
- package/operations/entry/keys.js.map +1 -0
- package/operations/group/index.d.ts +6 -5
- package/operations/group/index.js +35 -59
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +5 -4
- package/operations/model/index.js +35 -46
- package/operations/model/index.js.map +1 -0
- package/operations/system/index.d.ts +5 -4
- package/operations/system/index.js +20 -31
- package/operations/system/index.js.map +1 -0
- package/package.json +23 -29
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +23 -0
- package/plugins/CmsEntryFieldFilterPathPlugin.js +48 -0
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -0
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
- package/plugins/CmsEntryFieldFilterPlugin.js +27 -0
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
- package/plugins/CmsEntryFieldSortingPlugin.js +27 -0
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.js +23 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
- package/plugins/index.d.ts +4 -0
- package/plugins/index.js +51 -0
- package/plugins/index.js.map +1 -0
- package/types.d.ts +21 -45
- package/types.js +5 -6
- package/types.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/dynamoDb/path/ref.d.ts +0 -3
- package/dynamoDb/path/ref.js +0 -27
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/operations/entry/systemFields.d.ts +0 -2
- package/operations/entry/systemFields.js +0 -50
- package/operations/entry/utils.d.ts +0 -31
- package/operations/entry/utils.js +0 -406
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createFullTextSearch = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _getValue = require("./getValue");
|
|
10
|
+
/**
|
|
11
|
+
* Unfortunately we must use the contains plugin directly as plugins do not support multi field searching.
|
|
12
|
+
*/
|
|
13
|
+
const createFullTextSearch = params => {
|
|
14
|
+
const {
|
|
15
|
+
term,
|
|
16
|
+
targetFields,
|
|
17
|
+
fields: fieldDefinitions,
|
|
18
|
+
plugin
|
|
19
|
+
} = params;
|
|
20
|
+
if (!term || term.trim().length === 0 || !targetFields || targetFields.length === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return item => {
|
|
24
|
+
for (const target of targetFields) {
|
|
25
|
+
/**
|
|
26
|
+
* As fields is a mapped Field objects where key is a path to the value, we can directly find the related field.
|
|
27
|
+
*/
|
|
28
|
+
const field = fieldDefinitions[target];
|
|
29
|
+
if (!field) {
|
|
30
|
+
throw new _error.default(`Unknown field "${target}" in the model.`, "UNKNOWN_FIELD", {
|
|
31
|
+
target
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const value = (0, _getValue.getValue)(item.values, target);
|
|
35
|
+
if (!value) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (plugin.matches({
|
|
39
|
+
value,
|
|
40
|
+
compareValue: term
|
|
41
|
+
}) === true) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.createFullTextSearch = createFullTextSearch;
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=fullTextSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_getValue","createFullTextSearch","params","term","targetFields","fields","fieldDefinitions","plugin","trim","length","item","target","field","WebinyError","value","getValue","values","matches","compareValue","exports"],"sources":["fullTextSearch.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport type { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport type { Field } from \"./types\";\nimport { getValue } from \"./getValue\";\n\ninterface Params {\n term?: string;\n targetFields?: string[];\n fields: Record<string, Field>;\n plugin: ValueFilterPlugin;\n}\n\n/**\n * Unfortunately we must use the contains plugin directly as plugins do not support multi field searching.\n */\nexport const createFullTextSearch = (params: Params) => {\n const { term, targetFields, fields: fieldDefinitions, plugin } = params;\n if (!term || term.trim().length === 0 || !targetFields || targetFields.length === 0) {\n return null;\n }\n return (item: CmsEntry) => {\n for (const target of targetFields) {\n /**\n * As fields is a mapped Field objects where key is a path to the value, we can directly find the related field.\n */\n const field = fieldDefinitions[target];\n\n if (!field) {\n throw new WebinyError(`Unknown field \"${target}\" in the model.`, \"UNKNOWN_FIELD\", {\n target\n });\n }\n const value = getValue(item.values, target);\n if (!value) {\n continue;\n }\n if (plugin.matches({ value, compareValue: term }) === true) {\n return true;\n }\n }\n return false;\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AASA;AACA;AACA;AACO,MAAME,oBAAoB,GAAIC,MAAc,IAAK;EACpD,MAAM;IAAEC,IAAI;IAAEC,YAAY;IAAEC,MAAM,EAAEC,gBAAgB;IAAEC;EAAO,CAAC,GAAGL,MAAM;EACvE,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACK,IAAI,CAAC,CAAC,CAACC,MAAM,KAAK,CAAC,IAAI,CAACL,YAAY,IAAIA,YAAY,CAACK,MAAM,KAAK,CAAC,EAAE;IACjF,OAAO,IAAI;EACf;EACA,OAAQC,IAAc,IAAK;IACvB,KAAK,MAAMC,MAAM,IAAIP,YAAY,EAAE;MAC/B;AACZ;AACA;MACY,MAAMQ,KAAK,GAAGN,gBAAgB,CAACK,MAAM,CAAC;MAEtC,IAAI,CAACC,KAAK,EAAE;QACR,MAAM,IAAIC,cAAW,CAAC,kBAAkBF,MAAM,iBAAiB,EAAE,eAAe,EAAE;UAC9EA;QACJ,CAAC,CAAC;MACN;MACA,MAAMG,KAAK,GAAG,IAAAC,kBAAQ,EAACL,IAAI,CAACM,MAAM,EAAEL,MAAM,CAAC;MAC3C,IAAI,CAACG,KAAK,EAAE;QACR;MACJ;MACA,IAAIP,MAAM,CAACU,OAAO,CAAC;QAAEH,KAAK;QAAEI,YAAY,EAAEf;MAAK,CAAC,CAAC,KAAK,IAAI,EAAE;QACxD,OAAO,IAAI;MACf;IACJ;IACA,OAAO,KAAK;EAChB,CAAC;AACL,CAAC;AAACgB,OAAA,CAAAlB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getValue = void 0;
|
|
7
|
+
const addArrayResult = (target, result) => {
|
|
8
|
+
for (const r of result) {
|
|
9
|
+
if (target.some(t => r === t)) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
target.push(r);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A recursive function which goes through given input paths and returns the value in it.
|
|
17
|
+
* In case a path is an array, it goes through the array of those values to get values further down the path line.
|
|
18
|
+
*/
|
|
19
|
+
const find = (target, input) => {
|
|
20
|
+
const paths = [...input];
|
|
21
|
+
const path = paths.shift();
|
|
22
|
+
if (!path) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const value = target?.[path];
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
if (paths.length === 0) {
|
|
30
|
+
return value;
|
|
31
|
+
} else if (Array.isArray(value)) {
|
|
32
|
+
if (value.length === 0) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return value.reduce((collection, v) => {
|
|
36
|
+
const result = find(v, paths);
|
|
37
|
+
if (result === undefined) {
|
|
38
|
+
return collection;
|
|
39
|
+
} else if (Array.isArray(result)) {
|
|
40
|
+
addArrayResult(collection, result);
|
|
41
|
+
return collection;
|
|
42
|
+
}
|
|
43
|
+
collection.push(result);
|
|
44
|
+
return collection;
|
|
45
|
+
}, []);
|
|
46
|
+
}
|
|
47
|
+
return find(value, paths);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A wrapper function for the find function.
|
|
51
|
+
* Basically it transforms input paths to an array (and runs various checks).
|
|
52
|
+
*/
|
|
53
|
+
const getValue = (target, input) => {
|
|
54
|
+
const paths = Array.isArray(input) ? input : input.split(".");
|
|
55
|
+
if (paths.length === 0) {
|
|
56
|
+
throw new Error(`Path is empty!`);
|
|
57
|
+
}
|
|
58
|
+
const filtered = paths.filter(Boolean);
|
|
59
|
+
if (paths.length !== filtered.length) {
|
|
60
|
+
throw new Error(`Input path is different than the filtered empty path string. (${paths.join(".")} to ${filtered.join(".")})`);
|
|
61
|
+
}
|
|
62
|
+
return find(target, paths);
|
|
63
|
+
};
|
|
64
|
+
exports.getValue = getValue;
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=getValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["addArrayResult","target","result","r","some","t","push","find","input","paths","path","shift","undefined","value","length","Array","isArray","reduce","collection","v","getValue","split","Error","filtered","filter","Boolean","join","exports"],"sources":["getValue.ts"],"sourcesContent":["const addArrayResult = (target: any[], result: any[]): void => {\n for (const r of result) {\n if (target.some(t => r === t)) {\n continue;\n }\n target.push(r);\n }\n};\n/**\n * A recursive function which goes through given input paths and returns the value in it.\n * In case a path is an array, it goes through the array of those values to get values further down the path line.\n */\nconst find = (target: Record<string, any> | undefined, input: string[]): any[] | undefined => {\n const paths = [...input];\n const path = paths.shift();\n\n if (!path) {\n return undefined;\n }\n\n const value = target?.[path];\n if (value === undefined) {\n return undefined;\n }\n if (paths.length === 0) {\n return value;\n } else if (Array.isArray(value)) {\n if (value.length === 0) {\n return undefined;\n }\n return value.reduce<any[]>((collection, v) => {\n const result = find(v, paths);\n if (result === undefined) {\n return collection;\n } else if (Array.isArray(result)) {\n addArrayResult(collection, result);\n return collection;\n }\n collection.push(result);\n return collection;\n }, []);\n }\n return find(value, paths);\n};\n/**\n * A wrapper function for the find function.\n * Basically it transforms input paths to an array (and runs various checks).\n */\nexport const getValue = (target: Record<string, any>, input: string | string[]): any => {\n const paths = Array.isArray(input) ? input : input.split(\".\");\n if (paths.length === 0) {\n throw new Error(`Path is empty!`);\n }\n const filtered = paths.filter(Boolean);\n if (paths.length !== filtered.length) {\n throw new Error(\n `Input path is different than the filtered empty path string. (${paths.join(\n \".\"\n )} to ${filtered.join(\".\")})`\n );\n }\n\n return find(target, paths);\n};\n"],"mappings":";;;;;;AAAA,MAAMA,cAAc,GAAGA,CAACC,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A,OAAOX,IAAI,CAACM,KAAK,EAAEJ,KAAK,CAAC;AAC7B,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMW,QAAQ,GAAGA,CAACnB,MAA2B,EAAEO,KAAwB,KAAU;EACpF,MAAMC,KAAK,GAAGM,KAAK,CAACC,OAAO,CAACR,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,CAACa,KAAK,CAAC,GAAG,CAAC;EAC7D,IAAIZ,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;IACpB,MAAM,IAAIQ,KAAK,CAAC,gBAAgB,CAAC;EACrC;EACA,MAAMC,QAAQ,GAAGd,KAAK,CAACe,MAAM,CAACC,OAAO,CAAC;EACtC,IAAIhB,KAAK,CAACK,MAAM,KAAKS,QAAQ,CAACT,MAAM,EAAE;IAClC,MAAM,IAAIQ,KAAK,CACX,iEAAiEb,KAAK,CAACiB,IAAI,CACvE,GACJ,CAAC,OAAOH,QAAQ,CAACG,IAAI,CAAC,GAAG,CAAC,GAC9B,CAAC;EACL;EAEA,OAAOnB,IAAI,CAACN,MAAM,EAAEQ,KAAK,CAAC;AAC9B,CAAC;AAACkB,OAAA,CAAAP,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "filter", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _filter.filter;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "sort", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _sort.sort;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _filter = require("./filter");
|
|
19
|
+
var _sort = require("./sort");
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_filter","require","_sort"],"sources":["index.ts"],"sourcesContent":["export { filter } from \"./filter\";\nexport { sort } from \"./sort\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin, PluginsContainer } from "@webiny/plugins/types";
|
|
2
|
+
interface Params {
|
|
3
|
+
plugins: PluginsContainer;
|
|
4
|
+
type: string;
|
|
5
|
+
property: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getMappedPlugins: <T extends Plugin>(params: Params) => Record<string, T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getMappedPlugins = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
const getMappedPlugins = params => {
|
|
10
|
+
const {
|
|
11
|
+
plugins: pluginsContainer,
|
|
12
|
+
type,
|
|
13
|
+
property
|
|
14
|
+
} = params;
|
|
15
|
+
const plugins = pluginsContainer.byType(type);
|
|
16
|
+
if (plugins.length === 0) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
return plugins.reduce((collection, plugin) => {
|
|
20
|
+
const key = plugin[property];
|
|
21
|
+
if (typeof key !== "string") {
|
|
22
|
+
throw new _error.default("Property to map the plugins on must be a string.", "PLUGIN_PROPERTY_ERROR", {
|
|
23
|
+
type,
|
|
24
|
+
property
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
collection[key] = plugin;
|
|
28
|
+
return collection;
|
|
29
|
+
}, {});
|
|
30
|
+
};
|
|
31
|
+
exports.getMappedPlugins = getMappedPlugins;
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=mapPlugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","getMappedPlugins","params","plugins","pluginsContainer","type","property","byType","length","reduce","collection","plugin","key","WebinyError","exports"],"sources":["mapPlugins.ts"],"sourcesContent":["import type { Plugin, PluginsContainer } from \"@webiny/plugins/types\";\nimport WebinyError from \"@webiny/error\";\n\ninterface Params {\n plugins: PluginsContainer;\n type: string;\n property: string;\n}\nexport const getMappedPlugins = <T extends Plugin>(params: Params) => {\n const { plugins: pluginsContainer, type, property } = params;\n const plugins = pluginsContainer.byType<T>(type);\n if (plugins.length === 0) {\n return {};\n }\n return plugins.reduce<Record<string, T>>((collection, plugin) => {\n const key: keyof typeof plugin = plugin[property];\n if (typeof key !== \"string\") {\n throw new WebinyError(\n \"Property to map the plugins on must be a string.\",\n \"PLUGIN_PROPERTY_ERROR\",\n {\n type,\n property\n }\n );\n }\n collection[key] = plugin;\n return collection;\n }, {});\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAOO,MAAMC,gBAAgB,GAAsBC,MAAc,IAAK;EAClE,MAAM;IAAEC,OAAO,EAAEC,gBAAgB;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGJ,MAAM;EAC5D,MAAMC,OAAO,GAAGC,gBAAgB,CAACG,MAAM,CAAIF,IAAI,CAAC;EAChD,IAAIF,OAAO,CAACK,MAAM,KAAK,CAAC,EAAE;IACtB,OAAO,CAAC,CAAC;EACb;EACA,OAAOL,OAAO,CAACM,MAAM,CAAoB,CAACC,UAAU,EAAEC,MAAM,KAAK;IAC7D,MAAMC,GAAwB,GAAGD,MAAM,CAACL,QAAQ,CAAC;IACjD,IAAI,OAAOM,GAAG,KAAK,QAAQ,EAAE;MACzB,MAAM,IAAIC,cAAW,CACjB,kDAAkD,EAClD,uBAAuB,EACvB;QACIR,IAAI;QACJC;MACJ,CACJ,CAAC;IACL;IACAI,UAAU,CAACE,GAAG,CAAC,GAAGD,MAAM;IACxB,OAAOD,UAAU;EACrB,CAAC,EAAE,CAAC,CAAC,CAAC;AACV,CAAC;AAACI,OAAA,CAAAb,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createDefaultFilterCreate = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
10
|
+
const createDefaultFilterCreate = () => {
|
|
11
|
+
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
12
|
+
fieldType: _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin.ALL,
|
|
13
|
+
create: params => {
|
|
14
|
+
const {
|
|
15
|
+
negate,
|
|
16
|
+
transformValue,
|
|
17
|
+
field,
|
|
18
|
+
compareValue,
|
|
19
|
+
valueFilterPlugins
|
|
20
|
+
} = params;
|
|
21
|
+
const plugin = valueFilterPlugins[params.operation];
|
|
22
|
+
if (!plugin) {
|
|
23
|
+
throw new _error.default(`Missing ValueFilterPlugin for operation "${params.operation}".`, "MISSING_OPERATION_PLUGIN", {
|
|
24
|
+
operation: params.operation
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
negate,
|
|
29
|
+
transformValue,
|
|
30
|
+
field,
|
|
31
|
+
compareValue,
|
|
32
|
+
fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join("."),
|
|
33
|
+
path: field.createPath({
|
|
34
|
+
field
|
|
35
|
+
}),
|
|
36
|
+
plugin
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
plugin.name = `headless-cms.ddb.filter.default`;
|
|
41
|
+
return plugin;
|
|
42
|
+
};
|
|
43
|
+
exports.createDefaultFilterCreate = createDefaultFilterCreate;
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=defaultFilterCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPlugin","createDefaultFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","ALL","create","params","negate","transformValue","field","compareValue","valueFilterPlugins","operation","WebinyError","fieldPathId","parents","map","f","fieldId","join","path","createPath","name","exports"],"sources":["defaultFilterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\n\nexport const createDefaultFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: CmsEntryFieldFilterPlugin.ALL,\n create: params => {\n const { negate, transformValue, field, compareValue, valueFilterPlugins } = params;\n const plugin = valueFilterPlugins[params.operation];\n if (!plugin) {\n throw new WebinyError(\n `Missing ValueFilterPlugin for operation \"${params.operation}\".`,\n \"MISSING_OPERATION_PLUGIN\",\n {\n operation: params.operation\n }\n );\n }\n return {\n negate,\n transformValue,\n field,\n compareValue,\n fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join(\".\"),\n path: field.createPath({\n field\n }),\n plugin\n };\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAC;IACzCC,SAAS,EAAED,oDAAyB,CAACE,GAAG;IACxCC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QAAEC,MAAM;QAAEC,cAAc;QAAEC,KAAK;QAAEC,YAAY;QAAEC;MAAmB,CAAC,GAAGL,MAAM;MAClF,MAAML,MAAM,GAAGU,kBAAkB,CAACL,MAAM,CAACM,SAAS,CAAC;MACnD,IAAI,CAACX,MAAM,EAAE;QACT,MAAM,IAAIY,cAAW,CACjB,4CAA4CP,MAAM,CAACM,SAAS,IAAI,EAChE,0BAA0B,EAC1B;UACIA,SAAS,EAAEN,MAAM,CAACM;QACtB,CACJ,CAAC;MACL;MACA,OAAO;QACHL,MAAM;QACNC,cAAc;QACdC,KAAK;QACLC,YAAY;QACZI,WAAW,EAAE,CAAC,GAAGL,KAAK,CAACM,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,EAAET,KAAK,CAACS,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;QAC5EC,IAAI,EAAEX,KAAK,CAACY,UAAU,CAAC;UACnBZ;QACJ,CAAC,CAAC;QACFR;MACJ,CAAC;IACL;EACJ,CAAC,CAAC;EAEFA,MAAM,CAACqB,IAAI,GAAG,iCAAiC;EAE/C,OAAOrB,MAAM;AACjB,CAAC;AAACsB,OAAA,CAAAvB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createFilterCreatePlugins: () => import("../../../..").CmsEntryFieldFilterPlugin<import("@webiny/api/types").GenericRecord | null | undefined>[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createFilterCreatePlugins = void 0;
|
|
7
|
+
var _defaultFilterCreate = require("./defaultFilterCreate");
|
|
8
|
+
var _refFilterCreate = require("./refFilterCreate");
|
|
9
|
+
var _objectFilterCreate = require("./objectFilterCreate");
|
|
10
|
+
var _searchableJsonFilterCreate = require("./searchableJsonFilterCreate");
|
|
11
|
+
const createFilterCreatePlugins = () => {
|
|
12
|
+
return [(0, _defaultFilterCreate.createDefaultFilterCreate)(), (0, _refFilterCreate.createRefFilterCreate)(), (0, _objectFilterCreate.objectFilterCreate)(), (0, _searchableJsonFilterCreate.searchableJsonFilterCreate)()];
|
|
13
|
+
};
|
|
14
|
+
exports.createFilterCreatePlugins = createFilterCreatePlugins;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_defaultFilterCreate","require","_refFilterCreate","_objectFilterCreate","_searchableJsonFilterCreate","createFilterCreatePlugins","createDefaultFilterCreate","createRefFilterCreate","objectFilterCreate","searchableJsonFilterCreate","exports"],"sources":["index.ts"],"sourcesContent":["import { createDefaultFilterCreate } from \"./defaultFilterCreate\";\nimport { createRefFilterCreate } from \"./refFilterCreate\";\nimport { objectFilterCreate } from \"./objectFilterCreate\";\nimport { searchableJsonFilterCreate } from \"./searchableJsonFilterCreate\";\n\nexport const createFilterCreatePlugins = () => {\n return [\n createDefaultFilterCreate(),\n createRefFilterCreate(),\n objectFilterCreate(),\n searchableJsonFilterCreate()\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAEO,MAAMI,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,CACH,IAAAC,8CAAyB,EAAC,CAAC,EAC3B,IAAAC,sCAAqB,EAAC,CAAC,EACvB,IAAAC,sCAAkB,EAAC,CAAC,EACpB,IAAAC,sDAA0B,EAAC,CAAC,CAC/B;AACL,CAAC;AAACC,OAAA,CAAAL,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.objectFilterCreate = void 0;
|
|
8
|
+
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
9
|
+
var _where = require("../where");
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
var _transform = require("../transform");
|
|
12
|
+
const objectFilterCreate = () => {
|
|
13
|
+
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
14
|
+
fieldType: "object",
|
|
15
|
+
create: params => {
|
|
16
|
+
const {
|
|
17
|
+
value: objectValue,
|
|
18
|
+
valueFilterPlugins,
|
|
19
|
+
transformValuePlugins,
|
|
20
|
+
getFilterCreatePlugin,
|
|
21
|
+
field: parentField,
|
|
22
|
+
fields
|
|
23
|
+
} = params;
|
|
24
|
+
const filters = [];
|
|
25
|
+
for (const key in objectValue) {
|
|
26
|
+
const value = objectValue[key];
|
|
27
|
+
if (value === undefined) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const whereParams = (0, _where.extractWhereParams)(key);
|
|
31
|
+
if (!whereParams) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const {
|
|
35
|
+
negate,
|
|
36
|
+
fieldId,
|
|
37
|
+
operation
|
|
38
|
+
} = whereParams;
|
|
39
|
+
const fieldPath = parentField.parents.map(p => p.fieldId).concat([parentField.fieldId, fieldId]).join(".");
|
|
40
|
+
const field = fields[fieldPath];
|
|
41
|
+
if (!field) {
|
|
42
|
+
throw new _error.default(`There is no field with the field path "${fieldPath}".`, "FIELD_ERROR", {
|
|
43
|
+
fieldId
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const filterCreatePlugin = getFilterCreatePlugin(field.type);
|
|
47
|
+
const transformValuePlugin = transformValuePlugins[field.type];
|
|
48
|
+
const transformValueCallable = value => {
|
|
49
|
+
if (!transformValuePlugin) {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
return transformValuePlugin.transform({
|
|
53
|
+
field,
|
|
54
|
+
value
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const result = filterCreatePlugin.create({
|
|
58
|
+
key,
|
|
59
|
+
value,
|
|
60
|
+
valueFilterPlugins,
|
|
61
|
+
transformValuePlugins,
|
|
62
|
+
getFilterCreatePlugin,
|
|
63
|
+
operation,
|
|
64
|
+
negate,
|
|
65
|
+
field,
|
|
66
|
+
fields,
|
|
67
|
+
compareValue: (0, _transform.transformValue)({
|
|
68
|
+
value,
|
|
69
|
+
transform: transformValueCallable
|
|
70
|
+
}),
|
|
71
|
+
transformValue: transformValueCallable
|
|
72
|
+
});
|
|
73
|
+
if (!result) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(result)) {
|
|
77
|
+
filters.push(...result);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
filters.push(result);
|
|
81
|
+
}
|
|
82
|
+
return filters;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
plugin.name = `headless-cms.ddb.filter.object`;
|
|
86
|
+
return plugin;
|
|
87
|
+
};
|
|
88
|
+
exports.objectFilterCreate = objectFilterCreate;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=objectFilterCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_CmsEntryFieldFilterPlugin","require","_where","_error","_interopRequireDefault","_transform","objectFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","value","objectValue","valueFilterPlugins","transformValuePlugins","getFilterCreatePlugin","field","parentField","fields","filters","key","undefined","whereParams","extractWhereParams","negate","fieldId","operation","fieldPath","parents","map","p","concat","join","WebinyError","filterCreatePlugin","type","transformValuePlugin","transformValueCallable","transform","result","compareValue","transformValue","Array","isArray","push","name","exports"],"sources":["objectFilterCreate.ts"],"sourcesContent":["import { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { transformValue } from \"~/operations/entry/filtering/transform\";\n\nexport const objectFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: \"object\",\n create: params => {\n const {\n value: objectValue,\n valueFilterPlugins,\n transformValuePlugins,\n getFilterCreatePlugin,\n field: parentField,\n fields\n } = params;\n\n const filters = [];\n\n for (const key in objectValue) {\n const value = objectValue[key];\n if (value === undefined) {\n continue;\n }\n const whereParams = extractWhereParams(key);\n if (!whereParams) {\n continue;\n }\n const { negate, fieldId, operation } = whereParams;\n\n const fieldPath = parentField.parents\n .map(p => p.fieldId)\n .concat([parentField.fieldId, fieldId])\n .join(\".\");\n\n const field = fields[fieldPath];\n if (!field) {\n throw new WebinyError(\n `There is no field with the field path \"${fieldPath}\".`,\n \"FIELD_ERROR\",\n {\n fieldId\n }\n );\n }\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,\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 if (!result) {\n continue;\n }\n if (Array.isArray(result)) {\n filters.push(...result);\n continue;\n }\n\n filters.push(result);\n }\n return filters;\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.object`;\n\n return plugin;\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C,KAAK,CAACmB,IAAI,CAAC;QAE5D,MAAMC,oBAAwD,GAC1DtB,qBAAqB,CAACE,KAAK,CAACmB,IAAI,CAAC;QAErC,MAAME,sBAAsB,GAAI1B,KAAU,IAAK;UAC3C,IAAI,CAACyB,oBAAoB,EAAE;YACvB,OAAOzB,KAAK;UAChB;UACA,OAAOyB,oBAAoB,CAACE,SAAS,CAAC;YAClCtB,KAAK;YACLL;UACJ,CAAC,CAAC;QACN,CAAC;QAED,MAAM4B,MAAM,GAAGL,kBAAkB,CAACzB,MAAM,CAAC;UACrCW,GAAG;UACHT,KAAK;UACLE,kBAAkB;UAClBC,qBAAqB;UACrBC,qBAAqB;UACrBW,SAAS;UACTF,MAAM;UACNR,KAAK;UACLE,MAAM;UACNsB,YAAY,EAAE,IAAAC,yBAAc,EAAC;YACzB9B,KAAK;YACL2B,SAAS,EAAED;UACf,CAAC,CAAC;UACFI,cAAc,EAAEJ;QACpB,CAAC,CAAC;QACF,IAAI,CAACE,MAAM,EAAE;UACT;QACJ;QACA,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,EAAE;UACvBpB,OAAO,CAACyB,IAAI,CAAC,GAAGL,MAAM,CAAC;UACvB;QACJ;QAEApB,OAAO,CAACyB,IAAI,CAACL,MAAM,CAAC;MACxB;MACA,OAAOpB,OAAO;IAClB;EACJ,CAAC,CAAC;EAEFb,MAAM,CAACuC,IAAI,GAAG,gCAAgC;EAE9C,OAAOvC,MAAM;AACjB,CAAC;AAACwC,OAAA,CAAAzC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createRefFilterCreate = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
10
|
+
var _where = require("../where");
|
|
11
|
+
var _transform = require("../transform");
|
|
12
|
+
const createRefFilterCreate = () => {
|
|
13
|
+
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
14
|
+
fieldType: "ref",
|
|
15
|
+
create: params => {
|
|
16
|
+
const {
|
|
17
|
+
valueFilterPlugins,
|
|
18
|
+
transformValuePlugins,
|
|
19
|
+
field
|
|
20
|
+
} = params;
|
|
21
|
+
let value = params.value;
|
|
22
|
+
if (!value) {
|
|
23
|
+
value = {
|
|
24
|
+
entryId: null
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const propertyFilters = Object.keys(value);
|
|
28
|
+
if (propertyFilters.length === 0) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const filters = [];
|
|
32
|
+
for (const propertyFilter of propertyFilters) {
|
|
33
|
+
const whereParams = (0, _where.extractWhereParams)(propertyFilter);
|
|
34
|
+
if (!whereParams) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const {
|
|
38
|
+
fieldId: propertyId,
|
|
39
|
+
operation: propertyOperation,
|
|
40
|
+
negate
|
|
41
|
+
} = whereParams;
|
|
42
|
+
const transformValuePlugin = transformValuePlugins[field.type];
|
|
43
|
+
const transformValueCallable = value => {
|
|
44
|
+
if (!transformValuePlugin) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
return transformValuePlugin.transform({
|
|
48
|
+
field,
|
|
49
|
+
value
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const filterPlugin = valueFilterPlugins[propertyOperation];
|
|
53
|
+
if (!filterPlugin) {
|
|
54
|
+
throw new _error.default(`Missing operation filter for "${propertyOperation}".`, "MISSING_OPERATION_FILTER");
|
|
55
|
+
}
|
|
56
|
+
const paths = [field.createPath({
|
|
57
|
+
field
|
|
58
|
+
}), propertyId];
|
|
59
|
+
filters.push({
|
|
60
|
+
field,
|
|
61
|
+
path: paths.join("."),
|
|
62
|
+
fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join("."),
|
|
63
|
+
plugin: filterPlugin,
|
|
64
|
+
negate,
|
|
65
|
+
compareValue: (0, _transform.transformValue)({
|
|
66
|
+
value: value[propertyFilter],
|
|
67
|
+
transform: transformValueCallable
|
|
68
|
+
}),
|
|
69
|
+
transformValue: transformValueCallable
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return filters;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
plugin.name = `headless-cms.ddb.filter.ref`;
|
|
76
|
+
return plugin;
|
|
77
|
+
};
|
|
78
|
+
exports.createRefFilterCreate = createRefFilterCreate;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=refFilterCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPlugin","_where","_transform","createRefFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","valueFilterPlugins","transformValuePlugins","field","value","entryId","propertyFilters","Object","keys","length","filters","propertyFilter","whereParams","extractWhereParams","fieldId","propertyId","operation","propertyOperation","negate","transformValuePlugin","type","transformValueCallable","transform","filterPlugin","WebinyError","paths","createPath","push","path","join","fieldPathId","parents","map","f","compareValue","transformValue","name","exports"],"sources":["refFilterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryFieldFilterPluginCreateResponse } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\nimport { transformValue } from \"~/operations/entry/filtering/transform\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nexport const createRefFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin<GenericRecord | null | undefined>({\n fieldType: \"ref\",\n create: params => {\n const { valueFilterPlugins, transformValuePlugins, field } = params;\n let value = params.value;\n if (!value) {\n value = {\n entryId: null\n };\n }\n const propertyFilters = Object.keys(value);\n if (propertyFilters.length === 0) {\n return null;\n }\n const filters: CmsEntryFieldFilterPluginCreateResponse[] = [];\n\n for (const propertyFilter of propertyFilters) {\n const whereParams = extractWhereParams(propertyFilter);\n if (!whereParams) {\n continue;\n }\n const { fieldId: propertyId, operation: propertyOperation, negate } = whereParams;\n\n const transformValuePlugin = 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 filterPlugin = valueFilterPlugins[propertyOperation];\n if (!filterPlugin) {\n throw new WebinyError(\n `Missing operation filter for \"${propertyOperation}\".`,\n \"MISSING_OPERATION_FILTER\"\n );\n }\n\n const paths = [\n field.createPath({\n field\n }),\n propertyId\n ];\n\n filters.push({\n field,\n path: paths.join(\".\"),\n fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join(\".\"),\n plugin: filterPlugin,\n negate,\n compareValue: transformValue({\n value: value[propertyFilter],\n transform: transformValueCallable\n }),\n transformValue: transformValueCallable\n });\n }\n\n return filters;\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.ref`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAGO,MAAMI,qBAAqB,GAAGA,CAAA,KAAM;EACvC,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAmC;IAC3EC,SAAS,EAAE,KAAK;IAChBC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QAAEC,kBAAkB;QAAEC,qBAAqB;QAAEC;MAAM,CAAC,GAAGH,MAA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C,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACnB,OAAO,CAAC,EAAEX,KAAK,CAACW,OAAO,CAAC,CAACe,IAAI,CAAC,GAAG,CAAC;UAC5EjC,MAAM,EAAE2B,YAAY;UACpBL,MAAM;UACNgB,YAAY,EAAE,IAAAC,yBAAc,EAAC;YACzB/B,KAAK,EAAEA,KAAK,CAACO,cAAc,CAAC;YAC5BW,SAAS,EAAED;UACf,CAAC,CAAC;UACFc,cAAc,EAAEd;QACpB,CAAC,CAAC;MACN;MAEA,OAAOX,OAAO;IAClB;EACJ,CAAC,CAAC;EAEFd,MAAM,CAACwC,IAAI,GAAG,6BAA6B;EAE3C,OAAOxC,MAAM;AACjB,CAAC;AAACyC,OAAA,CAAA1C,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.searchableJsonFilterCreate = void 0;
|
|
8
|
+
var _dotObject = _interopRequireDefault(require("dot-object"));
|
|
9
|
+
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
10
|
+
var _where = require("../where");
|
|
11
|
+
const searchableJsonFilterCreate = () => {
|
|
12
|
+
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
13
|
+
fieldType: "searchable-json",
|
|
14
|
+
create: params => {
|
|
15
|
+
const {
|
|
16
|
+
value: objectValue,
|
|
17
|
+
valueFilterPlugins,
|
|
18
|
+
field: parentField
|
|
19
|
+
} = params;
|
|
20
|
+
const filters = [];
|
|
21
|
+
const accessPatterns = _dotObject.default.dot(objectValue);
|
|
22
|
+
for (const key in accessPatterns) {
|
|
23
|
+
const value = accessPatterns[key];
|
|
24
|
+
if (value === undefined) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const whereParams = (0, _where.extractWhereParams)(key);
|
|
28
|
+
if (!whereParams) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const {
|
|
32
|
+
negate,
|
|
33
|
+
operation
|
|
34
|
+
} = whereParams;
|
|
35
|
+
const transformValueCallable = value => {
|
|
36
|
+
return value;
|
|
37
|
+
};
|
|
38
|
+
const fieldId = `${parentField.fieldId}.${whereParams.fieldId ?? key}`;
|
|
39
|
+
const result = {
|
|
40
|
+
field: parentField,
|
|
41
|
+
path: `values.${fieldId}`,
|
|
42
|
+
fieldPathId: `values.${fieldId}`,
|
|
43
|
+
negate,
|
|
44
|
+
plugin: valueFilterPlugins[operation],
|
|
45
|
+
compareValue: value,
|
|
46
|
+
transformValue: transformValueCallable
|
|
47
|
+
};
|
|
48
|
+
if (!result) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(result)) {
|
|
52
|
+
filters.push(...result);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
filters.push(result);
|
|
56
|
+
}
|
|
57
|
+
return filters;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
plugin.name = `headless-cms.ddb.filter.searchable-json`;
|
|
61
|
+
return plugin;
|
|
62
|
+
};
|
|
63
|
+
exports.searchableJsonFilterCreate = searchableJsonFilterCreate;
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=searchableJsonFilterCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dotObject","_interopRequireDefault","require","_CmsEntryFieldFilterPlugin","_where","searchableJsonFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","value","objectValue","valueFilterPlugins","field","parentField","filters","accessPatterns","dot","key","undefined","whereParams","extractWhereParams","negate","operation","transformValueCallable","fieldId","result","path","fieldPathId","compareValue","transformValue","Array","isArray","push","name","exports"],"sources":["searchableJsonFilterCreate.ts"],"sourcesContent":["import dot from \"dot-object\";\nimport type { CmsEntryFieldFilterPluginCreateResponse } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\n\nexport const searchableJsonFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: \"searchable-json\",\n create: params => {\n const { value: objectValue, valueFilterPlugins, field: parentField } = params;\n\n const filters = [];\n\n const accessPatterns = dot.dot(objectValue);\n\n for (const key in accessPatterns) {\n const value = accessPatterns[key];\n if (value === undefined) {\n continue;\n }\n\n const whereParams = extractWhereParams(key);\n if (!whereParams) {\n continue;\n }\n const { negate, operation } = whereParams;\n\n const transformValueCallable = (value: any) => {\n return value;\n };\n\n const fieldId = `${parentField.fieldId}.${whereParams.fieldId ?? key}`;\n\n const result: CmsEntryFieldFilterPluginCreateResponse = {\n field: parentField,\n path: `values.${fieldId}`,\n fieldPathId: `values.${fieldId}`,\n negate,\n plugin: valueFilterPlugins[operation],\n compareValue: value,\n transformValue: transformValueCallable\n };\n\n if (!result) {\n continue;\n }\n if (Array.isArray(result)) {\n filters.push(...result);\n continue;\n }\n\n filters.push(result);\n }\n return filters;\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.searchable-json`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,0BAA0B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAC;IACzCC,SAAS,EAAE,iBAAiB;IAC5BC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QAAEC,KAAK,EAAEC,WAAW;QAAEC,kBAAkB;QAAEC,KAAK,EAAEC;MAAY,CAAC,GAAGL,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@@
|
|
|
1
|
+
import type { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import type { Field } from "./types";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
interface Params {
|
|
5
|
+
model: CmsModel;
|
|
6
|
+
items: CmsEntry[];
|
|
7
|
+
sort?: string[];
|
|
8
|
+
fields: Record<string, Field>;
|
|
9
|
+
plugins: PluginsContainer;
|
|
10
|
+
}
|
|
11
|
+
export declare const sort: (params: Params) => CmsEntry[];
|
|
12
|
+
export {};
|