@webiny/api-headless-cms-ddb 6.4.12-beta.4 → 6.5.0-beta.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.
Files changed (88) hide show
  1. package/dynamoDb/index.d.ts +1 -1
  2. package/dynamoDb/index.js +1 -3
  3. package/dynamoDb/index.js.map +1 -1
  4. package/index.js +11 -7
  5. package/index.js.map +1 -1
  6. package/operations/entry/index.js +36 -42
  7. package/operations/entry/index.js.map +1 -1
  8. package/package.json +19 -19
  9. package/plugins/index.d.ts +2 -4
  10. package/plugins/index.js +1 -4
  11. package/types.d.ts +2 -25
  12. package/types.js.map +1 -1
  13. package/dynamoDb/path/locationFolderId.d.ts +0 -2
  14. package/dynamoDb/path/locationFolderId.js +0 -21
  15. package/dynamoDb/path/locationFolderId.js.map +0 -1
  16. package/dynamoDb/path/plainObject.d.ts +0 -2
  17. package/dynamoDb/path/plainObject.js +0 -16
  18. package/dynamoDb/path/plainObject.js.map +0 -1
  19. package/dynamoDb/transformValue/datetime.d.ts +0 -5
  20. package/dynamoDb/transformValue/datetime.js +0 -29
  21. package/dynamoDb/transformValue/datetime.js.map +0 -1
  22. package/operations/entry/filtering/createExpressions.d.ts +0 -27
  23. package/operations/entry/filtering/createExpressions.js +0 -124
  24. package/operations/entry/filtering/createExpressions.js.map +0 -1
  25. package/operations/entry/filtering/createFields.d.ts +0 -16
  26. package/operations/entry/filtering/createFields.js +0 -93
  27. package/operations/entry/filtering/createFields.js.map +0 -1
  28. package/operations/entry/filtering/extractSort.d.ts +0 -17
  29. package/operations/entry/filtering/extractSort.js +0 -60
  30. package/operations/entry/filtering/extractSort.js.map +0 -1
  31. package/operations/entry/filtering/filter.d.ts +0 -16
  32. package/operations/entry/filtering/filter.js +0 -85
  33. package/operations/entry/filtering/filter.js.map +0 -1
  34. package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
  35. package/operations/entry/filtering/fullTextSearch.js +0 -25
  36. package/operations/entry/filtering/fullTextSearch.js.map +0 -1
  37. package/operations/entry/filtering/getValue.d.ts +0 -5
  38. package/operations/entry/filtering/getValue.js +0 -37
  39. package/operations/entry/filtering/getValue.js.map +0 -1
  40. package/operations/entry/filtering/index.d.ts +0 -2
  41. package/operations/entry/filtering/index.js +0 -2
  42. package/operations/entry/filtering/mapPlugins.d.ts +0 -8
  43. package/operations/entry/filtering/mapPlugins.js +0 -18
  44. package/operations/entry/filtering/mapPlugins.js.map +0 -1
  45. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
  46. package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -33
  47. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
  48. package/operations/entry/filtering/plugins/index.d.ts +0 -1
  49. package/operations/entry/filtering/plugins/index.js +0 -13
  50. package/operations/entry/filtering/plugins/index.js.map +0 -1
  51. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
  52. package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -68
  53. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
  54. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -3
  55. package/operations/entry/filtering/plugins/refFilterCreate.js +0 -63
  56. package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
  57. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +0 -2
  58. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +0 -56
  59. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +0 -1
  60. package/operations/entry/filtering/sort.d.ts +0 -12
  61. package/operations/entry/filtering/sort.js +0 -41
  62. package/operations/entry/filtering/sort.js.map +0 -1
  63. package/operations/entry/filtering/systemFields.d.ts +0 -2
  64. package/operations/entry/filtering/systemFields.js +0 -149
  65. package/operations/entry/filtering/systemFields.js.map +0 -1
  66. package/operations/entry/filtering/transform.d.ts +0 -6
  67. package/operations/entry/filtering/transform.js +0 -7
  68. package/operations/entry/filtering/transform.js.map +0 -1
  69. package/operations/entry/filtering/types.d.ts +0 -40
  70. package/operations/entry/filtering/types.js +0 -0
  71. package/operations/entry/filtering/values.d.ts +0 -2
  72. package/operations/entry/filtering/values.js +0 -15
  73. package/operations/entry/filtering/values.js.map +0 -1
  74. package/operations/entry/filtering/where.d.ts +0 -5
  75. package/operations/entry/filtering/where.js +0 -22
  76. package/operations/entry/filtering/where.js.map +0 -1
  77. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -23
  78. package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -30
  79. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
  80. package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
  81. package/plugins/CmsEntryFieldFilterPlugin.js +0 -20
  82. package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
  83. package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
  84. package/plugins/CmsEntryFieldSortingPlugin.js +0 -20
  85. package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
  86. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
  87. package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -19
  88. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
@@ -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
- else 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;SACJ,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,2 +0,0 @@
1
- import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
2
- export declare const createSystemFields: () => CmsModelField[];
@@ -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,6 +0,0 @@
1
- import type { Field } from "./types.js";
2
- interface Params extends Pick<Field, "transform"> {
3
- value: any;
4
- }
5
- export declare const transformValue: ({ value, transform }: Params) => any;
6
- export {};
@@ -1,7 +0,0 @@
1
- const transformValue = ({ value, transform })=>{
2
- if (Array.isArray(value)) return value.map((v)=>transform(v));
3
- return transform(value);
4
- };
5
- export { transformValue };
6
-
7
- //# sourceMappingURL=transform.js.map
@@ -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,2 +0,0 @@
1
- import type { CmsEntryListWhere } from "@webiny/api-headless-cms/types/index.js";
2
- export declare const getWhereValues: (value: unknown, condition: "AND" | "OR") => CmsEntryListWhere[];
@@ -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
@@ -1 +0,0 @@
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,5 +0,0 @@
1
- export declare const extractWhereParams: (key: string) => {
2
- fieldId: string;
3
- operation: string;
4
- negate: boolean;
5
- } | null;
@@ -1,22 +0,0 @@
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_", "");
14
- return {
15
- fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
16
- operation,
17
- negate
18
- };
19
- };
20
- export { extractWhereParams };
21
-
22
- //# sourceMappingURL=where.js.map
@@ -1 +0,0 @@
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"}
@@ -1,23 +0,0 @@
1
- import { Plugin } from "@webiny/plugins/Plugin.js";
2
- import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
3
- export interface CreatePathCallableParams {
4
- field: Partial<CmsModelField> & Pick<CmsModelField, "fieldId" | "storageId" | "id">;
5
- index?: number;
6
- }
7
- export interface CreatePathCallable {
8
- (params: CreatePathCallableParams): string;
9
- }
10
- export interface CmsEntryFieldFilterPathPluginParams {
11
- fieldType: string;
12
- fieldId?: string[];
13
- path: string | CreatePathCallable;
14
- canUse?: (field: Pick<CmsModelField, "fieldId" | "type">, parents?: string[]) => boolean;
15
- }
16
- export declare class CmsEntryFieldFilterPathPlugin extends Plugin {
17
- static readonly type: string;
18
- private readonly config;
19
- get fieldType(): string;
20
- constructor(config: CmsEntryFieldFilterPathPluginParams);
21
- canUse(field: Pick<CmsModelField, "fieldId" | "type">, parents: string[]): boolean;
22
- createPath(params: CreatePathCallableParams): string;
23
- }
@@ -1,30 +0,0 @@
1
- import error from "@webiny/error";
2
- import { Plugin } from "@webiny/plugins/Plugin.js";
3
- class CmsEntryFieldFilterPathPlugin extends Plugin {
4
- static{
5
- this.type = "cms-field-filter-path";
6
- }
7
- get fieldType() {
8
- return this.config.fieldType;
9
- }
10
- constructor(config){
11
- super();
12
- this.config = config;
13
- this.name = `${this.constructor.type}-${this.config.fieldType}`;
14
- }
15
- canUse(field, parents) {
16
- if (field.type !== this.config.fieldType) return false;
17
- else if (this.config.canUse) return this.config.canUse(field, parents);
18
- const fieldId = this.config.fieldId;
19
- if (!fieldId || false === Array.isArray(fieldId) || 0 === fieldId.length) return true;
20
- return fieldId.includes(field.fieldId);
21
- }
22
- createPath(params) {
23
- if ("function" == typeof this.config.path) return this.config.path(params);
24
- else if ("string" == typeof this.config.path) return this.config.path;
25
- throw new error(`Missing path in "${this.name}" plugin.`);
26
- }
27
- }
28
- export { CmsEntryFieldFilterPathPlugin };
29
-
30
- //# sourceMappingURL=CmsEntryFieldFilterPathPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/CmsEntryFieldFilterPathPlugin.js","sources":["../../src/plugins/CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface CreatePathCallableParams {\n field: Partial<CmsModelField> & Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\">;\n index?: number;\n}\nexport interface CreatePathCallable {\n (params: CreatePathCallableParams): string;\n}\nexport interface CmsEntryFieldFilterPathPluginParams {\n fieldType: string;\n fieldId?: string[];\n path: string | CreatePathCallable;\n canUse?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents?: string[]) => boolean;\n}\nexport class CmsEntryFieldFilterPathPlugin extends Plugin {\n public static override readonly type: string = \"cms-field-filter-path\";\n\n private readonly config: CmsEntryFieldFilterPathPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(config: CmsEntryFieldFilterPathPluginParams) {\n super();\n\n this.config = config;\n\n /**\n * We expect error here because we know that `this.constructor.type` is defined, but TS does not.\n */\n // @ts-expect-error\n this.name = `${this.constructor.type}-${this.config.fieldType}`;\n }\n\n public canUse(field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents: string[]): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\n } else if (this.config.canUse) {\n return this.config.canUse(field, parents);\n }\n const fieldId = this.config.fieldId;\n if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {\n return true;\n }\n return fieldId.includes(field.fieldId);\n }\n\n public createPath(params: CreatePathCallableParams): string {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n throw new WebinyError(`Missing path in \"${this.name}\" plugin.`);\n }\n}\n"],"names":["CmsEntryFieldFilterPathPlugin","Plugin","config","field","parents","fieldId","Array","params","WebinyError"],"mappings":";;AAiBO,MAAMA,sCAAsCC;;aACf,IAAI,GAAW;;IAI/C,IAAW,YAAoB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,YAAmBC,MAA2C,CAAE;QAC5D,KAAK;QAEL,IAAI,CAAC,MAAM,GAAGA;QAMd,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;IACnE;IAEO,OAAOC,KAA8C,EAAEC,OAAiB,EAAW;QACtF,IAAID,MAAM,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,EACpC,OAAO;aACJ,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EACzB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA,OAAOC;QAErC,MAAMC,UAAU,IAAI,CAAC,MAAM,CAAC,OAAO;QACnC,IAAI,CAACA,WAAWC,AAA2B,UAA3BA,MAAM,OAAO,CAACD,YAAsBA,AAAmB,MAAnBA,QAAQ,MAAM,EAC9D,OAAO;QAEX,OAAOA,QAAQ,QAAQ,CAACF,MAAM,OAAO;IACzC;IAEO,WAAWI,MAAgC,EAAU;QACxD,IAAI,AAA4B,cAA5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;aACrB,IAAI,AAA4B,YAA5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;QAE3B,MAAM,IAAIC,MAAY,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAClE;AACJ"}
@@ -1,43 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- import type { Field } from "../operations/entry/filtering/types.js";
3
- import type { CmsFieldFilterValueTransformPlugin } from "../types.js";
4
- import { ValueFilterRegistry } from "@webiny/db-dynamodb/feature/ValueFilter/index.js";
5
- /**
6
- * This plugin is used to create the filter.
7
- * Internally we have default one + the one for the reference field - because it is actually an object when filtering.
8
- */
9
- interface CmsEntryFieldFilterPluginParams<T = any> {
10
- fieldType: string;
11
- create: (params: CmsEntryFieldFilterPluginCreateParams<T>) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];
12
- }
13
- interface CmsEntryFieldFilterPluginCreateParams<T = any> {
14
- key: string;
15
- value: T;
16
- field: Field;
17
- fields: Record<string, Field>;
18
- operation: string;
19
- valueFilterRegistry: ValueFilterRegistry.Interface;
20
- transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;
21
- getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;
22
- negate: boolean;
23
- compareValue: any;
24
- transformValue: <I = any, O = any>(value: I) => O;
25
- }
26
- export interface CmsEntryFieldFilterPluginCreateResponse {
27
- field: Field;
28
- path: string;
29
- fieldPathId: string;
30
- filter: ValueFilterRegistry.Filter;
31
- negate: boolean;
32
- compareValue: any;
33
- transformValue: <I = any, O = any>(value: I) => O;
34
- }
35
- export declare class CmsEntryFieldFilterPlugin<T = any> extends Plugin {
36
- static readonly type: string;
37
- static readonly ALL: string;
38
- private readonly config;
39
- readonly fieldType: string;
40
- constructor(config: CmsEntryFieldFilterPluginParams<T>);
41
- create(params: CmsEntryFieldFilterPluginCreateParams<T>): CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[] | null;
42
- }
43
- export {};
@@ -1,20 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- class CmsEntryFieldFilterPlugin extends Plugin {
3
- static{
4
- this.type = "cms.dynamodb.entry.field.filter";
5
- }
6
- static{
7
- this.ALL = "*";
8
- }
9
- constructor(config){
10
- super();
11
- this.config = config;
12
- this.fieldType = this.config.fieldType;
13
- }
14
- create(params) {
15
- return this.config.create(params);
16
- }
17
- }
18
- export { CmsEntryFieldFilterPlugin };
19
-
20
- //# sourceMappingURL=CmsEntryFieldFilterPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/CmsEntryFieldFilterPlugin.js","sources":["../../src/plugins/CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-dynamodb/feature/ValueFilter/index.js\";\n\n/**\n * This plugin is used to create the filter.\n * Internally we have default one + the one for the reference field - because it is actually an object when filtering.\n */\n\ninterface CmsEntryFieldFilterPluginParams<T = any> {\n fieldType: string;\n create: (\n params: CmsEntryFieldFilterPluginCreateParams<T>\n ) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];\n}\n\ninterface CmsEntryFieldFilterPluginCreateParams<T = any> {\n key: string;\n value: T;\n field: Field;\n fields: Record<string, Field>;\n operation: string;\n valueFilterRegistry: ValueFilterRegistry.Interface;\n transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;\n getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport interface CmsEntryFieldFilterPluginCreateResponse {\n field: Field;\n path: string;\n fieldPathId: string;\n filter: ValueFilterRegistry.Filter;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport class CmsEntryFieldFilterPlugin<T = any> extends Plugin {\n public static override readonly type: string = \"cms.dynamodb.entry.field.filter\";\n public static readonly ALL: string = \"*\";\n\n private readonly config: CmsEntryFieldFilterPluginParams<T>;\n\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFieldFilterPluginParams<T>) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public create(params: CmsEntryFieldFilterPluginCreateParams<T>) {\n return this.config.create(params);\n }\n}\n"],"names":["CmsEntryFieldFilterPlugin","Plugin","config","params"],"mappings":";AAyCO,MAAMA,kCAA2CC;;aACpB,IAAI,GAAW;;;aACxB,GAAG,GAAW;;IAMrC,YAAmBC,MAA0C,CAAE;QAC3D,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;QACd,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS;IAC1C;IAEO,OAAOC,MAAgD,EAAE;QAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA;IAC9B;AACJ"}
@@ -1,42 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- import type { Field } from "../operations/entry/filtering/types.js";
3
- import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
- interface CmsEntryFieldSortingPluginCanUseParams {
5
- model: CmsModel;
6
- field?: Field;
7
- fieldId: string;
8
- order: "ASC" | "DESC";
9
- /**
10
- * Combination of fieldId and sortBy
11
- *
12
- * example: id_ASC or createdBy_DESC
13
- */
14
- sortBy: string;
15
- }
16
- interface CmsEntryFieldSortingPluginCreateSortParams {
17
- model: CmsModel;
18
- fieldId: string;
19
- order: "ASC" | "DESC";
20
- sortBy: string;
21
- fields: Record<string, Field>;
22
- field?: Field;
23
- }
24
- interface CmsEntryFieldSortingPluginCreateSortResult {
25
- valuePath: string;
26
- reverse: boolean;
27
- fieldId: string;
28
- field: Field;
29
- }
30
- interface CmsEntryFieldSortingPluginConfig {
31
- createSort: (params: CmsEntryFieldSortingPluginCreateSortParams) => CmsEntryFieldSortingPluginCreateSortResult;
32
- canUse: (params: CmsEntryFieldSortingPluginCanUseParams) => boolean;
33
- }
34
- export declare class CmsEntryFieldSortingPlugin extends Plugin {
35
- static readonly type: string;
36
- private readonly config;
37
- constructor(config: CmsEntryFieldSortingPluginConfig);
38
- canUse(params: CmsEntryFieldSortingPluginCanUseParams): boolean;
39
- createSort(params: CmsEntryFieldSortingPluginCreateSortParams): CmsEntryFieldSortingPluginCreateSortResult;
40
- }
41
- export declare const createCmsEntryFieldSortingPlugin: (config: CmsEntryFieldSortingPluginConfig) => CmsEntryFieldSortingPlugin;
42
- export {};
@@ -1,20 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- class CmsEntryFieldSortingPlugin extends Plugin {
3
- static{
4
- this.type = "cms.entry.field.sorting";
5
- }
6
- constructor(config){
7
- super();
8
- this.config = config;
9
- }
10
- canUse(params) {
11
- return this.config.canUse(params);
12
- }
13
- createSort(params) {
14
- return this.config.createSort(params);
15
- }
16
- }
17
- const createCmsEntryFieldSortingPlugin = (config)=>new CmsEntryFieldSortingPlugin(config);
18
- export { CmsEntryFieldSortingPlugin, createCmsEntryFieldSortingPlugin };
19
-
20
- //# sourceMappingURL=CmsEntryFieldSortingPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/CmsEntryFieldSortingPlugin.js","sources":["../../src/plugins/CmsEntryFieldSortingPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface CmsEntryFieldSortingPluginCanUseParams {\n model: CmsModel;\n field?: Field;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n /**\n * Combination of fieldId and sortBy\n *\n * example: id_ASC or createdBy_DESC\n */\n sortBy: string;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortParams {\n model: CmsModel;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n sortBy: string;\n fields: Record<string, Field>;\n field?: Field;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortResult {\n valuePath: string;\n reverse: boolean;\n fieldId: string;\n field: Field;\n}\n\ninterface CmsEntryFieldSortingPluginConfig {\n createSort: (\n params: CmsEntryFieldSortingPluginCreateSortParams\n ) => CmsEntryFieldSortingPluginCreateSortResult;\n canUse: (params: CmsEntryFieldSortingPluginCanUseParams) => boolean;\n}\n\nexport class CmsEntryFieldSortingPlugin extends Plugin {\n public static override readonly type: string = \"cms.entry.field.sorting\";\n private readonly config: CmsEntryFieldSortingPluginConfig;\n\n public constructor(config: CmsEntryFieldSortingPluginConfig) {\n super();\n this.config = config;\n }\n\n public canUse(params: CmsEntryFieldSortingPluginCanUseParams): boolean {\n return this.config.canUse(params);\n }\n\n public createSort(\n params: CmsEntryFieldSortingPluginCreateSortParams\n ): CmsEntryFieldSortingPluginCreateSortResult {\n return this.config.createSort(params);\n }\n}\n\nexport const createCmsEntryFieldSortingPlugin = (config: CmsEntryFieldSortingPluginConfig) => {\n return new CmsEntryFieldSortingPlugin(config);\n};\n"],"names":["CmsEntryFieldSortingPlugin","Plugin","config","params","createCmsEntryFieldSortingPlugin"],"mappings":";AAwCO,MAAMA,mCAAmCC;;aACZ,IAAI,GAAW;;IAG/C,YAAmBC,MAAwC,CAAE;QACzD,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEO,OAAOC,MAA8C,EAAW;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA;IAC9B;IAEO,WACHA,MAAkD,EACR;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAACA;IAClC;AACJ;AAEO,MAAMC,mCAAmC,CAACF,SACtC,IAAIF,2BAA2BE"}
@@ -1,11 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- import type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from "../types.js";
3
- type CmsFieldFilterValueTransformPluginParams = Omit<CmsFieldFilterValueTransformPluginInterface, "type">;
4
- export declare class CmsFieldFilterValueTransformPlugin extends Plugin implements Omit<CmsFieldFilterValueTransformPluginInterface, "type"> {
5
- static type: string;
6
- private config;
7
- get fieldType(): string;
8
- get transform(): CmsFieldFilterValueTransformPluginParams["transform"];
9
- constructor(config: CmsFieldFilterValueTransformPluginParams);
10
- }
11
- export {};
@@ -1,19 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- class CmsFieldFilterValueTransformPlugin extends Plugin {
3
- static{
4
- this.type = "cms-field-filter-value-transform";
5
- }
6
- get fieldType() {
7
- return this.config.fieldType;
8
- }
9
- get transform() {
10
- return this.config.transform;
11
- }
12
- constructor(config){
13
- super();
14
- this.config = config;
15
- }
16
- }
17
- export { CmsFieldFilterValueTransformPlugin };
18
-
19
- //# sourceMappingURL=CmsFieldFilterValueTransformPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/CmsFieldFilterValueTransformPlugin.js","sources":["../../src/plugins/CmsFieldFilterValueTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from \"~/types.js\";\n\ntype CmsFieldFilterValueTransformPluginParams = Omit<\n CmsFieldFilterValueTransformPluginInterface,\n \"type\"\n>;\nexport class CmsFieldFilterValueTransformPlugin\n extends Plugin\n implements Omit<CmsFieldFilterValueTransformPluginInterface, \"type\">\n{\n public static override type = \"cms-field-filter-value-transform\";\n\n private config: CmsFieldFilterValueTransformPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public get transform(): CmsFieldFilterValueTransformPluginParams[\"transform\"] {\n return this.config.transform;\n }\n\n public constructor(config: CmsFieldFilterValueTransformPluginParams) {\n super();\n this.config = config;\n }\n}\n"],"names":["CmsFieldFilterValueTransformPlugin","Plugin","config"],"mappings":";AAOO,MAAMA,2CACDC;;aAGe,IAAI,GAAG;;IAI9B,IAAW,YAAoB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,IAAW,YAAmE;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,YAAmBC,MAAgD,CAAE;QACjE,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;AACJ"}