@webiny/api-headless-cms-ddb 0.0.0-mt-1
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/LICENSE +21 -0
- package/README.md +25 -0
- package/definitions/entry.d.ts +8 -0
- package/definitions/entry.js +97 -0
- package/definitions/group.d.ts +8 -0
- package/definitions/group.js +74 -0
- package/definitions/model.d.ts +8 -0
- package/definitions/model.js +96 -0
- package/definitions/settings.d.ts +8 -0
- package/definitions/settings.js +62 -0
- package/definitions/system.d.ts +8 -0
- package/definitions/system.js +50 -0
- package/definitions/table.d.ts +8 -0
- package/definitions/table.js +30 -0
- package/dynamoDb/index.d.ts +2 -0
- package/dynamoDb/index.js +24 -0
- package/dynamoDb/path/plainObject.d.ts +3 -0
- package/dynamoDb/path/plainObject.js +33 -0
- package/dynamoDb/path/ref.d.ts +3 -0
- package/dynamoDb/path/ref.js +27 -0
- package/dynamoDb/storage/date.d.ts +3 -0
- package/dynamoDb/storage/date.js +65 -0
- package/dynamoDb/storage/longText.d.ts +7 -0
- package/dynamoDb/storage/longText.js +83 -0
- package/dynamoDb/storage/richText.d.ts +8 -0
- package/dynamoDb/storage/richText.js +110 -0
- package/dynamoDb/transformValue/datetime.d.ts +3 -0
- package/dynamoDb/transformValue/datetime.js +47 -0
- package/index.d.ts +2 -0
- package/index.js +125 -0
- package/operations/entry/dataLoaders.d.ts +38 -0
- package/operations/entry/dataLoaders.js +303 -0
- package/operations/entry/index.d.ts +8 -0
- package/operations/entry/index.js +823 -0
- package/operations/entry/keys.d.ts +25 -0
- package/operations/entry/keys.js +62 -0
- package/operations/entry/systemFields.d.ts +2 -0
- package/operations/entry/systemFields.js +50 -0
- package/operations/entry/utils.d.ts +31 -0
- package/operations/entry/utils.js +406 -0
- package/operations/group/index.d.ts +8 -0
- package/operations/group/index.js +198 -0
- package/operations/model/index.d.ts +6 -0
- package/operations/model/index.js +161 -0
- package/operations/settings/index.d.ts +6 -0
- package/operations/settings/index.js +141 -0
- package/operations/system/index.d.ts +6 -0
- package/operations/system/index.js +105 -0
- package/package.json +61 -0
- package/types.d.ts +84 -0
- package/types.js +16 -0
package/types.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
+
import { CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
|
|
4
|
+
import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
|
|
5
|
+
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
6
|
+
import { Entity, Table } from "dynamodb-toolbox";
|
|
7
|
+
interface CmsFieldFilterValueTransformParams {
|
|
8
|
+
/**
|
|
9
|
+
* A field which value we are transforming.
|
|
10
|
+
*/
|
|
11
|
+
field: CmsModelField;
|
|
12
|
+
value: any;
|
|
13
|
+
}
|
|
14
|
+
export interface CmsFieldFilterValueTransformPlugin extends Plugin {
|
|
15
|
+
/**
|
|
16
|
+
* A plugin type.
|
|
17
|
+
*/
|
|
18
|
+
type: "cms-field-filter-value-transform";
|
|
19
|
+
/**
|
|
20
|
+
* A field type this plugin is for.
|
|
21
|
+
*/
|
|
22
|
+
fieldType: string;
|
|
23
|
+
/**
|
|
24
|
+
* Transform method which expect field definition and value to transform.
|
|
25
|
+
*/
|
|
26
|
+
transform: (params: CmsFieldFilterValueTransformParams) => any;
|
|
27
|
+
}
|
|
28
|
+
interface CmsFieldFilterPathParams {
|
|
29
|
+
/**
|
|
30
|
+
* A field for which we are creating the value path.
|
|
31
|
+
*/
|
|
32
|
+
field: CmsModelField;
|
|
33
|
+
/**
|
|
34
|
+
* If value is an array we will need index position.
|
|
35
|
+
* It is up to the developer to add.
|
|
36
|
+
*/
|
|
37
|
+
index?: number | string;
|
|
38
|
+
}
|
|
39
|
+
export interface CmsFieldFilterPathPlugin extends Plugin {
|
|
40
|
+
/**
|
|
41
|
+
* A plugin type.
|
|
42
|
+
*/
|
|
43
|
+
type: "cms-field-filter-path";
|
|
44
|
+
/**
|
|
45
|
+
* A field type this plugin is for.
|
|
46
|
+
*/
|
|
47
|
+
fieldType: string;
|
|
48
|
+
/**
|
|
49
|
+
* A field id this plugin is for.
|
|
50
|
+
* It is meant for targeting only specific fields in a certain type.
|
|
51
|
+
*/
|
|
52
|
+
fieldId?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Get a path for given field.
|
|
55
|
+
*/
|
|
56
|
+
createPath: (params: CmsFieldFilterPathParams) => string;
|
|
57
|
+
}
|
|
58
|
+
export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
|
|
59
|
+
export declare type Attributes = Record<string, AttributeDefinition>;
|
|
60
|
+
export declare enum ENTITIES {
|
|
61
|
+
SYSTEM = "CmsSystem",
|
|
62
|
+
SETTINGS = "CmsSettings",
|
|
63
|
+
GROUPS = "CmsGroups",
|
|
64
|
+
MODELS = "CmsModels",
|
|
65
|
+
ENTRIES = "CmsEntries"
|
|
66
|
+
}
|
|
67
|
+
export interface TableModifier {
|
|
68
|
+
(table: TableConstructor): TableConstructor;
|
|
69
|
+
}
|
|
70
|
+
export interface StorageOperationsFactoryParams {
|
|
71
|
+
documentClient: DocumentClient;
|
|
72
|
+
table?: TableModifier;
|
|
73
|
+
modelFieldToGraphQLPlugins: CmsModelFieldToGraphQLPlugin[];
|
|
74
|
+
attributes?: Record<ENTITIES, Attributes>;
|
|
75
|
+
plugins?: Plugin[] | Plugin[][];
|
|
76
|
+
}
|
|
77
|
+
export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
|
|
78
|
+
getTable: () => Table;
|
|
79
|
+
getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries", Entity<any>>;
|
|
80
|
+
}
|
|
81
|
+
export interface StorageOperationsFactory {
|
|
82
|
+
(params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
package/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ENTITIES = void 0;
|
|
7
|
+
let ENTITIES;
|
|
8
|
+
exports.ENTITIES = ENTITIES;
|
|
9
|
+
|
|
10
|
+
(function (ENTITIES) {
|
|
11
|
+
ENTITIES["SYSTEM"] = "CmsSystem";
|
|
12
|
+
ENTITIES["SETTINGS"] = "CmsSettings";
|
|
13
|
+
ENTITIES["GROUPS"] = "CmsGroups";
|
|
14
|
+
ENTITIES["MODELS"] = "CmsModels";
|
|
15
|
+
ENTITIES["ENTRIES"] = "CmsEntries";
|
|
16
|
+
})(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
|