@webiny/api-headless-cms-ddb 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.9bd236cf5e
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 +4 -3
- package/definitions/entry.js +104 -13
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +4 -3
- package/definitions/group.js +9 -8
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +4 -3
- package/definitions/model.js +9 -8
- package/definitions/model.js.map +1 -1
- package/definitions/system.d.ts +4 -3
- package/definitions/system.js +9 -8
- package/definitions/system.js.map +1 -1
- package/definitions/table.d.ts +5 -5
- package/definitions/table.js +8 -4
- package/definitions/table.js.map +1 -1
- package/dynamoDb/index.js +4 -3
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.js +4 -2
- package/dynamoDb/path/locationFolderId.js.map +1 -1
- package/dynamoDb/path/plainObject.js +3 -1
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/storage/longText.js +4 -1
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.js +24 -58
- package/dynamoDb/storage/richText.js.map +1 -1
- package/dynamoDb/transformValue/datetime.d.ts +1 -1
- package/dynamoDb/transformValue/datetime.js +3 -1
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +5 -12
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.js +7 -9
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +3 -2
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +3 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +2 -2
- package/operations/entry/dataLoader/getAllEntryRevisions.js +3 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +2 -2
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +5 -6
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +2 -2
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +5 -6
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +2 -2
- package/operations/entry/dataLoader/getRevisionById.js +5 -6
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +3 -3
- package/operations/entry/dataLoader/index.js +3 -1
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +1 -1
- package/operations/entry/dataLoader/types.js +3 -1
- package/operations/entry/dataLoader/types.js.map +1 -1
- package/operations/entry/dataLoaders.d.ts +3 -3
- package/operations/entry/dataLoaders.js +15 -14
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +4 -4
- package/operations/entry/filtering/createExpressions.js +3 -1
- package/operations/entry/filtering/createExpressions.js.map +1 -1
- package/operations/entry/filtering/createFields.d.ts +3 -3
- package/operations/entry/filtering/createFields.js +12 -9
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.d.ts +3 -3
- package/operations/entry/filtering/extractSort.js +3 -1
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.d.ts +3 -3
- package/operations/entry/filtering/filter.js +24 -9
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
- package/operations/entry/filtering/fullTextSearch.js +3 -1
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/getValue.js +6 -3
- package/operations/entry/filtering/getValue.js.map +1 -1
- package/operations/entry/filtering/index.js +3 -1
- package/operations/entry/filtering/index.js.map +1 -1
- package/operations/entry/filtering/mapPlugins.d.ts +2 -2
- package/operations/entry/filtering/mapPlugins.js +3 -1
- 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 +3 -1
- 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 +5 -2
- 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 +3 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -1
- package/operations/entry/filtering/plugins/refFilterCreate.js +9 -2
- 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 +65 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
- package/operations/entry/filtering/sort.d.ts +3 -3
- package/operations/entry/filtering/sort.js +5 -3
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.d.ts +2 -2
- package/operations/entry/filtering/systemFields.js +34 -32
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.d.ts +1 -1
- package/operations/entry/filtering/transform.js +3 -1
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.d.ts +2 -2
- package/operations/entry/filtering/types.js +3 -1
- package/operations/entry/filtering/types.js.map +1 -1
- package/operations/entry/filtering/values.d.ts +1 -1
- package/operations/entry/filtering/values.js +3 -1
- package/operations/entry/filtering/values.js.map +1 -1
- package/operations/entry/filtering/where.js +3 -1
- package/operations/entry/filtering/where.js.map +1 -1
- package/operations/entry/index.d.ts +3 -3
- package/operations/entry/index.js +585 -197
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +3 -1
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.d.ts +3 -3
- package/operations/group/index.js +33 -21
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +2 -2
- package/operations/model/index.js +26 -13
- package/operations/model/index.js.map +1 -1
- package/operations/system/index.d.ts +2 -2
- package/operations/system/index.js +19 -7
- package/operations/system/index.js.map +1 -1
- package/package.json +19 -24
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +1 -1
- package/plugins/CmsEntryFieldFilterPathPlugin.js +8 -3
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +10 -10
- package/plugins/CmsEntryFieldFilterPlugin.js +9 -6
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
- package/plugins/CmsEntryFieldSortingPlugin.js +4 -5
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +2 -2
- package/plugins/CmsFieldFilterValueTransformPlugin.js +3 -4
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
- package/plugins/index.js +3 -1
- package/plugins/index.js.map +1 -1
- package/types.d.ts +11 -13
- package/types.js +5 -5
- package/types.js.map +1 -1
- package/definitions/settings.d.ts +0 -9
- package/definitions/settings.js +0 -53
- package/definitions/settings.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -82
- package/dynamoDb/storage/date.js.map +0 -1
- package/operations/settings/index.d.ts +0 -7
- package/operations/settings/index.js +0 -111
- package/operations/settings/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFullTextSearch","params","term","targetFields","fields","fieldDefinitions","plugin","trim","length","item","target","field","WebinyError","value","getValue","values","matches","compareValue"],"sources":["fullTextSearch.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { 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;AAIA;AASA;AACA;AACA;AACO,
|
|
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":[]}
|
|
@@ -21,10 +21,11 @@ const find = (target, input) => {
|
|
|
21
21
|
const path = paths.shift();
|
|
22
22
|
if (!path) {
|
|
23
23
|
return undefined;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
|
+
const value = target?.[path];
|
|
26
|
+
if (value === undefined) {
|
|
25
27
|
return undefined;
|
|
26
28
|
}
|
|
27
|
-
const value = target[path];
|
|
28
29
|
if (paths.length === 0) {
|
|
29
30
|
return value;
|
|
30
31
|
} else if (Array.isArray(value)) {
|
|
@@ -60,4 +61,6 @@ const getValue = (target, input) => {
|
|
|
60
61
|
}
|
|
61
62
|
return find(target, paths);
|
|
62
63
|
};
|
|
63
|
-
exports.getValue = getValue;
|
|
64
|
+
exports.getValue = getValue;
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=getValue.js.map
|
|
@@ -1 +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"],"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
|
|
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,MAAa,EAAEC,MAAa,KAAW;EAC3D,KAAK,MAAMC,CAAC,IAAID,MAAM,EAAE;IACpB,IAAID,MAAM,CAACG,IAAI,CAACC,CAAC,IAAIF,CAAC,KAAKE,CAAC,CAAC,EAAE;MAC3B;IACJ;IACAJ,MAAM,CAACK,IAAI,CAACH,CAAC,CAAC;EAClB;AACJ,CAAC;AACD;AACA;AACA;AACA;AACA,MAAMI,IAAI,GAAGA,CAACN,MAAuC,EAAEO,KAAe,KAAwB;EA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,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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { filter } from \"./filter\";\nexport { sort } from \"./sort\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA"}
|
|
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":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Plugin, PluginsContainer } from "@webiny/plugins/types";
|
|
1
|
+
import type { Plugin, PluginsContainer } from "@webiny/plugins/types";
|
|
2
2
|
interface Params {
|
|
3
3
|
plugins: PluginsContainer;
|
|
4
4
|
type: string;
|
|
5
5
|
property: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const getMappedPlugins: <T extends Plugin
|
|
7
|
+
export declare const getMappedPlugins: <T extends Plugin>(params: Params) => Record<string, T>;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getMappedPlugins","params","plugins","pluginsContainer","type","property","byType","length","reduce","collection","plugin","key","WebinyError"],"sources":["mapPlugins.ts"],"sourcesContent":["import { 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;AAOO,
|
|
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":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin";
|
|
2
|
-
export declare const createDefaultFilterCreate: () => CmsEntryFieldFilterPlugin
|
|
2
|
+
export declare const createDefaultFilterCreate: () => CmsEntryFieldFilterPlugin<any>;
|
|
@@ -40,4 +40,6 @@ const createDefaultFilterCreate = () => {
|
|
|
40
40
|
plugin.name = `headless-cms.ddb.filter.default`;
|
|
41
41
|
return plugin;
|
|
42
42
|
};
|
|
43
|
-
exports.createDefaultFilterCreate = createDefaultFilterCreate;
|
|
43
|
+
exports.createDefaultFilterCreate = createDefaultFilterCreate;
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=defaultFilterCreate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createDefaultFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","ALL","create","params","negate","transformValue","field","compareValue","valueFilterPlugins","operation","WebinyError","fieldPathId","parents","map","f","fieldId","join","path","createPath","name"],"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;AACA;AAEO,
|
|
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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createFilterCreatePlugins: () => import("../../../..").CmsEntryFieldFilterPlugin[];
|
|
1
|
+
export declare const createFilterCreatePlugins: () => import("../../../..").CmsEntryFieldFilterPlugin<import("@webiny/api/types").GenericRecord | null | undefined>[];
|
|
@@ -7,7 +7,10 @@ exports.createFilterCreatePlugins = void 0;
|
|
|
7
7
|
var _defaultFilterCreate = require("./defaultFilterCreate");
|
|
8
8
|
var _refFilterCreate = require("./refFilterCreate");
|
|
9
9
|
var _objectFilterCreate = require("./objectFilterCreate");
|
|
10
|
+
var _searchableJsonFilterCreate = require("./searchableJsonFilterCreate");
|
|
10
11
|
const createFilterCreatePlugins = () => {
|
|
11
|
-
return [(0, _defaultFilterCreate.createDefaultFilterCreate)(), (0, _refFilterCreate.createRefFilterCreate)(), (0, _objectFilterCreate.objectFilterCreate)()];
|
|
12
|
+
return [(0, _defaultFilterCreate.createDefaultFilterCreate)(), (0, _refFilterCreate.createRefFilterCreate)(), (0, _objectFilterCreate.objectFilterCreate)(), (0, _searchableJsonFilterCreate.searchableJsonFilterCreate)()];
|
|
12
13
|
};
|
|
13
|
-
exports.createFilterCreatePlugins = createFilterCreatePlugins;
|
|
14
|
+
exports.createFilterCreatePlugins = createFilterCreatePlugins;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFilterCreatePlugins","createDefaultFilterCreate","createRefFilterCreate","objectFilterCreate"],"sources":["index.ts"],"sourcesContent":["import { createDefaultFilterCreate } from \"./defaultFilterCreate\";\nimport { createRefFilterCreate } from \"./refFilterCreate\";\nimport { objectFilterCreate } from \"./objectFilterCreate\";\n\nexport const createFilterCreatePlugins = () => {\n return [createDefaultFilterCreate()
|
|
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":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin";
|
|
2
|
-
export declare const objectFilterCreate: () => CmsEntryFieldFilterPlugin
|
|
2
|
+
export declare const objectFilterCreate: () => CmsEntryFieldFilterPlugin<any>;
|
|
@@ -85,4 +85,6 @@ const objectFilterCreate = () => {
|
|
|
85
85
|
plugin.name = `headless-cms.ddb.filter.object`;
|
|
86
86
|
return plugin;
|
|
87
87
|
};
|
|
88
|
-
exports.objectFilterCreate = objectFilterCreate;
|
|
88
|
+
exports.objectFilterCreate = objectFilterCreate;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=objectFilterCreate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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"],"sources":["objectFilterCreate.ts"],"sourcesContent":["import { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\nimport WebinyError from \"@webiny/error\";\nimport { 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;\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AAEO,
|
|
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;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEO,MAAMK,kBAAkB,GAAGA,CAAA,KAAM;EACpC,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAC;IACzCC,SAAS,EAAE,QAAQ;IACnBC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QACFC,KAAK,EAAEC,WAAW;QAClBC,kBAAkB;QAClBC,qBAAqB;QACrBC,qBAAqB;QACrBC,KAAK,EAAEC,WAAW;QAClBC;MACJ,CAAC,GAAGR,MAAM;MAEV,MAAMS,OAAO,GAAG,EAAE;MAElB,KAAK,MAAMC,GAAG,IAAIR,WAAW,EAAE;QAC3B,MAAMD,KAAK,GAAGC,WAAW,CAACQ,GAAG,CAAC;QAC9B,IAAIT,KAAK,KAAKU,SAAS,EAAE;UACrB;QACJ;QACA,MAAMC,WAAW,GAAG,IAAAC,yBAAkB,EAACH,GAAG,CAAC;QAC3C,IAAI,CAACE,WAAW,EAAE;UACd;QACJ;QACA,MAAM;UAAEE,MAAM;UAAEC,OAAO;UAAEC;QAAU,CAAC,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,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":[]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin";
|
|
2
|
-
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types";
|
|
3
|
+
export declare const createRefFilterCreate: () => CmsEntryFieldFilterPlugin<GenericRecord | null | undefined>;
|
|
@@ -14,11 +14,16 @@ const createRefFilterCreate = () => {
|
|
|
14
14
|
fieldType: "ref",
|
|
15
15
|
create: params => {
|
|
16
16
|
const {
|
|
17
|
-
value,
|
|
18
17
|
valueFilterPlugins,
|
|
19
18
|
transformValuePlugins,
|
|
20
19
|
field
|
|
21
20
|
} = params;
|
|
21
|
+
let value = params.value;
|
|
22
|
+
if (!value) {
|
|
23
|
+
value = {
|
|
24
|
+
entryId: null
|
|
25
|
+
};
|
|
26
|
+
}
|
|
22
27
|
const propertyFilters = Object.keys(value);
|
|
23
28
|
if (propertyFilters.length === 0) {
|
|
24
29
|
return null;
|
|
@@ -70,4 +75,6 @@ const createRefFilterCreate = () => {
|
|
|
70
75
|
plugin.name = `headless-cms.ddb.filter.ref`;
|
|
71
76
|
return plugin;
|
|
72
77
|
};
|
|
73
|
-
exports.createRefFilterCreate = createRefFilterCreate;
|
|
78
|
+
exports.createRefFilterCreate = createRefFilterCreate;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=refFilterCreate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRefFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","
|
|
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,MAAM;MACnE,IAAII,KAAK,GAAGJ,MAAM,CAACI,KAAK;MACxB,IAAI,CAACA,KAAK,EAAE;QACRA,KAAK,GAAG;UACJC,OAAO,EAAE;QACb,CAAC;MACL;MACA,MAAMC,eAAe,GAAGC,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC;MAC1C,IAAIE,eAAe,CAACG,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI;MACf;MACA,MAAMC,OAAkD,GAAG,EAAE;MAE7D,KAAK,MAAMC,cAAc,IAAIL,eAAe,EAAE;QAC1C,MAAMM,WAAW,GAAG,IAAAC,yBAAkB,EAACF,cAAc,CAAC;QACtD,IAAI,CAACC,WAAW,EAAE;UACd;QACJ;QACA,MAAM;UAAEE,OAAO,EAAEC,UAAU;UAAEC,SAAS,EAAEC,iBAAiB;UAAEC;QAAO,CAAC,GAAGN,WAAW;QAEjF,MAAMO,oBAAoB,GAAGjB,qBAAqB,CAACC,KAAK,CAACiB,IAAI,CAAC;QAE9D,MAAMC,sBAAsB,GAAIjB,KAAU,IAAK;UAC3C,IAAI,CAACe,oBAAoB,EAAE;YACvB,OAAOf,KAAK;UAChB;UACA,OAAOe,oBAAoB,CAACG,SAAS,CAAC;YAClCnB,KAAK;YACLC;UACJ,CAAC,CAAC;QACN,CAAC;QAED,MAAMmB,YAAY,GAAGtB,kBAAkB,CAACgB,iBAAiB,CAAC;QAC1D,IAAI,CAACM,YAAY,EAAE;UACf,MAAM,IAAIC,cAAW,CACjB,iCAAiCP,iBAAiB,IAAI,EACtD,0BACJ,CAAC;QACL;QAEA,MAAMQ,KAAK,GAAG,CACVtB,KAAK,CAACuB,UAAU,CAAC;UACbvB;QACJ,CAAC,CAAC,EACFY,UAAU,CACb;QAEDL,OAAO,CAACiB,IAAI,CAAC;UACTxB,KAAK;UACLyB,IAAI,EAAEH,KAAK,CAACI,IAAI,CAAC,GAAG,CAAC;UACrBC,WAAW,EAAE,CAAC,GAAG3B,KAAK,CAAC4B,OAAO,CAACC,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,MAAM;MAE7E,MAAMM,OAAO,GAAG,EAAE;MAElB,MAAMC,cAAc,GAAGC,kBAAG,CAACA,GAAG,CAACN,WAAW,CAAC;MAE3C,KAAK,MAAMO,GAAG,IAAIF,cAAc,EAAE;QAC9B,MAAMN,KAAK,GAAGM,cAAc,CAACE,GAAG,CAAC;QACjC,IAAIR,KAAK,KAAKS,SAAS,EAAE;UACrB;QACJ;QAEA,MAAMC,WAAW,GAAG,IAAAC,yBAAkB,EAACH,GAAG,CAAC;QAC3C,IAAI,CAACE,WAAW,EAAE;UACd;QACJ;QACA,MAAM;UAAEE,MAAM;UAAEC;QAAU,CAAC,GAAGH,WAAW;QAEzC,MAAMI,sBAAsB,GAAId,KAAU,IAAK;UAC3C,OAAOA,KAAK;QAChB,CAAC;QAED,MAAMe,OAAO,GAAG,GAAGX,WAAW,CAACW,OAAO,IAAIL,WAAW,CAACK,OAAO,IAAIP,GAAG,EAAE;QAEtE,MAAMQ,MAA+C,GAAG;UACpDb,KAAK,EAAEC,WAAW;UAClBa,IAAI,EAAE,UAAUF,OAAO,EAAE;UACzBG,WAAW,EAAE,UAAUH,OAAO,EAAE;UAChCH,MAAM;UACNjB,MAAM,EAAEO,kBAAkB,CAACW,SAAS,CAAC;UACrCM,YAAY,EAAEnB,KAAK;UACnBoB,cAAc,EAAEN;QACpB,CAAC;QAED,IAAI,CAACE,MAAM,EAAE;UACT;QACJ;QACA,IAAIK,KAAK,CAACC,OAAO,CAACN,MAAM,CAAC,EAAE;UACvBX,OAAO,CAACkB,IAAI,CAAC,GAAGP,MAAM,CAAC;UACvB;QACJ;QAEAX,OAAO,CAACkB,IAAI,CAACP,MAAM,CAAC;MACxB;MACA,OAAOX,OAAO;IAClB;EACJ,CAAC,CAAC;EAEFV,MAAM,CAAC6B,IAAI,GAAG,yCAAyC;EAEvD,OAAO7B,MAAM;AACjB,CAAC;AAAC8B,OAAA,CAAA/B,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Field } from "./types";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
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
4
|
interface Params {
|
|
5
5
|
model: CmsModel;
|
|
6
6
|
items: CmsEntry[];
|
|
@@ -22,8 +22,8 @@ const sort = params => {
|
|
|
22
22
|
} else if (sort.length === 0) {
|
|
23
23
|
sort.push("savedOn_DESC");
|
|
24
24
|
} else if (sort.length > 1) {
|
|
25
|
-
throw new _error.default("Sorting is limited to a single field.", "SORT_MULTIPLE_FIELDS_ERROR", {
|
|
26
|
-
sort
|
|
25
|
+
throw new _error.default("Sorting is limited to a single field on DynamoDB only system.", "SORT_MULTIPLE_FIELDS_ERROR", {
|
|
26
|
+
sort
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
const [firstSort] = sort;
|
|
@@ -66,4 +66,6 @@ const sort = params => {
|
|
|
66
66
|
}
|
|
67
67
|
return newItems.reverse();
|
|
68
68
|
};
|
|
69
|
-
exports.sort = sort;
|
|
69
|
+
exports.sort = sort;
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sort","params","model","items","fields","plugins","length","push","WebinyError","firstSort","fieldId","field","valuePath","reverse","extractSort","sortBy","itemsToSort","map","item","id","value","transform","dotProp","get","sortedItems","lodashSortBy","newItems","s","find","i","sortingBy"],"sources":["sort.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy\";\nimport { extractSort } from \"./extractSort\";\nimport { Field } from \"./types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\ninterface Params {\n model: CmsModel;\n items: CmsEntry[];\n sort?: string[];\n fields: Record<string, Field>;\n plugins: PluginsContainer;\n}\n\ninterface SortedItem {\n id: string;\n value: any;\n}\n\nexport const sort = (params: Params): CmsEntry[] => {\n const { model, items, sort = [], fields, plugins } = params;\n if (items.length <= 1) {\n return items;\n } else if (sort.length === 0) {\n sort.push(\"savedOn_DESC\");\n } else if (sort.length > 1) {\n throw new WebinyError(\n \"Sorting is limited to a single field.\",\n \"SORT_MULTIPLE_FIELDS_ERROR\",\n {\n sort
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_dotProp","_sortBy","_extractSort","sort","params","model","items","fields","plugins","length","push","WebinyError","firstSort","fieldId","field","valuePath","reverse","extractSort","sortBy","itemsToSort","map","item","id","value","transform","dotProp","get","sortedItems","lodashSortBy","newItems","s","find","i","sortingBy","exports"],"sources":["sort.ts"],"sourcesContent":["import type { CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy\";\nimport { extractSort } from \"./extractSort\";\nimport type { Field } from \"./types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\ninterface Params {\n model: CmsModel;\n items: CmsEntry[];\n sort?: string[];\n fields: Record<string, Field>;\n plugins: PluginsContainer;\n}\n\ninterface SortedItem {\n id: string;\n value: any;\n}\n\nexport const sort = (params: Params): CmsEntry[] => {\n const { model, items, sort = [], fields, plugins } = params;\n if (items.length <= 1) {\n return items;\n } else if (sort.length === 0) {\n sort.push(\"savedOn_DESC\");\n } else if (sort.length > 1) {\n throw new WebinyError(\n \"Sorting is limited to a single field on DynamoDB only system.\",\n \"SORT_MULTIPLE_FIELDS_ERROR\",\n {\n sort\n }\n );\n }\n const [firstSort] = sort;\n if (!firstSort) {\n throw new WebinyError(\"Empty sort array item.\", \"SORT_EMPTY_ERROR\", {\n sort\n });\n }\n\n const { fieldId, field, valuePath, reverse } = extractSort({\n model,\n sortBy: firstSort,\n fields,\n plugins\n });\n\n const itemsToSort = items.map(item => {\n return {\n id: item.id,\n value: field.transform(dotProp.get(item, valuePath))\n };\n });\n const sortedItems: SortedItem[] = lodashSortBy(itemsToSort, \"value\");\n const newItems = sortedItems.map(s => {\n const item = items.find(i => i.id === s.id);\n if (item) {\n return item;\n }\n throw new WebinyError(\n \"Could not find item by given id after the sorting.\",\n \"SORTING_ITEMS_ERROR\",\n {\n id: s.id,\n sortingBy: fieldId,\n reverse\n }\n );\n });\n if (!reverse) {\n return newItems;\n }\n return newItems.reverse();\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAiBO,MAAMI,IAAI,GAAIC,MAAc,IAAiB;EAChD,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEH,IAAI,G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N,OAAOA,IAAI;IACf;IACA,MAAM,IAAIV,cAAW,CACjB,oDAAoD,EACpD,qBAAqB,EACrB;MACIW,EAAE,EAAEQ,CAAC,CAACR,EAAE;MACRW,SAAS,EAAEpB,OAAO;MAClBG;IACJ,CACJ,CAAC;EACL,CAAC,CAAC;EACF,IAAI,CAACA,OAAO,EAAE;IACV,OAAOa,QAAQ;EACnB;EACA,OAAOA,QAAQ,CAACb,OAAO,CAAC,CAAC;AAC7B,CAAC;AAACkB,OAAA,CAAA/B,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
-
|
|
1
|
+
import type { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
+
type Field = Pick<CmsModelField, "id" | "type" | "storageId" | "fieldId" | "settings" | "label">;
|
|
3
3
|
export declare const createSystemFields: () => Field[];
|
|
4
4
|
export {};
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.createSystemFields = void 0;
|
|
8
|
+
var _constants = require("@webiny/api-headless-cms/constants");
|
|
9
|
+
var _startCase = _interopRequireDefault(require("lodash/startCase"));
|
|
7
10
|
const createSystemFields = () => {
|
|
11
|
+
const onMetaFields = _constants.ENTRY_META_FIELDS.filter(_constants.isDateTimeEntryMetaField).map(fieldName => {
|
|
12
|
+
return {
|
|
13
|
+
id: fieldName,
|
|
14
|
+
type: "datetime",
|
|
15
|
+
storageId: fieldName,
|
|
16
|
+
fieldId: fieldName,
|
|
17
|
+
label: (0, _startCase.default)(fieldName)
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const byMetaFields = _constants.ENTRY_META_FIELDS.filter(_constants.isIdentityEntryMetaField).map(fieldName => {
|
|
21
|
+
return {
|
|
22
|
+
id: fieldName,
|
|
23
|
+
type: "plainObject",
|
|
24
|
+
storageId: fieldName,
|
|
25
|
+
fieldId: fieldName,
|
|
26
|
+
label: (0, _startCase.default)(fieldName),
|
|
27
|
+
settings: {
|
|
28
|
+
path: `${fieldName}.id`
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
});
|
|
8
32
|
return [{
|
|
9
33
|
id: "id",
|
|
10
34
|
type: "text",
|
|
@@ -17,28 +41,7 @@ const createSystemFields = () => {
|
|
|
17
41
|
storageId: "entryId",
|
|
18
42
|
fieldId: "entryId",
|
|
19
43
|
label: "Entry ID"
|
|
20
|
-
}, {
|
|
21
|
-
id: "createdOn",
|
|
22
|
-
type: "datetime",
|
|
23
|
-
storageId: "createdOn",
|
|
24
|
-
fieldId: "createdOn",
|
|
25
|
-
label: "Created On"
|
|
26
|
-
}, {
|
|
27
|
-
id: "savedOn",
|
|
28
|
-
type: "datetime",
|
|
29
|
-
storageId: "savedOn",
|
|
30
|
-
fieldId: "savedOn",
|
|
31
|
-
label: "Saved On"
|
|
32
|
-
}, {
|
|
33
|
-
id: "createdBy",
|
|
34
|
-
type: "plainObject",
|
|
35
|
-
storageId: "createdBy",
|
|
36
|
-
fieldId: "createdBy",
|
|
37
|
-
label: "Created By",
|
|
38
|
-
settings: {
|
|
39
|
-
path: "createdBy.id"
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
44
|
+
}, ...onMetaFields, ...byMetaFields, {
|
|
42
45
|
id: "meta",
|
|
43
46
|
type: "plainObject",
|
|
44
47
|
storageId: "meta",
|
|
@@ -62,15 +65,6 @@ const createSystemFields = () => {
|
|
|
62
65
|
}
|
|
63
66
|
}]
|
|
64
67
|
}
|
|
65
|
-
}, {
|
|
66
|
-
id: "ownedBy",
|
|
67
|
-
type: "plainObject",
|
|
68
|
-
storageId: "ownedBy",
|
|
69
|
-
fieldId: "ownedBy",
|
|
70
|
-
label: "Owned By",
|
|
71
|
-
settings: {
|
|
72
|
-
path: "ownedBy.id"
|
|
73
|
-
}
|
|
74
68
|
}, {
|
|
75
69
|
id: "version",
|
|
76
70
|
type: "number",
|
|
@@ -83,6 +77,14 @@ const createSystemFields = () => {
|
|
|
83
77
|
storageId: "status",
|
|
84
78
|
fieldId: "status",
|
|
85
79
|
label: "Status"
|
|
80
|
+
}, {
|
|
81
|
+
id: "wbyDeleted",
|
|
82
|
+
type: "boolean",
|
|
83
|
+
storageId: "wbyDeleted",
|
|
84
|
+
fieldId: "wbyDeleted",
|
|
85
|
+
label: "Deleted"
|
|
86
86
|
}];
|
|
87
87
|
};
|
|
88
|
-
exports.createSystemFields = createSystemFields;
|
|
88
|
+
exports.createSystemFields = createSystemFields;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=systemFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createSystemFields","id","type","storageId","fieldId","label","settings","path","fields"],"sources":["systemFields.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n
|
|
1
|
+
{"version":3,"names":["_constants","require","_startCase","_interopRequireDefault","createSystemFields","onMetaFields","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","fieldName","id","type","storageId","fieldId","label","lodashStartCase","byMetaFields","isIdentityEntryMetaField","settings","path","fields","exports"],"sources":["systemFields.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants\";\nimport lodashStartCase from \"lodash/startCase\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map(fieldName => {\n return {\n id: fieldName,\n type: \"datetime\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName)\n };\n });\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map(fieldName => {\n return {\n id: fieldName,\n type: \"plainObject\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName),\n settings: {\n path: `${fieldName}.id`\n }\n };\n });\n\n return [\n {\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n },\n {\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n },\n\n ...onMetaFields,\n ...byMetaFields,\n\n {\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n },\n {\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n {\n id: \"folderId\",\n type: \"text\",\n fieldId: \"folderId\",\n label: \"Folder ID\",\n storageId: \"folderId\",\n settings: {\n path: \"location.folderId\"\n }\n }\n ]\n }\n },\n\n {\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n },\n {\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n },\n {\n id: \"wbyDeleted\",\n type: \"boolean\",\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n label: \"Deleted\"\n }\n ];\n};\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIO,MAAMG,kBAAkB,GAAGA,CAAA,KAAe;EAC7C,MAAMC,YAAY,GAAGC,4BAAiB,CAACC,MAAM,CAACC,mCAAwB,CAAC,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EAAE,MAAM;QACZE,OAAO,EAAE,UAAU;QACnBC,KAAK,EAAE,WAAW;QAClBF,SAAS,EAAE,UAAU;QACrBM,QAAQ,EAAE;UACNC,IAAI,EAAE;QACV;MACJ,CAAC;IAET;EACJ,CAAC,EAED;IACIT,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE,QAAQ;IACjBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,YAAY;IAChBC,IAAI,EAAE,SAAS;IACfC,SAAS,EAAE,YAAY;IACvBC,OAAO,EAAE,YAAY;IACrBC,KAAK,EAAE;EACX,CAAC,CACJ;AACL,CAAC;AAACO,OAAA,CAAAlB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transformValue","value","transform","Array","isArray","map","v"],"sources":["transform.ts"],"sourcesContent":["import { Field } from \"./types\";\n\ninterface Params extends Pick<Field, \"transform\"> {\n value: any;\n}\nexport const transformValue = ({ value, transform }: Params): any => {\n if (Array.isArray(value)) {\n return value.map(v => transform(v));\n }\n return transform(value);\n};\n"],"mappings":";;;;;;AAKO,MAAMA,cAAc,
|
|
1
|
+
{"version":3,"names":["transformValue","value","transform","Array","isArray","map","v","exports"],"sources":["transform.ts"],"sourcesContent":["import type { Field } from \"./types\";\n\ninterface Params extends Pick<Field, \"transform\"> {\n value: any;\n}\nexport const transformValue = ({ value, transform }: Params): any => {\n if (Array.isArray(value)) {\n return value.map(v => transform(v));\n }\n return transform(value);\n};\n"],"mappings":";;;;;;AAKO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAkB,CAAC,KAAU;EACjE,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACI,GAAG,CAACC,CAAC,IAAIJ,SAAS,CAACI,CAAC,CAAC,CAAC;EACvC;EACA,OAAOJ,SAAS,CAACD,KAAK,CAAC;AAC3B,CAAC;AAACM,OAAA,CAAAP,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { CreatePathCallable } from "../../../plugins";
|
|
1
|
+
import type { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import type { CreatePathCallable } from "../../../plugins";
|
|
3
3
|
interface FieldValueTransform {
|
|
4
4
|
(value: any): any;
|
|
5
5
|
}
|