@webiny/api-headless-cms-ddb 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.
- package/definitions/entry.d.ts +2 -1
- package/definitions/group.d.ts +2 -1
- package/definitions/model.d.ts +2 -1
- package/definitions/settings.d.ts +2 -1
- package/definitions/system.d.ts +2 -1
- package/definitions/table.d.ts +2 -1
- package/dynamoDb/storage/richText.js +1 -0
- package/index.js +6 -6
- package/operations/entry/dataLoaders.d.ts +2 -2
- package/operations/entry/dataLoaders.js +9 -0
- package/operations/entry/utils.d.ts +1 -1
- package/operations/entry/utils.js +2 -2
- package/operations/group/index.d.ts +3 -2
- package/operations/model/index.d.ts +3 -2
- package/operations/settings/index.d.ts +3 -2
- package/operations/system/index.d.ts +3 -2
- package/package.json +11 -11
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
package/definitions/entry.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
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 {};
|
package/definitions/group.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
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 {};
|
package/definitions/model.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
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
|
-
|
|
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 {};
|
package/definitions/system.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
2
|
import { Attributes } from "../types";
|
|
3
|
-
|
|
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 {};
|
package/definitions/table.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
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<
|
|
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
|
|
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,
|
|
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
|
-
|
|
4
|
+
interface CreateGroupsStorageOperationsParams {
|
|
5
5
|
entity: Entity<any>;
|
|
6
6
|
plugins: PluginsContainer;
|
|
7
7
|
}
|
|
8
|
-
export declare const createGroupsStorageOperations: (params:
|
|
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
|
-
|
|
3
|
+
interface CreateModelsStorageOperationsParams {
|
|
4
4
|
entity: Entity<any>;
|
|
5
5
|
}
|
|
6
|
-
export declare const createModelsStorageOperations: (params:
|
|
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
|
-
|
|
3
|
+
interface CreateSettingsStorageOperationsParams {
|
|
4
4
|
entity: Entity<any>;
|
|
5
5
|
}
|
|
6
|
-
export declare const createSettingsStorageOperations: (params:
|
|
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
|
-
|
|
3
|
+
interface CreateSystemStorageOperationsParams {
|
|
4
4
|
entity: Entity<any>;
|
|
5
5
|
}
|
|
6
|
-
export declare const createSystemStorageOperations: (params:
|
|
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.
|
|
3
|
+
"version": "5.24.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.
|
|
26
|
-
"@webiny/db-dynamodb": "5.
|
|
27
|
-
"@webiny/error": "5.
|
|
28
|
-
"@webiny/handler-db": "5.
|
|
29
|
-
"@webiny/utils": "5.
|
|
25
|
+
"@webiny/api-headless-cms": "5.24.0",
|
|
26
|
+
"@webiny/db-dynamodb": "5.24.0",
|
|
27
|
+
"@webiny/error": "5.24.0",
|
|
28
|
+
"@webiny/handler-db": "5.24.0",
|
|
29
|
+
"@webiny/utils": "5.24.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
|
|
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.
|
|
44
|
-
"@webiny/plugins": "^5.
|
|
45
|
-
"@webiny/project-utils": "^5.
|
|
43
|
+
"@webiny/cli": "^5.24.0",
|
|
44
|
+
"@webiny/plugins": "^5.24.0",
|
|
45
|
+
"@webiny/project-utils": "^5.24.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": "
|
|
60
|
+
"gitHead": "be0cbfcaa9247c658c44179af7943cc5d6d71bc7"
|
|
61
61
|
}
|
|
@@ -7,7 +7,7 @@ export interface CreatePathCallableParams {
|
|
|
7
7
|
export interface CreatePathCallable {
|
|
8
8
|
(params: CreatePathCallableParams): string;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
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:
|
|
19
|
+
constructor(config: CmsEntryFieldFilterPathPluginParams);
|
|
20
20
|
canUse(field: CmsModelField): boolean;
|
|
21
21
|
createPath(params: CreatePathCallableParams): string;
|
|
22
22
|
}
|