@webiny/api-headless-cms-ddb 6.4.5-beta.0 → 6.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstractions/CmsDdbDataLoaders.d.ts +5 -0
- package/abstractions/CmsDdbDataLoaders.js +5 -0
- package/abstractions/CmsDdbDataLoaders.js.map +1 -0
- package/abstractions/CmsDdbEntryEntity.d.ts +5 -0
- package/abstractions/CmsDdbEntryEntity.js +5 -0
- package/abstractions/CmsDdbEntryEntity.js.map +1 -0
- package/abstractions/CmsDdbGroupEntity.d.ts +5 -0
- package/abstractions/CmsDdbGroupEntity.js +5 -0
- package/abstractions/CmsDdbGroupEntity.js.map +1 -0
- package/abstractions/CmsDdbModelEntity.d.ts +5 -0
- package/abstractions/CmsDdbModelEntity.js +5 -0
- package/abstractions/CmsDdbModelEntity.js.map +1 -0
- package/abstractions/CmsDdbTable.d.ts +5 -0
- package/abstractions/CmsDdbTable.js +5 -0
- package/abstractions/CmsDdbTable.js.map +1 -0
- package/index.d.ts +13 -2
- package/index.js +31 -71
- package/index.js.map +1 -1
- package/operations/entry/DdbCreateEntry.d.ts +16 -0
- package/operations/entry/DdbCreateEntry.js +77 -0
- package/operations/entry/DdbCreateEntry.js.map +1 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.d.ts +16 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js +85 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js.map +1 -0
- package/operations/entry/DdbDeleteEntry.d.ts +16 -0
- package/operations/entry/DdbDeleteEntry.js +65 -0
- package/operations/entry/DdbDeleteEntry.js.map +1 -0
- package/operations/entry/DdbDeleteEntryRevision.d.ts +17 -0
- package/operations/entry/DdbDeleteEntryRevision.js +91 -0
- package/operations/entry/DdbDeleteEntryRevision.js.map +1 -0
- package/operations/entry/DdbDeleteMultipleEntries.d.ts +16 -0
- package/operations/entry/DdbDeleteMultipleEntries.js +56 -0
- package/operations/entry/DdbDeleteMultipleEntries.js.map +1 -0
- package/operations/entry/DdbGetEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetEntriesByIds.js +31 -0
- package/operations/entry/DdbGetEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetEntry.d.ts +14 -0
- package/operations/entry/DdbGetEntry.js +27 -0
- package/operations/entry/DdbGetEntry.js.map +1 -0
- package/operations/entry/DdbGetLatestEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js +31 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetPreviousRevision.d.ts +14 -0
- package/operations/entry/DdbGetPreviousRevision.js +53 -0
- package/operations/entry/DdbGetPreviousRevision.js.map +1 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js +31 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetRevisionById.d.ts +14 -0
- package/operations/entry/DdbGetRevisionById.js +34 -0
- package/operations/entry/DdbGetRevisionById.js.map +1 -0
- package/operations/entry/DdbGetRevisions.d.ts +14 -0
- package/operations/entry/DdbGetRevisions.js +33 -0
- package/operations/entry/DdbGetRevisions.js.map +1 -0
- package/operations/entry/DdbGetUniqueFieldValues.d.ts +12 -0
- package/operations/entry/DdbGetUniqueFieldValues.js +31 -0
- package/operations/entry/DdbGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/DdbListEntries.d.ts +28 -0
- package/operations/entry/DdbListEntries.js +124 -0
- package/operations/entry/DdbListEntries.js.map +1 -0
- package/operations/entry/DdbMoveEntry.d.ts +14 -0
- package/operations/entry/DdbMoveEntry.js +57 -0
- package/operations/entry/DdbMoveEntry.js.map +1 -0
- package/operations/entry/DdbMoveToBin.d.ts +16 -0
- package/operations/entry/DdbMoveToBin.js +77 -0
- package/operations/entry/DdbMoveToBin.js.map +1 -0
- package/operations/entry/DdbPublishEntry.d.ts +18 -0
- package/operations/entry/DdbPublishEntry.js +161 -0
- package/operations/entry/DdbPublishEntry.js.map +1 -0
- package/operations/entry/DdbRestoreFromBin.d.ts +16 -0
- package/operations/entry/DdbRestoreFromBin.js +78 -0
- package/operations/entry/DdbRestoreFromBin.js.map +1 -0
- package/operations/entry/DdbUnpublishEntry.d.ts +17 -0
- package/operations/entry/DdbUnpublishEntry.js +112 -0
- package/operations/entry/DdbUnpublishEntry.js.map +1 -0
- package/operations/entry/DdbUpdateEntry.d.ts +17 -0
- package/operations/entry/DdbUpdateEntry.js +110 -0
- package/operations/entry/DdbUpdateEntry.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +7 -6
- package/operations/entry/dataLoaders.js +11 -3
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +55 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/storageEntryUtils.d.ts +8 -0
- package/operations/entry/storageEntryUtils.js +25 -0
- package/operations/entry/storageEntryUtils.js.map +1 -0
- package/operations/group/DdbCreateGroup.d.ts +12 -0
- package/operations/group/DdbCreateGroup.js +35 -0
- package/operations/group/DdbCreateGroup.js.map +1 -0
- package/operations/group/DdbDeleteGroup.d.ts +12 -0
- package/operations/group/DdbDeleteGroup.js +31 -0
- package/operations/group/DdbDeleteGroup.js.map +1 -0
- package/operations/group/DdbGetGroup.d.ts +12 -0
- package/operations/group/DdbGetGroup.js +31 -0
- package/operations/group/DdbGetGroup.js.map +1 -0
- package/operations/group/DdbListGroups.d.ts +14 -0
- package/operations/group/DdbListGroups.js +52 -0
- package/operations/group/DdbListGroups.js.map +1 -0
- package/operations/group/DdbUpdateGroup.d.ts +12 -0
- package/operations/group/DdbUpdateGroup.js +35 -0
- package/operations/group/DdbUpdateGroup.js.map +1 -0
- package/operations/group/feature.d.ts +4 -0
- package/operations/group/feature.js +19 -0
- package/operations/group/feature.js.map +1 -0
- package/operations/group/keys.d.ts +15 -0
- package/operations/group/keys.js +17 -0
- package/operations/group/keys.js.map +1 -0
- package/operations/model/DdbCreateModel.d.ts +12 -0
- package/operations/model/DdbCreateModel.js +37 -0
- package/operations/model/DdbCreateModel.js.map +1 -0
- package/operations/model/DdbDeleteModel.d.ts +12 -0
- package/operations/model/DdbDeleteModel.js +31 -0
- package/operations/model/DdbDeleteModel.js.map +1 -0
- package/operations/model/DdbGetModel.d.ts +12 -0
- package/operations/model/DdbGetModel.js +30 -0
- package/operations/model/DdbGetModel.js.map +1 -0
- package/operations/model/DdbListModels.d.ts +12 -0
- package/operations/model/DdbListModels.js +36 -0
- package/operations/model/DdbListModels.js.map +1 -0
- package/operations/model/DdbUpdateModel.d.ts +12 -0
- package/operations/model/DdbUpdateModel.js +36 -0
- package/operations/model/DdbUpdateModel.js.map +1 -0
- package/operations/model/feature.d.ts +4 -0
- package/operations/model/feature.js +19 -0
- package/operations/model/feature.js.map +1 -0
- package/operations/model/keys.d.ts +15 -0
- package/operations/model/keys.js +16 -0
- package/operations/model/keys.js.map +1 -0
- package/package.json +15 -17
- package/types.d.ts +9 -49
- package/types.js.map +1 -1
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -11
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/path/locationFolderId.d.ts +0 -2
- package/dynamoDb/path/locationFolderId.js +0 -21
- package/dynamoDb/path/locationFolderId.js.map +0 -1
- package/dynamoDb/path/plainObject.d.ts +0 -2
- package/dynamoDb/path/plainObject.js +0 -16
- package/dynamoDb/path/plainObject.js.map +0 -1
- package/dynamoDb/transformValue/datetime.d.ts +0 -5
- package/dynamoDb/transformValue/datetime.js +0 -29
- package/dynamoDb/transformValue/datetime.js.map +0 -1
- package/operations/entry/filtering/createExpressions.d.ts +0 -27
- package/operations/entry/filtering/createExpressions.js +0 -124
- package/operations/entry/filtering/createExpressions.js.map +0 -1
- package/operations/entry/filtering/createFields.d.ts +0 -16
- package/operations/entry/filtering/createFields.js +0 -93
- package/operations/entry/filtering/createFields.js.map +0 -1
- package/operations/entry/filtering/extractSort.d.ts +0 -17
- package/operations/entry/filtering/extractSort.js +0 -60
- package/operations/entry/filtering/extractSort.js.map +0 -1
- package/operations/entry/filtering/filter.d.ts +0 -16
- package/operations/entry/filtering/filter.js +0 -85
- package/operations/entry/filtering/filter.js.map +0 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
- package/operations/entry/filtering/fullTextSearch.js +0 -25
- package/operations/entry/filtering/fullTextSearch.js.map +0 -1
- package/operations/entry/filtering/getValue.d.ts +0 -5
- package/operations/entry/filtering/getValue.js +0 -37
- package/operations/entry/filtering/getValue.js.map +0 -1
- package/operations/entry/filtering/index.d.ts +0 -2
- package/operations/entry/filtering/index.js +0 -2
- package/operations/entry/filtering/mapPlugins.d.ts +0 -8
- package/operations/entry/filtering/mapPlugins.js +0 -18
- package/operations/entry/filtering/mapPlugins.js.map +0 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -33
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
- package/operations/entry/filtering/plugins/index.d.ts +0 -1
- package/operations/entry/filtering/plugins/index.js +0 -13
- package/operations/entry/filtering/plugins/index.js.map +0 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
- package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -68
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -3
- package/operations/entry/filtering/plugins/refFilterCreate.js +0 -63
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +0 -2
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +0 -56
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +0 -1
- package/operations/entry/filtering/sort.d.ts +0 -12
- package/operations/entry/filtering/sort.js +0 -41
- package/operations/entry/filtering/sort.js.map +0 -1
- package/operations/entry/filtering/systemFields.d.ts +0 -2
- package/operations/entry/filtering/systemFields.js +0 -149
- package/operations/entry/filtering/systemFields.js.map +0 -1
- package/operations/entry/filtering/transform.d.ts +0 -6
- package/operations/entry/filtering/transform.js +0 -7
- package/operations/entry/filtering/transform.js.map +0 -1
- package/operations/entry/filtering/types.d.ts +0 -40
- package/operations/entry/filtering/types.js +0 -0
- package/operations/entry/filtering/values.d.ts +0 -2
- package/operations/entry/filtering/values.js +0 -15
- package/operations/entry/filtering/values.js.map +0 -1
- package/operations/entry/filtering/where.d.ts +0 -5
- package/operations/entry/filtering/where.js +0 -22
- package/operations/entry/filtering/where.js.map +0 -1
- package/operations/entry/index.d.ts +0 -9
- package/operations/entry/index.js +0 -943
- package/operations/entry/index.js.map +0 -1
- package/operations/group/index.d.ts +0 -8
- package/operations/group/index.js +0 -121
- package/operations/group/index.js.map +0 -1
- package/operations/model/index.d.ts +0 -7
- package/operations/model/index.js +0 -106
- package/operations/model/index.js.map +0 -1
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -23
- package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -30
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
- package/plugins/CmsEntryFieldFilterPlugin.js +0 -20
- package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
- package/plugins/CmsEntryFieldSortingPlugin.js +0 -20
- package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
- package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -19
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -4
- package/plugins/index.js +0 -4
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import error from "@webiny/error";
|
|
2
|
-
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin.js";
|
|
3
|
-
const createDefaultFilterCreate = ()=>{
|
|
4
|
-
const plugin = new CmsEntryFieldFilterPlugin({
|
|
5
|
-
fieldType: CmsEntryFieldFilterPlugin.ALL,
|
|
6
|
-
create: (params)=>{
|
|
7
|
-
const { negate, transformValue, field, compareValue, valueFilterRegistry } = params;
|
|
8
|
-
const filter = valueFilterRegistry.get(params.operation);
|
|
9
|
-
if (!filter) throw new error(`Missing ValueFilterPlugin for operation "${params.operation}".`, "MISSING_OPERATION_PLUGIN", {
|
|
10
|
-
operation: params.operation
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
negate,
|
|
14
|
-
transformValue,
|
|
15
|
-
field,
|
|
16
|
-
compareValue,
|
|
17
|
-
fieldPathId: [
|
|
18
|
-
...field.parents.map((f)=>f.fieldId),
|
|
19
|
-
field.fieldId
|
|
20
|
-
].join("."),
|
|
21
|
-
path: field.createPath({
|
|
22
|
-
field
|
|
23
|
-
}),
|
|
24
|
-
filter
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
plugin.name = "headless-cms.ddb.filter.default";
|
|
29
|
-
return plugin;
|
|
30
|
-
};
|
|
31
|
-
export { createDefaultFilterCreate };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=defaultFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/plugins/defaultFilterCreate.js","sources":["../../../../../src/operations/entry/filtering/plugins/defaultFilterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin.js\";\n\nexport const createDefaultFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: CmsEntryFieldFilterPlugin.ALL,\n create: params => {\n const { negate, transformValue, field, compareValue, valueFilterRegistry } = params;\n const filter = valueFilterRegistry.get(params.operation);\n if (!filter) {\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 filter\n };\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.default`;\n\n return plugin;\n};\n"],"names":["createDefaultFilterCreate","plugin","CmsEntryFieldFilterPlugin","params","negate","transformValue","field","compareValue","valueFilterRegistry","filter","WebinyError","f"],"mappings":";;AAGO,MAAMA,4BAA4B;IACrC,MAAMC,SAAS,IAAIC,0BAA0B;QACzC,WAAWA,0BAA0B,GAAG;QACxC,QAAQC,CAAAA;YACJ,MAAM,EAAEC,MAAM,EAAEC,cAAc,EAAEC,KAAK,EAAEC,YAAY,EAAEC,mBAAmB,EAAE,GAAGL;YAC7E,MAAMM,SAASD,oBAAoB,GAAG,CAACL,OAAO,SAAS;YACvD,IAAI,CAACM,QACD,MAAM,IAAIC,MACN,CAAC,yCAAyC,EAAEP,OAAO,SAAS,CAAC,EAAE,CAAC,EAChE,4BACA;gBACI,WAAWA,OAAO,SAAS;YAC/B;YAGR,OAAO;gBACHC;gBACAC;gBACAC;gBACAC;gBACA,aAAa;uBAAID,MAAM,OAAO,CAAC,GAAG,CAACK,CAAAA,IAAKA,EAAE,OAAO;oBAAGL,MAAM,OAAO;iBAAC,CAAC,IAAI,CAAC;gBACxE,MAAMA,MAAM,UAAU,CAAC;oBACnBA;gBACJ;gBACAG;YACJ;QACJ;IACJ;IAEAR,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createFilterCreatePlugins: () => import("../../../../index.js").CmsEntryFieldFilterPlugin<import("@webiny/api/types.js").GenericRecord | null | undefined>[];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createDefaultFilterCreate } from "./defaultFilterCreate.js";
|
|
2
|
-
import { createRefFilterCreate } from "./refFilterCreate.js";
|
|
3
|
-
import { objectFilterCreate } from "./objectFilterCreate.js";
|
|
4
|
-
import { searchableJsonFilterCreate } from "./searchableJsonFilterCreate.js";
|
|
5
|
-
const createFilterCreatePlugins = ()=>[
|
|
6
|
-
createDefaultFilterCreate(),
|
|
7
|
-
createRefFilterCreate(),
|
|
8
|
-
objectFilterCreate(),
|
|
9
|
-
searchableJsonFilterCreate()
|
|
10
|
-
];
|
|
11
|
-
export { createFilterCreatePlugins };
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/plugins/index.js","sources":["../../../../../src/operations/entry/filtering/plugins/index.ts"],"sourcesContent":["import { createDefaultFilterCreate } from \"./defaultFilterCreate.js\";\nimport { createRefFilterCreate } from \"./refFilterCreate.js\";\nimport { objectFilterCreate } from \"./objectFilterCreate.js\";\nimport { searchableJsonFilterCreate } from \"./searchableJsonFilterCreate.js\";\n\nexport const createFilterCreatePlugins = () => {\n return [\n createDefaultFilterCreate(),\n createRefFilterCreate(),\n objectFilterCreate(),\n searchableJsonFilterCreate()\n ];\n};\n"],"names":["createFilterCreatePlugins","createDefaultFilterCreate","createRefFilterCreate","objectFilterCreate","searchableJsonFilterCreate"],"mappings":";;;;AAKO,MAAMA,4BAA4B,IAC9B;QACHC;QACAC;QACAC;QACAC;KACH"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin.js";
|
|
2
|
-
import { extractWhereParams } from "../where.js";
|
|
3
|
-
import error from "@webiny/error";
|
|
4
|
-
import { transformValue } from "../transform.js";
|
|
5
|
-
import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
|
|
6
|
-
const objectFilterCreate = ()=>{
|
|
7
|
-
const plugin = new CmsEntryFieldFilterPlugin({
|
|
8
|
-
fieldType: "object",
|
|
9
|
-
create: (params)=>{
|
|
10
|
-
const { value: objectValue, valueFilterRegistry, transformValuePlugins, getFilterCreatePlugin, field: parentField, fields } = params;
|
|
11
|
-
const filters = [];
|
|
12
|
-
for(const key in objectValue){
|
|
13
|
-
const value = objectValue[key];
|
|
14
|
-
if (void 0 === value) continue;
|
|
15
|
-
const whereParams = extractWhereParams(key);
|
|
16
|
-
if (!whereParams) continue;
|
|
17
|
-
const { negate, fieldId, operation } = whereParams;
|
|
18
|
-
const fieldPath = parentField.parents.map((p)=>p.fieldId).concat([
|
|
19
|
-
parentField.fieldId,
|
|
20
|
-
fieldId
|
|
21
|
-
]).join(".");
|
|
22
|
-
const field = fields[fieldPath];
|
|
23
|
-
if (!field) throw new error(`There is no field with the field path "${fieldPath}".`, "FIELD_ERROR", {
|
|
24
|
-
fieldId
|
|
25
|
-
});
|
|
26
|
-
const fieldType = getBaseFieldType(field);
|
|
27
|
-
const filterCreatePlugin = getFilterCreatePlugin(fieldType);
|
|
28
|
-
const transformValuePlugin = transformValuePlugins[fieldType];
|
|
29
|
-
const transformValueCallable = (value)=>{
|
|
30
|
-
if (!transformValuePlugin) return value;
|
|
31
|
-
return transformValuePlugin.transform({
|
|
32
|
-
field,
|
|
33
|
-
value
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const result = filterCreatePlugin.create({
|
|
37
|
-
key,
|
|
38
|
-
value,
|
|
39
|
-
valueFilterRegistry,
|
|
40
|
-
transformValuePlugins,
|
|
41
|
-
getFilterCreatePlugin,
|
|
42
|
-
operation,
|
|
43
|
-
negate,
|
|
44
|
-
field,
|
|
45
|
-
fields,
|
|
46
|
-
compareValue: transformValue({
|
|
47
|
-
value,
|
|
48
|
-
transform: transformValueCallable
|
|
49
|
-
}),
|
|
50
|
-
transformValue: transformValueCallable
|
|
51
|
-
});
|
|
52
|
-
if (result) {
|
|
53
|
-
if (Array.isArray(result)) {
|
|
54
|
-
filters.push(...result);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
filters.push(result);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return filters;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
plugin.name = "headless-cms.ddb.filter.object";
|
|
64
|
-
return plugin;
|
|
65
|
-
};
|
|
66
|
-
export { objectFilterCreate };
|
|
67
|
-
|
|
68
|
-
//# sourceMappingURL=objectFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/plugins/objectFilterCreate.js","sources":["../../../../../src/operations/entry/filtering/plugins/objectFilterCreate.ts"],"sourcesContent":["import { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin.js\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where.js\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { transformValue } from \"~/operations/entry/filtering/transform.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\nexport const objectFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: \"object\",\n create: params => {\n const {\n value: objectValue,\n valueFilterRegistry,\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 fieldType = getBaseFieldType(field);\n\n const filterCreatePlugin = getFilterCreatePlugin(fieldType);\n\n const transformValuePlugin: CmsFieldFilterValueTransformPlugin =\n transformValuePlugins[fieldType];\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 valueFilterRegistry,\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"],"names":["objectFilterCreate","plugin","CmsEntryFieldFilterPlugin","params","objectValue","valueFilterRegistry","transformValuePlugins","getFilterCreatePlugin","parentField","fields","filters","key","value","undefined","whereParams","extractWhereParams","negate","fieldId","operation","fieldPath","p","field","WebinyError","fieldType","getBaseFieldType","filterCreatePlugin","transformValuePlugin","transformValueCallable","result","transformValue","Array"],"mappings":";;;;;AAOO,MAAMA,qBAAqB;IAC9B,MAAMC,SAAS,IAAIC,0BAA0B;QACzC,WAAW;QACX,QAAQC,CAAAA;YACJ,MAAM,EACF,OAAOC,WAAW,EAClBC,mBAAmB,EACnBC,qBAAqB,EACrBC,qBAAqB,EACrB,OAAOC,WAAW,EAClBC,MAAM,EACT,GAAGN;YAEJ,MAAMO,UAAU,EAAE;YAElB,IAAK,MAAMC,OAAOP,YAAa;gBAC3B,MAAMQ,QAAQR,WAAW,CAACO,IAAI;gBAC9B,IAAIC,AAAUC,WAAVD,OACA;gBAEJ,MAAME,cAAcC,mBAAmBJ;gBACvC,IAAI,CAACG,aACD;gBAEJ,MAAM,EAAEE,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGJ;gBAEvC,MAAMK,YAAYX,YAAY,OAAO,CAChC,GAAG,CAACY,CAAAA,IAAKA,EAAE,OAAO,EAClB,MAAM,CAAC;oBAACZ,YAAY,OAAO;oBAAES;iBAAQ,EACrC,IAAI,CAAC;gBAEV,MAAMI,QAAQZ,MAAM,CAACU,UAAU;gBAC/B,IAAI,CAACE,OACD,MAAM,IAAIC,MACN,CAAC,uCAAuC,EAAEH,UAAU,EAAE,CAAC,EACvD,eACA;oBACIF;gBACJ;gBAIR,MAAMM,YAAYC,iBAAiBH;gBAEnC,MAAMI,qBAAqBlB,sBAAsBgB;gBAEjD,MAAMG,uBACFpB,qBAAqB,CAACiB,UAAU;gBAEpC,MAAMI,yBAAyB,CAACf;oBAC5B,IAAI,CAACc,sBACD,OAAOd;oBAEX,OAAOc,qBAAqB,SAAS,CAAC;wBAClCL;wBACAT;oBACJ;gBACJ;gBAEA,MAAMgB,SAASH,mBAAmB,MAAM,CAAC;oBACrCd;oBACAC;oBACAP;oBACAC;oBACAC;oBACAW;oBACAF;oBACAK;oBACAZ;oBACA,cAAcoB,eAAe;wBACzBjB;wBACA,WAAWe;oBACf;oBACA,gBAAgBA;gBACpB;gBACA,IAAKC;oBAGL,IAAIE,MAAM,OAAO,CAACF,SAAS;wBACvBlB,QAAQ,IAAI,IAAIkB;wBAChB;oBACJ;oBAEAlB,QAAQ,IAAI,CAACkB;;YACjB;YACA,OAAOlB;QACX;IACJ;IAEAT,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import error from "@webiny/error";
|
|
2
|
-
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin.js";
|
|
3
|
-
import { extractWhereParams } from "../where.js";
|
|
4
|
-
import { transformValue } from "../transform.js";
|
|
5
|
-
import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
|
|
6
|
-
const createRefFilterCreate = ()=>{
|
|
7
|
-
const plugin = new CmsEntryFieldFilterPlugin({
|
|
8
|
-
fieldType: "ref",
|
|
9
|
-
create: (params)=>{
|
|
10
|
-
const { valueFilterRegistry, transformValuePlugins, field } = params;
|
|
11
|
-
let value = params.value;
|
|
12
|
-
if (!value) value = {
|
|
13
|
-
entryId: null
|
|
14
|
-
};
|
|
15
|
-
const propertyFilters = Object.keys(value);
|
|
16
|
-
if (0 === propertyFilters.length) return null;
|
|
17
|
-
const filters = [];
|
|
18
|
-
for (const propertyFilter of propertyFilters){
|
|
19
|
-
const whereParams = extractWhereParams(propertyFilter);
|
|
20
|
-
if (!whereParams) continue;
|
|
21
|
-
const { fieldId: propertyId, operation: propertyOperation, negate } = whereParams;
|
|
22
|
-
const fieldType = getBaseFieldType(field);
|
|
23
|
-
const transformValuePlugin = transformValuePlugins[fieldType];
|
|
24
|
-
const transformValueCallable = (value)=>{
|
|
25
|
-
if (!transformValuePlugin) return value;
|
|
26
|
-
return transformValuePlugin.transform({
|
|
27
|
-
field,
|
|
28
|
-
value
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
const filter = valueFilterRegistry.get(propertyOperation);
|
|
32
|
-
if (!filter) throw new error(`Missing operation filter for "${propertyOperation}".`, "MISSING_OPERATION_FILTER");
|
|
33
|
-
const paths = [
|
|
34
|
-
field.createPath({
|
|
35
|
-
field
|
|
36
|
-
}),
|
|
37
|
-
propertyId
|
|
38
|
-
];
|
|
39
|
-
filters.push({
|
|
40
|
-
field,
|
|
41
|
-
path: paths.join("."),
|
|
42
|
-
fieldPathId: [
|
|
43
|
-
...field.parents.map((f)=>f.fieldId),
|
|
44
|
-
field.fieldId
|
|
45
|
-
].join("."),
|
|
46
|
-
filter,
|
|
47
|
-
negate,
|
|
48
|
-
compareValue: transformValue({
|
|
49
|
-
value: value[propertyFilter],
|
|
50
|
-
transform: transformValueCallable
|
|
51
|
-
}),
|
|
52
|
-
transformValue: transformValueCallable
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return filters;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
plugin.name = "headless-cms.ddb.filter.ref";
|
|
59
|
-
return plugin;
|
|
60
|
-
};
|
|
61
|
-
export { createRefFilterCreate };
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=refFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/plugins/refFilterCreate.js","sources":["../../../../../src/operations/entry/filtering/plugins/refFilterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryFieldFilterPluginCreateResponse } from \"~/plugins/CmsEntryFieldFilterPlugin.js\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin.js\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where.js\";\nimport { transformValue } from \"~/operations/entry/filtering/transform.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\nexport const createRefFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin<GenericRecord | null | undefined>({\n fieldType: \"ref\",\n create: params => {\n const { valueFilterRegistry, 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 fieldType = getBaseFieldType(field);\n\n const transformValuePlugin = transformValuePlugins[fieldType];\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 filter = valueFilterRegistry.get(propertyOperation);\n if (!filter) {\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 filter,\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"],"names":["createRefFilterCreate","plugin","CmsEntryFieldFilterPlugin","params","valueFilterRegistry","transformValuePlugins","field","value","propertyFilters","Object","filters","propertyFilter","whereParams","extractWhereParams","propertyId","propertyOperation","negate","fieldType","getBaseFieldType","transformValuePlugin","transformValueCallable","filter","WebinyError","paths","f","transformValue"],"mappings":";;;;;AAQO,MAAMA,wBAAwB;IACjC,MAAMC,SAAS,IAAIC,0BAA4D;QAC3E,WAAW;QACX,QAAQC,CAAAA;YACJ,MAAM,EAAEC,mBAAmB,EAAEC,qBAAqB,EAAEC,KAAK,EAAE,GAAGH;YAC9D,IAAII,QAAQJ,OAAO,KAAK;YACxB,IAAI,CAACI,OACDA,QAAQ;gBACJ,SAAS;YACb;YAEJ,MAAMC,kBAAkBC,OAAO,IAAI,CAACF;YACpC,IAAIC,AAA2B,MAA3BA,gBAAgB,MAAM,EACtB,OAAO;YAEX,MAAME,UAAqD,EAAE;YAE7D,KAAK,MAAMC,kBAAkBH,gBAAiB;gBAC1C,MAAMI,cAAcC,mBAAmBF;gBACvC,IAAI,CAACC,aACD;gBAEJ,MAAM,EAAE,SAASE,UAAU,EAAE,WAAWC,iBAAiB,EAAEC,MAAM,EAAE,GAAGJ;gBAEtE,MAAMK,YAAYC,iBAAiBZ;gBAEnC,MAAMa,uBAAuBd,qBAAqB,CAACY,UAAU;gBAE7D,MAAMG,yBAAyB,CAACb;oBAC5B,IAAI,CAACY,sBACD,OAAOZ;oBAEX,OAAOY,qBAAqB,SAAS,CAAC;wBAClCb;wBACAC;oBACJ;gBACJ;gBAEA,MAAMc,SAASjB,oBAAoB,GAAG,CAACW;gBACvC,IAAI,CAACM,QACD,MAAM,IAAIC,MACN,CAAC,8BAA8B,EAAEP,kBAAkB,EAAE,CAAC,EACtD;gBAIR,MAAMQ,QAAQ;oBACVjB,MAAM,UAAU,CAAC;wBACbA;oBACJ;oBACAQ;iBACH;gBAEDJ,QAAQ,IAAI,CAAC;oBACTJ;oBACA,MAAMiB,MAAM,IAAI,CAAC;oBACjB,aAAa;2BAAIjB,MAAM,OAAO,CAAC,GAAG,CAACkB,CAAAA,IAAKA,EAAE,OAAO;wBAAGlB,MAAM,OAAO;qBAAC,CAAC,IAAI,CAAC;oBACxEe;oBACAL;oBACA,cAAcS,eAAe;wBACzB,OAAOlB,KAAK,CAACI,eAAe;wBAC5B,WAAWS;oBACf;oBACA,gBAAgBA;gBACpB;YACJ;YAEA,OAAOV;QACX;IACJ;IAEAT,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { CmsEntryFieldFilterPlugin } from "../../../../plugins/CmsEntryFieldFilterPlugin.js";
|
|
2
|
-
import { extractWhereParams } from "../where.js";
|
|
3
|
-
function dotFlatten(obj, prefix = "") {
|
|
4
|
-
return Object.entries(obj).reduce((acc, [key, val])=>{
|
|
5
|
-
const path = prefix ? `${prefix}.${key}` : key;
|
|
6
|
-
if (val && "object" == typeof val && !Array.isArray(val)) Object.assign(acc, dotFlatten(val, path));
|
|
7
|
-
else acc[path] = val;
|
|
8
|
-
return acc;
|
|
9
|
-
}, {});
|
|
10
|
-
}
|
|
11
|
-
const searchableJsonFilterCreate = ()=>{
|
|
12
|
-
const plugin = new CmsEntryFieldFilterPlugin({
|
|
13
|
-
fieldType: "searchable-json",
|
|
14
|
-
create: (params)=>{
|
|
15
|
-
const { value: objectValue, valueFilterRegistry, field: parentField } = params;
|
|
16
|
-
const filters = [];
|
|
17
|
-
const accessPatterns = dotFlatten(objectValue);
|
|
18
|
-
for(const key in accessPatterns){
|
|
19
|
-
const value = accessPatterns[key];
|
|
20
|
-
if (void 0 === value) continue;
|
|
21
|
-
const whereParams = extractWhereParams(key);
|
|
22
|
-
if (!whereParams) continue;
|
|
23
|
-
const { negate, operation } = whereParams;
|
|
24
|
-
const transformValueCallable = (value)=>value;
|
|
25
|
-
const fieldId = `${parentField.fieldId}.${whereParams.fieldId ?? key}`;
|
|
26
|
-
const filter = valueFilterRegistry.get(operation);
|
|
27
|
-
if (!filter) {
|
|
28
|
-
console.error(`Missing operation filter for "${operation}".`);
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const result = {
|
|
32
|
-
field: parentField,
|
|
33
|
-
path: `values.${fieldId}`,
|
|
34
|
-
fieldPathId: `values.${fieldId}`,
|
|
35
|
-
negate,
|
|
36
|
-
filter,
|
|
37
|
-
compareValue: value,
|
|
38
|
-
transformValue: transformValueCallable
|
|
39
|
-
};
|
|
40
|
-
if (result) {
|
|
41
|
-
if (Array.isArray(result)) {
|
|
42
|
-
filters.push(...result);
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
filters.push(result);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return filters;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
plugin.name = "headless-cms.ddb.filter.searchable-json";
|
|
52
|
-
return plugin;
|
|
53
|
-
};
|
|
54
|
-
export { searchableJsonFilterCreate };
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=searchableJsonFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/plugins/searchableJsonFilterCreate.js","sources":["../../../../../src/operations/entry/filtering/plugins/searchableJsonFilterCreate.ts"],"sourcesContent":["import type { CmsEntryFieldFilterPluginCreateResponse } from \"~/plugins/CmsEntryFieldFilterPlugin.js\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin.js\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where.js\";\n\nfunction dotFlatten(obj: Record<string, any>, prefix = \"\"): Record<string, any> {\n return Object.entries(obj).reduce<Record<string, any>>((acc, [key, val]) => {\n const path = prefix ? `${prefix}.${key}` : key;\n if (val && typeof val === \"object\" && !Array.isArray(val)) {\n Object.assign(acc, dotFlatten(val, path));\n } else {\n acc[path] = val;\n }\n return acc;\n }, {});\n}\n\nexport const searchableJsonFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: \"searchable-json\",\n create: params => {\n const { value: objectValue, valueFilterRegistry, field: parentField } = params;\n\n const filters = [];\n\n const accessPatterns = dotFlatten(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 filter = valueFilterRegistry.get(operation);\n if (!filter) {\n console.error(`Missing operation filter for \"${operation}\".`);\n continue;\n }\n\n const result: CmsEntryFieldFilterPluginCreateResponse = {\n field: parentField,\n path: `values.${fieldId}`,\n fieldPathId: `values.${fieldId}`,\n negate,\n filter,\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"],"names":["dotFlatten","obj","prefix","Object","acc","key","val","path","Array","searchableJsonFilterCreate","plugin","CmsEntryFieldFilterPlugin","params","objectValue","valueFilterRegistry","parentField","filters","accessPatterns","value","undefined","whereParams","extractWhereParams","negate","operation","transformValueCallable","fieldId","filter","console","result"],"mappings":";;AAIA,SAASA,WAAWC,GAAwB,EAAEC,SAAS,EAAE;IACrD,OAAOC,OAAO,OAAO,CAACF,KAAK,MAAM,CAAsB,CAACG,KAAK,CAACC,KAAKC,IAAI;QACnE,MAAMC,OAAOL,SAAS,GAAGA,OAAO,CAAC,EAAEG,KAAK,GAAGA;QAC3C,IAAIC,OAAO,AAAe,YAAf,OAAOA,OAAoB,CAACE,MAAM,OAAO,CAACF,MACjDH,OAAO,MAAM,CAACC,KAAKJ,WAAWM,KAAKC;aAEnCH,GAAG,CAACG,KAAK,GAAGD;QAEhB,OAAOF;IACX,GAAG,CAAC;AACR;AAEO,MAAMK,6BAA6B;IACtC,MAAMC,SAAS,IAAIC,0BAA0B;QACzC,WAAW;QACX,QAAQC,CAAAA;YACJ,MAAM,EAAE,OAAOC,WAAW,EAAEC,mBAAmB,EAAE,OAAOC,WAAW,EAAE,GAAGH;YAExE,MAAMI,UAAU,EAAE;YAElB,MAAMC,iBAAiBjB,WAAWa;YAElC,IAAK,MAAMR,OAAOY,eAAgB;gBAC9B,MAAMC,QAAQD,cAAc,CAACZ,IAAI;gBACjC,IAAIa,AAAUC,WAAVD,OACA;gBAGJ,MAAME,cAAcC,mBAAmBhB;gBACvC,IAAI,CAACe,aACD;gBAEJ,MAAM,EAAEE,MAAM,EAAEC,SAAS,EAAE,GAAGH;gBAE9B,MAAMI,yBAAyB,CAACN,QACrBA;gBAGX,MAAMO,UAAU,GAAGV,YAAY,OAAO,CAAC,CAAC,EAAEK,YAAY,OAAO,IAAIf,KAAK;gBAEtE,MAAMqB,SAASZ,oBAAoB,GAAG,CAACS;gBACvC,IAAI,CAACG,QAAQ;oBACTC,QAAQ,KAAK,CAAC,CAAC,8BAA8B,EAAEJ,UAAU,EAAE,CAAC;oBAC5D;gBACJ;gBAEA,MAAMK,SAAkD;oBACpD,OAAOb;oBACP,MAAM,CAAC,OAAO,EAAEU,SAAS;oBACzB,aAAa,CAAC,OAAO,EAAEA,SAAS;oBAChCH;oBACAI;oBACA,cAAcR;oBACd,gBAAgBM;gBACpB;gBAEA,IAAKI;oBAGL,IAAIpB,MAAM,OAAO,CAACoB,SAAS;wBACvBZ,QAAQ,IAAI,IAAIY;wBAChB;oBACJ;oBAEAZ,QAAQ,IAAI,CAACY;;YACjB;YACA,OAAOZ;QACX;IACJ;IAEAN,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CmsEntry, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import type { Field } from "./types.js";
|
|
3
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
interface Params<T extends CmsEntryValues = CmsEntryValues> {
|
|
5
|
-
model: CmsModel;
|
|
6
|
-
items: CmsEntry<T>[];
|
|
7
|
-
sort?: string[];
|
|
8
|
-
fields: Record<string, Field>;
|
|
9
|
-
plugins: PluginsContainer;
|
|
10
|
-
}
|
|
11
|
-
export declare const sort: <T extends CmsEntryValues = CmsEntryValues>(params: Params<T>) => CmsEntry<T>[];
|
|
12
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import error from "@webiny/error";
|
|
2
|
-
import sortBy from "lodash/sortBy.js";
|
|
3
|
-
import { extractSort } from "./extractSort.js";
|
|
4
|
-
import * as __rspack_external_dot_prop_0ebbd169 from "dot-prop";
|
|
5
|
-
const sort_sort = (params)=>{
|
|
6
|
-
const { model, items, sort = [], fields, plugins } = params;
|
|
7
|
-
if (items.length <= 1) return items;
|
|
8
|
-
if (0 === sort.length) sort.push("savedOn_DESC");
|
|
9
|
-
else if (sort.length > 1) throw new error("Sorting is limited to a single field on DynamoDB only system.", "SORT_MULTIPLE_FIELDS_ERROR", {
|
|
10
|
-
sort
|
|
11
|
-
});
|
|
12
|
-
const [firstSort] = sort;
|
|
13
|
-
if (!firstSort) throw new error("Empty sort array item.", "SORT_EMPTY_ERROR", {
|
|
14
|
-
sort
|
|
15
|
-
});
|
|
16
|
-
const { fieldId, field, valuePath, reverse } = extractSort({
|
|
17
|
-
model,
|
|
18
|
-
sortBy: firstSort,
|
|
19
|
-
fields,
|
|
20
|
-
plugins
|
|
21
|
-
});
|
|
22
|
-
const itemsToSort = items.map((item)=>({
|
|
23
|
-
id: item.id,
|
|
24
|
-
value: field.transform(__rspack_external_dot_prop_0ebbd169.getProperty(item, valuePath))
|
|
25
|
-
}));
|
|
26
|
-
const sortedItems = sortBy(itemsToSort, "value");
|
|
27
|
-
const newItems = sortedItems.map((s)=>{
|
|
28
|
-
const item = items.find((i)=>i.id === s.id);
|
|
29
|
-
if (item) return item;
|
|
30
|
-
throw new error("Could not find item by given id after the sorting.", "SORTING_ITEMS_ERROR", {
|
|
31
|
-
id: s.id,
|
|
32
|
-
sortingBy: fieldId,
|
|
33
|
-
reverse
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
if (!reverse) return newItems;
|
|
37
|
-
return newItems.reverse();
|
|
38
|
-
};
|
|
39
|
-
export { sort_sort as sort };
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/sort.js","sources":["../../../../src/operations/entry/filtering/sort.ts"],"sourcesContent":["import type { CmsEntry, CmsEntryValues, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport * as dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy.js\";\nimport { extractSort } from \"./extractSort.js\";\nimport type { Field } from \"./types.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\ninterface Params<T extends CmsEntryValues = CmsEntryValues> {\n model: CmsModel;\n items: CmsEntry<T>[];\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 = <T extends CmsEntryValues = CmsEntryValues>(\n params: Params<T>\n): CmsEntry<T>[] => {\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.getProperty(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 /**\n * This is impossible to happen because sorting items does not remove the items.\n * BUT, we need to have this check just in case for development purposes.\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"],"names":["sort","params","model","items","fields","plugins","WebinyError","firstSort","fieldId","field","valuePath","reverse","extractSort","itemsToSort","item","dotProp","sortedItems","lodashSortBy","newItems","s","i"],"mappings":";;;;AAqBO,MAAMA,YAAO,CAChBC;IAEA,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEH,OAAO,EAAE,EAAEI,MAAM,EAAEC,OAAO,EAAE,GAAGJ;IACrD,IAAIE,MAAM,MAAM,IAAI,GAChB,OAAOA;IACJ,IAAIH,AAAgB,MAAhBA,KAAK,MAAM,EAClBA,KAAK,IAAI,CAAC;SACP,IAAIA,KAAK,MAAM,GAAG,GACrB,MAAM,IAAIM,MACN,iEACA,8BACA;QACIN;IACJ;IAGR,MAAM,CAACO,UAAU,GAAGP;IACpB,IAAI,CAACO,WACD,MAAM,IAAID,MAAY,0BAA0B,oBAAoB;QAChEN;IACJ;IAGJ,MAAM,EAAEQ,OAAO,EAAEC,KAAK,EAAEC,SAAS,EAAEC,OAAO,EAAE,GAAGC,YAAY;QACvDV;QACA,QAAQK;QACRH;QACAC;IACJ;IAEA,MAAMQ,cAAcV,MAAM,GAAG,CAACW,CAAAA,OACnB;YACH,IAAIA,KAAK,EAAE;YACX,OAAOL,MAAM,SAAS,CAACM,oCAAAA,WAAmB,CAACD,MAAMJ;QACrD;IAEJ,MAAMM,cAA4BC,OAAaJ,aAAa;IAC5D,MAAMK,WAAWF,YAAY,GAAG,CAACG,CAAAA;QAC7B,MAAML,OAAOX,MAAM,IAAI,CAACiB,CAAAA,IAAKA,EAAE,EAAE,KAAKD,EAAE,EAAE;QAC1C,IAAIL,MACA,OAAOA;QAMX,MAAM,IAAIR,MACN,sDACA,uBACA;YACI,IAAIa,EAAE,EAAE;YACR,WAAWX;YACXG;QACJ;IAER;IACA,IAAI,CAACA,SACD,OAAOO;IAEX,OAAOA,SAAS,OAAO;AAC3B"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { ENTRY_META_FIELDS, isDateTimeEntryMetaField, isIdentityEntryMetaField } from "@webiny/api-headless-cms/constants.js";
|
|
2
|
-
import startCase from "lodash/startCase.js";
|
|
3
|
-
import { createModelField } from "@webiny/api-headless-cms";
|
|
4
|
-
const createSystemFields = ()=>{
|
|
5
|
-
const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map((fieldName)=>createModelField({
|
|
6
|
-
id: fieldName,
|
|
7
|
-
type: "datetime",
|
|
8
|
-
storageId: fieldName,
|
|
9
|
-
fieldId: fieldName,
|
|
10
|
-
label: startCase(fieldName)
|
|
11
|
-
}));
|
|
12
|
-
const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map((fieldName)=>createModelField({
|
|
13
|
-
id: fieldName,
|
|
14
|
-
type: "plainObject",
|
|
15
|
-
storageId: fieldName,
|
|
16
|
-
fieldId: fieldName,
|
|
17
|
-
label: startCase(fieldName),
|
|
18
|
-
settings: {
|
|
19
|
-
path: `${fieldName}.id`
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
return [
|
|
23
|
-
createModelField({
|
|
24
|
-
id: "id",
|
|
25
|
-
type: "text",
|
|
26
|
-
storageId: "id",
|
|
27
|
-
fieldId: "id",
|
|
28
|
-
label: "ID"
|
|
29
|
-
}),
|
|
30
|
-
createModelField({
|
|
31
|
-
id: "entryId",
|
|
32
|
-
type: "text",
|
|
33
|
-
storageId: "entryId",
|
|
34
|
-
fieldId: "entryId",
|
|
35
|
-
label: "Entry ID"
|
|
36
|
-
}),
|
|
37
|
-
...onMetaFields,
|
|
38
|
-
...byMetaFields,
|
|
39
|
-
createModelField({
|
|
40
|
-
id: "meta",
|
|
41
|
-
type: "plainObject",
|
|
42
|
-
storageId: "meta",
|
|
43
|
-
fieldId: "meta",
|
|
44
|
-
label: "Meta"
|
|
45
|
-
}),
|
|
46
|
-
createModelField({
|
|
47
|
-
id: "wbyAco_location",
|
|
48
|
-
type: "object",
|
|
49
|
-
storageId: "location",
|
|
50
|
-
label: "Location",
|
|
51
|
-
fieldId: "wbyAco_location",
|
|
52
|
-
settings: {
|
|
53
|
-
fields: [
|
|
54
|
-
createModelField({
|
|
55
|
-
id: "folderId",
|
|
56
|
-
type: "text",
|
|
57
|
-
fieldId: "folderId",
|
|
58
|
-
label: "Folder ID",
|
|
59
|
-
storageId: "folderId",
|
|
60
|
-
settings: {
|
|
61
|
-
path: "location.folderId"
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
|
-
createModelField({
|
|
68
|
-
id: "version",
|
|
69
|
-
type: "number",
|
|
70
|
-
storageId: "version",
|
|
71
|
-
fieldId: "version",
|
|
72
|
-
label: "Version"
|
|
73
|
-
}),
|
|
74
|
-
createModelField({
|
|
75
|
-
id: "status",
|
|
76
|
-
type: "text",
|
|
77
|
-
storageId: "status",
|
|
78
|
-
fieldId: "status",
|
|
79
|
-
label: "Status"
|
|
80
|
-
}),
|
|
81
|
-
createModelField({
|
|
82
|
-
id: "wbyDeleted",
|
|
83
|
-
type: "boolean",
|
|
84
|
-
storageId: "wbyDeleted",
|
|
85
|
-
fieldId: "wbyDeleted",
|
|
86
|
-
label: "Deleted"
|
|
87
|
-
}),
|
|
88
|
-
createModelField({
|
|
89
|
-
id: "state",
|
|
90
|
-
type: "object",
|
|
91
|
-
storageId: "object@state",
|
|
92
|
-
fieldId: "state",
|
|
93
|
-
label: "State",
|
|
94
|
-
settings: {
|
|
95
|
-
fields: [
|
|
96
|
-
createModelField({
|
|
97
|
-
id: "stepId",
|
|
98
|
-
type: "text",
|
|
99
|
-
fieldId: "stepId",
|
|
100
|
-
label: "Step ID",
|
|
101
|
-
storageId: "stepId"
|
|
102
|
-
}),
|
|
103
|
-
createModelField({
|
|
104
|
-
id: "stepName",
|
|
105
|
-
type: "text",
|
|
106
|
-
fieldId: "stepName",
|
|
107
|
-
label: "Step Name",
|
|
108
|
-
storageId: "stepName"
|
|
109
|
-
}),
|
|
110
|
-
createModelField({
|
|
111
|
-
id: "state",
|
|
112
|
-
type: "text",
|
|
113
|
-
fieldId: "state",
|
|
114
|
-
label: "State",
|
|
115
|
-
storageId: "state"
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
createModelField({
|
|
121
|
-
id: "values",
|
|
122
|
-
type: "object",
|
|
123
|
-
storageId: "values",
|
|
124
|
-
fieldId: "values",
|
|
125
|
-
label: "Values"
|
|
126
|
-
}),
|
|
127
|
-
createModelField({
|
|
128
|
-
id: "live",
|
|
129
|
-
type: "object",
|
|
130
|
-
storageId: "live",
|
|
131
|
-
fieldId: "live",
|
|
132
|
-
label: "Live",
|
|
133
|
-
settings: {
|
|
134
|
-
fields: [
|
|
135
|
-
createModelField({
|
|
136
|
-
id: "version",
|
|
137
|
-
type: "number",
|
|
138
|
-
fieldId: "version",
|
|
139
|
-
label: "Version",
|
|
140
|
-
storageId: "version"
|
|
141
|
-
})
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
];
|
|
146
|
-
};
|
|
147
|
-
export { createSystemFields };
|
|
148
|
-
|
|
149
|
-
//# sourceMappingURL=systemFields.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/systemFields.js","sources":["../../../../src/operations/entry/filtering/systemFields.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants.js\";\nimport lodashStartCase from \"lodash/startCase.js\";\nimport { createModelField } from \"@webiny/api-headless-cms\";\n\nexport const createSystemFields = (): CmsModelField[] => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map<CmsModelField>(\n fieldName => {\n return createModelField({\n id: fieldName,\n type: \"datetime\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName)\n });\n }\n );\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map<CmsModelField>(\n fieldName => {\n return createModelField({\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\n return [\n createModelField({\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n }),\n createModelField({\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n }),\n\n ...onMetaFields,\n ...byMetaFields,\n\n createModelField({\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n }),\n createModelField({\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n createModelField({\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 createModelField({\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n }),\n createModelField({\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n }),\n createModelField({\n id: \"wbyDeleted\",\n type: \"boolean\",\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n label: \"Deleted\"\n }),\n createModelField({\n id: \"state\",\n type: \"object\",\n storageId: \"object@state\",\n fieldId: \"state\",\n label: \"State\",\n settings: {\n fields: [\n createModelField({\n id: \"stepId\",\n type: \"text\",\n fieldId: \"stepId\",\n label: \"Step ID\",\n storageId: \"stepId\"\n }),\n createModelField({\n id: \"stepName\",\n type: \"text\",\n fieldId: \"stepName\",\n label: \"Step Name\",\n storageId: \"stepName\"\n }),\n createModelField({\n id: \"state\",\n type: \"text\",\n fieldId: \"state\",\n label: \"State\",\n storageId: \"state\"\n })\n ]\n }\n }),\n createModelField({\n id: \"values\",\n type: \"object\",\n storageId: \"values\",\n fieldId: \"values\",\n label: \"Values\"\n }),\n createModelField({\n id: \"live\",\n type: \"object\",\n storageId: \"live\",\n fieldId: \"live\",\n label: \"Live\",\n settings: {\n fields: [\n createModelField({\n id: \"version\",\n type: \"number\",\n fieldId: \"version\",\n label: \"Version\",\n storageId: \"version\"\n })\n ]\n }\n })\n ];\n};\n"],"names":["createSystemFields","onMetaFields","ENTRY_META_FIELDS","isDateTimeEntryMetaField","fieldName","createModelField","lodashStartCase","byMetaFields","isIdentityEntryMetaField"],"mappings":";;;AASO,MAAMA,qBAAqB;IAC9B,MAAMC,eAAeC,kBAAkB,MAAM,CAACC,0BAA0B,GAAG,CACvEC,CAAAA,YACWC,iBAAiB;YACpB,IAAID;YACJ,MAAM;YACN,WAAWA;YACX,SAASA;YACT,OAAOE,UAAgBF;QAC3B;IAIR,MAAMG,eAAeL,kBAAkB,MAAM,CAACM,0BAA0B,GAAG,CACvEJ,CAAAA,YACWC,iBAAiB;YACpB,IAAID;YACJ,MAAM;YACN,WAAWA;YACX,SAASA;YACT,OAAOE,UAAgBF;YACvB,UAAU;gBACN,MAAM,GAAGA,UAAU,GAAG,CAAC;YAC3B;QACJ;IAIR,OAAO;QACHC,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;WAEGJ;WACAM;QAEHF,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,OAAO;YACP,SAAS;YACT,UAAU;gBACN,QAAQ;oBACJA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;wBACX,UAAU;4BACN,MAAM;wBACV;oBACJ;iBACH;YACL;QACJ;QAEAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;YACP,UAAU;gBACN,QAAQ;oBACJA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;oBACAA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;oBACAA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;iBACH;YACL;QACJ;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;YACP,UAAU;gBACN,QAAQ;oBACJA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;iBACH;YACL;QACJ;KACH;AACL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/filtering/transform.js","sources":["../../../../src/operations/entry/filtering/transform.ts"],"sourcesContent":["import type { Field } from \"./types.js\";\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"],"names":["transformValue","value","transform","Array","v"],"mappings":"AAKO,MAAMA,iBAAiB,CAAC,EAAEC,KAAK,EAAEC,SAAS,EAAU;IACvD,IAAIC,MAAM,OAAO,CAACF,QACd,OAAOA,MAAM,GAAG,CAACG,CAAAA,IAAKF,UAAUE;IAEpC,OAAOF,UAAUD;AACrB"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import type { CreatePathCallable } from "../../../plugins/index.js";
|
|
3
|
-
interface FieldValueTransform {
|
|
4
|
-
(value: any): any;
|
|
5
|
-
}
|
|
6
|
-
export interface FieldParent {
|
|
7
|
-
fieldId: string;
|
|
8
|
-
list?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface Field extends Partial<Omit<CmsModelField, "id" | "type" | "storageId" | "fieldId">>, Pick<CmsModelField, "id" | "type" | "storageId" | "fieldId"> {
|
|
11
|
-
/**
|
|
12
|
-
* A list od fieldId of all parents of the current field.
|
|
13
|
-
*
|
|
14
|
-
* This is used to check if we need to iterate through an array of parent values.
|
|
15
|
-
*/
|
|
16
|
-
parents: FieldParent[];
|
|
17
|
-
/**
|
|
18
|
-
* The method which creates a path for the filtering.
|
|
19
|
-
*
|
|
20
|
-
* Always exists. In most cases it will return some fixed value.
|
|
21
|
-
* When having a CmsEntryFieldFilterPathPlugin then it is executed to create a path.
|
|
22
|
-
*/
|
|
23
|
-
createPath: CreatePathCallable;
|
|
24
|
-
/**
|
|
25
|
-
* In most cases, return value of this method is what ever is the input.
|
|
26
|
-
*
|
|
27
|
-
* In some cases there might be a CmsFieldFilterValueTransformPlugin, which transforms value to a comparable one.
|
|
28
|
-
* For example, time in format 15:45:58 is not comparable, so we transform it into the seconds and then compare.
|
|
29
|
-
*/
|
|
30
|
-
transform: FieldValueTransform;
|
|
31
|
-
/**
|
|
32
|
-
* Is the field a system field?
|
|
33
|
-
* System fields are built into the code and cannot be changed.
|
|
34
|
-
*/
|
|
35
|
-
system: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface FilterItemFromStorage {
|
|
38
|
-
<T = any>(field: CmsModelField, value: any): Promise<T>;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
File without changes
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import error from "@webiny/error";
|
|
2
|
-
const getWhereValues = (value, condition)=>{
|
|
3
|
-
const values = value;
|
|
4
|
-
if (Array.isArray(values)) {
|
|
5
|
-
if (0 === values.length) throw new error(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
6
|
-
value
|
|
7
|
-
});
|
|
8
|
-
} else throw new error(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
9
|
-
value
|
|
10
|
-
});
|
|
11
|
-
return values;
|
|
12
|
-
};
|
|
13
|
-
export { getWhereValues };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=values.js.map
|