@webiny/api-headless-cms-ddb-es 0.0.0-unstable.5e7233243f → 0.0.0-unstable.615a930a68

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 (160) hide show
  1. package/configurations.js +1 -1
  2. package/definitions/entry.js +3 -7
  3. package/definitions/entry.js.map +1 -1
  4. package/definitions/entryElasticsearch.js +3 -7
  5. package/definitions/entryElasticsearch.js.map +1 -1
  6. package/definitions/group.js +3 -7
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.js +3 -7
  9. package/definitions/model.js.map +1 -1
  10. package/definitions/settings.js +3 -7
  11. package/definitions/settings.js.map +1 -1
  12. package/definitions/system.js +3 -7
  13. package/definitions/system.js.map +1 -1
  14. package/dynamoDb/storage/date.js +1 -1
  15. package/dynamoDb/storage/date.js.map +1 -1
  16. package/dynamoDb/storage/longText.js +1 -1
  17. package/dynamoDb/storage/richText.js +1 -1
  18. package/elasticsearch/createElasticsearchIndex.js +3 -3
  19. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  20. package/elasticsearch/index.d.ts +1 -1
  21. package/elasticsearch/index.js +1 -1
  22. package/elasticsearch/indexing/index.js +1 -1
  23. package/elasticsearch/indexing/longTextIndexing.d.ts +4 -0
  24. package/elasticsearch/indexing/longTextIndexing.js +20 -4
  25. package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
  26. package/elasticsearch/indices/base.js +2 -10
  27. package/elasticsearch/indices/base.js.map +1 -1
  28. package/elasticsearch/indices/index.d.ts +1 -1
  29. package/elasticsearch/indices/japanese.js +2 -10
  30. package/elasticsearch/indices/japanese.js.map +1 -1
  31. package/elasticsearch/search/refSearch.js +4 -2
  32. package/elasticsearch/search/refSearch.js.map +1 -1
  33. package/helpers/createElasticsearchQueryBody.js +20 -22
  34. package/helpers/createElasticsearchQueryBody.js.map +1 -1
  35. package/helpers/entryIndexHelpers.js +6 -11
  36. package/helpers/entryIndexHelpers.js.map +1 -1
  37. package/helpers/index.d.ts +0 -1
  38. package/helpers/index.js +0 -13
  39. package/helpers/index.js.map +1 -1
  40. package/index.d.ts +1 -0
  41. package/index.js +79 -13
  42. package/index.js.map +1 -1
  43. package/operations/entry/dataLoaders.js +7 -9
  44. package/operations/entry/dataLoaders.js.map +1 -1
  45. package/operations/entry/elasticsearch/body.d.ts +13 -0
  46. package/operations/entry/elasticsearch/body.js +162 -0
  47. package/operations/entry/elasticsearch/body.js.map +1 -0
  48. package/operations/entry/elasticsearch/fields.d.ts +9 -0
  49. package/operations/entry/elasticsearch/fields.js +248 -0
  50. package/operations/entry/elasticsearch/fields.js.map +1 -0
  51. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
  52. package/operations/entry/elasticsearch/filtering/applyFiltering.js +66 -0
  53. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
  54. package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
  55. package/operations/entry/elasticsearch/filtering/exec.js +214 -0
  56. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
  57. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
  58. package/operations/entry/elasticsearch/filtering/index.js +18 -0
  59. package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
  60. package/operations/entry/elasticsearch/filtering/path.d.ts +15 -0
  61. package/operations/entry/elasticsearch/filtering/path.js +52 -0
  62. package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
  63. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
  64. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +35 -0
  65. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
  66. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
  67. package/operations/entry/elasticsearch/filtering/plugins/index.js +18 -0
  68. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
  69. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
  70. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +78 -0
  71. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
  72. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
  73. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +58 -0
  74. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
  75. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
  76. package/operations/entry/elasticsearch/filtering/populated.js +30 -0
  77. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
  78. package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
  79. package/operations/entry/elasticsearch/filtering/values.js +28 -0
  80. package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
  81. package/operations/entry/elasticsearch/fullTextSearch.d.ts +9 -0
  82. package/operations/entry/elasticsearch/fullTextSearch.js +34 -0
  83. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  84. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  85. package/operations/entry/elasticsearch/fullTextSearchFields.js +52 -0
  86. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  87. package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
  88. package/operations/entry/elasticsearch/initialQuery.js +117 -0
  89. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  90. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  91. package/operations/entry/elasticsearch/keyword.js +38 -0
  92. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  93. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
  94. package/operations/entry/elasticsearch/plugins/bodyModifier.js +19 -0
  95. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
  96. package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
  97. package/operations/entry/elasticsearch/plugins/operator.js +45 -0
  98. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
  99. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
  100. package/operations/entry/elasticsearch/plugins/queryModifier.js +19 -0
  101. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
  102. package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
  103. package/operations/entry/elasticsearch/plugins/search.js +30 -0
  104. package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
  105. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
  106. package/operations/entry/elasticsearch/plugins/sortModifier.js +19 -0
  107. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
  108. package/operations/entry/elasticsearch/sort.d.ts +12 -0
  109. package/operations/entry/elasticsearch/sort.js +92 -0
  110. package/operations/entry/elasticsearch/sort.js.map +1 -0
  111. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
  112. package/operations/entry/elasticsearch/transformValueForSearch.js +34 -0
  113. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
  114. package/operations/entry/elasticsearch/types.d.ts +41 -0
  115. package/operations/entry/elasticsearch/types.js +5 -0
  116. package/operations/entry/elasticsearch/types.js.map +1 -0
  117. package/operations/entry/elasticsearchFields.js +3 -0
  118. package/operations/entry/elasticsearchFields.js.map +1 -1
  119. package/operations/entry/index.d.ts +0 -2
  120. package/operations/entry/index.js +86 -300
  121. package/operations/entry/index.js.map +1 -1
  122. package/operations/entry/recordType.d.ts +3 -0
  123. package/operations/entry/recordType.js +24 -0
  124. package/operations/entry/recordType.js.map +1 -0
  125. package/operations/group/index.js +7 -12
  126. package/operations/group/index.js.map +1 -1
  127. package/operations/model/index.js +4 -8
  128. package/operations/model/index.js.map +1 -1
  129. package/operations/settings/index.js +6 -10
  130. package/operations/settings/index.js.map +1 -1
  131. package/operations/system/index.js +4 -8
  132. package/operations/system/index.js.map +1 -1
  133. package/package.json +18 -19
  134. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +4 -1
  135. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -3
  136. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  137. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +1 -1
  138. package/plugins/CmsEntryElasticsearchFieldPlugin.js +3 -3
  139. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -1
  140. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +1 -1
  141. package/plugins/CmsEntryElasticsearchIndexPlugin.js +3 -3
  142. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  143. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +1 -1
  144. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -1
  145. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -3
  146. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  147. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -1
  148. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -3
  149. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  150. package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
  151. package/plugins/CmsEntryFilterPlugin.js +31 -0
  152. package/plugins/CmsEntryFilterPlugin.js.map +1 -0
  153. package/plugins/index.d.ts +6 -0
  154. package/plugins/index.js +83 -0
  155. package/plugins/index.js.map +1 -0
  156. package/types.d.ts +5 -2
  157. package/types.js.map +1 -1
  158. package/upgrades/index.d.ts +0 -2
  159. package/upgrades/index.js +0 -10
  160. package/upgrades/index.js.map +0 -1
@@ -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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginCollection } from "@webiny/plugins/types";
2
- import { CmsEntry, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
2
+ import { CmsContext as BaseCmsContext, CmsEntry, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
3
  import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
4
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
5
5
  import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
@@ -150,7 +150,7 @@ export interface StorageOperationsFactoryParams {
150
150
  attributes?: Record<ENTITIES, Attributes>;
151
151
  plugins?: PluginCollection;
152
152
  }
153
- export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
153
+ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
154
154
  getTable: () => Table;
155
155
  getEsTable: () => Table;
156
156
  getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
@@ -158,4 +158,7 @@ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOper
158
158
  export interface StorageOperationsFactory {
159
159
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
160
160
  }
161
+ export interface CmsContext extends BaseCmsContext {
162
+ [key: string]: any;
163
+ }
161
164
  export {};
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\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 {\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"],"mappings":";;;;;;;AAkBA;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"}
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"}
@@ -1,2 +0,0 @@
1
- declare const _default: () => never[];
2
- export default _default;
package/upgrades/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _default = () => [];
9
-
10
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export default () => [];\n"],"mappings":";;;;;;;eAAe,MAAM,E"}