@webiny/api-headless-cms 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.97a151f74d
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/crud/contentEntry/markLockedFields.js +5 -2
- package/crud/contentEntry/markLockedFields.js.map +1 -1
- package/crud/contentEntry/referenceFieldsMapping.js +9 -5
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- package/crud/contentEntry/searchableFields.d.ts +9 -0
- package/crud/contentEntry/searchableFields.js +83 -0
- package/crud/contentEntry/searchableFields.js.map +1 -0
- package/crud/contentEntry.crud.js +5 -32
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/createFieldStorageId.js +5 -1
- package/crud/contentModel/createFieldStorageId.js.map +1 -1
- package/crud/contentModel/models.js +12 -0
- package/crud/contentModel/models.js.map +1 -1
- package/crud/contentModel/validateModelFields.js +14 -6
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel.crud.js +22 -0
- package/crud/contentModel.crud.js.map +1 -1
- package/graphql/graphQLHandlerFactory.js +52 -14
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/schema/contentModels.js +18 -1
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +1 -1
- package/graphql/schema/createFieldResolvers.js +9 -5
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.js +5 -4
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createReadSDL.js +5 -3
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +2 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js +209 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +79 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
- package/graphqlFields/dynamicZone/index.d.ts +2 -0
- package/graphqlFields/dynamicZone/index.js +21 -0
- package/graphqlFields/dynamicZone/index.js.map +1 -0
- package/graphqlFields/index.d.ts +1 -1
- package/graphqlFields/index.js +3 -1
- package/graphqlFields/index.js.map +1 -1
- package/graphqlFields/number.js +4 -0
- package/graphqlFields/number.js.map +1 -1
- package/graphqlFields/object.js +109 -72
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/ref.js +29 -47
- package/graphqlFields/ref.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +24 -23
- package/plugins/StorageTransformPlugin.d.ts +11 -11
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/storage/object.js +5 -2
- package/storage/object.js.map +1 -1
- package/types.d.ts +85 -40
- package/types.js +11 -7
- package/types.js.map +1 -1
- package/utils/converters/ConverterCollection.js +6 -2
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/createTypeFromFields.d.ts +15 -0
- package/utils/createTypeFromFields.js +75 -0
- package/utils/createTypeFromFields.js.map +1 -0
- package/utils/createTypeName.js +3 -1
- package/utils/createTypeName.js.map +1 -1
- package/utils/entryStorage.js +8 -4
- package/utils/entryStorage.js.map +1 -1
- package/utils/getBaseFieldType.d.ts +4 -0
- package/utils/getBaseFieldType.js +12 -0
- package/utils/getBaseFieldType.js.map +1 -0
- package/utils/renderFields.js +3 -1
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.js +8 -3
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.js +3 -1
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.js +5 -2
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.js +3 -1
- package/utils/renderSortEnum.js.map +1 -1
- package/validators/dynamicZone.d.ts +2 -0
- package/validators/dynamicZone.js +24 -0
- package/validators/dynamicZone.js.map +1 -0
- package/validators/index.js +3 -1
- package/validators/index.js.map +1 -1
package/index.js
CHANGED
|
@@ -58,6 +58,8 @@ var _default = require("./storage/default");
|
|
|
58
58
|
|
|
59
59
|
var _object = require("./storage/object");
|
|
60
60
|
|
|
61
|
+
var _dynamicZoneStorage = require("./graphqlFields/dynamicZone/dynamicZoneStorage");
|
|
62
|
+
|
|
61
63
|
var _parameters = require("./parameters");
|
|
62
64
|
|
|
63
65
|
var _context = require("./context");
|
|
@@ -103,7 +105,7 @@ const createHeadlessCmsContext = params => {
|
|
|
103
105
|
/**
|
|
104
106
|
*
|
|
105
107
|
*/
|
|
106
|
-
(0, _crud.createCrud)(params), (0, _graphqlFields.createGraphQLFields)(), (0, _fieldConverters.createFieldConverters)(), (0, _validators.createValidators)(), (0, _default.createDefaultStorageTransform)(), (0, _object.createObjectStorageTransform)(), (0, _upgrades.createUpgrades)()];
|
|
108
|
+
(0, _crud.createCrud)(params), (0, _graphqlFields.createGraphQLFields)(), (0, _fieldConverters.createFieldConverters)(), (0, _validators.createValidators)(), (0, _default.createDefaultStorageTransform)(), (0, _object.createObjectStorageTransform)(), (0, _dynamicZoneStorage.createDynamicZoneStorageTransform)(), (0, _upgrades.createUpgrades)()];
|
|
107
109
|
};
|
|
108
110
|
|
|
109
111
|
exports.createHeadlessCmsContext = createHeadlessCmsContext;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createHeadlessCmsGraphQL","params","createPathParameterPlugin","createHeaderParameterPlugin","createContextParameterPlugin","baseCreateGraphQL","createHeadlessCmsContext","createContextPlugin","createDefaultModelManager","createCrud","createGraphQLFields","createFieldConverters","createValidators","createDefaultStorageTransform","createObjectStorageTransform","createUpgrades"],"sources":["index.ts"],"sourcesContent":["import { createGraphQL as baseCreateGraphQL, CreateGraphQLParams } from \"~/graphql\";\nimport { createUpgrades } from \"~/upgrades\";\nimport { createDefaultModelManager } from \"~/modelManager\";\nimport { createCrud, CrudParams } from \"~/crud\";\nimport { createGraphQLFields } from \"~/graphqlFields\";\nimport { createValidators } from \"~/validators\";\nimport { createDefaultStorageTransform } from \"~/storage/default\";\nimport { createObjectStorageTransform } from \"~/storage/object\";\nimport {\n createContextParameterPlugin,\n createHeaderParameterPlugin,\n createPathParameterPlugin\n} from \"~/parameters\";\nimport { createContextPlugin } from \"~/context\";\nimport {\n entryFieldFromStorageTransform,\n entryFromStorageTransform,\n entryToStorageTransform\n} from \"./utils/entryStorage\";\nimport { createFieldConverters } from \"~/fieldConverters\";\n\nexport type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;\nexport const createHeadlessCmsGraphQL = (params: CreateHeadlessCmsGraphQLParams = {}) => {\n return [\n /**\n * PathParameter plugins are used to determine the type of the cms endpoint\n */\n createPathParameterPlugin(),\n createHeaderParameterPlugin(),\n createContextParameterPlugin(),\n /**\n * At this point we can create, or not create, CMS GraphQL Schema.\n */\n baseCreateGraphQL(params)\n ];\n};\n\nexport type ContentContextParams = CrudParams;\nexport const createHeadlessCmsContext = (params: ContentContextParams) => {\n return [\n /**\n * Context for all Lambdas - everything is loaded now.\n */\n createContextPlugin(),\n createDefaultModelManager(),\n /**\n *\n */\n createCrud(params),\n createGraphQLFields(),\n createFieldConverters(),\n createValidators(),\n createDefaultStorageTransform(),\n createObjectStorageTransform(),\n createUpgrades()\n ];\n};\nexport * from \"~/graphqlFields\";\nexport * from \"~/plugins\";\nexport { entryToStorageTransform, entryFieldFromStorageTransform, entryFromStorageTransform };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"names":["createHeadlessCmsGraphQL","params","createPathParameterPlugin","createHeaderParameterPlugin","createContextParameterPlugin","baseCreateGraphQL","createHeadlessCmsContext","createContextPlugin","createDefaultModelManager","createCrud","createGraphQLFields","createFieldConverters","createValidators","createDefaultStorageTransform","createObjectStorageTransform","createDynamicZoneStorageTransform","createUpgrades"],"sources":["index.ts"],"sourcesContent":["import { createGraphQL as baseCreateGraphQL, CreateGraphQLParams } from \"~/graphql\";\nimport { createUpgrades } from \"~/upgrades\";\nimport { createDefaultModelManager } from \"~/modelManager\";\nimport { createCrud, CrudParams } from \"~/crud\";\nimport { createGraphQLFields } from \"~/graphqlFields\";\nimport { createValidators } from \"~/validators\";\nimport { createDefaultStorageTransform } from \"~/storage/default\";\nimport { createObjectStorageTransform } from \"~/storage/object\";\nimport { createDynamicZoneStorageTransform } from \"~/graphqlFields/dynamicZone/dynamicZoneStorage\";\nimport {\n createContextParameterPlugin,\n createHeaderParameterPlugin,\n createPathParameterPlugin\n} from \"~/parameters\";\nimport { createContextPlugin } from \"~/context\";\nimport {\n entryFieldFromStorageTransform,\n entryFromStorageTransform,\n entryToStorageTransform\n} from \"./utils/entryStorage\";\nimport { createFieldConverters } from \"~/fieldConverters\";\n\nexport type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;\nexport const createHeadlessCmsGraphQL = (params: CreateHeadlessCmsGraphQLParams = {}) => {\n return [\n /**\n * PathParameter plugins are used to determine the type of the cms endpoint\n */\n createPathParameterPlugin(),\n createHeaderParameterPlugin(),\n createContextParameterPlugin(),\n /**\n * At this point we can create, or not create, CMS GraphQL Schema.\n */\n baseCreateGraphQL(params)\n ];\n};\n\nexport type ContentContextParams = CrudParams;\nexport const createHeadlessCmsContext = (params: ContentContextParams) => {\n return [\n /**\n * Context for all Lambdas - everything is loaded now.\n */\n createContextPlugin(),\n createDefaultModelManager(),\n /**\n *\n */\n createCrud(params),\n createGraphQLFields(),\n createFieldConverters(),\n createValidators(),\n createDefaultStorageTransform(),\n createObjectStorageTransform(),\n createDynamicZoneStorageTransform(),\n createUpgrades()\n ];\n};\nexport * from \"~/graphqlFields\";\nexport * from \"~/plugins\";\nexport { entryToStorageTransform, entryFieldFromStorageTransform, entryFromStorageTransform };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAuDA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAtDA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AAwCA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AArCO,MAAMA,wBAAwB,GAAG,CAACC,MAAsC,GAAG,EAA1C,KAAiD;EACrF,OAAO;EACH;AACR;AACA;EACQ,IAAAC,qCAAA,GAJG,EAKH,IAAAC,uCAAA,GALG,EAMH,IAAAC,wCAAA,GANG;EAOH;AACR;AACA;EACQ,IAAAC,sBAAA,EAAkBJ,MAAlB,CAVG,CAAP;AAYH,CAbM;;;;AAgBA,MAAMK,wBAAwB,GAAIL,MAAD,IAAkC;EACtE,OAAO;EACH;AACR;AACA;EACQ,IAAAM,4BAAA,GAJG,EAKH,IAAAC,uCAAA,GALG;EAMH;AACR;AACA;EACQ,IAAAC,gBAAA,EAAWR,MAAX,CATG,EAUH,IAAAS,kCAAA,GAVG,EAWH,IAAAC,sCAAA,GAXG,EAYH,IAAAC,4BAAA,GAZG,EAaH,IAAAC,sCAAA,GAbG,EAcH,IAAAC,oCAAA,GAdG,EAeH,IAAAC,qDAAA,GAfG,EAgBH,IAAAC,wBAAA,GAhBG,CAAP;AAkBH,CAnBM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.97a151f74d",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms:base"
|
|
@@ -21,22 +21,23 @@
|
|
|
21
21
|
"@babel/runtime": "7.19.0",
|
|
22
22
|
"@commodo/fields": "1.1.2-beta.20",
|
|
23
23
|
"@graphql-tools/schema": "7.1.5",
|
|
24
|
-
"@webiny/api": "0.0.0-unstable.
|
|
25
|
-
"@webiny/api-file-manager": "0.0.0-unstable.
|
|
26
|
-
"@webiny/api-i18n": "0.0.0-unstable.
|
|
27
|
-
"@webiny/api-i18n-ddb": "0.0.0-unstable.
|
|
28
|
-
"@webiny/api-security": "0.0.0-unstable.
|
|
29
|
-
"@webiny/api-tenancy": "0.0.0-unstable.
|
|
30
|
-
"@webiny/api-upgrade": "0.0.0-unstable.
|
|
31
|
-
"@webiny/error": "0.0.0-unstable.
|
|
32
|
-
"@webiny/handler": "0.0.0-unstable.
|
|
33
|
-
"@webiny/handler-aws": "0.0.0-unstable.
|
|
34
|
-
"@webiny/handler-db": "0.0.0-unstable.
|
|
35
|
-
"@webiny/handler-graphql": "0.0.0-unstable.
|
|
36
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
37
|
-
"@webiny/pubsub": "0.0.0-unstable.
|
|
38
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
39
|
-
"@webiny/validation": "0.0.0-unstable.
|
|
24
|
+
"@webiny/api": "0.0.0-unstable.97a151f74d",
|
|
25
|
+
"@webiny/api-file-manager": "0.0.0-unstable.97a151f74d",
|
|
26
|
+
"@webiny/api-i18n": "0.0.0-unstable.97a151f74d",
|
|
27
|
+
"@webiny/api-i18n-ddb": "0.0.0-unstable.97a151f74d",
|
|
28
|
+
"@webiny/api-security": "0.0.0-unstable.97a151f74d",
|
|
29
|
+
"@webiny/api-tenancy": "0.0.0-unstable.97a151f74d",
|
|
30
|
+
"@webiny/api-upgrade": "0.0.0-unstable.97a151f74d",
|
|
31
|
+
"@webiny/error": "0.0.0-unstable.97a151f74d",
|
|
32
|
+
"@webiny/handler": "0.0.0-unstable.97a151f74d",
|
|
33
|
+
"@webiny/handler-aws": "0.0.0-unstable.97a151f74d",
|
|
34
|
+
"@webiny/handler-db": "0.0.0-unstable.97a151f74d",
|
|
35
|
+
"@webiny/handler-graphql": "0.0.0-unstable.97a151f74d",
|
|
36
|
+
"@webiny/plugins": "0.0.0-unstable.97a151f74d",
|
|
37
|
+
"@webiny/pubsub": "0.0.0-unstable.97a151f74d",
|
|
38
|
+
"@webiny/utils": "0.0.0-unstable.97a151f74d",
|
|
39
|
+
"@webiny/validation": "0.0.0-unstable.97a151f74d",
|
|
40
|
+
"code-frame": "5.0.0",
|
|
40
41
|
"commodo-fields-object": "1.0.6",
|
|
41
42
|
"dataloader": "2.1.0",
|
|
42
43
|
"dot-prop": "6.0.1",
|
|
@@ -52,11 +53,11 @@
|
|
|
52
53
|
"@babel/cli": "^7.19.3",
|
|
53
54
|
"@babel/core": "^7.19.3",
|
|
54
55
|
"@babel/preset-env": "^7.19.4",
|
|
55
|
-
"@webiny/api-security-so-ddb": "^0.0.0-unstable.
|
|
56
|
-
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.
|
|
57
|
-
"@webiny/api-wcp": "^0.0.0-unstable.
|
|
58
|
-
"@webiny/cli": "^0.0.0-unstable.
|
|
59
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
|
56
|
+
"@webiny/api-security-so-ddb": "^0.0.0-unstable.97a151f74d",
|
|
57
|
+
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.97a151f74d",
|
|
58
|
+
"@webiny/api-wcp": "^0.0.0-unstable.97a151f74d",
|
|
59
|
+
"@webiny/cli": "^0.0.0-unstable.97a151f74d",
|
|
60
|
+
"@webiny/project-utils": "^0.0.0-unstable.97a151f74d",
|
|
60
61
|
"apollo-graphql": "^0.9.5",
|
|
61
62
|
"get-yarn-workspaces": "^1.0.2",
|
|
62
63
|
"graphql": "^15.7.2",
|
|
@@ -76,5 +77,5 @@
|
|
|
76
77
|
"build": "yarn webiny run build",
|
|
77
78
|
"watch": "yarn webiny run watch"
|
|
78
79
|
},
|
|
79
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "97a151f74d8c5679323989fcc8cc7036be0f150e"
|
|
80
81
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins/Plugin";
|
|
2
2
|
import { CmsModel, CmsModelField } from "../types";
|
|
3
3
|
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
export interface ToStorageParams<T> {
|
|
4
|
+
export interface ToStorageParams<T, F extends CmsModelField> {
|
|
5
5
|
model: CmsModel;
|
|
6
|
-
field:
|
|
6
|
+
field: F;
|
|
7
7
|
value: T;
|
|
8
8
|
getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;
|
|
9
9
|
plugins: PluginsContainer;
|
|
10
10
|
}
|
|
11
|
-
export interface FromStorageParams<T> {
|
|
11
|
+
export interface FromStorageParams<T, F extends CmsModelField> {
|
|
12
12
|
model: CmsModel;
|
|
13
|
-
field:
|
|
13
|
+
field: Partial<F> & Pick<F, "id" | "fieldId" | "storageId" | "type" | "settings">;
|
|
14
14
|
value: T;
|
|
15
15
|
getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;
|
|
16
16
|
plugins: PluginsContainer;
|
|
17
17
|
}
|
|
18
|
-
export interface StorageTransformPluginParams<T, R> {
|
|
18
|
+
export interface StorageTransformPluginParams<T, R, F extends CmsModelField> {
|
|
19
19
|
name?: string;
|
|
20
20
|
fieldType: string;
|
|
21
|
-
toStorage: (params: ToStorageParams<T>) => Promise<R>;
|
|
22
|
-
fromStorage: (params: FromStorageParams<R>) => Promise<T>;
|
|
21
|
+
toStorage: (params: ToStorageParams<T, F>) => Promise<R>;
|
|
22
|
+
fromStorage: (params: FromStorageParams<R, F>) => Promise<T>;
|
|
23
23
|
}
|
|
24
|
-
export declare class StorageTransformPlugin<T = any, R = any> extends Plugin {
|
|
24
|
+
export declare class StorageTransformPlugin<T = any, R = any, F extends CmsModelField = CmsModelField> extends Plugin {
|
|
25
25
|
static readonly type: string;
|
|
26
26
|
get fieldType(): string;
|
|
27
27
|
private readonly config;
|
|
28
|
-
constructor(config: StorageTransformPluginParams<T, R>);
|
|
29
|
-
toStorage(params: ToStorageParams<T>): Promise<R>;
|
|
30
|
-
fromStorage(params: FromStorageParams<R>): Promise<T>;
|
|
28
|
+
constructor(config: StorageTransformPluginParams<T, R, F>);
|
|
29
|
+
toStorage(params: ToStorageParams<T, F>): Promise<R>;
|
|
30
|
+
fromStorage(params: FromStorageParams<R, F>): Promise<T>;
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StorageTransformPlugin","Plugin","fieldType","config","constructor","name","toStorage","params","fromStorage"],"sources":["StorageTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModel, CmsModelField } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface ToStorageParams<T> {\n model: CmsModel;\n field:
|
|
1
|
+
{"version":3,"names":["StorageTransformPlugin","Plugin","fieldType","config","constructor","name","toStorage","params","fromStorage"],"sources":["StorageTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModel, CmsModelField } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface ToStorageParams<T, F extends CmsModelField> {\n model: CmsModel;\n field: F;\n value: T;\n getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;\n plugins: PluginsContainer;\n}\n\nexport interface FromStorageParams<T, F extends CmsModelField> {\n model: CmsModel;\n field: Partial<F> & Pick<F, \"id\" | \"fieldId\" | \"storageId\" | \"type\" | \"settings\">;\n value: T;\n getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;\n plugins: PluginsContainer;\n}\n\nexport interface StorageTransformPluginParams<T, R, F extends CmsModelField> {\n name?: string;\n fieldType: string;\n toStorage: (params: ToStorageParams<T, F>) => Promise<R>;\n fromStorage: (params: FromStorageParams<R, F>) => Promise<T>;\n}\nexport class StorageTransformPlugin<\n T = any,\n R = any,\n F extends CmsModelField = CmsModelField\n> extends Plugin {\n public static override readonly type: string = \"cms.storage.transform.plugin\";\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n private readonly config: StorageTransformPluginParams<T, R, F>;\n\n public constructor(config: StorageTransformPluginParams<T, R, F>) {\n super();\n this.name = config.name;\n this.config = config;\n }\n\n public toStorage(params: ToStorageParams<T, F>): Promise<R> {\n return this.config.toStorage(params);\n }\n\n public fromStorage(params: FromStorageParams<R, F>): Promise<T> {\n return this.config.fromStorage(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AA0BO,MAAMA,sBAAN,SAIGC,cAJH,CAIU;EAEO,IAATC,SAAS,GAAW;IAC3B,OAAO,KAAKC,MAAL,CAAYD,SAAnB;EACH;;EAIME,WAAW,CAACD,MAAD,EAAgD;IAC9D;IAD8D;IAE9D,KAAKE,IAAL,GAAYF,MAAM,CAACE,IAAnB;IACA,KAAKF,MAAL,GAAcA,MAAd;EACH;;EAEMG,SAAS,CAACC,MAAD,EAA4C;IACxD,OAAO,KAAKJ,MAAL,CAAYG,SAAZ,CAAsBC,MAAtB,CAAP;EACH;;EAEMC,WAAW,CAACD,MAAD,EAA8C;IAC5D,OAAO,KAAKJ,MAAL,CAAYK,WAAZ,CAAwBD,MAAxB,CAAP;EACH;;AApBY;;;8BAJJP,sB,UAKsC,8B"}
|
package/storage/object.js
CHANGED
|
@@ -15,6 +15,8 @@ var _pMap = _interopRequireDefault(require("p-map"));
|
|
|
15
15
|
|
|
16
16
|
var _StorageTransformPlugin = require("../plugins/StorageTransformPlugin");
|
|
17
17
|
|
|
18
|
+
var _getBaseFieldType = require("../utils/getBaseFieldType");
|
|
19
|
+
|
|
18
20
|
const processValue = async params => {
|
|
19
21
|
const {
|
|
20
22
|
fields,
|
|
@@ -25,10 +27,11 @@ const processValue = async params => {
|
|
|
25
27
|
operation
|
|
26
28
|
} = params;
|
|
27
29
|
return await (0, _pReduce.default)(fields, async (values, field) => {
|
|
28
|
-
const
|
|
30
|
+
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
31
|
+
const plugin = getStoragePlugin(baseType);
|
|
29
32
|
|
|
30
33
|
if (!plugin) {
|
|
31
|
-
throw new Error(`Missing storage plugin for field type "${
|
|
34
|
+
throw new Error(`Missing storage plugin for field type "${baseType}".`);
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
const value = await plugin[operation]({
|
package/storage/object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["processValue","params","fields","sourceValue","getStoragePlugin","plugins","model","operation","pReduce","values","field","
|
|
1
|
+
{"version":3,"names":["processValue","params","fields","sourceValue","getStoragePlugin","plugins","model","operation","pReduce","values","field","baseType","getBaseFieldType","plugin","Error","value","fieldId","createObjectStorageTransform","StorageTransformPlugin","name","fieldType","toStorage","settings","multipleValues","pMap","fromStorage"],"sources":["object.ts"],"sourcesContent":["import pReduce from \"p-reduce\";\nimport pMap from \"p-map\";\nimport { CmsModel, CmsModelField } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface ProcessValueParams {\n fields: CmsModelField[];\n sourceValue: Record<string, any>;\n getStoragePlugin: (fieldType: string) => StorageTransformPlugin;\n plugins: PluginsContainer;\n model: CmsModel;\n operation: \"toStorage\" | \"fromStorage\";\n}\ninterface ProcessValue {\n (params: ProcessValueParams): Promise<Record<string, any>>;\n}\n\nconst processValue: ProcessValue = async params => {\n const { fields, sourceValue, getStoragePlugin, plugins, model, operation } = params;\n return await pReduce(\n fields,\n async (values, field) => {\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n if (!plugin) {\n throw new Error(`Missing storage plugin for field type \"${baseType}\".`);\n }\n const value = await plugin[operation]({\n plugins,\n model,\n field,\n value: sourceValue[field.fieldId],\n getStoragePlugin\n });\n return { ...values, [field.fieldId]: value };\n },\n {}\n );\n};\n\nexport const createObjectStorageTransform = (): StorageTransformPlugin => {\n return new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.object.default\",\n fieldType: \"object\",\n toStorage: async ({ field, value, getStoragePlugin, model, plugins }) => {\n if (!value) {\n return null;\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.multipleValues) {\n return await pMap(value as Record<string, any>[], value =>\n processValue({\n sourceValue: value,\n getStoragePlugin,\n model,\n plugins,\n operation: \"toStorage\",\n fields\n })\n );\n }\n\n return await processValue({\n sourceValue: value,\n getStoragePlugin,\n model,\n plugins,\n operation: \"toStorage\",\n fields\n });\n },\n fromStorage: async ({ field, value, getStoragePlugin, plugins, model }) => {\n if (!value) {\n return null;\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.multipleValues) {\n return pMap(value as Record<string, any>[], value =>\n processValue({\n sourceValue: value,\n getStoragePlugin,\n model,\n plugins,\n operation: \"fromStorage\",\n fields\n })\n );\n }\n\n return processValue({\n sourceValue: value,\n getStoragePlugin,\n model,\n plugins,\n operation: \"fromStorage\",\n fields\n });\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAGA;;AACA;;AAcA,MAAMA,YAA0B,GAAG,MAAMC,MAAN,IAAgB;EAC/C,MAAM;IAAEC,MAAF;IAAUC,WAAV;IAAuBC,gBAAvB;IAAyCC,OAAzC;IAAkDC,KAAlD;IAAyDC;EAAzD,IAAuEN,MAA7E;EACA,OAAO,MAAM,IAAAO,gBAAA,EACTN,MADS,EAET,OAAOO,MAAP,EAAeC,KAAf,KAAyB;IACrB,MAAMC,QAAQ,GAAG,IAAAC,kCAAA,EAAiBF,KAAjB,CAAjB;IACA,MAAMG,MAAM,GAAGT,gBAAgB,CAACO,QAAD,CAA/B;;IACA,IAAI,CAACE,MAAL,EAAa;MACT,MAAM,IAAIC,KAAJ,CAAW,0CAAyCH,QAAS,IAA7D,CAAN;IACH;;IACD,MAAMI,KAAK,GAAG,MAAMF,MAAM,CAACN,SAAD,CAAN,CAAkB;MAClCF,OADkC;MAElCC,KAFkC;MAGlCI,KAHkC;MAIlCK,KAAK,EAAEZ,WAAW,CAACO,KAAK,CAACM,OAAP,CAJgB;MAKlCZ;IALkC,CAAlB,CAApB;IAOA,mEAAYK,MAAZ;MAAoB,CAACC,KAAK,CAACM,OAAP,GAAiBD;IAArC;EACH,CAhBQ,EAiBT,EAjBS,CAAb;AAmBH,CArBD;;AAuBO,MAAME,4BAA4B,GAAG,MAA8B;EACtE,OAAO,IAAIC,8CAAJ,CAA2B;IAC9BC,IAAI,EAAE,+CADwB;IAE9BC,SAAS,EAAE,QAFmB;IAG9BC,SAAS,EAAE,OAAO;MAAEX,KAAF;MAASK,KAAT;MAAgBX,gBAAhB;MAAkCE,KAAlC;MAAyCD;IAAzC,CAAP,KAA8D;MAAA;;MACrE,IAAI,CAACU,KAAL,EAAY;QACR,OAAO,IAAP;MACH;;MAED,MAAMb,MAAM,GAAI,oBAAAQ,KAAK,CAACY,QAAN,oEAAgBpB,MAAhB,KAA0B,EAA1C;;MAEA,IAAIQ,KAAK,CAACa,cAAV,EAA0B;QACtB,OAAO,MAAM,IAAAC,aAAA,EAAKT,KAAL,EAAqCA,KAAK,IACnDf,YAAY,CAAC;UACTG,WAAW,EAAEY,KADJ;UAETX,gBAFS;UAGTE,KAHS;UAITD,OAJS;UAKTE,SAAS,EAAE,WALF;UAMTL;QANS,CAAD,CADH,CAAb;MAUH;;MAED,OAAO,MAAMF,YAAY,CAAC;QACtBG,WAAW,EAAEY,KADS;QAEtBX,gBAFsB;QAGtBE,KAHsB;QAItBD,OAJsB;QAKtBE,SAAS,EAAE,WALW;QAMtBL;MANsB,CAAD,CAAzB;IAQH,CA/B6B;IAgC9BuB,WAAW,EAAE,OAAO;MAAEf,KAAF;MAASK,KAAT;MAAgBX,gBAAhB;MAAkCC,OAAlC;MAA2CC;IAA3C,CAAP,KAA8D;MAAA;;MACvE,IAAI,CAACS,KAAL,EAAY;QACR,OAAO,IAAP;MACH;;MAED,MAAMb,MAAM,GAAI,qBAAAQ,KAAK,CAACY,QAAN,sEAAgBpB,MAAhB,KAA0B,EAA1C;;MAEA,IAAIQ,KAAK,CAACa,cAAV,EAA0B;QACtB,OAAO,IAAAC,aAAA,EAAKT,KAAL,EAAqCA,KAAK,IAC7Cf,YAAY,CAAC;UACTG,WAAW,EAAEY,KADJ;UAETX,gBAFS;UAGTE,KAHS;UAITD,OAJS;UAKTE,SAAS,EAAE,aALF;UAMTL;QANS,CAAD,CADT,CAAP;MAUH;;MAED,OAAOF,YAAY,CAAC;QAChBG,WAAW,EAAEY,KADG;QAEhBX,gBAFgB;QAGhBE,KAHgB;QAIhBD,OAJgB;QAKhBE,SAAS,EAAE,aALK;QAMhBL;MANgB,CAAD,CAAnB;IAQH;EA5D6B,CAA3B,CAAP;AA8DH,CA/DM"}
|
package/types.d.ts
CHANGED
|
@@ -195,6 +195,10 @@ export interface CmsModelField {
|
|
|
195
195
|
*
|
|
196
196
|
*/
|
|
197
197
|
multipleValues?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Fields can be tagged to give them contextual meaning.
|
|
200
|
+
*/
|
|
201
|
+
tags?: string[];
|
|
198
202
|
/**
|
|
199
203
|
* Any user defined settings.
|
|
200
204
|
*
|
|
@@ -202,6 +206,27 @@ export interface CmsModelField {
|
|
|
202
206
|
*/
|
|
203
207
|
settings?: CmsModelFieldSettings;
|
|
204
208
|
}
|
|
209
|
+
export interface CmsDynamicZoneTemplate {
|
|
210
|
+
id: string;
|
|
211
|
+
name: string;
|
|
212
|
+
gqlTypeName: string;
|
|
213
|
+
description: string;
|
|
214
|
+
icon: string;
|
|
215
|
+
fields: CmsModelField[];
|
|
216
|
+
layout: string[][];
|
|
217
|
+
validation: CmsModelFieldValidation[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A definition for dynamic-zone field to show possible type of the field in settings.
|
|
221
|
+
*/
|
|
222
|
+
export interface CmsModelDynamicZoneField extends CmsModelField {
|
|
223
|
+
/**
|
|
224
|
+
* Settings object for the field. Contains `templates` property.
|
|
225
|
+
*/
|
|
226
|
+
settings: {
|
|
227
|
+
templates: CmsDynamicZoneTemplate[];
|
|
228
|
+
};
|
|
229
|
+
}
|
|
205
230
|
/**
|
|
206
231
|
* Used for our internal functionality.
|
|
207
232
|
*/
|
|
@@ -213,7 +238,7 @@ export interface CmsModelFieldWithParent extends CmsModelField {
|
|
|
213
238
|
*/
|
|
214
239
|
export interface CmsModelDateTimeField extends CmsModelField {
|
|
215
240
|
/**
|
|
216
|
-
* Settings object for the field. Contains type property.
|
|
241
|
+
* Settings object for the field. Contains `type` property.
|
|
217
242
|
*/
|
|
218
243
|
settings: {
|
|
219
244
|
type: "time" | "date" | "dateTimeWithoutTimezone" | "dateTimeWithTimezone";
|
|
@@ -401,6 +426,10 @@ export interface CmsModel {
|
|
|
401
426
|
* ```
|
|
402
427
|
*/
|
|
403
428
|
layout: string[][];
|
|
429
|
+
/**
|
|
430
|
+
* Models can be tagged to give them contextual meaning.
|
|
431
|
+
*/
|
|
432
|
+
tags?: string[];
|
|
404
433
|
/**
|
|
405
434
|
* List of locked fields. Updated when entry is saved and a field has been used.
|
|
406
435
|
*/
|
|
@@ -437,15 +466,15 @@ export interface CmsModelFieldDefinition {
|
|
|
437
466
|
fields: string;
|
|
438
467
|
typeDefs?: string;
|
|
439
468
|
}
|
|
440
|
-
interface CmsModelFieldToGraphQLCreateResolverParams {
|
|
469
|
+
interface CmsModelFieldToGraphQLCreateResolverParams<TField> {
|
|
441
470
|
models: CmsModel[];
|
|
442
471
|
model: CmsModel;
|
|
443
472
|
graphQLType: string;
|
|
444
|
-
field:
|
|
473
|
+
field: TField;
|
|
445
474
|
createFieldResolvers: any;
|
|
446
475
|
}
|
|
447
|
-
export interface CmsModelFieldToGraphQLCreateResolver {
|
|
448
|
-
(params: CmsModelFieldToGraphQLCreateResolverParams): GraphQLFieldResolver | {
|
|
476
|
+
export interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {
|
|
477
|
+
(params: CmsModelFieldToGraphQLCreateResolverParams<TField>): GraphQLFieldResolver | {
|
|
449
478
|
resolver: GraphQLFieldResolver | null;
|
|
450
479
|
typeResolvers: Resolvers<CmsContext>;
|
|
451
480
|
} | false;
|
|
@@ -455,7 +484,7 @@ export interface CmsModelFieldToGraphQLCreateResolver {
|
|
|
455
484
|
* @category ModelField
|
|
456
485
|
* @category GraphQL
|
|
457
486
|
*/
|
|
458
|
-
export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
487
|
+
export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField> extends Plugin {
|
|
459
488
|
/**
|
|
460
489
|
* A plugin type
|
|
461
490
|
*/
|
|
@@ -509,7 +538,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
509
538
|
*/
|
|
510
539
|
createStorageId?: (params: {
|
|
511
540
|
model: CmsModel;
|
|
512
|
-
field:
|
|
541
|
+
field: TField;
|
|
513
542
|
}) => string | null | undefined;
|
|
514
543
|
/**
|
|
515
544
|
* Read API methods.
|
|
@@ -528,7 +557,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
528
557
|
*/
|
|
529
558
|
createGetFilters?(params: {
|
|
530
559
|
model: CmsModel;
|
|
531
|
-
field:
|
|
560
|
+
field: TField;
|
|
532
561
|
}): string;
|
|
533
562
|
/**
|
|
534
563
|
* Definition for list filtering for GraphQL.
|
|
@@ -548,7 +577,8 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
548
577
|
*/
|
|
549
578
|
createListFilters?(params: {
|
|
550
579
|
model: CmsModel;
|
|
551
|
-
field:
|
|
580
|
+
field: TField;
|
|
581
|
+
plugins: CmsFieldTypePlugins;
|
|
552
582
|
}): string;
|
|
553
583
|
/**
|
|
554
584
|
* Definition of the field type for GraphQL - be aware if multiple values is selected.
|
|
@@ -567,12 +597,12 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
567
597
|
*/
|
|
568
598
|
createTypeField(params: {
|
|
569
599
|
model: CmsModel;
|
|
570
|
-
field:
|
|
600
|
+
field: TField;
|
|
571
601
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
572
602
|
}): CmsModelFieldDefinition | string | null;
|
|
573
603
|
/**
|
|
574
604
|
* Definition for field resolver.
|
|
575
|
-
* By default it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
605
|
+
* By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
576
606
|
*
|
|
577
607
|
* ```ts
|
|
578
608
|
* read: {
|
|
@@ -584,7 +614,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
584
614
|
* }
|
|
585
615
|
* ```
|
|
586
616
|
*/
|
|
587
|
-
createResolver?: CmsModelFieldToGraphQLCreateResolver
|
|
617
|
+
createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
|
|
588
618
|
/**
|
|
589
619
|
* Read API schema definitions for the field and resolvers for them.
|
|
590
620
|
*
|
|
@@ -627,7 +657,8 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
627
657
|
*/
|
|
628
658
|
createListFilters?: (params: {
|
|
629
659
|
model: CmsModel;
|
|
630
|
-
field:
|
|
660
|
+
field: TField;
|
|
661
|
+
plugins: CmsFieldTypePlugins;
|
|
631
662
|
}) => string;
|
|
632
663
|
/**
|
|
633
664
|
* Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.
|
|
@@ -666,7 +697,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
666
697
|
*/
|
|
667
698
|
createTypeField: (params: {
|
|
668
699
|
model: CmsModel;
|
|
669
|
-
field:
|
|
700
|
+
field: TField;
|
|
670
701
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
671
702
|
}) => CmsModelFieldDefinition | string | null;
|
|
672
703
|
/**
|
|
@@ -686,12 +717,12 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
686
717
|
*/
|
|
687
718
|
createInputField: (params: {
|
|
688
719
|
model: CmsModel;
|
|
689
|
-
field:
|
|
720
|
+
field: TField;
|
|
690
721
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
691
722
|
}) => CmsModelFieldDefinition | string | null;
|
|
692
723
|
/**
|
|
693
724
|
* Definition for field resolver.
|
|
694
|
-
* By default it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
725
|
+
* By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
695
726
|
*
|
|
696
727
|
* ```ts
|
|
697
728
|
* manage: {
|
|
@@ -703,7 +734,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
703
734
|
* }
|
|
704
735
|
* ```
|
|
705
736
|
*/
|
|
706
|
-
createResolver?: CmsModelFieldToGraphQLCreateResolver
|
|
737
|
+
createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
|
|
707
738
|
};
|
|
708
739
|
}
|
|
709
740
|
/**
|
|
@@ -743,7 +774,7 @@ export interface CmsFieldTypePlugins {
|
|
|
743
774
|
[key: string]: CmsModelFieldToGraphQLPlugin;
|
|
744
775
|
}
|
|
745
776
|
/**
|
|
746
|
-
*
|
|
777
|
+
* An interface describing the reference to a user that created some data in the database.
|
|
747
778
|
*
|
|
748
779
|
* @category General
|
|
749
780
|
*/
|
|
@@ -837,7 +868,7 @@ export declare type CmsSystemContext = {
|
|
|
837
868
|
onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;
|
|
838
869
|
};
|
|
839
870
|
/**
|
|
840
|
-
* A GraphQL params.data parameter received when creating content model group.
|
|
871
|
+
* A GraphQL `params.data` parameter received when creating content model group.
|
|
841
872
|
*
|
|
842
873
|
* @category CmsGroup
|
|
843
874
|
* @category GraphQL params
|
|
@@ -849,7 +880,7 @@ export interface CmsGroupCreateInput {
|
|
|
849
880
|
icon: string;
|
|
850
881
|
}
|
|
851
882
|
/**
|
|
852
|
-
* A GraphQL params.data parameter received when updating content model group.
|
|
883
|
+
* A GraphQL `params.data` parameter received when updating content model group.
|
|
853
884
|
*
|
|
854
885
|
* @category CmsGroup
|
|
855
886
|
* @category GraphQL params
|
|
@@ -919,7 +950,7 @@ export interface CmsGroup {
|
|
|
919
950
|
isPrivate?: boolean;
|
|
920
951
|
}
|
|
921
952
|
/**
|
|
922
|
-
* A data.where parameter received when listing content model groups.
|
|
953
|
+
* A `data.where` parameter received when listing content model groups.
|
|
923
954
|
*
|
|
924
955
|
* @category CmsGroup
|
|
925
956
|
* @category GraphQL params
|
|
@@ -1060,7 +1091,7 @@ export interface CmsModelFieldValidation {
|
|
|
1060
1091
|
};
|
|
1061
1092
|
}
|
|
1062
1093
|
/**
|
|
1063
|
-
* A GraphQL params.data parameter received when creating content model.
|
|
1094
|
+
* A GraphQL `params.data` parameter received when creating content model.
|
|
1064
1095
|
*
|
|
1065
1096
|
* @category GraphQL params
|
|
1066
1097
|
* @category CmsModel
|
|
@@ -1097,6 +1128,10 @@ export interface CmsModelCreateInput {
|
|
|
1097
1128
|
* ```
|
|
1098
1129
|
*/
|
|
1099
1130
|
layout?: string[][];
|
|
1131
|
+
/**
|
|
1132
|
+
* Models can be tagged to give them contextual meaning.
|
|
1133
|
+
*/
|
|
1134
|
+
tags?: string[];
|
|
1100
1135
|
/**
|
|
1101
1136
|
* The field that is being displayed as entry title.
|
|
1102
1137
|
* It is picked as first available text field. Or user can select own field.
|
|
@@ -1104,7 +1139,7 @@ export interface CmsModelCreateInput {
|
|
|
1104
1139
|
titleFieldId?: string;
|
|
1105
1140
|
}
|
|
1106
1141
|
/**
|
|
1107
|
-
* A GraphQL params.data parameter received when creating content model from existing model.
|
|
1142
|
+
* A GraphQL `params.data` parameter received when creating content model from existing model.
|
|
1108
1143
|
*
|
|
1109
1144
|
* @category GraphQL params
|
|
1110
1145
|
* @category CmsModel
|
|
@@ -1150,6 +1185,10 @@ export interface CmsModelFieldInput {
|
|
|
1150
1185
|
* Text to display in the field.
|
|
1151
1186
|
*/
|
|
1152
1187
|
placeholderText?: string;
|
|
1188
|
+
/**
|
|
1189
|
+
* Fields can be tagged to give them contextual meaning.
|
|
1190
|
+
*/
|
|
1191
|
+
tags?: string[];
|
|
1153
1192
|
/**
|
|
1154
1193
|
* Are multiple values allowed?
|
|
1155
1194
|
*/
|
|
@@ -1176,7 +1215,7 @@ export interface CmsModelFieldInput {
|
|
|
1176
1215
|
settings?: Record<string, any>;
|
|
1177
1216
|
}
|
|
1178
1217
|
/**
|
|
1179
|
-
* A GraphQL params.data parameter received when updating content model.
|
|
1218
|
+
* A GraphQL `params.data` parameter received when updating content model.
|
|
1180
1219
|
*
|
|
1181
1220
|
* @category GraphQL params
|
|
1182
1221
|
* @category CmsModel
|
|
@@ -1258,7 +1297,7 @@ export interface CmsEntryValues {
|
|
|
1258
1297
|
export interface CmsEntry<T = CmsEntryValues> {
|
|
1259
1298
|
/**
|
|
1260
1299
|
* A version of the webiny this entry was created with.
|
|
1261
|
-
* This can be used when upgrading the system so we know which entries to update.
|
|
1300
|
+
* This can be used when upgrading the system, so we know which entries to update.
|
|
1262
1301
|
*/
|
|
1263
1302
|
webinyVersion: string;
|
|
1264
1303
|
/**
|
|
@@ -1328,10 +1367,10 @@ export interface CmsEntry<T = CmsEntryValues> {
|
|
|
1328
1367
|
/**
|
|
1329
1368
|
* Settings for the given entry.
|
|
1330
1369
|
*
|
|
1331
|
-
* Introduced with Advanced Publishing Workflow
|
|
1332
|
-
* Be aware that when accessing properties in it on old systems
|
|
1370
|
+
* Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.
|
|
1371
|
+
* Be aware that when accessing properties in it on old systems, it will break if not checked first.
|
|
1333
1372
|
*
|
|
1334
|
-
* Available only on the Manage API in entry GraphQL type meta.data property.
|
|
1373
|
+
* Available only on the Manage API in entry GraphQL type `meta.data` property.
|
|
1335
1374
|
*/
|
|
1336
1375
|
meta?: {
|
|
1337
1376
|
[key: string]: any;
|
|
@@ -1364,7 +1403,7 @@ export interface CmsModelManager {
|
|
|
1364
1403
|
*/
|
|
1365
1404
|
getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;
|
|
1366
1405
|
/**
|
|
1367
|
-
* Get a list of latest entries by the ID list.
|
|
1406
|
+
* Get a list of the latest entries by the ID list.
|
|
1368
1407
|
*/
|
|
1369
1408
|
getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;
|
|
1370
1409
|
/**
|
|
@@ -1372,15 +1411,15 @@ export interface CmsModelManager {
|
|
|
1372
1411
|
*/
|
|
1373
1412
|
get: (id: string) => Promise<CmsEntry>;
|
|
1374
1413
|
/**
|
|
1375
|
-
* Create
|
|
1414
|
+
* Create an entry.
|
|
1376
1415
|
*/
|
|
1377
1416
|
create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;
|
|
1378
1417
|
/**
|
|
1379
|
-
* Update
|
|
1418
|
+
* Update an entry.
|
|
1380
1419
|
*/
|
|
1381
1420
|
update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;
|
|
1382
1421
|
/**
|
|
1383
|
-
* Delete
|
|
1422
|
+
* Delete an entry.
|
|
1384
1423
|
*/
|
|
1385
1424
|
delete: (id: string) => Promise<void>;
|
|
1386
1425
|
}
|
|
@@ -1469,7 +1508,7 @@ export interface CmsModelContext {
|
|
|
1469
1508
|
*/
|
|
1470
1509
|
initializeModel: (modelId: string) => Promise<boolean>;
|
|
1471
1510
|
/**
|
|
1472
|
-
* Get
|
|
1511
|
+
* Get an instance of CmsModelManager for given content modelId.
|
|
1473
1512
|
*
|
|
1474
1513
|
* @see CmsModelManager
|
|
1475
1514
|
*
|
|
@@ -1619,7 +1658,12 @@ export interface CmsEntryListWhere {
|
|
|
1619
1658
|
/**
|
|
1620
1659
|
* This is to allow querying by any content model field defined by the user.
|
|
1621
1660
|
*/
|
|
1622
|
-
[key: string]:
|
|
1661
|
+
[key: string]: string | number | boolean | undefined | string[] | number[] | null | CmsEntryListWhere[] | CmsEntryListWhere | CmsEntryListWhereRef;
|
|
1662
|
+
/**
|
|
1663
|
+
* To allow querying via nested queries, we added the AND / OR properties.
|
|
1664
|
+
*/
|
|
1665
|
+
AND?: CmsEntryListWhere[];
|
|
1666
|
+
OR?: CmsEntryListWhere[];
|
|
1623
1667
|
}
|
|
1624
1668
|
/**
|
|
1625
1669
|
* Entry listing sort.
|
|
@@ -1834,7 +1878,7 @@ export interface CmsEntryContext {
|
|
|
1834
1878
|
*/
|
|
1835
1879
|
listEntries: (model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1836
1880
|
/**
|
|
1837
|
-
* Lists latest entries. Used for manage API.
|
|
1881
|
+
* Lists the latest entries. Used for manage API.
|
|
1838
1882
|
*/
|
|
1839
1883
|
listLatestEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1840
1884
|
/**
|
|
@@ -2022,13 +2066,13 @@ export interface BaseCmsSecurityPermission extends SecurityPermission {
|
|
|
2022
2066
|
*/
|
|
2023
2067
|
export interface CmsModelPermission extends BaseCmsSecurityPermission {
|
|
2024
2068
|
/**
|
|
2025
|
-
*
|
|
2069
|
+
* An object representing `key: model.modelId` values where key is locale code.
|
|
2026
2070
|
*/
|
|
2027
2071
|
models?: {
|
|
2028
2072
|
[key: string]: string[];
|
|
2029
2073
|
};
|
|
2030
2074
|
/**
|
|
2031
|
-
*
|
|
2075
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2032
2076
|
*/
|
|
2033
2077
|
groups?: {
|
|
2034
2078
|
[key: string]: string[];
|
|
@@ -2042,7 +2086,7 @@ export interface CmsModelPermission extends BaseCmsSecurityPermission {
|
|
|
2042
2086
|
*/
|
|
2043
2087
|
export interface CmsGroupPermission extends BaseCmsSecurityPermission {
|
|
2044
2088
|
/**
|
|
2045
|
-
*
|
|
2089
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2046
2090
|
*/
|
|
2047
2091
|
groups?: {
|
|
2048
2092
|
[key: string]: string[];
|
|
@@ -2057,13 +2101,13 @@ export interface CmsGroupPermission extends BaseCmsSecurityPermission {
|
|
|
2057
2101
|
export interface CmsEntryPermission extends BaseCmsSecurityPermission {
|
|
2058
2102
|
pw?: string;
|
|
2059
2103
|
/**
|
|
2060
|
-
*
|
|
2104
|
+
* An object representing `key: model.modelId` values where key is locale code.
|
|
2061
2105
|
*/
|
|
2062
2106
|
models?: {
|
|
2063
2107
|
[key: string]: string[];
|
|
2064
2108
|
};
|
|
2065
2109
|
/**
|
|
2066
|
-
*
|
|
2110
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2067
2111
|
*/
|
|
2068
2112
|
groups?: {
|
|
2069
2113
|
[key: string]: string[];
|
|
@@ -2439,6 +2483,7 @@ export interface CmsSystemStorageOperations {
|
|
|
2439
2483
|
update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;
|
|
2440
2484
|
}
|
|
2441
2485
|
export interface HeadlessCmsStorageOperations<C = CmsContext> {
|
|
2486
|
+
name: string;
|
|
2442
2487
|
system: CmsSystemStorageOperations;
|
|
2443
2488
|
settings: CmsSettingsStorageOperations;
|
|
2444
2489
|
groups: CmsGroupStorageOperations;
|