@webiny/api-headless-cms-ddb 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/definitions/entry.d.ts +6 -4
  2. package/definitions/entry.js +111 -20
  3. package/definitions/entry.js.map +1 -0
  4. package/definitions/group.d.ts +6 -4
  5. package/definitions/group.js +8 -16
  6. package/definitions/group.js.map +1 -0
  7. package/definitions/model.d.ts +6 -4
  8. package/definitions/model.js +30 -16
  9. package/definitions/model.js.map +1 -0
  10. package/definitions/system.d.ts +6 -4
  11. package/definitions/system.js +8 -16
  12. package/definitions/system.js.map +1 -0
  13. package/definitions/table.d.ts +7 -6
  14. package/definitions/table.js +7 -6
  15. package/definitions/table.js.map +1 -0
  16. package/dynamoDb/index.d.ts +1 -1
  17. package/dynamoDb/index.js +9 -18
  18. package/dynamoDb/index.js.map +1 -0
  19. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  20. package/dynamoDb/path/locationFolderId.js +43 -0
  21. package/dynamoDb/path/locationFolderId.js.map +1 -0
  22. package/dynamoDb/path/plainObject.d.ts +2 -3
  23. package/dynamoDb/path/plainObject.js +26 -24
  24. package/dynamoDb/path/plainObject.js.map +1 -0
  25. package/dynamoDb/storage/longText.d.ts +7 -4
  26. package/dynamoDb/storage/longText.js +74 -63
  27. package/dynamoDb/storage/longText.js.map +1 -0
  28. package/dynamoDb/storage/richText.d.ts +2 -8
  29. package/dynamoDb/storage/richText.js +49 -98
  30. package/dynamoDb/storage/richText.js.map +1 -0
  31. package/dynamoDb/transformValue/datetime.d.ts +5 -3
  32. package/dynamoDb/transformValue/datetime.js +29 -29
  33. package/dynamoDb/transformValue/datetime.js.map +1 -0
  34. package/index.d.ts +2 -1
  35. package/index.js +56 -54
  36. package/index.js.map +1 -0
  37. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  38. package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
  39. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  40. package/operations/entry/dataLoader/constants.d.ts +1 -0
  41. package/operations/entry/dataLoader/constants.js +10 -0
  42. package/operations/entry/dataLoader/constants.js.map +1 -0
  43. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  44. package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
  45. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  46. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  47. package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
  48. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  49. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  50. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +56 -0
  51. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  52. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  53. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +56 -0
  54. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  55. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  56. package/operations/entry/dataLoader/getRevisionById.js +62 -0
  57. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  58. package/operations/entry/dataLoader/index.d.ts +8 -0
  59. package/operations/entry/dataLoader/index.js +40 -0
  60. package/operations/entry/dataLoader/index.js.map +1 -0
  61. package/operations/entry/dataLoader/types.d.ts +6 -0
  62. package/operations/entry/dataLoader/types.js +7 -0
  63. package/operations/entry/dataLoader/types.js.map +1 -0
  64. package/operations/entry/dataLoaders.d.ts +18 -29
  65. package/operations/entry/dataLoaders.js +59 -246
  66. package/operations/entry/dataLoaders.js.map +1 -0
  67. package/operations/entry/filtering/createExpressions.d.ts +26 -0
  68. package/operations/entry/filtering/createExpressions.js +178 -0
  69. package/operations/entry/filtering/createExpressions.js.map +1 -0
  70. package/operations/entry/filtering/createFields.d.ts +16 -0
  71. package/operations/entry/filtering/createFields.js +108 -0
  72. package/operations/entry/filtering/createFields.js.map +1 -0
  73. package/operations/entry/filtering/extractSort.d.ts +17 -0
  74. package/operations/entry/filtering/extractSort.js +69 -0
  75. package/operations/entry/filtering/extractSort.js.map +1 -0
  76. package/operations/entry/filtering/filter.d.ts +15 -0
  77. package/operations/entry/filtering/filter.js +158 -0
  78. package/operations/entry/filtering/filter.js.map +1 -0
  79. package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
  80. package/operations/entry/filtering/fullTextSearch.js +50 -0
  81. package/operations/entry/filtering/fullTextSearch.js.map +1 -0
  82. package/operations/entry/filtering/getValue.d.ts +5 -0
  83. package/operations/entry/filtering/getValue.js +66 -0
  84. package/operations/entry/filtering/getValue.js.map +1 -0
  85. package/operations/entry/filtering/index.d.ts +2 -0
  86. package/operations/entry/filtering/index.js +21 -0
  87. package/operations/entry/filtering/index.js.map +1 -0
  88. package/operations/entry/filtering/mapPlugins.d.ts +8 -0
  89. package/operations/entry/filtering/mapPlugins.js +33 -0
  90. package/operations/entry/filtering/mapPlugins.js.map +1 -0
  91. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
  92. package/operations/entry/filtering/plugins/defaultFilterCreate.js +45 -0
  93. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
  94. package/operations/entry/filtering/plugins/index.d.ts +1 -0
  95. package/operations/entry/filtering/plugins/index.js +16 -0
  96. package/operations/entry/filtering/plugins/index.js.map +1 -0
  97. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
  98. package/operations/entry/filtering/plugins/objectFilterCreate.js +90 -0
  99. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
  100. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -0
  101. package/operations/entry/filtering/plugins/refFilterCreate.js +80 -0
  102. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
  103. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  104. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +65 -0
  105. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  106. package/operations/entry/filtering/sort.d.ts +12 -0
  107. package/operations/entry/filtering/sort.js +71 -0
  108. package/operations/entry/filtering/sort.js.map +1 -0
  109. package/operations/entry/filtering/systemFields.d.ts +4 -0
  110. package/operations/entry/filtering/systemFields.js +90 -0
  111. package/operations/entry/filtering/systemFields.js.map +1 -0
  112. package/operations/entry/filtering/transform.d.ts +6 -0
  113. package/operations/entry/filtering/transform.js +18 -0
  114. package/operations/entry/filtering/transform.js.map +1 -0
  115. package/operations/entry/filtering/types.d.ts +40 -0
  116. package/operations/entry/filtering/types.js +7 -0
  117. package/operations/entry/filtering/types.js.map +1 -0
  118. package/operations/entry/filtering/values.d.ts +2 -0
  119. package/operations/entry/filtering/values.js +24 -0
  120. package/operations/entry/filtering/values.js.map +1 -0
  121. package/operations/entry/filtering/where.d.ts +5 -0
  122. package/operations/entry/filtering/where.js +35 -0
  123. package/operations/entry/filtering/where.js.map +1 -0
  124. package/operations/entry/index.d.ts +5 -5
  125. package/operations/entry/index.js +920 -437
  126. package/operations/entry/index.js.map +1 -0
  127. package/operations/entry/keys.js +9 -14
  128. package/operations/entry/keys.js.map +1 -0
  129. package/operations/group/index.d.ts +6 -5
  130. package/operations/group/index.js +35 -59
  131. package/operations/group/index.js.map +1 -0
  132. package/operations/model/index.d.ts +5 -4
  133. package/operations/model/index.js +35 -46
  134. package/operations/model/index.js.map +1 -0
  135. package/operations/system/index.d.ts +5 -4
  136. package/operations/system/index.js +20 -31
  137. package/operations/system/index.js.map +1 -0
  138. package/package.json +23 -29
  139. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +23 -0
  140. package/plugins/CmsEntryFieldFilterPathPlugin.js +48 -0
  141. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -0
  142. package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
  143. package/plugins/CmsEntryFieldFilterPlugin.js +27 -0
  144. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
  145. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  146. package/plugins/CmsEntryFieldSortingPlugin.js +27 -0
  147. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  148. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  149. package/plugins/CmsFieldFilterValueTransformPlugin.js +23 -0
  150. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  151. package/plugins/index.d.ts +4 -0
  152. package/plugins/index.js +51 -0
  153. package/plugins/index.js.map +1 -0
  154. package/types.d.ts +21 -45
  155. package/types.js +5 -6
  156. package/types.js.map +1 -0
  157. package/definitions/settings.d.ts +0 -8
  158. package/definitions/settings.js +0 -62
  159. package/dynamoDb/path/ref.d.ts +0 -3
  160. package/dynamoDb/path/ref.js +0 -27
  161. package/dynamoDb/storage/date.d.ts +0 -3
  162. package/dynamoDb/storage/date.js +0 -65
  163. package/operations/entry/systemFields.d.ts +0 -2
  164. package/operations/entry/systemFields.js +0 -50
  165. package/operations/entry/utils.d.ts +0 -31
  166. package/operations/entry/utils.js +0 -406
  167. package/operations/settings/index.d.ts +0 -6
  168. package/operations/settings/index.js +0 -141
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createExpressions = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
10
+ var _mapPlugins = require("./mapPlugins");
11
+ var _where = require("./where");
12
+ var _transform = require("./transform");
13
+ var _CmsEntryFieldFilterPlugin = require("../../../plugins/CmsEntryFieldFilterPlugin");
14
+ var _values = require("./values");
15
+ const createExpressions = params => {
16
+ const {
17
+ where,
18
+ plugins,
19
+ fields
20
+ } = params;
21
+ const filterPlugins = (0, _mapPlugins.getMappedPlugins)({
22
+ plugins,
23
+ type: _ValueFilterPlugin.ValueFilterPlugin.type,
24
+ property: "operation"
25
+ });
26
+ const transformValuePlugins = (0, _mapPlugins.getMappedPlugins)({
27
+ plugins,
28
+ type: "cms-field-filter-value-transform",
29
+ property: "fieldType"
30
+ });
31
+ const fieldFilterCreatePlugins = (0, _mapPlugins.getMappedPlugins)({
32
+ plugins,
33
+ type: _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin.type,
34
+ property: "fieldType"
35
+ });
36
+ const defaultFilterCreatePlugin = fieldFilterCreatePlugins["*"];
37
+ const getFilterCreatePlugin = type => {
38
+ const filterCreatePlugin = fieldFilterCreatePlugins[type] || defaultFilterCreatePlugin;
39
+ if (filterCreatePlugin) {
40
+ return filterCreatePlugin;
41
+ }
42
+ throw new _error.default(`There is no filter create plugin for the field type "${type}".`, "MISSING_FILTER_CREATE_PLUGIN", {
43
+ type
44
+ });
45
+ };
46
+ const createExpression = ({
47
+ where,
48
+ condition
49
+ }) => {
50
+ const expression = {
51
+ filters: [],
52
+ expressions: [],
53
+ condition
54
+ };
55
+ for (const key in where) {
56
+ const value = where[key];
57
+ if (value === undefined) {
58
+ continue;
59
+ }
60
+
61
+ /**
62
+ * If there are "AND" or "OR" keys, let's sort them out first.
63
+ *
64
+ *
65
+ * AND conditional
66
+ */
67
+ if (key === "AND") {
68
+ const childWhereList = (0, _values.getWhereValues)(value, key);
69
+ const childExpression = {
70
+ condition: "AND",
71
+ filters: [],
72
+ expressions: []
73
+ };
74
+ for (const childWhere of childWhereList) {
75
+ const result = createExpression({
76
+ where: childWhere,
77
+ condition: "AND"
78
+ });
79
+ childExpression.expressions.push(result);
80
+ }
81
+ expression.expressions.push(childExpression);
82
+ continue;
83
+ }
84
+ /**
85
+ * OR conditional
86
+ */
87
+ if (key === "OR") {
88
+ const childWhereList = (0, _values.getWhereValues)(value, key);
89
+ const childExpression = {
90
+ condition: "OR",
91
+ filters: [],
92
+ expressions: []
93
+ };
94
+ for (const childWhere of childWhereList) {
95
+ const result = createExpression({
96
+ where: childWhere,
97
+ condition: "AND"
98
+ });
99
+ childExpression.expressions.push(result);
100
+ }
101
+ expression.expressions.push(childExpression);
102
+ continue;
103
+ }
104
+ const whereParams = (0, _where.extractWhereParams)(key);
105
+ if (!whereParams) {
106
+ continue;
107
+ }
108
+ const {
109
+ fieldId,
110
+ operation,
111
+ negate
112
+ } = whereParams;
113
+ const field = fields[fieldId];
114
+ if (!field) {
115
+ throw new _error.default(`There is no field with the fieldId "${fieldId}".`, "FIELD_ERROR", {
116
+ fieldId
117
+ });
118
+ }
119
+
120
+ /**
121
+ * We need a filter create plugin for this type.
122
+ */
123
+ const filterCreatePlugin = getFilterCreatePlugin(field.type);
124
+ const transformValuePlugin = transformValuePlugins[field.type];
125
+ const transformValueCallable = value => {
126
+ if (!transformValuePlugin) {
127
+ return value;
128
+ }
129
+ return transformValuePlugin.transform({
130
+ field,
131
+ value
132
+ });
133
+ };
134
+ const result = filterCreatePlugin.create({
135
+ key,
136
+ value,
137
+ valueFilterPlugins: filterPlugins,
138
+ transformValuePlugins,
139
+ getFilterCreatePlugin,
140
+ operation,
141
+ negate,
142
+ field,
143
+ fields,
144
+ compareValue: (0, _transform.transformValue)({
145
+ value,
146
+ transform: transformValueCallable
147
+ }),
148
+ transformValue: transformValueCallable
149
+ });
150
+ /**
151
+ * There is a possibility of
152
+ * - no result
153
+ * - result being an array
154
+ * - result being an object
155
+ */
156
+ if (!result || Array.isArray(result) && result.length === 0) {
157
+ continue;
158
+ }
159
+ expression.filters.push(...(Array.isArray(result) ? result : [result]));
160
+ }
161
+ return expression;
162
+ };
163
+ const expression = createExpression({
164
+ where,
165
+ condition: "AND"
166
+ });
167
+ /**
168
+ * If the first expression has no filters and has only one expression, put that expression as main one.
169
+ * This will mostly be used when having an OR condition as the single expression in the root level of the where
170
+ */
171
+ if (expression.filters.length > 0 || expression.expressions.length !== 1) {
172
+ return expression;
173
+ }
174
+ return expression.expressions[0];
175
+ };
176
+ exports.createExpressions = createExpressions;
177
+
178
+ //# sourceMappingURL=createExpressions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_ValueFilterPlugin","_mapPlugins","_where","_transform","_CmsEntryFieldFilterPlugin","_values","createExpressions","params","where","plugins","fields","filterPlugins","getMappedPlugins","type","ValueFilterPlugin","property","transformValuePlugins","fieldFilterCreatePlugins","CmsEntryFieldFilterPlugin","defaultFilterCreatePlugin","getFilterCreatePlugin","filterCreatePlugin","WebinyError","createExpression","condition","expression","filters","expressions","key","value","undefined","childWhereList","getWhereValues","childExpression","childWhere","result","push","whereParams","extractWhereParams","fieldId","operation","negate","field","transformValuePlugin","transformValueCallable","transform","create","valueFilterPlugins","compareValue","transformValue","Array","isArray","length","exports"],"sources":["createExpressions.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { Field } from \"./types\";\nimport { getMappedPlugins } from \"./mapPlugins\";\nimport { extractWhereParams } from \"./where\";\nimport { transformValue } from \"./transform\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { getWhereValues } from \"~/operations/entry/filtering/values\";\n\ninterface CreateExpressionParams {\n where: Partial<CmsEntryListWhere>;\n condition: ExpressionCondition;\n}\n\ninterface CreateExpressionCb {\n (params: CreateExpressionParams): Expression;\n}\n\ninterface Params {\n plugins: PluginsContainer;\n where: Partial<CmsEntryListWhere>;\n fields: Record<string, Field>;\n}\n\nexport type ExpressionCondition = \"AND\" | \"OR\";\n\nexport interface Expression {\n expressions: Expression[];\n filters: Filter[];\n condition: ExpressionCondition;\n}\n\nexport interface Filter {\n field: Field;\n path: string;\n fieldPathId: string;\n plugin: ValueFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport const createExpressions = (params: Params): Expression => {\n const { where, plugins, fields } = params;\n const filterPlugins = getMappedPlugins<ValueFilterPlugin>({\n plugins,\n type: ValueFilterPlugin.type,\n property: \"operation\"\n });\n const transformValuePlugins = getMappedPlugins<CmsFieldFilterValueTransformPlugin>({\n plugins,\n type: \"cms-field-filter-value-transform\",\n property: \"fieldType\"\n });\n const fieldFilterCreatePlugins = getMappedPlugins<CmsEntryFieldFilterPlugin>({\n plugins,\n type: CmsEntryFieldFilterPlugin.type,\n property: \"fieldType\"\n });\n\n const defaultFilterCreatePlugin = fieldFilterCreatePlugins[\"*\"] as CmsEntryFieldFilterPlugin;\n\n const getFilterCreatePlugin = (type: string) => {\n const filterCreatePlugin = fieldFilterCreatePlugins[type] || defaultFilterCreatePlugin;\n if (filterCreatePlugin) {\n return filterCreatePlugin;\n }\n throw new WebinyError(\n `There is no filter create plugin for the field type \"${type}\".`,\n \"MISSING_FILTER_CREATE_PLUGIN\",\n {\n type\n }\n );\n };\n\n const createExpression: CreateExpressionCb = ({ where, condition }) => {\n const expression: Expression = {\n filters: [],\n expressions: [],\n condition\n };\n\n for (const key in where) {\n const value = where[key];\n if (value === undefined) {\n continue;\n }\n\n /**\n * If there are \"AND\" or \"OR\" keys, let's sort them out first.\n *\n *\n * AND conditional\n */\n if (key === \"AND\") {\n const childWhereList = getWhereValues(value, key);\n const childExpression: Expression = {\n condition: \"AND\",\n filters: [],\n expressions: []\n };\n for (const childWhere of childWhereList) {\n const result = createExpression({\n where: childWhere,\n condition: \"AND\"\n });\n childExpression.expressions.push(result);\n }\n expression.expressions.push(childExpression);\n continue;\n }\n /**\n * OR conditional\n */\n if (key === \"OR\") {\n const childWhereList = getWhereValues(value, key);\n\n const childExpression: Expression = {\n condition: \"OR\",\n filters: [],\n expressions: []\n };\n for (const childWhere of childWhereList) {\n const result = createExpression({\n where: childWhere,\n condition: \"AND\"\n });\n childExpression.expressions.push(result);\n }\n expression.expressions.push(childExpression);\n continue;\n }\n\n const whereParams = extractWhereParams(key);\n if (!whereParams) {\n continue;\n }\n\n const { fieldId, operation, negate } = whereParams;\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(\n `There is no field with the fieldId \"${fieldId}\".`,\n \"FIELD_ERROR\",\n {\n fieldId\n }\n );\n }\n\n /**\n * We need a filter create plugin for this type.\n */\n const filterCreatePlugin = getFilterCreatePlugin(field.type);\n\n const transformValuePlugin: CmsFieldFilterValueTransformPlugin =\n transformValuePlugins[field.type];\n\n const transformValueCallable = (value: any) => {\n if (!transformValuePlugin) {\n return value;\n }\n return transformValuePlugin.transform({\n field,\n value\n });\n };\n\n const result = filterCreatePlugin.create({\n key,\n value,\n valueFilterPlugins: filterPlugins,\n transformValuePlugins,\n getFilterCreatePlugin,\n operation,\n negate,\n field,\n fields,\n compareValue: transformValue({\n value,\n transform: transformValueCallable\n }),\n transformValue: transformValueCallable\n });\n /**\n * There is a possibility of\n * - no result\n * - result being an array\n * - result being an object\n */\n if (!result || (Array.isArray(result) && result.length === 0)) {\n continue;\n }\n\n expression.filters.push(...(Array.isArray(result) ? result : [result]));\n }\n\n return expression;\n };\n\n const expression = createExpression({\n where,\n condition: \"AND\"\n });\n /**\n * If the first expression has no filters and has only one expression, put that expression as main one.\n * This will mostly be used when having an OR condition as the single expression in the root level of the where\n */\n if (expression.filters.length > 0 || expression.expressions.length !== 1) {\n return expression;\n }\n return expression.expressions[0];\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IA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,EAAE;EACf,CAAC,CAAC;EACF;AACJ;AACA;AACA;EACI,IAAIC,UAAU,CAACC,OAAO,CAAC0B,MAAM,GAAG,CAAC,IAAI3B,UAAU,CAACE,WAAW,CAACyB,MAAM,KAAK,CAAC,EAAE;IACtE,OAAO3B,UAAU;EACrB;EACA,OAAOA,UAAU,CAACE,WAAW,CAAC,CAAC,CAAC;AACpC,CAAC;AAAC0B,OAAA,CAAA/C,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ import type { CmsModelField } from "@webiny/api-headless-cms/types";
2
+ import type { Field } from "./types";
3
+ import type { PluginsContainer } from "@webiny/plugins";
4
+ interface Params {
5
+ fields: CmsModelField[];
6
+ plugins: PluginsContainer;
7
+ }
8
+ /**
9
+ * This method will map the fieldId (fieldId -> field) to the actual field.
10
+ *
11
+ * In case of nested fields, fieldId is all the parent fieldIds + current one, joined by the dot (.).
12
+ */
13
+ export declare const createFields: (params: Params) => {
14
+ [x: string]: Field;
15
+ };
16
+ export {};
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createFields = void 0;
7
+ var _systemFields = require("./systemFields");
8
+ var _plugins = require("../../../plugins");
9
+ var _mapPlugins = require("./mapPlugins");
10
+ const createFieldCollection = params => {
11
+ const {
12
+ fields,
13
+ parents,
14
+ transformValuePlugins,
15
+ valuePathPlugins,
16
+ system
17
+ } = params;
18
+ return fields.reduce((collection, field) => {
19
+ const transformPlugin = transformValuePlugins[field.type];
20
+ const valuePathPlugin = valuePathPlugins[field.type];
21
+ const basePath = system ? [] : ["values"];
22
+ /**
23
+ * The required fieldId is a product of all of its parents and its own fieldId.
24
+ */
25
+ const fieldId = [...parents, {
26
+ fieldId: field.fieldId,
27
+ multipleValues: field.multipleValues
28
+ }].map(f => f.fieldId).join(".");
29
+ collection[fieldId] = {
30
+ ...field,
31
+ parents,
32
+ system,
33
+ createPath: params => {
34
+ if (valuePathPlugin && valuePathPlugin.canUse(field, parents.map(p => p.fieldId))) {
35
+ return valuePathPlugin.createPath(params);
36
+ }
37
+ return basePath.concat(parents.map(parent => parent.fieldId)).concat([params.field.fieldId]).join(".");
38
+ },
39
+ transform: value => {
40
+ if (!transformPlugin) {
41
+ return value;
42
+ }
43
+ return transformPlugin.transform({
44
+ field,
45
+ value
46
+ });
47
+ }
48
+ };
49
+ const childFields = field.settings?.fields;
50
+ if (!childFields?.length) {
51
+ return collection;
52
+ }
53
+ const result = createFieldCollection({
54
+ fields: childFields,
55
+ parents: [...parents, {
56
+ fieldId: field.fieldId,
57
+ multipleValues: field.multipleValues
58
+ }],
59
+ transformValuePlugins,
60
+ valuePathPlugins,
61
+ system
62
+ });
63
+ Object.assign(collection, result);
64
+ return collection;
65
+ }, {});
66
+ };
67
+ /**
68
+ * This method will map the fieldId (fieldId -> field) to the actual field.
69
+ *
70
+ * In case of nested fields, fieldId is all the parent fieldIds + current one, joined by the dot (.).
71
+ */
72
+ const createFields = params => {
73
+ const {
74
+ fields,
75
+ plugins
76
+ } = params;
77
+ const transformValuePlugins = (0, _mapPlugins.getMappedPlugins)({
78
+ plugins,
79
+ type: "cms-field-filter-value-transform",
80
+ property: "fieldType"
81
+ });
82
+ const valuePathPlugins = (0, _mapPlugins.getMappedPlugins)({
83
+ plugins,
84
+ type: _plugins.CmsEntryFieldFilterPathPlugin.type,
85
+ property: "fieldType"
86
+ });
87
+ const collection = createFieldCollection({
88
+ fields: (0, _systemFields.createSystemFields)(),
89
+ transformValuePlugins,
90
+ valuePathPlugins,
91
+ parents: [],
92
+ system: true
93
+ });
94
+ const result = createFieldCollection({
95
+ fields,
96
+ transformValuePlugins,
97
+ valuePathPlugins,
98
+ parents: [],
99
+ system: false
100
+ });
101
+ return {
102
+ ...collection,
103
+ ...result
104
+ };
105
+ };
106
+ exports.createFields = createFields;
107
+
108
+ //# sourceMappingURL=createFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_systemFields","require","_plugins","_mapPlugins","createFieldCollection","params","fields","parents","transformValuePlugins","valuePathPlugins","system","reduce","collection","field","transformPlugin","type","valuePathPlugin","basePath","fieldId","multipleValues","map","f","join","createPath","canUse","p","concat","parent","transform","value","childFields","settings","length","result","Object","assign","createFields","plugins","getMappedPlugins","property","CmsEntryFieldFilterPathPlugin","createSystemFields","exports"],"sources":["createFields.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createSystemFields } from \"./systemFields\";\nimport type { Field, FieldParent } from \"./types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins\";\nimport { getMappedPlugins } from \"./mapPlugins\";\n\ninterface Params {\n fields: CmsModelField[];\n plugins: PluginsContainer;\n}\n\ninterface FieldCollection {\n [key: string]: Field;\n}\n\ninterface AddFieldsToCollectionParams {\n fields: CmsModelField[];\n parents: FieldParent[];\n transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;\n valuePathPlugins: Record<string, CmsEntryFieldFilterPathPlugin>;\n system: boolean;\n}\n\nconst createFieldCollection = (params: AddFieldsToCollectionParams): FieldCollection => {\n const { fields, parents, transformValuePlugins, valuePathPlugins, system } = params;\n return fields.reduce<FieldCollection>((collection, field) => {\n const transformPlugin = transformValuePlugins[field.type];\n const valuePathPlugin = valuePathPlugins[field.type];\n\n const basePath = system ? [] : [\"values\"];\n /**\n * The required fieldId is a product of all of its parents and its own fieldId.\n */\n const fieldId = [\n ...parents,\n {\n fieldId: field.fieldId,\n multipleValues: field.multipleValues\n }\n ]\n .map(f => f.fieldId)\n .join(\".\");\n\n collection[fieldId] = {\n ...field,\n parents,\n system,\n createPath: params => {\n if (\n valuePathPlugin &&\n valuePathPlugin.canUse(\n field,\n parents.map(p => p.fieldId)\n )\n ) {\n return valuePathPlugin.createPath(params);\n }\n\n return basePath\n .concat(parents.map(parent => parent.fieldId))\n .concat([params.field.fieldId])\n .join(\".\");\n },\n transform: value => {\n if (!transformPlugin) {\n return value;\n }\n return transformPlugin.transform({\n field,\n value\n });\n }\n };\n const childFields = field.settings?.fields;\n if (!childFields?.length) {\n return collection;\n }\n\n const result = createFieldCollection({\n fields: childFields,\n parents: [\n ...parents,\n {\n fieldId: field.fieldId,\n multipleValues: field.multipleValues\n }\n ],\n transformValuePlugins,\n valuePathPlugins,\n system\n });\n Object.assign(collection, result);\n return collection;\n }, {});\n};\n/**\n * This method will map the fieldId (fieldId -> field) to the actual field.\n *\n * In case of nested fields, fieldId is all the parent fieldIds + current one, joined by the dot (.).\n */\nexport const createFields = (params: Params) => {\n const { fields, plugins } = params;\n\n const transformValuePlugins = getMappedPlugins<CmsFieldFilterValueTransformPlugin>({\n plugins,\n type: \"cms-field-filter-value-transform\",\n property: \"fieldType\"\n });\n const valuePathPlugins = getMappedPlugins<CmsEntryFieldFilterPathPlugin>({\n plugins,\n type: CmsEntryFieldFilterPathPlugin.type,\n property: \"fieldType\"\n });\n\n const collection = createFieldCollection({\n fields: createSystemFields(),\n transformValuePlugins,\n valuePathPlugins,\n parents: [],\n system: true\n });\n\n const result = createFieldCollection({\n fields,\n transformValuePlugins,\n valuePathPlugins,\n parents: [],\n system: false\n });\n\n return {\n ...collection,\n ...result\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAmBA,MAAMG,qBAAqB,GAAIC,MAAmC,IAAsB;EACpF,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC,qBAAqB;IAAEC,gBAAgB;IAAEC;EAAO,CAAC,GAAGL,MAAM;EACnF,OAAOC,MAAM,CAACK,MAAM,CAAkB,CAACC,UAAU,EAAEC,KAAK,KAAK;IACzD,MAAMC,eAAe,GAAGN,qBAAqB,CAACK,KAAK,CAACE,IAAI,CAAC;IACzD,MAAMC,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1
+ import type { Field } from "./types";
2
+ import type { PluginsContainer } from "@webiny/plugins";
3
+ import type { CmsModel } from "@webiny/api-headless-cms/types";
4
+ interface Result {
5
+ valuePath: string;
6
+ reverse: boolean;
7
+ fieldId: string;
8
+ field: Field;
9
+ }
10
+ interface Params {
11
+ model: CmsModel;
12
+ sortBy: string;
13
+ fields: Record<string, Field>;
14
+ plugins: PluginsContainer;
15
+ }
16
+ export declare const extractSort: (params: Params) => Result;
17
+ export {};
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.extractSort = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ var _plugins = require("../../../plugins");
10
+ const extractSort = params => {
11
+ const {
12
+ model,
13
+ sortBy,
14
+ fields,
15
+ plugins
16
+ } = params;
17
+ const result = sortBy.split("_");
18
+ if (result.length !== 2) {
19
+ throw new _error.default("Problem in determining the sorting for the entry items.", "SORT_EXTRACT_ERROR", {
20
+ sortBy
21
+ });
22
+ }
23
+ const [fieldId, order] = result;
24
+ const field = Object.values(fields).find(field => {
25
+ /**
26
+ * We do not support sorting by nested fields.
27
+ */
28
+ if (field.parents.length > 0) {
29
+ return false;
30
+ }
31
+ return field.fieldId === fieldId;
32
+ });
33
+ const plugin = plugins.byType(_plugins.CmsEntryFieldSortingPlugin.type).reverse().find(plugin => {
34
+ return plugin.canUse({
35
+ model,
36
+ field,
37
+ fieldId,
38
+ order,
39
+ sortBy
40
+ });
41
+ });
42
+ if (plugin) {
43
+ return plugin.createSort({
44
+ model,
45
+ fieldId,
46
+ order,
47
+ sortBy,
48
+ field,
49
+ fields
50
+ });
51
+ } else if (!field) {
52
+ throw new _error.default("Sorting field does not exist in the content model.", "SORTING_FIELD_ERROR", {
53
+ fieldId,
54
+ fields
55
+ });
56
+ }
57
+ const valuePath = field.createPath({
58
+ field
59
+ });
60
+ return {
61
+ field,
62
+ fieldId,
63
+ valuePath,
64
+ reverse: order === "DESC"
65
+ };
66
+ };
67
+ exports.extractSort = extractSort;
68
+
69
+ //# sourceMappingURL=extractSort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_plugins","extractSort","params","model","sortBy","fields","plugins","result","split","length","WebinyError","fieldId","order","field","Object","values","find","parents","plugin","byType","CmsEntryFieldSortingPlugin","type","reverse","canUse","createSort","valuePath","createPath","exports"],"sources":["extractSort.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { Field } from \"./types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryFieldSortingPlugin } from \"~/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\ninterface Result {\n valuePath: string;\n reverse: boolean;\n fieldId: string;\n field: Field;\n}\n\ninterface Params {\n model: CmsModel;\n sortBy: string;\n fields: Record<string, Field>;\n plugins: PluginsContainer;\n}\n\nexport const extractSort = (params: Params): Result => {\n const { model, sortBy, fields, plugins } = params;\n const result = sortBy.split(\"_\");\n if (result.length !== 2) {\n throw new WebinyError(\n \"Problem in determining the sorting for the entry items.\",\n \"SORT_EXTRACT_ERROR\",\n {\n sortBy\n }\n );\n }\n const [fieldId, order] = result as [string, \"ASC\" | \"DESC\"];\n\n const field = Object.values(fields).find(field => {\n /**\n * We do not support sorting by nested fields.\n */\n if (field.parents.length > 0) {\n return false;\n }\n return field.fieldId === fieldId;\n });\n\n const plugin = plugins\n .byType<CmsEntryFieldSortingPlugin>(CmsEntryFieldSortingPlugin.type)\n .reverse()\n .find(plugin => {\n return plugin.canUse({\n model,\n field,\n fieldId,\n order,\n sortBy\n });\n });\n\n if (plugin) {\n return plugin.createSort({\n model,\n fieldId,\n order,\n sortBy,\n field,\n fields\n });\n } else if (!field) {\n throw new WebinyError(\n \"Sorting field does not exist in the content model.\",\n \"SORTING_FIELD_ERROR\",\n {\n fieldId,\n fields\n }\n );\n }\n const valuePath = field.createPath({\n field\n });\n return {\n field,\n fieldId,\n valuePath,\n reverse: order === \"DESC\"\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AAiBO,MAAME,WAAW,GAAIC,MAAc,IAAa;EACnD,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EACjD,MAAMK,MAAM,GAAGH,MAAM,CAACI,KAAK,CAAC,GAAG,CAAC;EAChC,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,cAAW,CACjB,yDAAyD,EACzD,oBAAoB,EACpB;MACIN;IACJ,CACJ,CAAC;EACL;EACA,MAAM,CAACO,OAAO,EAAEC,KAAK,CAAC,GAAGL,MAAkC;EAE3D,MAAMM,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACV,MAAM,CAAC,CAACW,IAAI,CAACH,KAAK,IAAI;IAC9C;AACR;AACA;IACQ,IAAIA,KAAK,CAACI,OAAO,CAACR,MAAM,GAAG,CAAC,EAAE;MAC1B,OAAO,KAAK;IAChB;IACA,OAAOI,KAAK,CAACF,OAAO,KAAKA,OAAO;EACpC,CAAC,CAAC;EAEF,MAAMO,MAAM,GAAGZ,OAAO,CACjBa,MAAM,CAA6BC,mCAA0B,CAACC,IAAI,CAAC,CACnEC,OAAO,CAAC,CAAC,CACTN,IAAI,CAACE,MAAM,IAAI;IACZ,OAAOA,MAAM,CAACK,MAAM,CAAC;MACjBpB,KAAK;MACLU,KAAK;MACLF,OAAO;MACPC,KAAK;MACLR;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEN,IAAIc,MAAM,EAAE;IACR,OAAOA,MAAM,CAACM,UAAU,CAAC;MACrBrB,KAAK;MACLQ,OAAO;MACPC,KAAK;MACLR,MAAM;MACNS,KAAK;MACLR;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAI,CAACQ,KAAK,EAAE;IACf,MAAM,IAAIH,cAAW,CACjB,oDAAoD,EACpD,qBAAqB,EACrB;MACIC,OAAO;MACPN;IACJ,CACJ,CAAC;EACL;EACA,MAAMoB,SAAS,GAAGZ,KAAK,CAACa,UAAU,CAAC;IAC/Bb;EACJ,CAAC,CAAC;EACF,OAAO;IACHA,KAAK;IACLF,OAAO;IACPc,SAAS;IACTH,OAAO,EAAEV,KAAK,KAAK;EACvB,CAAC;AACL,CAAC;AAACe,OAAA,CAAA1B,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ import type { CmsEntry, CmsEntryListWhere } from "@webiny/api-headless-cms/types";
2
+ import type { PluginsContainer } from "@webiny/plugins";
3
+ import type { Field } from "./types";
4
+ interface Params {
5
+ items: CmsEntry[];
6
+ where: Partial<CmsEntryListWhere>;
7
+ plugins: PluginsContainer;
8
+ fields: Record<string, Field>;
9
+ fullTextSearch?: {
10
+ term?: string;
11
+ fields?: string[];
12
+ };
13
+ }
14
+ export declare const filter: (params: Params) => CmsEntry[];
15
+ export {};
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.filter = void 0;
8
+ var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
9
+ var _error = _interopRequireDefault(require("@webiny/error"));
10
+ var _fullTextSearch = require("./fullTextSearch");
11
+ var _createExpressions = require("./createExpressions");
12
+ var _transform = require("./transform");
13
+ var _getValue = require("./getValue");
14
+ const executeFilter = params => {
15
+ const {
16
+ value,
17
+ filter
18
+ } = params;
19
+
20
+ /**
21
+ * We need to check if the filter can be used.
22
+ * If it cannot, we will just return true.
23
+ */
24
+ const canUse = filter.plugin.canUse({
25
+ value,
26
+ compareValue: filter.compareValue
27
+ });
28
+ if (!canUse) {
29
+ return true;
30
+ }
31
+ const matched = filter.plugin.matches({
32
+ value,
33
+ compareValue: filter.compareValue
34
+ });
35
+ if (filter.negate) {
36
+ return matched === false;
37
+ }
38
+ return matched;
39
+ };
40
+ const executeExpressions = params => {
41
+ const {
42
+ expressions,
43
+ getCachedValue,
44
+ filters,
45
+ condition
46
+ } = params;
47
+ if (expressions.length === 0 && filters.length === 0) {
48
+ return true;
49
+ }
50
+ /**
51
+ * Always run filters first as they might trigger an early return.
52
+ */
53
+ for (const filter of filters) {
54
+ const value = getCachedValue(filter);
55
+ const result = executeFilter({
56
+ value,
57
+ filter
58
+ });
59
+ /**
60
+ * Filters are ALWAYS executed as an AND.
61
+ * So if even one is false, everything false.
62
+ */
63
+ if (!result) {
64
+ return false;
65
+ }
66
+ }
67
+ /**
68
+ * Then we move onto expressions, which are basically nested upon nested filters with different conditions.
69
+ */
70
+ for (const expression of expressions) {
71
+ const result = executeExpressions({
72
+ ...expression,
73
+ getCachedValue
74
+ });
75
+ if (result && condition === "OR") {
76
+ return true;
77
+ } else if (!result && condition == "AND") {
78
+ return false;
79
+ }
80
+ }
81
+ /**
82
+ * If condition is an OR, we can fail the expressions check because the code would return a lot earlier than this line.
83
+ *
84
+ * Also, if condition is not an OR, we can say that the expressions check is ok, because it would fail a lot earlier than this line.
85
+ */
86
+ return condition === "OR" ? false : true;
87
+ };
88
+ const filter = params => {
89
+ const {
90
+ items: records,
91
+ where,
92
+ plugins,
93
+ fields,
94
+ fullTextSearch
95
+ } = params;
96
+ const keys = Object.keys(where);
97
+ if (keys.length === 0 && !fullTextSearch) {
98
+ return records;
99
+ }
100
+ const expression = (0, _createExpressions.createExpressions)({
101
+ plugins,
102
+ where,
103
+ fields
104
+ });
105
+
106
+ /**
107
+ * No point in going further if there are no expressions to be applied and no full text search to be executed.
108
+ */
109
+ if (expression.filters.length === 0 && expression.expressions.length === 0 && !fullTextSearch?.term) {
110
+ return records;
111
+ }
112
+ /**
113
+ * We need the contains plugin to run the full text search.
114
+ */
115
+ const fullTextSearchPlugin = plugins.byType(_ValueFilterPlugin.ValueFilterPlugin.type).find(plugin => plugin.getOperation() === "contains");
116
+ if (!fullTextSearchPlugin) {
117
+ throw new _error.default(`Missing "contains" plugin to run the full-text search.`, "MISSING_PLUGIN");
118
+ }
119
+ const search = (0, _fullTextSearch.createFullTextSearch)({
120
+ term: fullTextSearch?.term,
121
+ targetFields: fullTextSearch?.fields,
122
+ fields,
123
+ plugin: fullTextSearchPlugin
124
+ });
125
+ return records.filter(record => {
126
+ const cachedValues = {};
127
+ const getCachedValue = filter => {
128
+ const {
129
+ path
130
+ } = filter;
131
+ if (cachedValues[path] !== undefined) {
132
+ return cachedValues[path];
133
+ }
134
+ const plainValue = (0, _getValue.getValue)(record, path);
135
+ const rawValue = (0, _transform.transformValue)({
136
+ value: plainValue,
137
+ transform: filter.transformValue
138
+ });
139
+ cachedValues[path] = rawValue;
140
+ return rawValue;
141
+ };
142
+ const exprResult = executeExpressions({
143
+ ...expression,
144
+ getCachedValue
145
+ });
146
+ /**
147
+ * If expression result is false we do not need to continue further.
148
+ * Also, if there is no full text search defined, just return the expression result.
149
+ */
150
+ if (!exprResult || !search) {
151
+ return exprResult;
152
+ }
153
+ return search(record);
154
+ });
155
+ };
156
+ exports.filter = filter;
157
+
158
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ValueFilterPlugin","require","_error","_interopRequireDefault","_fullTextSearch","_createExpressions","_transform","_getValue","executeFilter","params","value","filter","canUse","plugin","compareValue","matched","matches","negate","executeExpressions","expressions","getCachedValue","filters","condition","length","result","expression","items","records","where","plugins","fields","fullTextSearch","keys","Object","createExpressions","term","fullTextSearchPlugin","byType","ValueFilterPlugin","type","find","getOperation","WebinyError","search","createFullTextSearch","targetFields","record","cachedValues","path","undefined","plainValue","getValue","rawValue","transformValue","transform","exprResult","exports"],"sources":["filter.ts"],"sourcesContent":["import type { CmsEntry, CmsEntryListWhere } from \"@webiny/api-headless-cms/types\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport WebinyError from \"@webiny/error\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { Field } from \"./types\";\nimport { createFullTextSearch } from \"./fullTextSearch\";\nimport type { Expression, ExpressionCondition, Filter } from \"./createExpressions\";\nimport { createExpressions } from \"./createExpressions\";\nimport { transformValue } from \"./transform\";\nimport { getValue } from \"~/operations/entry/filtering/getValue\";\n\ninterface ExecuteFilterParams {\n value: any;\n filter: Filter;\n}\n\nconst executeFilter = (params: ExecuteFilterParams) => {\n const { value, filter } = params;\n\n /**\n * We need to check if the filter can be used.\n * If it cannot, we will just return true.\n */\n const canUse = filter.plugin.canUse({\n value,\n compareValue: filter.compareValue\n });\n if (!canUse) {\n return true;\n }\n\n const matched = filter.plugin.matches({\n value,\n compareValue: filter.compareValue\n });\n if (filter.negate) {\n return matched === false;\n }\n return matched;\n};\n\ninterface ExecuteExpressionsParams {\n getCachedValue: (filter: Filter) => Promise<any>;\n expressions: Expression[];\n filters: Filter[];\n condition: ExpressionCondition;\n}\n\nconst executeExpressions = (params: ExecuteExpressionsParams): boolean => {\n const { expressions, getCachedValue, filters, condition } = params;\n if (expressions.length === 0 && filters.length === 0) {\n return true;\n }\n /**\n * Always run filters first as they might trigger an early return.\n */\n for (const filter of filters) {\n const value = getCachedValue(filter);\n\n const result = executeFilter({\n value,\n filter\n });\n /**\n * Filters are ALWAYS executed as an AND.\n * So if even one is false, everything false.\n */\n if (!result) {\n return false;\n }\n }\n /**\n * Then we move onto expressions, which are basically nested upon nested filters with different conditions.\n */\n for (const expression of expressions) {\n const result = executeExpressions({\n ...expression,\n getCachedValue\n });\n if (result && condition === \"OR\") {\n return true;\n } else if (!result && condition == \"AND\") {\n return false;\n }\n }\n /**\n * If condition is an OR, we can fail the expressions check because the code would return a lot earlier than this line.\n *\n * Also, if condition is not an OR, we can say that the expressions check is ok, because it would fail a lot earlier than this line.\n */\n return condition === \"OR\" ? false : true;\n};\n\ninterface Params {\n items: CmsEntry[];\n where: Partial<CmsEntryListWhere>;\n plugins: PluginsContainer;\n fields: Record<string, Field>;\n fullTextSearch?: {\n term?: string;\n fields?: string[];\n };\n}\n\nexport const filter = (params: Params): CmsEntry[] => {\n const { items: records, where, plugins, fields, fullTextSearch } = params;\n\n const keys = Object.keys(where);\n if (keys.length === 0 && !fullTextSearch) {\n return records;\n }\n const expression = createExpressions({\n plugins,\n where,\n fields\n });\n\n /**\n * No point in going further if there are no expressions to be applied and no full text search to be executed.\n */\n if (\n expression.filters.length === 0 &&\n expression.expressions.length === 0 &&\n !fullTextSearch?.term\n ) {\n return records;\n }\n /**\n * We need the contains plugin to run the full text search.\n */\n const fullTextSearchPlugin = plugins\n .byType<ValueFilterPlugin>(ValueFilterPlugin.type)\n .find(plugin => plugin.getOperation() === \"contains\");\n if (!fullTextSearchPlugin) {\n throw new WebinyError(\n `Missing \"contains\" plugin to run the full-text search.`,\n \"MISSING_PLUGIN\"\n );\n }\n\n const search = createFullTextSearch({\n term: fullTextSearch?.term,\n targetFields: fullTextSearch?.fields,\n fields,\n plugin: fullTextSearchPlugin\n });\n\n return records.filter(record => {\n const cachedValues: Record<string, any> = {};\n\n const getCachedValue = (filter: Filter) => {\n const { path } = filter;\n if (cachedValues[path] !== undefined) {\n return cachedValues[path];\n }\n const plainValue = getValue(record, path);\n\n const rawValue = transformValue({\n value: plainValue,\n transform: filter.transformValue\n });\n\n cachedValues[path] = rawValue;\n return rawValue;\n };\n\n const exprResult = executeExpressions({ ...expression, getCachedValue });\n /**\n * If expression result is false we do not need to continue further.\n * Also, if there is no full text search defined, just return the expression result.\n */\n if (!exprResult || !search) {\n return exprResult;\n }\n\n return search(record);\n });\n};\n"],"mappings":";;;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI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,EAAEI,IAAI;IAC1BU,YAAY,EAAEd,cAAc,EAAED,MAAM;IACpCA,MAAM;IACNjB,MAAM,EAAEuB;EACZ,CAAC,CAAC;EAEF,OAAOT,OAAO,CAAChB,MAAM,CAACmC,MAAM,IAAI;IAC5B,MAAMC,YAAiC,GAAG,CAAC,CAAC;IAE5C,MAAM3B,cAAc,GAAIT,MAAc,IAAK;MACvC,MAAM;QAAEqC;MAAK,CAAC,GAAGrC,MAAM;MACvB,IAAIoC,YAAY,CAACC,IAAI,CAAC,KAAKC,SAAS,EAAE;QAClC,OAAOF,YAAY,CAACC,IAAI,CAAC;MAC7B;MACA,MAAME,UAAU,GAAG,IAAAC,kBAAQ,EAACL,MAAM,EAAEE,IAAI,CAAC;MAEzC,MAAMI,QAAQ,GAAG,IAAAC,yBAAc,EAAC;QAC5B3C,KAAK,EAAEwC,UAAU;QACjBI,SAAS,EAAE3C,MAAM,CAAC0C;MACtB,CAAC,CAAC;MAEFN,YAAY,CAACC,IAAI,CAAC,GAAGI,QAAQ;MAC7B,OAAOA,QAAQ;IACnB,CAAC;IAED,MAAMG,UAAU,GAAGrC,kBAAkB,CAAC;MAAE,GAAGO,UAAU;MAAEL;IAAe,CAAC,CAAC;IACxE;AACR;AACA;AACA;IACQ,IAAI,CAACmC,UAAU,IAAI,CAACZ,MAAM,EAAE;MACxB,OAAOY,UAAU;IACrB;IAEA,OAAOZ,MAAM,CAACG,MAAM,CAAC;EACzB,CAAC,CAAC;AACN,CAAC;AAACU,OAAA,CAAA7C,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import type { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
2
+ import type { CmsEntry } from "@webiny/api-headless-cms/types";
3
+ import type { Field } from "./types";
4
+ interface Params {
5
+ term?: string;
6
+ targetFields?: string[];
7
+ fields: Record<string, Field>;
8
+ plugin: ValueFilterPlugin;
9
+ }
10
+ /**
11
+ * Unfortunately we must use the contains plugin directly as plugins do not support multi field searching.
12
+ */
13
+ export declare const createFullTextSearch: (params: Params) => ((item: CmsEntry) => boolean) | null;
14
+ export {};