@webiny/api-headless-cms-ddb-es 5.23.1-beta.0 → 5.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/definitions/entry.d.ts +2 -2
  2. package/definitions/entryElasticsearch.d.ts +2 -2
  3. package/definitions/group.d.ts +2 -2
  4. package/definitions/model.d.ts +2 -2
  5. package/definitions/settings.d.ts +2 -2
  6. package/definitions/system.d.ts +2 -2
  7. package/definitions/table.d.ts +2 -2
  8. package/definitions/tableElasticsearch.d.ts +2 -2
  9. package/dynamoDb/storage/richText.js +1 -0
  10. package/helpers/createElasticsearchQueryBody.js +3 -0
  11. package/helpers/fields.d.ts +1 -61
  12. package/helpers/transformValueForSearch.d.ts +5 -2
  13. package/helpers/transformValueForSearch.js +3 -0
  14. package/index.js +7 -7
  15. package/operations/entry/dataLoaders.d.ts +2 -2
  16. package/operations/entry/dataLoaders.js +9 -0
  17. package/operations/entry/fields.js +1 -0
  18. package/operations/entry/index.d.ts +2 -2
  19. package/operations/entry/index.js +19 -19
  20. package/operations/group/index.d.ts +2 -2
  21. package/operations/model/index.d.ts +2 -2
  22. package/operations/settings/index.d.ts +2 -2
  23. package/operations/system/createElasticsearchTemplate.d.ts +2 -2
  24. package/operations/system/index.d.ts +2 -2
  25. package/package.json +16 -18
  26. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +2 -2
  27. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +2 -2
  28. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +2 -2
  29. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +2 -2
  30. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +2 -2
  31. package/upgrades/utils.d.ts +3 -0
  32. package/upgrades/utils.js +4 -0
  33. package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +3 -0
  34. package/upgrades/v5.0.0/cleanDatabaseRecord.js +6 -2
  35. package/upgrades/v5.0.0/entryValueFixer.d.ts +3 -0
  36. package/upgrades/v5.0.0/fieldFinder.d.ts +3 -0
  37. package/upgrades/v5.0.0/fieldFinder.js +4 -0
  38. package/upgrades/v5.8.0/index.d.ts +3 -0
  39. package/upgrades/v5.8.0/index.js +3 -3
@@ -1,8 +1,8 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ export interface CreateEntryEntityParams {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createEntryEntity: (params: Params) => Entity<any>;
8
+ export declare const createEntryEntity: (params: CreateEntryEntityParams) => Entity<any>;
@@ -1,8 +1,8 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ export interface CreateEntryElasticsearchEntityParams {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createEntryElasticsearchEntity: (params: Params) => Entity<any>;
8
+ export declare const createEntryElasticsearchEntity: (params: CreateEntryElasticsearchEntityParams) => Entity<any>;
@@ -1,8 +1,8 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ export interface CreateGroupEntityParams {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createGroupEntity: (params: Params) => Entity<any>;
8
+ export declare const createGroupEntity: (params: CreateGroupEntityParams) => Entity<any>;
@@ -1,8 +1,8 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ export interface CreateModelEntityParams {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createModelEntity: (params: Params) => Entity<any>;
8
+ export declare const createModelEntity: (params: CreateModelEntityParams) => Entity<any>;
@@ -1,8 +1,8 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ export interface CreateSettingsEntityParams {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createSettingsEntity: (params: Params) => Entity<any>;
8
+ export declare const createSettingsEntity: (params: CreateSettingsEntityParams) => Entity<any>;
@@ -1,8 +1,8 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ export interface CreateSystemEntityParams {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createSystemEntity: (params: Params) => Entity<any>;
8
+ export declare const createSystemEntity: (params: CreateSystemEntityParams) => Entity<any>;
@@ -1,8 +1,8 @@
1
1
  import { TableModifier } from "../types";
2
2
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
3
3
  import { Table } from "dynamodb-toolbox";
4
- export interface Params {
4
+ export interface CreateTableParams {
5
5
  table?: TableModifier;
6
6
  documentClient: DocumentClient;
7
7
  }
8
- export declare const createTable: ({ table, documentClient }: Params) => Table;
8
+ export declare const createTable: ({ table, documentClient }: CreateTableParams) => Table;
@@ -1,8 +1,8 @@
1
1
  import { TableModifier } from "../types";
2
2
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
3
3
  import { Table } from "dynamodb-toolbox";
4
- export interface Params {
4
+ export interface CreateElasticsearchTableParams {
5
5
  table?: TableModifier;
6
6
  documentClient: DocumentClient;
7
7
  }
8
- export declare const createElasticsearchTable: ({ table, documentClient }: Params) => Table;
8
+ export declare const createElasticsearchTable: ({ table, documentClient }: CreateElasticsearchTableParams) => Table;
@@ -18,6 +18,7 @@ var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/
18
18
  * https://github.com/rgcl/jsonpack/pull/25/files
19
19
  * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.
20
20
  */
21
+ // TODO @ts-refactor figure better type
21
22
  const transformArray = value => {
22
23
  if (!value) {
23
24
  return value;
@@ -161,6 +161,9 @@ const createFieldPath = ({
161
161
  }
162
162
 
163
163
  if (!path) {
164
+ /**
165
+ * We know that modelFieldPath is a string or undefined at this point.
166
+ */
164
167
  path = modelField.path || modelField.field.fieldId || modelField.field.id;
165
168
  }
166
169
 
@@ -12,66 +12,6 @@ export interface ModelField {
12
12
  path?: ModelFieldPath;
13
13
  }
14
14
  export declare type ModelFields = Record<string, ModelField>;
15
- export declare const systemFields: {
16
- id: {
17
- type: string;
18
- isSystemField: boolean;
19
- isSearchable: boolean;
20
- isSortable: boolean;
21
- field: CmsModelField;
22
- };
23
- entryId: {
24
- type: string;
25
- isSystemField: boolean;
26
- isSearchable: boolean;
27
- isSortable: boolean;
28
- field: CmsModelField;
29
- };
30
- savedOn: {
31
- type: string;
32
- unmappedType: string;
33
- keyword: boolean;
34
- isSystemField: boolean;
35
- isSearchable: boolean;
36
- isSortable: boolean;
37
- field: CmsModelField;
38
- };
39
- createdOn: {
40
- type: string;
41
- unmappedType: string;
42
- keyword: boolean;
43
- isSystemField: boolean;
44
- isSearchable: boolean;
45
- isSortable: boolean;
46
- field: CmsModelField;
47
- };
48
- createdBy: {
49
- type: string;
50
- unmappedType: any;
51
- isSystemField: boolean;
52
- isSearchable: boolean;
53
- isSortable: boolean;
54
- path: string;
55
- field: CmsModelField;
56
- };
57
- ownedBy: {
58
- type: string;
59
- unmappedType: any;
60
- isSystemField: boolean;
61
- isSearchable: boolean;
62
- isSortable: boolean;
63
- path: string;
64
- field: CmsModelField;
65
- };
66
- version: {
67
- type: string;
68
- unmappedType: any;
69
- keyword: boolean;
70
- isSystemField: boolean;
71
- isSearchable: boolean;
72
- isSortable: boolean;
73
- field: CmsModelField;
74
- };
75
- };
15
+ export declare const systemFields: ModelFields;
76
16
  export declare const createModelFields: (plugins: PluginsContainer, model: CmsModel) => ModelFields;
77
17
  export {};
@@ -1,9 +1,12 @@
1
1
  import { ElasticsearchQuerySearchValuePlugins } from "./searchPluginsList";
2
2
  import { CmsModelField } from "@webiny/api-headless-cms/types";
3
- interface Params {
3
+ interface TransformValueForSearchParams {
4
4
  plugins: ElasticsearchQuerySearchValuePlugins;
5
5
  field: CmsModelField;
6
6
  value: any;
7
7
  }
8
- export declare const transformValueForSearch: (args: Params) => any;
8
+ /**
9
+ * Transformed can be anything.
10
+ */
11
+ export declare const transformValueForSearch: (args: TransformValueForSearchParams) => any;
9
12
  export {};
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.transformValueForSearch = void 0;
7
7
 
8
+ /**
9
+ * Transformed can be anything.
10
+ */
8
11
  const transformValueForSearch = args => {
9
12
  const {
10
13
  field,
package/index.js CHANGED
@@ -51,7 +51,7 @@ var _elasticsearchFields = require("./operations/entry/elasticsearchFields");
51
51
 
52
52
  const createStorageOperations = params => {
53
53
  const {
54
- attributes = {},
54
+ attributes,
55
55
  table,
56
56
  esTable,
57
57
  documentClient,
@@ -71,32 +71,32 @@ const createStorageOperations = params => {
71
71
  settings: (0, _settings2.createSettingsEntity)({
72
72
  entityName: _types.ENTITIES.SETTINGS,
73
73
  table: tableInstance,
74
- attributes: attributes[_types.ENTITIES.SETTINGS]
74
+ attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
75
75
  }),
76
76
  system: (0, _system2.createSystemEntity)({
77
77
  entityName: _types.ENTITIES.SYSTEM,
78
78
  table: tableInstance,
79
- attributes: attributes[_types.ENTITIES.SYSTEM]
79
+ attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
80
80
  }),
81
81
  groups: (0, _group.createGroupEntity)({
82
82
  entityName: _types.ENTITIES.GROUPS,
83
83
  table: tableInstance,
84
- attributes: attributes[_types.ENTITIES.GROUPS]
84
+ attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
85
85
  }),
86
86
  models: (0, _model2.createModelEntity)({
87
87
  entityName: _types.ENTITIES.MODELS,
88
88
  table: tableInstance,
89
- attributes: attributes[_types.ENTITIES.MODELS]
89
+ attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
90
90
  }),
91
91
  entries: (0, _entry2.createEntryEntity)({
92
92
  entityName: _types.ENTITIES.ENTRIES,
93
93
  table: tableInstance,
94
- attributes: attributes[_types.ENTITIES.ENTRIES]
94
+ attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
95
95
  }),
96
96
  entriesEs: (0, _entryElasticsearch.createEntryElasticsearchEntity)({
97
97
  entityName: _types.ENTITIES.ENTRIES_ES,
98
98
  table: tableElasticsearchInstance,
99
- attributes: attributes[_types.ENTITIES.ENTRIES_ES]
99
+ attributes: attributes ? attributes[_types.ENTITIES.ENTRIES_ES] : {}
100
100
  })
101
101
  };
102
102
  const plugins = new _plugins.PluginsContainer([
@@ -20,13 +20,13 @@ interface ClearLoaderParams {
20
20
  model: CmsModel;
21
21
  entry?: CmsEntry;
22
22
  }
23
- export interface Params {
23
+ export interface DataLoadersHandlerParams {
24
24
  entity: Entity<any>;
25
25
  }
26
26
  export declare class DataLoadersHandler {
27
27
  private readonly loaders;
28
28
  private readonly entity;
29
- constructor(params: any);
29
+ constructor(params: DataLoadersHandlerParams);
30
30
  getAllEntryRevisions(params: GetAllEntryRevisionsParams): Promise<CmsEntry[]>;
31
31
  clearAllEntryRevisions(params: ClearLoaderParams): void;
32
32
  getRevisionById(params: GetRevisionByIdParams): Promise<CmsEntry[]>;
@@ -94,6 +94,9 @@ const getRevisionById = params => {
94
94
  SK: sortKey
95
95
  });
96
96
  return collection;
97
+ /**
98
+ * We use any because there is no type for the return type.
99
+ */
97
100
  }, {});
98
101
  const records = await (0, _batchRead.batchReadAll)({
99
102
  table: entity.table,
@@ -135,6 +138,9 @@ const getPublishedRevisionByEntryId = params => {
135
138
  SK: publishedKey
136
139
  });
137
140
  return collection;
141
+ /**
142
+ * We use any because there is no type for the return type.
143
+ */
138
144
  }, {});
139
145
  const records = await (0, _batchRead.batchReadAll)({
140
146
  table: entity.table,
@@ -179,6 +185,9 @@ const getLatestRevisionByEntryId = params => {
179
185
  SK: latestKey
180
186
  });
181
187
  return collection;
188
+ /**
189
+ * We use any because there is no type for the return type.
190
+ */
182
191
  }, {});
183
192
  const records = await (0, _batchRead.batchReadAll)({
184
193
  table: entity.table,
@@ -7,6 +7,7 @@ exports.createElasticsearchFields = void 0;
7
7
 
8
8
  var _CmsEntryElasticsearchFieldPlugin = require("../../plugins/CmsEntryElasticsearchFieldPlugin");
9
9
 
10
+ // TODO @bruno Verify that this file is required?
10
11
  const fieldsWithKeywords = ["text", "long-text", "rich-text", "id", "ref"];
11
12
  /**
12
13
  * We need to map entry system fields that have different paths, no keyword or not sortable.
@@ -4,10 +4,10 @@ import { Client } from "@elastic/elasticsearch";
4
4
  import { PluginsContainer } from "@webiny/plugins";
5
5
  export declare const createLatestType: () => string;
6
6
  export declare const createPublishedType: () => string;
7
- export interface Params {
7
+ export interface CreateEntriesStorageOperationsParams {
8
8
  entity: Entity<any>;
9
9
  esEntity: Entity<any>;
10
10
  elasticsearch: Client;
11
11
  plugins: PluginsContainer;
12
12
  }
13
- export declare const createEntriesStorageOperations: (params: Params) => CmsEntryStorageOperations;
13
+ export declare const createEntriesStorageOperations: (params: CreateEntriesStorageOperationsParams) => CmsEntryStorageOperations;
@@ -17,9 +17,9 @@ var _configurations = _interopRequireDefault(require("../../configurations"));
17
17
 
18
18
  var _error = _interopRequireDefault(require("@webiny/error"));
19
19
 
20
- var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
20
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
21
21
 
22
- var _lodash2 = _interopRequireDefault(require("lodash.omit"));
22
+ var _omit = _interopRequireDefault(require("lodash/omit"));
23
23
 
24
24
  var _compression = require("@webiny/api-elasticsearch/compression");
25
25
 
@@ -62,7 +62,7 @@ const createPublishedType = () => {
62
62
  exports.createPublishedType = createPublishedType;
63
63
 
64
64
  const getEntryData = entry => {
65
- return _objectSpread(_objectSpread({}, (0, _lodash2.default)(entry, ["PK", "SK", "published", "latest"])), {}, {
65
+ return _objectSpread(_objectSpread({}, (0, _omit.default)(entry, ["PK", "SK", "published", "latest"])), {}, {
66
66
  TYPE: createType(),
67
67
  __type: createType()
68
68
  });
@@ -103,8 +103,8 @@ const createEntriesStorageOperations = params => {
103
103
  const esEntry = (0, _helpers.prepareEntryToIndex)({
104
104
  plugins,
105
105
  model,
106
- entry: (0, _lodash.default)(entry),
107
- storageEntry: (0, _lodash.default)(storageEntry)
106
+ entry: (0, _cloneDeep.default)(entry),
107
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
108
108
  });
109
109
 
110
110
  const {
@@ -177,8 +177,8 @@ const createEntriesStorageOperations = params => {
177
177
  const esEntry = (0, _helpers.prepareEntryToIndex)({
178
178
  plugins,
179
179
  model,
180
- entry: (0, _lodash.default)(entry),
181
- storageEntry: (0, _lodash.default)(storageEntry)
180
+ entry: (0, _cloneDeep.default)(entry),
181
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
182
182
  });
183
183
  const esLatestData = await getESLatestEntryData(plugins, esEntry);
184
184
  const items = [entity.putBatch(_objectSpread(_objectSpread({}, storageEntry), {}, {
@@ -279,8 +279,8 @@ const createEntriesStorageOperations = params => {
279
279
  const esEntry = (0, _helpers.prepareEntryToIndex)({
280
280
  plugins,
281
281
  model,
282
- entry: (0, _lodash.default)(entry),
283
- storageEntry: (0, _lodash.default)(storageEntry)
282
+ entry: (0, _cloneDeep.default)(entry),
283
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
284
284
  });
285
285
  elasticsearchLatestData = await getESLatestEntryData(plugins, esEntry);
286
286
  }
@@ -442,8 +442,8 @@ const createEntriesStorageOperations = params => {
442
442
  const esEntry = (0, _helpers.prepareEntryToIndex)({
443
443
  plugins,
444
444
  model,
445
- entry: (0, _lodash.default)(entryToSetAsLatest),
446
- storageEntry: (0, _lodash.default)(storageEntryToSetAsLatest)
445
+ entry: (0, _cloneDeep.default)(entryToSetAsLatest),
446
+ storageEntry: (0, _cloneDeep.default)(storageEntryToSetAsLatest)
447
447
  });
448
448
  const esLatestData = await getESLatestEntryData(plugins, esEntry);
449
449
  /**
@@ -713,8 +713,8 @@ const createEntriesStorageOperations = params => {
713
713
  const preparedEntryData = (0, _helpers.prepareEntryToIndex)({
714
714
  plugins,
715
715
  model,
716
- entry: (0, _lodash.default)(entry),
717
- storageEntry: (0, _lodash.default)(storageEntry)
716
+ entry: (0, _cloneDeep.default)(entry),
717
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
718
718
  });
719
719
  /**
720
720
  * Update the published revision entry in ES.
@@ -807,8 +807,8 @@ const createEntriesStorageOperations = params => {
807
807
  const preparedEntryData = (0, _helpers.prepareEntryToIndex)({
808
808
  plugins,
809
809
  model,
810
- entry: (0, _lodash.default)(entry),
811
- storageEntry: (0, _lodash.default)(storageEntry)
810
+ entry: (0, _cloneDeep.default)(entry),
811
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
812
812
  });
813
813
  const esLatestData = await getESLatestEntryData(plugins, preparedEntryData);
814
814
  esItems.push(esEntity.putBatch({
@@ -888,8 +888,8 @@ const createEntriesStorageOperations = params => {
888
888
  const preparedEntryData = (0, _helpers.prepareEntryToIndex)({
889
889
  plugins,
890
890
  model,
891
- entry: (0, _lodash.default)(entry),
892
- storageEntry: (0, _lodash.default)(storageEntry)
891
+ entry: (0, _cloneDeep.default)(entry),
892
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
893
893
  });
894
894
  esLatestData = await getESLatestEntryData(plugins, preparedEntryData);
895
895
  }
@@ -978,8 +978,8 @@ const createEntriesStorageOperations = params => {
978
978
  const preparedEntryData = (0, _helpers.prepareEntryToIndex)({
979
979
  plugins,
980
980
  model,
981
- entry: (0, _lodash.default)(entry),
982
- storageEntry: (0, _lodash.default)(storageEntry)
981
+ entry: (0, _cloneDeep.default)(entry),
982
+ storageEntry: (0, _cloneDeep.default)(storageEntry)
983
983
  });
984
984
  esLatestData = await getESLatestEntryData(plugins, preparedEntryData);
985
985
  }
@@ -1,8 +1,8 @@
1
1
  import { CmsGroupStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
3
  import { PluginsContainer } from "@webiny/plugins";
4
- export interface Params {
4
+ export interface CreateGroupsStorageOperationsParams {
5
5
  entity: Entity<any>;
6
6
  plugins: PluginsContainer;
7
7
  }
8
- export declare const createGroupsStorageOperations: (params: Params) => CmsGroupStorageOperations;
8
+ export declare const createGroupsStorageOperations: (params: CreateGroupsStorageOperationsParams) => CmsGroupStorageOperations;
@@ -1,8 +1,8 @@
1
1
  import { CmsModelStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
3
  import { Client } from "@elastic/elasticsearch";
4
- export interface Params {
4
+ export interface CreateModelsStorageOperationsParams {
5
5
  entity: Entity<any>;
6
6
  elasticsearch: Client;
7
7
  }
8
- export declare const createModelsStorageOperations: (params: Params) => CmsModelStorageOperations;
8
+ export declare const createModelsStorageOperations: (params: CreateModelsStorageOperationsParams) => CmsModelStorageOperations;
@@ -1,6 +1,6 @@
1
1
  import { CmsSettingsStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
- export interface Params {
3
+ export interface CreateSettingsStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  }
6
- export declare const createSettingsStorageOperations: (params: Params) => CmsSettingsStorageOperations;
6
+ export declare const createSettingsStorageOperations: (params: CreateSettingsStorageOperationsParams) => CmsSettingsStorageOperations;
@@ -1,5 +1,5 @@
1
1
  import { Client } from "@elastic/elasticsearch";
2
- export interface Params {
2
+ export interface CreateElasticsearchTemplateParams {
3
3
  elasticsearch: Client;
4
4
  }
5
- export declare const createElasticsearchTemplate: (params: Params) => Promise<void>;
5
+ export declare const createElasticsearchTemplate: (params: CreateElasticsearchTemplateParams) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
- export interface Params {
3
+ export interface CreateSystemStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  }
6
- export declare const createSystemStorageOperations: (params: Params) => CmsSystemStorageOperations;
6
+ export declare const createSystemStorageOperations: (params: CreateSystemStorageOperationsParams) => CmsSystemStorageOperations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "5.23.1-beta.0",
3
+ "version": "5.24.0",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
@@ -23,21 +23,19 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/runtime": "7.16.7",
26
- "@webiny/api-headless-cms": "5.23.1-beta.0",
27
- "@webiny/api-upgrade": "5.23.1-beta.0",
28
- "@webiny/db-dynamodb": "5.23.1-beta.0",
29
- "@webiny/error": "5.23.1-beta.0",
30
- "@webiny/handler": "5.23.1-beta.0",
31
- "@webiny/handler-aws": "5.23.1-beta.0",
32
- "@webiny/handler-db": "5.23.1-beta.0",
33
- "@webiny/plugins": "5.23.1-beta.0",
34
- "@webiny/utils": "5.23.1-beta.0",
26
+ "@webiny/api-headless-cms": "5.24.0",
27
+ "@webiny/api-upgrade": "5.24.0",
28
+ "@webiny/db-dynamodb": "5.24.0",
29
+ "@webiny/error": "5.24.0",
30
+ "@webiny/handler": "5.24.0",
31
+ "@webiny/handler-aws": "5.24.0",
32
+ "@webiny/handler-db": "5.24.0",
33
+ "@webiny/plugins": "5.24.0",
34
+ "@webiny/utils": "5.24.0",
35
35
  "dataloader": "2.0.0",
36
36
  "dynamodb-toolbox": "0.3.5",
37
37
  "jsonpack": "1.1.5",
38
- "lodash.chunk": "4.2.0",
39
- "lodash.clonedeep": "4.5.0",
40
- "lodash.omit": "4.5.0"
38
+ "lodash": "4.17.21"
41
39
  },
42
40
  "devDependencies": {
43
41
  "@babel/cli": "^7.16.0",
@@ -47,10 +45,10 @@
47
45
  "@elastic/elasticsearch": "7.12.0",
48
46
  "@shelf/jest-elasticsearch": "^1.0.0",
49
47
  "@types/jsonpack": "^1.1.0",
50
- "@webiny/api-dynamodb-to-elasticsearch": "^5.23.1-beta.0",
51
- "@webiny/api-elasticsearch": "^5.23.1-beta.0",
52
- "@webiny/cli": "^5.23.1-beta.0",
53
- "@webiny/project-utils": "^5.23.1-beta.0",
48
+ "@webiny/api-dynamodb-to-elasticsearch": "^5.24.0",
49
+ "@webiny/api-elasticsearch": "^5.24.0",
50
+ "@webiny/cli": "^5.24.0",
51
+ "@webiny/project-utils": "^5.24.0",
54
52
  "jest": "^26.6.3",
55
53
  "jest-dynalite": "^3.2.0",
56
54
  "jest-environment-node": "^26.6.2",
@@ -69,5 +67,5 @@
69
67
  "build": "yarn webiny run build",
70
68
  "watch": "yarn webiny run watch"
71
69
  },
72
- "gitHead": "05db67aebc2de3c33ba0622f730157ae14143b95"
70
+ "gitHead": "be0cbfcaa9247c658c44179af7943cc5d6d71bc7"
73
71
  }
@@ -3,7 +3,7 @@ import { CmsModel } from "@webiny/api-headless-cms/types";
3
3
  export interface ModifyBodyParams extends BaseModifyBodyParams {
4
4
  model: CmsModel;
5
5
  }
6
- export interface Config {
6
+ export interface CmsEntryElasticsearchBodyModifierPluginConfig {
7
7
  modifyBody: ModifyBodyCallable<ModifyBodyParams>;
8
8
  /**
9
9
  * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
@@ -13,5 +13,5 @@ export interface Config {
13
13
  export declare class CmsEntryElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin<ModifyBodyParams> {
14
14
  static readonly type: string;
15
15
  readonly modelId?: string;
16
- constructor(config: Config);
16
+ constructor(config: CmsEntryElasticsearchBodyModifierPluginConfig);
17
17
  }
@@ -1,5 +1,5 @@
1
1
  import { ElasticsearchFieldPlugin, Params as BaseParams } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchFieldPlugin";
2
- export interface Params extends BaseParams {
2
+ export interface CmsEntryElasticsearchFieldPluginParams extends BaseParams {
3
3
  /**
4
4
  * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
5
5
  */
@@ -8,5 +8,5 @@ export interface Params extends BaseParams {
8
8
  export declare class CmsEntryElasticsearchFieldPlugin extends ElasticsearchFieldPlugin {
9
9
  static readonly type: string;
10
10
  readonly modelId?: string;
11
- constructor(params: Params);
11
+ constructor(params: CmsEntryElasticsearchFieldPluginParams);
12
12
  }
@@ -15,7 +15,7 @@ export interface TransformCallableParams<T = any> {
15
15
  export interface TransformCallable<T = any> {
16
16
  (params: TransformCallableParams<T>): string;
17
17
  }
18
- export interface Params {
18
+ export interface CmsEntryElasticsearchQueryBuilderValueSearchPluginParams {
19
19
  fieldType: string;
20
20
  path?: string | CreatePathCallable;
21
21
  transform: TransformCallable;
@@ -24,7 +24,7 @@ export declare class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends
24
24
  static readonly type: string;
25
25
  private readonly config;
26
26
  get fieldType(): string;
27
- constructor(params: Params);
27
+ constructor(params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams);
28
28
  transform(params: TransformCallableParams): any;
29
29
  createPath(params: CreatePathCallableParams): string;
30
30
  }
@@ -3,7 +3,7 @@ import { CmsModel } from "@webiny/api-headless-cms/types";
3
3
  export interface ModifyQueryParams extends BaseModifyQueryParams {
4
4
  model: CmsModel;
5
5
  }
6
- export interface Config {
6
+ export interface CmsEntryElasticsearchQueryModifierPluginConfig {
7
7
  modifyQuery: ModifyQueryCallable<ModifyQueryParams>;
8
8
  /**
9
9
  * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
@@ -13,5 +13,5 @@ export interface Config {
13
13
  export declare class CmsEntryElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin<ModifyQueryParams> {
14
14
  static readonly type: string;
15
15
  readonly modelId?: string;
16
- constructor(config: Config);
16
+ constructor(config: CmsEntryElasticsearchQueryModifierPluginConfig);
17
17
  }
@@ -3,7 +3,7 @@ import { CmsModel } from "@webiny/api-headless-cms/types";
3
3
  export interface ModifySortParams extends BaseModifySortParams {
4
4
  model: CmsModel;
5
5
  }
6
- export interface Config {
6
+ export interface CmsEntryElasticsearchSortModifierPluginConfig {
7
7
  modifySort: ModifySortCallable<ModifySortParams>;
8
8
  /**
9
9
  * If modelId is not passed, there is no filtering of plugins by it when plugin is applied during the runtime.
@@ -13,5 +13,5 @@ export interface Config {
13
13
  export declare class CmsEntryElasticsearchSortModifierPlugin extends ElasticsearchSortModifierPlugin<ModifySortParams> {
14
14
  static readonly type: string;
15
15
  readonly modelId?: string;
16
- constructor(config: Config);
16
+ constructor(config: CmsEntryElasticsearchSortModifierPluginConfig);
17
17
  }
@@ -1 +1,4 @@
1
+ /**
2
+ * File not used anymore.
3
+ */
1
4
  export declare const paginateBatch: (items: any, perPage: any, execute: any) => Promise<void>;
package/upgrades/utils.js CHANGED
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.paginateBatch = void 0;
7
7
 
8
+ /**
9
+ * File not used anymore.
10
+ */
11
+ // @ts-nocheck
8
12
  const paginateBatch = async (items, perPage, execute) => {
9
13
  const pages = Math.ceil(items.length / perPage);
10
14
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * File not used anymore.
3
+ */
1
4
  import { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
2
5
  export declare const cleanDatabaseRecord: <T extends CmsModel | CmsEntry>(record: T & {
3
6
  PK?: string;
@@ -7,10 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.cleanDatabaseRecord = void 0;
9
9
 
10
- var _lodash = _interopRequireDefault(require("lodash.omit"));
10
+ var _omit = _interopRequireDefault(require("lodash/omit"));
11
11
 
12
+ /**
13
+ * File not used anymore.
14
+ */
15
+ // @ts-nocheck
12
16
  const cleanDatabaseRecord = record => {
13
- return (0, _lodash.default)(record, ["PK", "SK", "TYPE"]);
17
+ return (0, _omit.default)(record, ["PK", "SK", "TYPE"]);
14
18
  };
15
19
 
16
20
  exports.cleanDatabaseRecord = cleanDatabaseRecord;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * File not used anymore.
3
+ */
1
4
  import { ModelFieldFinder } from "./fieldFinder";
2
5
  import { CmsIndexEntry } from "../../types";
3
6
  import { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
@@ -1,3 +1,6 @@
1
+ /**
2
+ * File not used anymore.
3
+ */
1
4
  import { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
2
5
  export interface ModelFieldFinder {
3
6
  findById: (model: CmsModel | string, fieldId: string) => CmsModelField;
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createFieldFinder = void 0;
7
7
 
8
+ /**
9
+ * File not used anymore.
10
+ */
11
+ // @ts-nocheck
8
12
  const createFieldFinder = models => {
9
13
  const modelsList = {};
10
14
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * File not used anymore.
3
+ */
1
4
  import { UpgradePlugin } from "@webiny/api-upgrade/types";
2
5
  import { CmsContext } from "@webiny/api-headless-cms/types";
3
6
  declare const _default: () => UpgradePlugin<CmsContext>;
@@ -15,7 +15,7 @@ var _CmsContentEntryDynamoElastic = require("../../operations/entry/CmsContentEn
15
15
 
16
16
  var _error = _interopRequireDefault(require("@webiny/error"));
17
17
 
18
- var _lodash = _interopRequireDefault(require("lodash.chunk"));
18
+ var _chunk = _interopRequireDefault(require("lodash/chunk"));
19
19
 
20
20
  var _definitions = _interopRequireDefault(require("../../definitions"));
21
21
 
@@ -327,7 +327,7 @@ var _default = () => ({
327
327
  }
328
328
 
329
329
  try {
330
- const chunks = (0, _lodash.default)(updates, recordsInABatch);
330
+ const chunks = (0, _chunk.default)(updates, recordsInABatch);
331
331
 
332
332
  for (const key in chunks) {
333
333
  if (!chunks.hasOwnProperty(key)) {
@@ -402,7 +402,7 @@ var _default = () => ({
402
402
  * We will take breakMs ms break between each recordsInABatch records
403
403
  */
404
404
 
405
- const elasticUpdatesChunks = (0, _lodash.default)(elasticUpdates, recordsInABatch);
405
+ const elasticUpdatesChunks = (0, _chunk.default)(elasticUpdates, recordsInABatch);
406
406
  console.log(`[ELASTICSEARCH] Total chunks to be written with ${recordsInABatch} records in a batch: ${elasticUpdatesChunks.length}`);
407
407
 
408
408
  for (const elasticUpdateChunk of elasticUpdatesChunks) {