@webiny/api-headless-cms-ddb 0.0.0-unstable.b14eaecf38 → 0.0.0-unstable.b6d7105cee

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 (165) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -5
  3. package/definitions/entry.js +10 -93
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -5
  6. package/definitions/group.js +10 -64
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -5
  9. package/definitions/model.js +10 -108
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/table.d.ts +4 -6
  12. package/definitions/table.js +7 -26
  13. package/definitions/table.js.map +1 -1
  14. package/definitions/types.d.ts +65 -0
  15. package/definitions/types.js +0 -0
  16. package/dynamoDb/index.d.ts +1 -1
  17. package/dynamoDb/index.js +8 -12
  18. package/dynamoDb/index.js.map +1 -1
  19. package/index.d.ts +2 -3
  20. package/index.js +87 -128
  21. package/index.js.map +1 -1
  22. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  23. package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
  24. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  25. package/operations/entry/dataLoader/constants.d.ts +1 -0
  26. package/operations/entry/dataLoader/constants.js +5 -0
  27. package/operations/entry/dataLoader/constants.js.map +1 -0
  28. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  29. package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
  30. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  31. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  32. package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
  33. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  34. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  35. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +40 -0
  36. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  37. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  38. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +40 -0
  39. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  40. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  41. package/operations/entry/dataLoader/getRevisionById.js +42 -0
  42. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  43. package/operations/entry/dataLoader/index.d.ts +8 -0
  44. package/operations/entry/dataLoader/index.js +18 -0
  45. package/operations/entry/dataLoader/index.js.map +1 -0
  46. package/operations/entry/dataLoader/types.d.ts +6 -0
  47. package/operations/entry/dataLoader/types.js +0 -0
  48. package/operations/entry/dataLoaders.d.ts +14 -30
  49. package/operations/entry/dataLoaders.js +84 -272
  50. package/operations/entry/dataLoaders.js.map +1 -1
  51. package/operations/entry/index.d.ts +5 -4
  52. package/operations/entry/index.js +899 -807
  53. package/operations/entry/index.js.map +1 -1
  54. package/operations/entry/keys.d.ts +46 -2
  55. package/operations/entry/keys.js +54 -49
  56. package/operations/entry/keys.js.map +1 -1
  57. package/operations/group/index.d.ts +4 -5
  58. package/operations/group/index.js +117 -158
  59. package/operations/group/index.js.map +1 -1
  60. package/operations/model/index.d.ts +3 -3
  61. package/operations/model/index.js +103 -134
  62. package/operations/model/index.js.map +1 -1
  63. package/package.json +32 -33
  64. package/plugins/index.d.ts +2 -4
  65. package/plugins/index.js +1 -49
  66. package/types.d.ts +25 -41
  67. package/types.js +8 -14
  68. package/types.js.map +1 -1
  69. package/definitions/settings.d.ts +0 -9
  70. package/definitions/settings.js +0 -53
  71. package/definitions/settings.js.map +0 -1
  72. package/definitions/system.d.ts +0 -9
  73. package/definitions/system.js +0 -41
  74. package/definitions/system.js.map +0 -1
  75. package/dynamoDb/path/plainObject.d.ts +0 -2
  76. package/dynamoDb/path/plainObject.js +0 -33
  77. package/dynamoDb/path/plainObject.js.map +0 -1
  78. package/dynamoDb/storage/date.d.ts +0 -3
  79. package/dynamoDb/storage/date.js +0 -91
  80. package/dynamoDb/storage/date.js.map +0 -1
  81. package/dynamoDb/storage/longText.d.ts +0 -10
  82. package/dynamoDb/storage/longText.js +0 -91
  83. package/dynamoDb/storage/longText.js.map +0 -1
  84. package/dynamoDb/storage/richText.d.ts +0 -2
  85. package/dynamoDb/storage/richText.js +0 -95
  86. package/dynamoDb/storage/richText.js.map +0 -1
  87. package/dynamoDb/transformValue/datetime.d.ts +0 -5
  88. package/dynamoDb/transformValue/datetime.js +0 -45
  89. package/dynamoDb/transformValue/datetime.js.map +0 -1
  90. package/operations/entry/filtering/createExpressions.d.ts +0 -26
  91. package/operations/entry/filtering/createExpressions.js +0 -176
  92. package/operations/entry/filtering/createExpressions.js.map +0 -1
  93. package/operations/entry/filtering/createFields.d.ts +0 -14
  94. package/operations/entry/filtering/createFields.js +0 -105
  95. package/operations/entry/filtering/createFields.js.map +0 -1
  96. package/operations/entry/filtering/extractSort.d.ts +0 -17
  97. package/operations/entry/filtering/extractSort.js +0 -67
  98. package/operations/entry/filtering/extractSort.js.map +0 -1
  99. package/operations/entry/filtering/filter.d.ts +0 -15
  100. package/operations/entry/filtering/filter.js +0 -143
  101. package/operations/entry/filtering/filter.js.map +0 -1
  102. package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
  103. package/operations/entry/filtering/fullTextSearch.js +0 -48
  104. package/operations/entry/filtering/fullTextSearch.js.map +0 -1
  105. package/operations/entry/filtering/getValue.d.ts +0 -5
  106. package/operations/entry/filtering/getValue.js +0 -63
  107. package/operations/entry/filtering/getValue.js.map +0 -1
  108. package/operations/entry/filtering/index.d.ts +0 -2
  109. package/operations/entry/filtering/index.js +0 -19
  110. package/operations/entry/filtering/index.js.map +0 -1
  111. package/operations/entry/filtering/mapPlugins.d.ts +0 -8
  112. package/operations/entry/filtering/mapPlugins.js +0 -31
  113. package/operations/entry/filtering/mapPlugins.js.map +0 -1
  114. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
  115. package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -41
  116. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
  117. package/operations/entry/filtering/plugins/index.d.ts +0 -1
  118. package/operations/entry/filtering/plugins/index.js +0 -13
  119. package/operations/entry/filtering/plugins/index.js.map +0 -1
  120. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
  121. package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -86
  122. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
  123. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -2
  124. package/operations/entry/filtering/plugins/refFilterCreate.js +0 -71
  125. package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
  126. package/operations/entry/filtering/sort.d.ts +0 -12
  127. package/operations/entry/filtering/sort.js +0 -69
  128. package/operations/entry/filtering/sort.js.map +0 -1
  129. package/operations/entry/filtering/systemFields.d.ts +0 -4
  130. package/operations/entry/filtering/systemFields.js +0 -70
  131. package/operations/entry/filtering/systemFields.js.map +0 -1
  132. package/operations/entry/filtering/transform.d.ts +0 -6
  133. package/operations/entry/filtering/transform.js +0 -16
  134. package/operations/entry/filtering/transform.js.map +0 -1
  135. package/operations/entry/filtering/types.d.ts +0 -40
  136. package/operations/entry/filtering/types.js +0 -5
  137. package/operations/entry/filtering/types.js.map +0 -1
  138. package/operations/entry/filtering/values.d.ts +0 -2
  139. package/operations/entry/filtering/values.js +0 -22
  140. package/operations/entry/filtering/values.js.map +0 -1
  141. package/operations/entry/filtering/where.d.ts +0 -5
  142. package/operations/entry/filtering/where.js +0 -32
  143. package/operations/entry/filtering/where.js.map +0 -1
  144. package/operations/entry/systemFields.d.ts +0 -2
  145. package/operations/entry/systemFields.js +0 -72
  146. package/operations/entry/systemFields.js.map +0 -1
  147. package/operations/settings/index.d.ts +0 -7
  148. package/operations/settings/index.js +0 -111
  149. package/operations/settings/index.js.map +0 -1
  150. package/operations/system/index.d.ts +0 -7
  151. package/operations/system/index.js +0 -82
  152. package/operations/system/index.js.map +0 -1
  153. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -22
  154. package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -41
  155. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
  156. package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
  157. package/plugins/CmsEntryFieldFilterPlugin.js +0 -24
  158. package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
  159. package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
  160. package/plugins/CmsEntryFieldSortingPlugin.js +0 -28
  161. package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
  162. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
  163. package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -24
  164. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
  165. package/plugins/index.js.map +0 -1
@@ -1,7 +0,0 @@
1
- import { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
2
- import { Entity } from "dynamodb-toolbox";
3
- interface CreateSystemStorageOperationsParams {
4
- entity: Entity<any>;
5
- }
6
- export declare const createSystemStorageOperations: (params: CreateSystemStorageOperationsParams) => CmsSystemStorageOperations;
7
- export {};
@@ -1,82 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSystemStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _error = _interopRequireDefault(require("@webiny/error"));
10
- var _get = require("@webiny/db-dynamodb/utils/get");
11
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
12
- const createPartitionKey = ({
13
- tenant
14
- }) => {
15
- return `T#${tenant.toLowerCase()}#SYSTEM`;
16
- };
17
- const createSortKey = () => {
18
- return "CMS";
19
- };
20
- const createKeys = params => {
21
- return {
22
- PK: createPartitionKey(params),
23
- SK: createSortKey()
24
- };
25
- };
26
- const createSystemStorageOperations = params => {
27
- const {
28
- entity
29
- } = params;
30
- const create = async ({
31
- system
32
- }) => {
33
- const keys = createKeys(system);
34
- try {
35
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, system), keys));
36
- return system;
37
- } catch (ex) {
38
- throw new _error.default(ex.message || "Could not create system.", ex.code || "CREATE_SYSTEM_ERROR", {
39
- error: ex,
40
- system,
41
- keys
42
- });
43
- }
44
- };
45
- const update = async params => {
46
- const {
47
- system
48
- } = params;
49
- const keys = createKeys(system);
50
- try {
51
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, system), keys));
52
- return system;
53
- } catch (ex) {
54
- throw new _error.default(ex.message || "Could not update system.", ex.code || "UPDATE_SYSTEM_ERROR", {
55
- error: ex,
56
- system,
57
- keys
58
- });
59
- }
60
- };
61
- const get = async params => {
62
- const keys = createKeys(params);
63
- try {
64
- const system = await (0, _get.get)({
65
- entity,
66
- keys
67
- });
68
- return (0, _cleanup.cleanupItem)(entity, system);
69
- } catch (ex) {
70
- throw new _error.default(ex.message || "Could not get system.", ex.code || "GET_SYSTEM_ERROR", {
71
- error: ex,
72
- keys
73
- });
74
- }
75
- };
76
- return {
77
- create,
78
- update,
79
- get
80
- };
81
- };
82
- exports.createSystemStorageOperations = createSystemStorageOperations;
@@ -1 +0,0 @@
1
- {"version":3,"names":["createPartitionKey","tenant","toLowerCase","createSortKey","createKeys","params","PK","SK","createSystemStorageOperations","entity","create","system","keys","put","ex","WebinyError","message","code","error","update","get","getRecord","cleanupItem"],"sources":["index.ts"],"sourcesContent":["import {\n CmsSystem,\n CmsSystemStorageOperations,\n CmsSystemStorageOperationsCreateParams,\n CmsSystemStorageOperationsGetParams,\n CmsSystemStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { get as getRecord } from \"@webiny/db-dynamodb/utils/get\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\n\ninterface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = ({ tenant }: PartitionKeyParams): string => {\n return `T#${tenant.toLowerCase()}#SYSTEM`;\n};\nconst createSortKey = (): string => {\n return \"CMS\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): CmsSystemStorageOperations => {\n const { entity } = params;\n\n const create = async ({ system }: CmsSystemStorageOperationsCreateParams) => {\n const keys = createKeys(system);\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create system.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSystemStorageOperationsUpdateParams) => {\n const { system } = params;\n\n const keys = createKeys(system);\n\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update system.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSystemStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const system = await getRecord<CmsSystem>({\n entity,\n keys\n });\n return cleanupItem(entity, system);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get system.\",\n ex.code || \"GET_SYSTEM_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n update,\n get\n };\n};\n"],"mappings":";;;;;;;;AAQA;AACA;AACA;AASA,MAAMA,kBAAkB,GAAG,CAAC;EAAEC;AAA2B,CAAC,KAAa;EACnE,OAAQ,KAAIA,MAAM,CAACC,WAAW,EAAG,SAAQ;AAC7C,CAAC;AACD,MAAMC,aAAa,GAAG,MAAc;EAChC,OAAO,KAAK;AAChB,CAAC;AAMD,MAAMC,UAAU,GAAIC,MAA0B,IAAW;EACrD,OAAO;IACHC,EAAE,EAAEN,kBAAkB,CAACK,MAAM,CAAC;IAC9BE,EAAE,EAAEJ,aAAa;EACrB,CAAC;AACL,CAAC;AAEM,MAAMK,6BAA6B,GACtCH,MAA2C,IACd;EAC7B,MAAM;IAAEI;EAAO,CAAC,GAAGJ,MAAM;EAEzB,MAAMK,MAAM,GAAG,OAAO;IAAEC;EAA+C,CAAC,KAAK;IACzE,MAAMC,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAC/B,IAAI;MACA,MAAMF,MAAM,CAACI,GAAG,6DACTF,MAAM,GACNC,IAAI,EACT;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTH,MAAM;QACNC;MACJ,CAAC,CACJ;IACL;EACJ,CAAC;EAED,MAAMO,MAAM,GAAG,MAAOd,MAA8C,IAAK;IACrE,MAAM;MAAEM;IAAO,CAAC,GAAGN,MAAM;IAEzB,MAAMO,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAE/B,IAAI;MACA,MAAMF,MAAM,CAACI,GAAG,6DACTF,MAAM,GACNC,IAAI,EACT;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTH,MAAM;QACNC;MACJ,CAAC,CACJ;IACL;EACJ,CAAC;EAED,MAAMQ,GAAG,GAAG,MAAOf,MAA2C,IAAK;IAC/D,MAAMO,IAAI,GAAGR,UAAU,CAACC,MAAM,CAAC;IAE/B,IAAI;MACA,MAAMM,MAAM,GAAG,MAAM,IAAAU,QAAS,EAAY;QACtCZ,MAAM;QACNG;MACJ,CAAC,CAAC;MACF,OAAO,IAAAU,oBAAW,EAACb,MAAM,EAAEE,MAAM,CAAC;IACtC,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,uBAAuB,EACrCF,EAAE,CAACG,IAAI,IAAI,kBAAkB,EAC7B;QACIC,KAAK,EAAEJ,EAAE;QACTF;MACJ,CAAC,CACJ;IACL;EACJ,CAAC;EAED,OAAO;IACHF,MAAM;IACNS,MAAM;IACNC;EACJ,CAAC;AACL,CAAC;AAAC"}
@@ -1,22 +0,0 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import { CmsModelField } from "@webiny/api-headless-cms/types";
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
- }
15
- export declare class CmsEntryFieldFilterPathPlugin extends Plugin {
16
- static readonly type: string;
17
- private readonly config;
18
- get fieldType(): string;
19
- constructor(config: CmsEntryFieldFilterPathPluginParams);
20
- canUse(field: Pick<CmsModelField, "fieldId" | "type">): boolean;
21
- createPath(params: CreatePathCallableParams): string;
22
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.CmsEntryFieldFilterPathPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _error = _interopRequireDefault(require("@webiny/error"));
10
- var _Plugin = require("@webiny/plugins/Plugin");
11
- class CmsEntryFieldFilterPathPlugin extends _Plugin.Plugin {
12
- get fieldType() {
13
- return this.config.fieldType;
14
- }
15
- constructor(config) {
16
- super();
17
- (0, _defineProperty2.default)(this, "config", void 0);
18
- this.config = config;
19
- this.name = `${this.constructor.type}-${this.config.fieldType}`;
20
- }
21
- canUse(field) {
22
- if (field.type !== this.config.fieldType) {
23
- return false;
24
- }
25
- const fieldId = this.config.fieldId;
26
- if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {
27
- return true;
28
- }
29
- return fieldId.includes(field.fieldId);
30
- }
31
- createPath(params) {
32
- if (typeof this.config.path === "function") {
33
- return this.config.path(params);
34
- } else if (typeof this.config.path === "string") {
35
- return this.config.path;
36
- }
37
- throw new _error.default(`Missing path in "${this.name}" plugin.`);
38
- }
39
- }
40
- exports.CmsEntryFieldFilterPathPlugin = CmsEntryFieldFilterPathPlugin;
41
- (0, _defineProperty2.default)(CmsEntryFieldFilterPathPlugin, "type", "cms-field-filter-path");
@@ -1 +0,0 @@
1
- {"version":3,"names":["CmsEntryFieldFilterPathPlugin","Plugin","fieldType","config","constructor","name","type","canUse","field","fieldId","Array","isArray","length","includes","createPath","params","path","WebinyError"],"sources":["CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\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}\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 this.name = `${(this.constructor as any).type}-${this.config.fieldType}`;\n }\n\n public canUse(field: Pick<CmsModelField, \"fieldId\" | \"type\">): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\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"],"mappings":";;;;;;;;AAAA;AACA;AAeO,MAAMA,6BAA6B,SAASC,cAAM,CAAC;EAKtD,IAAWC,SAAS,GAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAEOE,WAAW,CAACD,MAA2C,EAAE;IAC5D,KAAK,EAAE;IAAC;IAER,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACE,IAAI,GAAI,GAAG,IAAI,CAACD,WAAW,CAASE,IAAK,IAAG,IAAI,CAACH,MAAM,CAACD,SAAU,EAAC;EAC5E;EAEOK,MAAM,CAACC,KAA8C,EAAW;IACnE,IAAIA,KAAK,CAACF,IAAI,KAAK,IAAI,CAACH,MAAM,CAACD,SAAS,EAAE;MACtC,OAAO,KAAK;IAChB;IACA,MAAMO,OAAO,GAAG,IAAI,CAACN,MAAM,CAACM,OAAO;IACnC,IAAI,CAACA,OAAO,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,KAAK,KAAK,IAAIA,OAAO,CAACG,MAAM,KAAK,CAAC,EAAE;MACtE,OAAO,IAAI;IACf;IACA,OAAOH,OAAO,CAACI,QAAQ,CAACL,KAAK,CAACC,OAAO,CAAC;EAC1C;EAEOK,UAAU,CAACC,MAAgC,EAAU;IACxD,IAAI,OAAO,IAAI,CAACZ,MAAM,CAACa,IAAI,KAAK,UAAU,EAAE;MACxC,OAAO,IAAI,CAACb,MAAM,CAACa,IAAI,CAACD,MAAM,CAAC;IACnC,CAAC,MAAM,IAAI,OAAO,IAAI,CAACZ,MAAM,CAACa,IAAI,KAAK,QAAQ,EAAE;MAC7C,OAAO,IAAI,CAACb,MAAM,CAACa,IAAI;IAC3B;IACA,MAAM,IAAIC,cAAW,CAAE,oBAAmB,IAAI,CAACZ,IAAK,WAAU,CAAC;EACnE;AACJ;AAAC;AAAA,8BApCYL,6BAA6B,UACS,uBAAuB"}
@@ -1,43 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
3
- import { Field } from "../operations/entry/filtering/types";
4
- import { CmsFieldFilterValueTransformPlugin } from "../types";
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 {
10
- fieldType: string;
11
- create: (params: CmsEntryFieldFilterPluginCreateParams) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];
12
- }
13
- interface CmsEntryFieldFilterPluginCreateParams {
14
- key: string;
15
- value: any;
16
- field: Field;
17
- fields: Record<string, Field>;
18
- operation: string;
19
- valueFilterPlugins: Record<string, ValueFilterPlugin>;
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
- plugin: ValueFilterPlugin;
31
- negate: boolean;
32
- compareValue: any;
33
- transformValue: <I = any, O = any>(value: I) => O;
34
- }
35
- export declare class CmsEntryFieldFilterPlugin extends Plugin {
36
- static readonly type: string;
37
- static readonly ALL: string;
38
- private readonly config;
39
- readonly fieldType: string;
40
- constructor(config: CmsEntryFieldFilterPluginParams);
41
- create(params: CmsEntryFieldFilterPluginCreateParams): CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[] | null;
42
- }
43
- export {};
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.CmsEntryFieldFilterPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _plugins = require("@webiny/plugins");
10
- class CmsEntryFieldFilterPlugin extends _plugins.Plugin {
11
- constructor(config) {
12
- super();
13
- (0, _defineProperty2.default)(this, "config", void 0);
14
- (0, _defineProperty2.default)(this, "fieldType", void 0);
15
- this.config = config;
16
- this.fieldType = this.config.fieldType;
17
- }
18
- create(params) {
19
- return this.config.create(params);
20
- }
21
- }
22
- exports.CmsEntryFieldFilterPlugin = CmsEntryFieldFilterPlugin;
23
- (0, _defineProperty2.default)(CmsEntryFieldFilterPlugin, "type", "cms.dynamodb.entry.field.filter");
24
- (0, _defineProperty2.default)(CmsEntryFieldFilterPlugin, "ALL", "*");
@@ -1 +0,0 @@
1
- {"version":3,"names":["CmsEntryFieldFilterPlugin","Plugin","constructor","config","fieldType","create","params"],"sources":["CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { Field } from \"~/operations/entry/filtering/types\";\nimport { CmsFieldFilterValueTransformPlugin } from \"~/types\";\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 {\n fieldType: string;\n create: (\n params: CmsEntryFieldFilterPluginCreateParams\n ) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];\n}\n\ninterface CmsEntryFieldFilterPluginCreateParams {\n key: string;\n value: any;\n field: Field;\n fields: Record<string, Field>;\n operation: string;\n valueFilterPlugins: Record<string, ValueFilterPlugin>;\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 plugin: ValueFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport class CmsEntryFieldFilterPlugin 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;\n\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFieldFilterPluginParams) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public create(params: CmsEntryFieldFilterPluginCreateParams) {\n return this.config.create(params);\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAyCO,MAAMA,yBAAyB,SAASC,eAAM,CAAC;EAQ3CC,WAAW,CAACC,MAAuC,EAAE;IACxD,KAAK,EAAE;IAAC;IAAA;IACR,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACD,MAAM,CAACC,SAAS;EAC1C;EAEOC,MAAM,CAACC,MAA6C,EAAE;IACzD,OAAO,IAAI,CAACH,MAAM,CAACE,MAAM,CAACC,MAAM,CAAC;EACrC;AACJ;AAAC;AAAA,8BAjBYN,yBAAyB,UACa,iCAAiC;AAAA,8BADvEA,yBAAyB,SAEG,GAAG"}
@@ -1,42 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- import { Field } from "../operations/entry/filtering/types";
3
- import { CmsModel } from "@webiny/api-headless-cms/types";
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,28 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createCmsEntryFieldSortingPlugin = exports.CmsEntryFieldSortingPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _plugins = require("@webiny/plugins");
10
- class CmsEntryFieldSortingPlugin extends _plugins.Plugin {
11
- constructor(config) {
12
- super();
13
- (0, _defineProperty2.default)(this, "config", void 0);
14
- this.config = config;
15
- }
16
- canUse(params) {
17
- return this.config.canUse(params);
18
- }
19
- createSort(params) {
20
- return this.config.createSort(params);
21
- }
22
- }
23
- exports.CmsEntryFieldSortingPlugin = CmsEntryFieldSortingPlugin;
24
- (0, _defineProperty2.default)(CmsEntryFieldSortingPlugin, "type", "cms.entry.field.sorting");
25
- const createCmsEntryFieldSortingPlugin = config => {
26
- return new CmsEntryFieldSortingPlugin(config);
27
- };
28
- exports.createCmsEntryFieldSortingPlugin = createCmsEntryFieldSortingPlugin;
@@ -1 +0,0 @@
1
- {"version":3,"names":["CmsEntryFieldSortingPlugin","Plugin","constructor","config","canUse","params","createSort","createCmsEntryFieldSortingPlugin"],"sources":["CmsEntryFieldSortingPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { Field } from \"~/operations/entry/filtering/types\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\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"],"mappings":";;;;;;;;AAAA;AAwCO,MAAMA,0BAA0B,SAASC,eAAM,CAAC;EAI5CC,WAAW,CAACC,MAAwC,EAAE;IACzD,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEOC,MAAM,CAACC,MAA8C,EAAW;IACnE,OAAO,IAAI,CAACF,MAAM,CAACC,MAAM,CAACC,MAAM,CAAC;EACrC;EAEOC,UAAU,CACbD,MAAkD,EACR;IAC1C,OAAO,IAAI,CAACF,MAAM,CAACG,UAAU,CAACD,MAAM,CAAC;EACzC;AACJ;AAAC;AAAA,8BAlBYL,0BAA0B,UACY,yBAAyB;AAmBrE,MAAMO,gCAAgC,GAAIJ,MAAwC,IAAK;EAC1F,OAAO,IAAIH,0BAA0B,CAACG,MAAM,CAAC;AACjD,CAAC;AAAC"}
@@ -1,11 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- import { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from "../types";
3
- declare 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,24 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.CmsFieldFilterValueTransformPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _plugins = require("@webiny/plugins");
10
- class CmsFieldFilterValueTransformPlugin extends _plugins.Plugin {
11
- get fieldType() {
12
- return this.config.fieldType;
13
- }
14
- get transform() {
15
- return this.config.transform;
16
- }
17
- constructor(config) {
18
- super();
19
- (0, _defineProperty2.default)(this, "config", void 0);
20
- this.config = config;
21
- }
22
- }
23
- exports.CmsFieldFilterValueTransformPlugin = CmsFieldFilterValueTransformPlugin;
24
- (0, _defineProperty2.default)(CmsFieldFilterValueTransformPlugin, "type", "cms-field-filter-value-transform");
@@ -1 +0,0 @@
1
- {"version":3,"names":["CmsFieldFilterValueTransformPlugin","Plugin","fieldType","config","transform","constructor"],"sources":["CmsFieldFilterValueTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from \"~/types\";\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"],"mappings":";;;;;;;;AAAA;AAOO,MAAMA,kCAAkC,SACnCC,eAAM,CAElB;EAKI,IAAWC,SAAS,GAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAEA,IAAWE,SAAS,GAA0D;IAC1E,OAAO,IAAI,CAACD,MAAM,CAACC,SAAS;EAChC;EAEOC,WAAW,CAACF,MAAgD,EAAE;IACjE,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;AACJ;AAAC;AAAA,8BApBYH,kCAAkC,UAIb,kCAAkC"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryFieldFilterPathPlugin\";\nexport * from \"./CmsEntryFieldSortingPlugin\";\nexport * from \"./CmsEntryFieldFilterPlugin\";\nexport * from \"./CmsFieldFilterValueTransformPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}