@webiny/api-headless-cms-ddb 6.3.0 → 6.4.0-beta.1
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.js +7 -9
- package/definitions/entry.js.map +1 -1
- package/definitions/group.js +7 -9
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +7 -9
- package/definitions/model.js.map +1 -1
- package/definitions/table.js +6 -7
- package/definitions/table.js.map +1 -1
- package/definitions/types.d.ts +1 -0
- package/definitions/types.js +0 -3
- package/dynamoDb/index.js +6 -1
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.js +16 -29
- package/dynamoDb/path/locationFolderId.js.map +1 -1
- package/dynamoDb/path/plainObject.js +11 -21
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/transformValue/datetime.js +21 -32
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.js +67 -77
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +2 -1
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +31 -41
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +31 -41
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.js +33 -47
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.js +8 -9
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.js +0 -3
- package/operations/entry/dataLoaders.js +81 -99
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.js +109 -157
- package/operations/entry/filtering/createExpressions.js.map +1 -1
- package/operations/entry/filtering/createFields.js +83 -96
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.js +50 -74
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.js +72 -140
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.js +21 -38
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/getValue.js +31 -53
- package/operations/entry/filtering/getValue.js.map +1 -1
- package/operations/entry/filtering/index.js +0 -2
- package/operations/entry/filtering/mapPlugins.js +15 -22
- package/operations/entry/filtering/mapPlugins.js.map +1 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +29 -33
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/index.js +7 -3
- package/operations/entry/filtering/plugins/index.js.map +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.js +60 -76
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.js +55 -66
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +43 -56
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
- package/operations/entry/filtering/sort.js +34 -60
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.js +144 -126
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.js +4 -8
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.js +0 -3
- package/operations/entry/filtering/values.js +11 -12
- package/operations/entry/filtering/values.js.map +1 -1
- package/operations/entry/filtering/where.js +17 -23
- package/operations/entry/filtering/where.js.map +1 -1
- package/operations/entry/index.js +894 -1148
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +54 -77
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.js +113 -134
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +100 -121
- package/operations/model/index.js.map +1 -1
- package/package.json +16 -16
- package/plugins/CmsEntryFieldFilterPathPlugin.js +23 -33
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.js +16 -17
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.js +16 -15
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.js +15 -12
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
- package/plugins/index.js +0 -2
- package/types.js +6 -5
- package/types.js.map +1 -1
- package/definitions/types.js.map +0 -1
- package/operations/entry/dataLoader/types.js.map +0 -1
- package/operations/entry/filtering/index.js.map +0 -1
- package/operations/entry/filtering/types.js.map +0 -1
- package/plugins/index.js.map +0 -1
|
@@ -1,131 +1,149 @@
|
|
|
1
1
|
import { ENTRY_META_FIELDS, isDateTimeEntryMetaField, isIdentityEntryMetaField } from "@webiny/api-headless-cms/constants.js";
|
|
2
|
-
import
|
|
2
|
+
import startCase from "lodash/startCase.js";
|
|
3
3
|
import { createModelField } from "@webiny/api-headless-cms";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
+
];
|
|
129
146
|
};
|
|
147
|
+
export { createSystemFields };
|
|
130
148
|
|
|
131
149
|
//# sourceMappingURL=systemFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}) => {
|
|
5
|
-
if (Array.isArray(value)) {
|
|
6
|
-
return value.map(v => transform(v));
|
|
7
|
-
}
|
|
8
|
-
return transform(value);
|
|
1
|
+
const transformValue = ({ value, transform })=>{
|
|
2
|
+
if (Array.isArray(value)) return value.map((v)=>transform(v));
|
|
3
|
+
return transform(value);
|
|
9
4
|
};
|
|
5
|
+
export { transformValue };
|
|
10
6
|
|
|
11
7
|
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,16 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
7
10
|
});
|
|
8
|
-
|
|
9
|
-
throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
10
|
-
value
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
return values;
|
|
11
|
+
return values;
|
|
14
12
|
};
|
|
13
|
+
export { getWhereValues };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=values.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/filtering/values.js","sources":["../../../../src/operations/entry/filtering/values.ts"],"sourcesContent":["import type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"names":["getWhereValues","value","condition","values","Array","WebinyError"],"mappings":";AAGO,MAAMA,iBAAiB,CAACC,OAAgBC;IAC3C,MAAMC,SAASF;IACf,IAAKG,MAAM,OAAO,CAACD,SAQZ;QAAA,IAAIA,AAAkB,MAAlBA,OAAO,MAAM,EACpB,MAAM,IAAIE,MACN,CAAC,8BAA8B,EAAEH,UAAU,qCAAqC,CAAC,EACjF,CAAC,UAAU,EAAEA,UAAU,UAAU,CAAC,EAClC;YACID;QACJ;IAER,OAfI,MAAM,IAAII,MACN,CAAC,8BAA8B,EAAEH,UAAU,sCAAsC,CAAC,EAClF,CAAC,UAAU,EAAEA,UAAU,UAAU,CAAC,EAClC;QACID;IACJ;IAWR,OAAOE;AACX"}
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
const extractWhereParams = (key)=>{
|
|
2
|
+
const isWbyAco = null !== key.match("wbyAco_");
|
|
3
|
+
const result = key.replace("wbyAco_", "").split("_");
|
|
4
|
+
const fieldId = result.shift();
|
|
5
|
+
if (!fieldId) return null;
|
|
6
|
+
const rawOp = 0 === result.length ? "eq" : result.join("_");
|
|
7
|
+
if ("not" === rawOp) return {
|
|
8
|
+
fieldId,
|
|
9
|
+
operation: "eq",
|
|
10
|
+
negate: true
|
|
11
|
+
};
|
|
12
|
+
const negate = null !== rawOp.match("not_");
|
|
13
|
+
const operation = rawOp.replace("not_", "");
|
|
13
14
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
|
|
16
|
+
operation,
|
|
17
|
+
negate
|
|
17
18
|
};
|
|
18
|
-
}
|
|
19
|
-
const negate = rawOp.match("not_") !== null;
|
|
20
|
-
const operation = rawOp.replace("not_", "");
|
|
21
|
-
return {
|
|
22
|
-
fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
|
|
23
|
-
operation,
|
|
24
|
-
negate
|
|
25
|
-
};
|
|
26
19
|
};
|
|
20
|
+
export { extractWhereParams };
|
|
27
21
|
|
|
28
22
|
//# sourceMappingURL=where.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/filtering/where.js","sources":["../../../../src/operations/entry/filtering/where.ts"],"sourcesContent":["export const extractWhereParams = (key: string) => {\n const isWbyAco = key.match(\"wbyAco_\") !== null;\n const result = key.replace(\"wbyAco_\", \"\").split(\"_\");\n const fieldId = result.shift();\n if (!fieldId) {\n return null;\n }\n const rawOp = result.length === 0 ? \"eq\" : result.join(\"_\");\n /**\n * When rawOp is not, it means it is equal negated so just return that.\n */\n if (rawOp === \"not\") {\n return {\n fieldId,\n operation: \"eq\",\n negate: true\n };\n }\n const negate = rawOp.match(\"not_\") !== null;\n const operation = rawOp.replace(\"not_\", \"\");\n return {\n fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,\n operation,\n negate\n };\n};\n"],"names":["extractWhereParams","key","isWbyAco","result","fieldId","rawOp","negate","operation"],"mappings":"AAAO,MAAMA,qBAAqB,CAACC;IAC/B,MAAMC,WAAWD,AAAyB,SAAzBA,IAAI,KAAK,CAAC;IAC3B,MAAME,SAASF,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC;IAChD,MAAMG,UAAUD,OAAO,KAAK;IAC5B,IAAI,CAACC,SACD,OAAO;IAEX,MAAMC,QAAQF,AAAkB,MAAlBA,OAAO,MAAM,GAAS,OAAOA,OAAO,IAAI,CAAC;IAIvD,IAAIE,AAAU,UAAVA,OACA,OAAO;QACHD;QACA,WAAW;QACX,QAAQ;IACZ;IAEJ,MAAME,SAASD,AAAwB,SAAxBA,MAAM,KAAK,CAAC;IAC3B,MAAME,YAAYF,MAAM,OAAO,CAAC,QAAQ;IACxC,OAAO;QACH,SAASH,WAAW,CAAC,OAAO,EAAEE,SAAS,GAAGA;QAC1CG;QACAD;IACJ;AACJ"}
|