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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createEntryEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createGroupEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createModelEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createSettingsEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createSystemEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,8 +1,9 @@
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
+ interface Params {
5
5
  table?: TableModifier;
6
6
  documentClient: DocumentClient;
7
7
  }
8
8
  export declare const createTable: ({ table, documentClient }: Params) => Table;
9
+ export {};
@@ -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;
package/index.js CHANGED
@@ -39,7 +39,7 @@ var _entry2 = require("./operations/entry");
39
39
 
40
40
  const createStorageOperations = params => {
41
41
  const {
42
- attributes = {},
42
+ attributes,
43
43
  table,
44
44
  documentClient,
45
45
  plugins: customPlugins,
@@ -53,27 +53,27 @@ const createStorageOperations = params => {
53
53
  settings: (0, _settings.createSettingsEntity)({
54
54
  entityName: _types.ENTITIES.SETTINGS,
55
55
  table: tableInstance,
56
- attributes: attributes[_types.ENTITIES.SETTINGS]
56
+ attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
57
57
  }),
58
58
  system: (0, _system.createSystemEntity)({
59
59
  entityName: _types.ENTITIES.SYSTEM,
60
60
  table: tableInstance,
61
- attributes: attributes[_types.ENTITIES.SYSTEM]
61
+ attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
62
62
  }),
63
63
  groups: (0, _group.createGroupEntity)({
64
64
  entityName: _types.ENTITIES.GROUPS,
65
65
  table: tableInstance,
66
- attributes: attributes[_types.ENTITIES.GROUPS]
66
+ attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
67
67
  }),
68
68
  models: (0, _model.createModelEntity)({
69
69
  entityName: _types.ENTITIES.MODELS,
70
70
  table: tableInstance,
71
- attributes: attributes[_types.ENTITIES.MODELS]
71
+ attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
72
72
  }),
73
73
  entries: (0, _entry.createEntryEntity)({
74
74
  entityName: _types.ENTITIES.ENTRIES,
75
75
  table: tableInstance,
76
- attributes: attributes[_types.ENTITIES.ENTRIES]
76
+ attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
77
77
  })
78
78
  };
79
79
  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
+ 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
  getRevisionById(params: GetRevisionByIdParams): Promise<CmsEntry[]>;
32
32
  getPublishedRevisionByEntryId(params: GetPublishedRevisionByEntryIdParams): Promise<CmsEntry[]>;
@@ -94,6 +94,9 @@ const getRevisionById = params => {
94
94
  SK: sortKey
95
95
  });
96
96
  return collection;
97
+ /**
98
+ * We cast as any because there is no return type defined.
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 cast as any because there is no return type defined.
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 cast as any because there is no return type defined.
190
+ */
182
191
  }, {});
183
192
  const records = await (0, _batchRead.batchReadAll)({
184
193
  table: entity.table,
@@ -9,7 +9,7 @@ interface ModelField {
9
9
  }
10
10
  declare type ModelFieldRecords = Record<string, ModelField>;
11
11
  export interface FilterItemFromStorage {
12
- (field: CmsModelField, value: any): Promise<any>;
12
+ <T = any>(field: CmsModelField, value: any): Promise<T>;
13
13
  }
14
14
  interface FilterItemsParams {
15
15
  items: CmsEntry[];
@@ -9,7 +9,7 @@ exports.sortEntryItems = exports.filterItems = exports.buildModelFields = void 0
9
9
 
10
10
  var _error = _interopRequireDefault(require("@webiny/error"));
11
11
 
12
- var _lodash = _interopRequireDefault(require("lodash.sortby"));
12
+ var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
13
13
 
14
14
  var _dotProp = _interopRequireDefault(require("dot-prop"));
15
15
 
@@ -431,7 +431,7 @@ const sortEntryItems = params => {
431
431
  value: field.valueTransformer(_dotProp.default.get(item, valuePath))
432
432
  };
433
433
  });
434
- const sortedItems = (0, _lodash.default)(itemsToSort, "value");
434
+ const sortedItems = (0, _sortBy.default)(itemsToSort, "value");
435
435
  const newItems = sortedItems.map(s => {
436
436
  const item = items.find(i => i.id === s.id);
437
437
 
@@ -1,8 +1,9 @@
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
+ 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;
9
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { CmsModelStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
- export interface Params {
3
+ interface CreateModelsStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  }
6
- export declare const createModelsStorageOperations: (params: Params) => CmsModelStorageOperations;
6
+ export declare const createModelsStorageOperations: (params: CreateModelsStorageOperationsParams) => CmsModelStorageOperations;
7
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { CmsSettingsStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
- export interface Params {
3
+ 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;
7
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
2
2
  import { Entity } from "dynamodb-toolbox";
3
- export interface Params {
3
+ 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;
7
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb",
3
- "version": "5.23.1",
3
+ "version": "5.24.0-beta.0",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
@@ -22,17 +22,17 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "@babel/runtime": "7.16.7",
25
- "@webiny/api-headless-cms": "5.23.1",
26
- "@webiny/db-dynamodb": "5.23.1",
27
- "@webiny/error": "5.23.1",
28
- "@webiny/handler-db": "5.23.1",
29
- "@webiny/utils": "5.23.1",
25
+ "@webiny/api-headless-cms": "5.24.0-beta.0",
26
+ "@webiny/db-dynamodb": "5.24.0-beta.0",
27
+ "@webiny/error": "5.24.0-beta.0",
28
+ "@webiny/handler-db": "5.24.0-beta.0",
29
+ "@webiny/utils": "5.24.0-beta.0",
30
30
  "aws-sdk": "2.1066.0",
31
31
  "dataloader": "2.0.0",
32
32
  "dot-prop": "5.3.0",
33
33
  "dynamodb-toolbox": "0.3.5",
34
34
  "jsonpack": "1.1.5",
35
- "lodash.sortby": "4.7.0"
35
+ "lodash": "4.17.21"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@babel/cli": "^7.16.0",
@@ -40,9 +40,9 @@
40
40
  "@babel/preset-env": "^7.16.4",
41
41
  "@babel/preset-flow": "^7.16.0",
42
42
  "@types/jsonpack": "^1.1.0",
43
- "@webiny/cli": "^5.23.1",
44
- "@webiny/plugins": "^5.23.1",
45
- "@webiny/project-utils": "^5.23.1",
43
+ "@webiny/cli": "^5.24.0-beta.0",
44
+ "@webiny/plugins": "^5.24.0-beta.0",
45
+ "@webiny/project-utils": "^5.24.0-beta.0",
46
46
  "jest": "^26.6.3",
47
47
  "jest-dynalite": "^3.2.0",
48
48
  "jest-environment-node": "^26.6.2",
@@ -57,5 +57,5 @@
57
57
  "build": "yarn webiny run build",
58
58
  "watch": "yarn webiny run watch"
59
59
  },
60
- "gitHead": "a726d09d2647d13e5a4f376cef23463564ef7ca0"
60
+ "gitHead": "05b90b92bbaf2ef3adf275d008c4641580cf5f42"
61
61
  }
@@ -7,7 +7,7 @@ export interface CreatePathCallableParams {
7
7
  export interface CreatePathCallable {
8
8
  (params: CreatePathCallableParams): string;
9
9
  }
10
- export interface Params {
10
+ export interface CmsEntryFieldFilterPathPluginParams {
11
11
  fieldType: string;
12
12
  fieldId?: string[];
13
13
  path: string | CreatePathCallable;
@@ -16,7 +16,7 @@ export declare class CmsEntryFieldFilterPathPlugin extends Plugin {
16
16
  static readonly type: string;
17
17
  private readonly config;
18
18
  get fieldType(): string;
19
- constructor(config: Params);
19
+ constructor(config: CmsEntryFieldFilterPathPluginParams);
20
20
  canUse(field: CmsModelField): boolean;
21
21
  createPath(params: CreatePathCallableParams): string;
22
22
  }