@webiny/api-headless-cms-ddb-es 0.0.0-ee-vpcs.549378cf03

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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/configurations.d.ts +12 -0
  4. package/configurations.js +43 -0
  5. package/configurations.js.map +1 -0
  6. package/definitions/entry.d.ts +8 -0
  7. package/definitions/entry.js +90 -0
  8. package/definitions/entry.js.map +1 -0
  9. package/definitions/entryElasticsearch.d.ts +8 -0
  10. package/definitions/entryElasticsearch.js +42 -0
  11. package/definitions/entryElasticsearch.js.map +1 -0
  12. package/definitions/group.d.ts +8 -0
  13. package/definitions/group.js +70 -0
  14. package/definitions/group.js.map +1 -0
  15. package/definitions/model.d.ts +8 -0
  16. package/definitions/model.js +97 -0
  17. package/definitions/model.js.map +1 -0
  18. package/definitions/settings.d.ts +8 -0
  19. package/definitions/settings.js +58 -0
  20. package/definitions/settings.js.map +1 -0
  21. package/definitions/system.d.ts +8 -0
  22. package/definitions/system.js +46 -0
  23. package/definitions/system.js.map +1 -0
  24. package/definitions/table.d.ts +8 -0
  25. package/definitions/table.js +24 -0
  26. package/definitions/table.js.map +1 -0
  27. package/definitions/tableElasticsearch.d.ts +8 -0
  28. package/definitions/tableElasticsearch.js +24 -0
  29. package/definitions/tableElasticsearch.js.map +1 -0
  30. package/dynamoDb/index.d.ts +2 -0
  31. package/dynamoDb/index.js +16 -0
  32. package/dynamoDb/index.js.map +1 -0
  33. package/dynamoDb/storage/date.d.ts +3 -0
  34. package/dynamoDb/storage/date.js +99 -0
  35. package/dynamoDb/storage/date.js.map +1 -0
  36. package/dynamoDb/storage/longText.d.ts +10 -0
  37. package/dynamoDb/storage/longText.js +108 -0
  38. package/dynamoDb/storage/longText.js.map +1 -0
  39. package/dynamoDb/storage/richText.d.ts +7 -0
  40. package/dynamoDb/storage/richText.js +128 -0
  41. package/dynamoDb/storage/richText.js.map +1 -0
  42. package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
  43. package/elasticsearch/createElasticsearchIndex.js +60 -0
  44. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  45. package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
  46. package/elasticsearch/deleteElasticsearchIndex.js +43 -0
  47. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
  48. package/elasticsearch/index.d.ts +2 -0
  49. package/elasticsearch/index.js +16 -0
  50. package/elasticsearch/index.js.map +1 -0
  51. package/elasticsearch/indexing/dateTimeIndexing.d.ts +3 -0
  52. package/elasticsearch/indexing/dateTimeIndexing.js +103 -0
  53. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
  54. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +3 -0
  55. package/elasticsearch/indexing/defaultFieldIndexing.js +47 -0
  56. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
  57. package/elasticsearch/indexing/index.d.ts +2 -0
  58. package/elasticsearch/indexing/index.js +24 -0
  59. package/elasticsearch/indexing/index.js.map +1 -0
  60. package/elasticsearch/indexing/longTextIndexing.d.ts +7 -0
  61. package/elasticsearch/indexing/longTextIndexing.js +52 -0
  62. package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
  63. package/elasticsearch/indexing/numberIndexing.d.ts +3 -0
  64. package/elasticsearch/indexing/numberIndexing.js +48 -0
  65. package/elasticsearch/indexing/numberIndexing.js.map +1 -0
  66. package/elasticsearch/indexing/objectIndexing.d.ts +12 -0
  67. package/elasticsearch/indexing/objectIndexing.js +223 -0
  68. package/elasticsearch/indexing/objectIndexing.js.map +1 -0
  69. package/elasticsearch/indexing/richTextIndexing.d.ts +3 -0
  70. package/elasticsearch/indexing/richTextIndexing.js +34 -0
  71. package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
  72. package/elasticsearch/indices/base.d.ts +2 -0
  73. package/elasticsearch/indices/base.js +15 -0
  74. package/elasticsearch/indices/base.js.map +1 -0
  75. package/elasticsearch/indices/index.d.ts +1 -0
  76. package/elasticsearch/indices/index.js +16 -0
  77. package/elasticsearch/indices/index.js.map +1 -0
  78. package/elasticsearch/indices/japanese.d.ts +2 -0
  79. package/elasticsearch/indices/japanese.js +16 -0
  80. package/elasticsearch/indices/japanese.js.map +1 -0
  81. package/elasticsearch/search/index.d.ts +3 -0
  82. package/elasticsearch/search/index.js +14 -0
  83. package/elasticsearch/search/index.js.map +1 -0
  84. package/elasticsearch/search/refSearch.d.ts +2 -0
  85. package/elasticsearch/search/refSearch.js +35 -0
  86. package/elasticsearch/search/refSearch.js.map +1 -0
  87. package/elasticsearch/search/timeSearch.d.ts +2 -0
  88. package/elasticsearch/search/timeSearch.js +33 -0
  89. package/elasticsearch/search/timeSearch.js.map +1 -0
  90. package/helpers/entryIndexHelpers.d.ts +18 -0
  91. package/helpers/entryIndexHelpers.js +204 -0
  92. package/helpers/entryIndexHelpers.js.map +1 -0
  93. package/helpers/index.d.ts +1 -0
  94. package/helpers/index.js +18 -0
  95. package/helpers/index.js.map +1 -0
  96. package/index.d.ts +3 -0
  97. package/index.js +275 -0
  98. package/index.js.map +1 -0
  99. package/operations/entry/dataLoaders.d.ts +51 -0
  100. package/operations/entry/dataLoaders.js +365 -0
  101. package/operations/entry/dataLoaders.js.map +1 -0
  102. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
  103. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
  104. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
  105. package/operations/entry/elasticsearch/body.d.ts +13 -0
  106. package/operations/entry/elasticsearch/body.js +162 -0
  107. package/operations/entry/elasticsearch/body.js.map +1 -0
  108. package/operations/entry/elasticsearch/fields.d.ts +9 -0
  109. package/operations/entry/elasticsearch/fields.js +248 -0
  110. package/operations/entry/elasticsearch/fields.js.map +1 -0
  111. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
  112. package/operations/entry/elasticsearch/filtering/applyFiltering.js +66 -0
  113. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
  114. package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
  115. package/operations/entry/elasticsearch/filtering/exec.js +215 -0
  116. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
  117. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
  118. package/operations/entry/elasticsearch/filtering/index.js +18 -0
  119. package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
  120. package/operations/entry/elasticsearch/filtering/path.d.ts +15 -0
  121. package/operations/entry/elasticsearch/filtering/path.js +52 -0
  122. package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
  123. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
  124. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +35 -0
  125. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
  126. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
  127. package/operations/entry/elasticsearch/filtering/plugins/index.js +18 -0
  128. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
  129. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
  130. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +78 -0
  131. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
  132. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
  133. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +58 -0
  134. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
  135. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
  136. package/operations/entry/elasticsearch/filtering/populated.js +30 -0
  137. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
  138. package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
  139. package/operations/entry/elasticsearch/filtering/values.js +28 -0
  140. package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
  141. package/operations/entry/elasticsearch/fullTextSearch.d.ts +9 -0
  142. package/operations/entry/elasticsearch/fullTextSearch.js +34 -0
  143. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  144. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  145. package/operations/entry/elasticsearch/fullTextSearchFields.js +52 -0
  146. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  147. package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
  148. package/operations/entry/elasticsearch/initialQuery.js +117 -0
  149. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  150. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  151. package/operations/entry/elasticsearch/keyword.js +38 -0
  152. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  153. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
  154. package/operations/entry/elasticsearch/plugins/bodyModifier.js +19 -0
  155. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
  156. package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
  157. package/operations/entry/elasticsearch/plugins/operator.js +45 -0
  158. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
  159. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
  160. package/operations/entry/elasticsearch/plugins/queryModifier.js +19 -0
  161. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
  162. package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
  163. package/operations/entry/elasticsearch/plugins/search.js +30 -0
  164. package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
  165. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
  166. package/operations/entry/elasticsearch/plugins/sortModifier.js +19 -0
  167. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
  168. package/operations/entry/elasticsearch/sort.d.ts +12 -0
  169. package/operations/entry/elasticsearch/sort.js +92 -0
  170. package/operations/entry/elasticsearch/sort.js.map +1 -0
  171. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
  172. package/operations/entry/elasticsearch/transformValueForSearch.js +34 -0
  173. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
  174. package/operations/entry/elasticsearch/types.d.ts +41 -0
  175. package/operations/entry/elasticsearch/types.js +5 -0
  176. package/operations/entry/elasticsearch/types.js.map +1 -0
  177. package/operations/entry/elasticsearchFields.d.ts +2 -0
  178. package/operations/entry/elasticsearchFields.js +38 -0
  179. package/operations/entry/elasticsearchFields.js.map +1 -0
  180. package/operations/entry/index.d.ts +11 -0
  181. package/operations/entry/index.js +1251 -0
  182. package/operations/entry/index.js.map +1 -0
  183. package/operations/entry/keys.d.ts +12 -0
  184. package/operations/entry/keys.js +40 -0
  185. package/operations/entry/keys.js.map +1 -0
  186. package/operations/entry/recordType.d.ts +3 -0
  187. package/operations/entry/recordType.js +24 -0
  188. package/operations/entry/recordType.js.map +1 -0
  189. package/operations/group/index.d.ts +8 -0
  190. package/operations/group/index.js +195 -0
  191. package/operations/group/index.js.map +1 -0
  192. package/operations/model/index.d.ts +8 -0
  193. package/operations/model/index.js +204 -0
  194. package/operations/model/index.js.map +1 -0
  195. package/operations/settings/index.d.ts +6 -0
  196. package/operations/settings/index.js +135 -0
  197. package/operations/settings/index.js.map +1 -0
  198. package/operations/system/index.d.ts +6 -0
  199. package/operations/system/index.js +99 -0
  200. package/operations/system/index.js.map +1 -0
  201. package/package.json +68 -0
  202. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +20 -0
  203. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +24 -0
  204. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
  205. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +12 -0
  206. package/plugins/CmsEntryElasticsearchFieldPlugin.js +24 -0
  207. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -0
  208. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
  209. package/plugins/CmsEntryElasticsearchIndexPlugin.js +17 -0
  210. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
  211. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +30 -0
  212. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +43 -0
  213. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
  214. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +17 -0
  215. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +24 -0
  216. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
  217. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +17 -0
  218. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +24 -0
  219. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
  220. package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
  221. package/plugins/CmsEntryFilterPlugin.js +31 -0
  222. package/plugins/CmsEntryFilterPlugin.js.map +1 -0
  223. package/plugins/index.d.ts +6 -0
  224. package/plugins/index.js +83 -0
  225. package/plugins/index.js.map +1 -0
  226. package/types.d.ts +164 -0
  227. package/types.js +47 -0
  228. package/types.js.map +1 -0
@@ -0,0 +1,4 @@
1
+ import { ElasticsearchIndexPlugin } from "@webiny/api-elasticsearch";
2
+ export declare class CmsEntryElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {
3
+ static readonly type: string;
4
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CmsEntryElasticsearchIndexPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
+
14
+ class CmsEntryElasticsearchIndexPlugin extends _apiElasticsearch.ElasticsearchIndexPlugin {}
15
+
16
+ exports.CmsEntryElasticsearchIndexPlugin = CmsEntryElasticsearchIndexPlugin;
17
+ (0, _defineProperty2.default)(CmsEntryElasticsearchIndexPlugin, "type", "cms.entry.elasticsearch.index");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryElasticsearchIndexPlugin","ElasticsearchIndexPlugin"],"sources":["CmsEntryElasticsearchIndexPlugin.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class CmsEntryElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {\n public static override readonly type: string = \"cms.entry.elasticsearch.index\";\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEO,MAAMA,gCAAN,SAA+CC,0CAA/C,CAAwE;;;8BAAlED,gC,UACsC,+B"}
@@ -0,0 +1,30 @@
1
+ import { Plugin } from "@webiny/plugins/Plugin";
2
+ import { CmsModelField } from "@webiny/api-headless-cms/types";
3
+ export interface CreatePathCallableParams<T = any> {
4
+ field: CmsModelField;
5
+ key: string;
6
+ value: T;
7
+ }
8
+ export interface CreatePathCallable<T = any> {
9
+ (params: CreatePathCallableParams<T>): string;
10
+ }
11
+ export interface TransformCallableParams<T = any> {
12
+ field: CmsModelField;
13
+ value: T;
14
+ }
15
+ export interface TransformCallable<T = any> {
16
+ (params: TransformCallableParams<T>): string;
17
+ }
18
+ export interface CmsEntryElasticsearchQueryBuilderValueSearchPluginParams {
19
+ fieldType: string;
20
+ path?: string | CreatePathCallable;
21
+ transform: TransformCallable;
22
+ }
23
+ export declare class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends Plugin {
24
+ static readonly type: string;
25
+ private readonly config;
26
+ get fieldType(): string;
27
+ constructor(params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams);
28
+ transform(params: TransformCallableParams): any;
29
+ createPath(params: CreatePathCallableParams): string | null;
30
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CmsEntryElasticsearchQueryBuilderValueSearchPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _Plugin = require("@webiny/plugins/Plugin");
13
+
14
+ class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends _Plugin.Plugin {
15
+ get fieldType() {
16
+ return this.config.fieldType;
17
+ }
18
+
19
+ constructor(params) {
20
+ super();
21
+ (0, _defineProperty2.default)(this, "config", void 0);
22
+ this.config = params;
23
+ this.name = `${this.constructor.type}-${this.config.fieldType}`;
24
+ }
25
+
26
+ transform(params) {
27
+ return this.config.transform(params);
28
+ }
29
+
30
+ createPath(params) {
31
+ if (typeof this.config.path === "function") {
32
+ return this.config.path(params);
33
+ } else if (typeof this.config.path === "string") {
34
+ return this.config.path;
35
+ }
36
+
37
+ return null;
38
+ }
39
+
40
+ }
41
+
42
+ exports.CmsEntryElasticsearchQueryBuilderValueSearchPlugin = CmsEntryElasticsearchQueryBuilderValueSearchPlugin;
43
+ (0, _defineProperty2.default)(CmsEntryElasticsearchQueryBuilderValueSearchPlugin, "type", "cms-elastic-search-query-builder-value-search");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryElasticsearchQueryBuilderValueSearchPlugin","Plugin","fieldType","config","constructor","params","name","type","transform","createPath","path"],"sources":["CmsEntryElasticsearchQueryBuilderValueSearchPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreatePathCallableParams<T = any> {\n field: CmsModelField;\n key: string;\n value: T;\n}\n\nexport interface CreatePathCallable<T = any> {\n (params: CreatePathCallableParams<T>): string;\n}\n\nexport interface TransformCallableParams<T = any> {\n field: CmsModelField;\n value: T;\n}\nexport interface TransformCallable<T = any> {\n (params: TransformCallableParams<T>): string;\n}\n\nexport interface CmsEntryElasticsearchQueryBuilderValueSearchPluginParams {\n fieldType: string;\n path?: string | CreatePathCallable;\n transform: TransformCallable;\n}\nexport class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends Plugin {\n public static override readonly type: string = \"cms-elastic-search-query-builder-value-search\";\n\n private readonly config: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams) {\n super();\n\n this.config = params;\n this.name = `${(this.constructor as any).type}-${this.config.fieldType}`;\n }\n\n public transform(params: TransformCallableParams): any {\n return this.config.transform(params);\n }\n\n public createPath(params: CreatePathCallableParams): string | null {\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 return null;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AA0BO,MAAMA,kDAAN,SAAiEC,cAAjE,CAAwE;EAKvD,IAATC,SAAS,GAAW;IAC3B,OAAO,KAAKC,MAAL,CAAYD,SAAnB;EACH;;EAEME,WAAW,CAACC,MAAD,EAAmE;IACjF;IADiF;IAGjF,KAAKF,MAAL,GAAcE,MAAd;IACA,KAAKC,IAAL,GAAa,GAAG,KAAKF,WAAN,CAA0BG,IAAK,IAAG,KAAKJ,MAAL,CAAYD,SAAU,EAAvE;EACH;;EAEMM,SAAS,CAACH,MAAD,EAAuC;IACnD,OAAO,KAAKF,MAAL,CAAYK,SAAZ,CAAsBH,MAAtB,CAAP;EACH;;EAEMI,UAAU,CAACJ,MAAD,EAAkD;IAC/D,IAAI,OAAO,KAAKF,MAAL,CAAYO,IAAnB,KAA4B,UAAhC,EAA4C;MACxC,OAAO,KAAKP,MAAL,CAAYO,IAAZ,CAAiBL,MAAjB,CAAP;IACH,CAFD,MAEO,IAAI,OAAO,KAAKF,MAAL,CAAYO,IAAnB,KAA4B,QAAhC,EAA0C;MAC7C,OAAO,KAAKP,MAAL,CAAYO,IAAnB;IACH;;IACD,OAAO,IAAP;EACH;;AA3B0E;;;8BAAlEV,kD,UACsC,+C"}
@@ -0,0 +1,17 @@
1
+ import { ElasticsearchQueryModifierPlugin, ModifyQueryCallable, ModifyQueryParams as BaseModifyQueryParams } from "@webiny/api-elasticsearch";
2
+ import { CmsModel } from "@webiny/api-headless-cms/types";
3
+ export interface ModifyQueryParams extends BaseModifyQueryParams {
4
+ model: CmsModel;
5
+ }
6
+ export interface CmsEntryElasticsearchQueryModifierPluginConfig {
7
+ modifyQuery: ModifyQueryCallable<ModifyQueryParams>;
8
+ /**
9
+ * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
10
+ */
11
+ modelId?: string;
12
+ }
13
+ export declare class CmsEntryElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin<ModifyQueryParams> {
14
+ static readonly type: string;
15
+ readonly modelId?: string;
16
+ constructor(config: CmsEntryElasticsearchQueryModifierPluginConfig);
17
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CmsEntryElasticsearchQueryModifierPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
+
14
+ class CmsEntryElasticsearchQueryModifierPlugin extends _apiElasticsearch.ElasticsearchQueryModifierPlugin {
15
+ constructor(config) {
16
+ super(config.modifyQuery);
17
+ (0, _defineProperty2.default)(this, "modelId", void 0);
18
+ this.modelId = config.modelId;
19
+ }
20
+
21
+ }
22
+
23
+ exports.CmsEntryElasticsearchQueryModifierPlugin = CmsEntryElasticsearchQueryModifierPlugin;
24
+ (0, _defineProperty2.default)(CmsEntryElasticsearchQueryModifierPlugin, "type", "cms.elasticsearch.modifier.query.entry");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryElasticsearchQueryModifierPlugin","ElasticsearchQueryModifierPlugin","constructor","config","modifyQuery","modelId"],"sources":["CmsEntryElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import {\n ElasticsearchQueryModifierPlugin,\n ModifyQueryCallable,\n ModifyQueryParams as BaseModifyQueryParams\n} from \"@webiny/api-elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface ModifyQueryParams extends BaseModifyQueryParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryElasticsearchQueryModifierPluginConfig {\n modifyQuery: ModifyQueryCallable<ModifyQueryParams>;\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\n\nexport class CmsEntryElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin<ModifyQueryParams> {\n public static override readonly type: string = \"cms.elasticsearch.modifier.query.entry\";\n\n public readonly modelId?: string;\n\n public constructor(config: CmsEntryElasticsearchQueryModifierPluginConfig) {\n super(config.modifyQuery);\n\n this.modelId = config.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAmBO,MAAMA,wCAAN,SAAuDC,kDAAvD,CAA2G;EAKvGC,WAAW,CAACC,MAAD,EAAyD;IACvE,MAAMA,MAAM,CAACC,WAAb;IADuE;IAGvE,KAAKC,OAAL,GAAeF,MAAM,CAACE,OAAtB;EACH;;AAT6G;;;8BAArGL,wC,UACsC,wC"}
@@ -0,0 +1,17 @@
1
+ import { ElasticsearchSortModifierPlugin, ModifySortCallable, ModifySortParams as BaseModifySortParams } from "@webiny/api-elasticsearch";
2
+ import { CmsModel } from "@webiny/api-headless-cms/types";
3
+ export interface ModifySortParams extends BaseModifySortParams {
4
+ model: CmsModel;
5
+ }
6
+ export interface CmsEntryElasticsearchSortModifierPluginConfig {
7
+ modifySort: ModifySortCallable<ModifySortParams>;
8
+ /**
9
+ * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
10
+ */
11
+ modelId?: string;
12
+ }
13
+ export declare class CmsEntryElasticsearchSortModifierPlugin extends ElasticsearchSortModifierPlugin<ModifySortParams> {
14
+ static readonly type: string;
15
+ readonly modelId?: string;
16
+ constructor(config: CmsEntryElasticsearchSortModifierPluginConfig);
17
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CmsEntryElasticsearchSortModifierPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
+
14
+ class CmsEntryElasticsearchSortModifierPlugin extends _apiElasticsearch.ElasticsearchSortModifierPlugin {
15
+ constructor(config) {
16
+ super(config.modifySort);
17
+ (0, _defineProperty2.default)(this, "modelId", void 0);
18
+ this.modelId = config.modelId;
19
+ }
20
+
21
+ }
22
+
23
+ exports.CmsEntryElasticsearchSortModifierPlugin = CmsEntryElasticsearchSortModifierPlugin;
24
+ (0, _defineProperty2.default)(CmsEntryElasticsearchSortModifierPlugin, "type", "cms.elasticsearch.modifier.sort.entry");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryElasticsearchSortModifierPlugin","ElasticsearchSortModifierPlugin","constructor","config","modifySort","modelId"],"sources":["CmsEntryElasticsearchSortModifierPlugin.ts"],"sourcesContent":["import {\n ElasticsearchSortModifierPlugin,\n ModifySortCallable,\n ModifySortParams as BaseModifySortParams\n} from \"@webiny/api-elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface ModifySortParams extends BaseModifySortParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryElasticsearchSortModifierPluginConfig {\n modifySort: ModifySortCallable<ModifySortParams>;\n /**\n * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.\n */\n modelId?: string;\n}\n\nexport class CmsEntryElasticsearchSortModifierPlugin extends ElasticsearchSortModifierPlugin<ModifySortParams> {\n public static override readonly type: string = \"cms.elasticsearch.modifier.sort.entry\";\n\n public readonly modelId?: string;\n\n public constructor(config: CmsEntryElasticsearchSortModifierPluginConfig) {\n super(config.modifySort);\n this.modelId = config.modelId;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAmBO,MAAMA,uCAAN,SAAsDC,iDAAtD,CAAwG;EAKpGC,WAAW,CAACC,MAAD,EAAwD;IACtE,MAAMA,MAAM,CAACC,UAAb;IADsE;IAEtE,KAAKC,OAAL,GAAeF,MAAM,CAACE,OAAtB;EACH;;AAR0G;;;8BAAlGL,uC,UACsC,uC"}
@@ -0,0 +1,49 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
3
+ import { ModelField, ModelFields } from "../operations/entry/elasticsearch/types";
4
+ import { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
5
+ interface CmsEntryFilterPluginConfig {
6
+ fieldType: string;
7
+ exec: (params: ExecParams) => void;
8
+ }
9
+ interface ApplyParams {
10
+ key: string;
11
+ value: any;
12
+ query: ElasticsearchBoolQueryConfig;
13
+ operator: string;
14
+ field: ModelField;
15
+ }
16
+ export interface ApplyFilteringCb {
17
+ (params: ApplyParams): void;
18
+ }
19
+ export interface GetFilterPluginCb {
20
+ (type: string): CmsEntryFilterPlugin;
21
+ }
22
+ interface ExecParams {
23
+ applyFiltering: ApplyFilteringCb;
24
+ getFilterPlugin: GetFilterPluginCb;
25
+ key: string;
26
+ value: any;
27
+ operator: string;
28
+ field: ModelField;
29
+ fields: ModelFields;
30
+ query: ElasticsearchBoolQueryConfig;
31
+ }
32
+ export interface CmsEntryFilterPluginCreateResponse {
33
+ field: ModelField;
34
+ path: string;
35
+ fieldPathId: string;
36
+ plugin: ValueFilterPlugin;
37
+ negate: boolean;
38
+ compareValue: any;
39
+ transformValue: <I = any, O = any>(value: I) => O;
40
+ }
41
+ export declare class CmsEntryFilterPlugin extends Plugin {
42
+ static readonly type: string;
43
+ static readonly ALL: string;
44
+ private readonly config;
45
+ readonly fieldType: string;
46
+ constructor(config: CmsEntryFilterPluginConfig);
47
+ exec(params: ExecParams): void;
48
+ }
49
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CmsEntryFilterPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class CmsEntryFilterPlugin extends _plugins.Plugin {
15
+ constructor(config) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "config", void 0);
18
+ (0, _defineProperty2.default)(this, "fieldType", void 0);
19
+ this.config = config;
20
+ this.fieldType = this.config.fieldType;
21
+ }
22
+
23
+ exec(params) {
24
+ return this.config.exec(params);
25
+ }
26
+
27
+ }
28
+
29
+ exports.CmsEntryFilterPlugin = CmsEntryFilterPlugin;
30
+ (0, _defineProperty2.default)(CmsEntryFilterPlugin, "type", "cms.elasticsearch.entry.filter");
31
+ (0, _defineProperty2.default)(CmsEntryFilterPlugin, "ALL", "*");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryFilterPlugin","Plugin","constructor","config","fieldType","exec","params"],"sources":["CmsEntryFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { ModelField, ModelFields } from \"~/operations/entry/elasticsearch/types\";\nimport { ElasticsearchBoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\n\ninterface CmsEntryFilterPluginConfig {\n fieldType: string;\n exec: (params: ExecParams) => void;\n}\ninterface ApplyParams {\n key: string;\n value: any;\n query: ElasticsearchBoolQueryConfig;\n operator: string;\n field: ModelField;\n}\nexport interface ApplyFilteringCb {\n (params: ApplyParams): void;\n}\n\nexport interface GetFilterPluginCb {\n (type: string): CmsEntryFilterPlugin;\n}\n\ninterface ExecParams {\n applyFiltering: ApplyFilteringCb;\n getFilterPlugin: GetFilterPluginCb;\n key: string;\n value: any;\n operator: string;\n field: ModelField;\n fields: ModelFields;\n query: ElasticsearchBoolQueryConfig;\n}\n\nexport interface CmsEntryFilterPluginCreateResponse {\n field: ModelField;\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 CmsEntryFilterPlugin extends Plugin {\n public static override readonly type: string = \"cms.elasticsearch.entry.filter\";\n public static readonly ALL: string = \"*\";\n\n private readonly config: CmsEntryFilterPluginConfig;\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFilterPluginConfig) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public exec(params: ExecParams) {\n return this.config.exec(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AA6CO,MAAMA,oBAAN,SAAmCC,eAAnC,CAA0C;EAOtCC,WAAW,CAACC,MAAD,EAAqC;IACnD;IADmD;IAAA;IAEnD,KAAKA,MAAL,GAAcA,MAAd;IACA,KAAKC,SAAL,GAAiB,KAAKD,MAAL,CAAYC,SAA7B;EACH;;EAEMC,IAAI,CAACC,MAAD,EAAqB;IAC5B,OAAO,KAAKH,MAAL,CAAYE,IAAZ,CAAiBC,MAAjB,CAAP;EACH;;AAf4C;;;8BAApCN,oB,UACsC,gC;8BADtCA,oB,SAE4B,G"}
@@ -0,0 +1,6 @@
1
+ export * from "./CmsEntryElasticsearchBodyModifierPlugin";
2
+ export * from "./CmsEntryElasticsearchFieldPlugin";
3
+ export * from "./CmsEntryElasticsearchIndexPlugin";
4
+ export * from "./CmsEntryElasticsearchQueryBuilderValueSearchPlugin";
5
+ export * from "./CmsEntryElasticsearchQueryModifierPlugin";
6
+ export * from "./CmsEntryElasticsearchSortModifierPlugin";
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _CmsEntryElasticsearchBodyModifierPlugin = require("./CmsEntryElasticsearchBodyModifierPlugin");
8
+
9
+ Object.keys(_CmsEntryElasticsearchBodyModifierPlugin).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _CmsEntryElasticsearchBodyModifierPlugin[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _CmsEntryElasticsearchBodyModifierPlugin[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _CmsEntryElasticsearchFieldPlugin = require("./CmsEntryElasticsearchFieldPlugin");
21
+
22
+ Object.keys(_CmsEntryElasticsearchFieldPlugin).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _CmsEntryElasticsearchFieldPlugin[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _CmsEntryElasticsearchFieldPlugin[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _CmsEntryElasticsearchIndexPlugin = require("./CmsEntryElasticsearchIndexPlugin");
34
+
35
+ Object.keys(_CmsEntryElasticsearchIndexPlugin).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _CmsEntryElasticsearchIndexPlugin[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _CmsEntryElasticsearchIndexPlugin[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _CmsEntryElasticsearchQueryBuilderValueSearchPlugin = require("./CmsEntryElasticsearchQueryBuilderValueSearchPlugin");
47
+
48
+ Object.keys(_CmsEntryElasticsearchQueryBuilderValueSearchPlugin).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _CmsEntryElasticsearchQueryBuilderValueSearchPlugin[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _CmsEntryElasticsearchQueryBuilderValueSearchPlugin[key];
55
+ }
56
+ });
57
+ });
58
+
59
+ var _CmsEntryElasticsearchQueryModifierPlugin = require("./CmsEntryElasticsearchQueryModifierPlugin");
60
+
61
+ Object.keys(_CmsEntryElasticsearchQueryModifierPlugin).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _CmsEntryElasticsearchQueryModifierPlugin[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _CmsEntryElasticsearchQueryModifierPlugin[key];
68
+ }
69
+ });
70
+ });
71
+
72
+ var _CmsEntryElasticsearchSortModifierPlugin = require("./CmsEntryElasticsearchSortModifierPlugin");
73
+
74
+ Object.keys(_CmsEntryElasticsearchSortModifierPlugin).forEach(function (key) {
75
+ if (key === "default" || key === "__esModule") return;
76
+ if (key in exports && exports[key] === _CmsEntryElasticsearchSortModifierPlugin[key]) return;
77
+ Object.defineProperty(exports, key, {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _CmsEntryElasticsearchSortModifierPlugin[key];
81
+ }
82
+ });
83
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryElasticsearchBodyModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchFieldPlugin\";\nexport * from \"./CmsEntryElasticsearchIndexPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryBuilderValueSearchPlugin\";\nexport * from \"./CmsEntryElasticsearchQueryModifierPlugin\";\nexport * from \"./CmsEntryElasticsearchSortModifierPlugin\";\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;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
package/types.d.ts ADDED
@@ -0,0 +1,164 @@
1
+ import { Plugin, PluginCollection } from "@webiny/plugins/types";
2
+ import { CmsContext as BaseCmsContext, CmsEntry, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
+ import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
5
+ import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
6
+ import { Client } from "@elastic/elasticsearch";
7
+ import { Entity, Table } from "dynamodb-toolbox";
8
+ import { PluginsContainer } from "@webiny/plugins";
9
+ /**
10
+ * A definition of the entry that is being prepared for the Elasticsearch.
11
+ *
12
+ * @category Elasticsearch
13
+ * @category CmsEntry
14
+ */
15
+ export interface CmsIndexEntry extends CmsEntry {
16
+ /**
17
+ * Values that are not going to be indexed.
18
+ */
19
+ rawValues: Record<string, any>;
20
+ /**
21
+ * A first part of the ID, without the revision.
22
+ * For example, we can search for all the revisions of the given entry.
23
+ */
24
+ primaryId: string;
25
+ /**
26
+ * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.
27
+ */
28
+ [key: string]: any;
29
+ }
30
+ /**
31
+ * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.
32
+ *
33
+ * @category Elasticsearch
34
+ * @category CmsEntry
35
+ */
36
+ interface CmsModelFieldToElasticsearchToParams {
37
+ plugins: PluginsContainer;
38
+ model: CmsModel;
39
+ field: CmsModelField;
40
+ /**
41
+ * Raw value on the entry - before prepare for storage.
42
+ */
43
+ rawValue: any;
44
+ /**
45
+ * Value prepared for storage received from base api-headless-cms package.
46
+ */
47
+ value: any;
48
+ getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;
49
+ getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;
50
+ }
51
+ /**
52
+ * Arguments for the method that is transforming content entry from Elasticsearch into the original one.
53
+ *
54
+ * @category Elasticsearch
55
+ * @category CmsEntry
56
+ */
57
+ interface CmsModelFieldToElasticsearchFromParams {
58
+ plugins: PluginsContainer;
59
+ model: CmsModel;
60
+ field: CmsModelField;
61
+ value: any;
62
+ rawValue: any;
63
+ getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;
64
+ getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;
65
+ }
66
+ interface ToIndexValue {
67
+ /**
68
+ * Use this key to store value for indexing.
69
+ */
70
+ value?: any;
71
+ /**
72
+ * Use this key to tell ES that this value should not be indexed.
73
+ */
74
+ rawValue?: any;
75
+ }
76
+ /**
77
+ * A plugin defining transformation of entry for Elasticsearch.
78
+ *
79
+ * @category Plugin
80
+ * @category ContentModelField
81
+ * @category CmsEntry
82
+ * @category Elasticsearch
83
+ */
84
+ export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
85
+ /**
86
+ * A plugin type
87
+ */
88
+ type: "cms-model-field-to-elastic-search";
89
+ /**
90
+ * A unique identifier of the field type (text, number, json, myField, ...).
91
+ *
92
+ * ```ts
93
+ * fieldType: "myField"
94
+ * ```
95
+ */
96
+ fieldType: string;
97
+ /**
98
+ * If you need to define a type when building an Elasticsearch query.
99
+ * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.
100
+ *
101
+ * ```ts
102
+ * unmappedType: "date"
103
+ * ```
104
+ */
105
+ unmappedType?: (field: CmsModelField) => string;
106
+ /**
107
+ * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.
108
+ * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.
109
+ *
110
+ * ```ts
111
+ * toIndex({ value }) {
112
+ * return {
113
+ * value: value, // This will be stored and indexed
114
+ * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing
115
+ * };
116
+ * }
117
+ * ```
118
+ */
119
+ toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;
120
+ /**
121
+ * This is meant to revert a transformation done in the `toIndex` method.
122
+ * You have access to "value" or a "rawValue", depending on what you returned from `toIndex`.
123
+ *
124
+ * ```ts
125
+ * fromIndex({ value, rawValue }) {
126
+ * return JSON.parse(rawValue);
127
+ * }
128
+ * ```
129
+ */
130
+ fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;
131
+ }
132
+ export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
133
+ export declare type Attributes = Record<string, AttributeDefinition>;
134
+ export declare enum ENTITIES {
135
+ SYSTEM = "CmsSystem",
136
+ SETTINGS = "CmsSettings",
137
+ GROUPS = "CmsGroups",
138
+ MODELS = "CmsModels",
139
+ ENTRIES = "CmsEntries",
140
+ ENTRIES_ES = "CmsEntriesElasticsearch"
141
+ }
142
+ export interface TableModifier {
143
+ (table: TableConstructor): TableConstructor;
144
+ }
145
+ export interface StorageOperationsFactoryParams {
146
+ documentClient: DocumentClient;
147
+ elasticsearch: Client;
148
+ table?: TableModifier;
149
+ esTable?: TableModifier;
150
+ attributes?: Record<ENTITIES, Attributes>;
151
+ plugins?: PluginCollection;
152
+ }
153
+ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
154
+ getTable: () => Table;
155
+ getEsTable: () => Table;
156
+ getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
157
+ }
158
+ export interface StorageOperationsFactory {
159
+ (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
160
+ }
161
+ export interface CmsContext extends BaseCmsContext {
162
+ [key: string]: any;
163
+ }
164
+ export {};
package/types.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ENTITIES = void 0;
7
+
8
+ /**
9
+ * A definition of the entry that is being prepared for the Elasticsearch.
10
+ *
11
+ * @category Elasticsearch
12
+ * @category CmsEntry
13
+ */
14
+
15
+ /**
16
+ * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.
17
+ *
18
+ * @category Elasticsearch
19
+ * @category CmsEntry
20
+ */
21
+
22
+ /**
23
+ * Arguments for the method that is transforming content entry from Elasticsearch into the original one.
24
+ *
25
+ * @category Elasticsearch
26
+ * @category CmsEntry
27
+ */
28
+
29
+ /**
30
+ * A plugin defining transformation of entry for Elasticsearch.
31
+ *
32
+ * @category Plugin
33
+ * @category ContentModelField
34
+ * @category CmsEntry
35
+ * @category Elasticsearch
36
+ */
37
+ let ENTITIES;
38
+ exports.ENTITIES = ENTITIES;
39
+
40
+ (function (ENTITIES) {
41
+ ENTITIES["SYSTEM"] = "CmsSystem";
42
+ ENTITIES["SETTINGS"] = "CmsSettings";
43
+ ENTITIES["GROUPS"] = "CmsGroups";
44
+ ENTITIES["MODELS"] = "CmsModels";
45
+ ENTITIES["ENTRIES"] = "CmsEntries";
46
+ ENTITIES["ENTRIES_ES"] = "CmsEntriesElasticsearch";
47
+ })(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry extends CmsEntry {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Record<string, any>;\n /**\n * A first part of the ID, without the revision.\n * For example, we can search for all the revisions of the given entry.\n */\n primaryId: string;\n /**\n * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\n/**\n * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchToParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n /**\n * Raw value on the entry - before prepare for storage.\n */\n rawValue: any;\n /**\n * Value prepared for storage received from base api-headless-cms package.\n */\n value: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * Arguments for the method that is transforming content entry from Elasticsearch into the original one.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\ninterface CmsModelFieldToElasticsearchFromParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\ninterface ToIndexValue {\n /**\n * Use this key to store value for indexing.\n */\n value?: any;\n /**\n * Use this key to tell ES that this value should not be indexed.\n */\n rawValue?: any;\n}\n\n/**\n * A plugin defining transformation of entry for Elasticsearch.\n *\n * @category Plugin\n * @category ContentModelField\n * @category CmsEntry\n * @category Elasticsearch\n */\nexport interface CmsModelFieldToElasticsearchPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-elastic-search\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * If you need to define a type when building an Elasticsearch query.\n * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.\n *\n * ```ts\n * unmappedType: \"date\"\n * ```\n */\n unmappedType?: (field: CmsModelField) => string;\n /**\n * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.\n * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.\n *\n * ```ts\n * toIndex({ value }) {\n * return {\n * value: value, // This will be stored and indexed\n * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing\n * };\n * }\n * ```\n */\n toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;\n /**\n * This is meant to revert a transformation done in the `toIndex` method.\n * You have access to \"value\" or a \"rawValue\", depending on what you returned from `toIndex`.\n *\n * ```ts\n * fromIndex({ value, rawValue }) {\n * return JSON.parse(rawValue);\n * }\n * ```\n */\n fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;\n}\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n SETTINGS = \"CmsSettings\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DocumentClient;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table;\n getEsTable: () => Table;\n getEntities: () => Record<\n \"system\" | \"settings\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\n}\n"],"mappings":";;;;;;;AAmBA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAsDYA,Q;;;WAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;GAAAA,Q,wBAAAA,Q"}