@webiny/api-headless-cms 0.0.0-unstable.3386f66516 → 0.0.0-unstable.496cf268ac
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/context.js +0 -25
- package/context.js.map +1 -1
- package/crud/contentEntry/afterDelete.js +0 -5
- package/crud/contentEntry/afterDelete.js.map +1 -1
- package/crud/contentEntry/beforeCreate.js +0 -3
- package/crud/contentEntry/beforeCreate.js.map +1 -1
- package/crud/contentEntry/beforeUpdate.js +0 -3
- package/crud/contentEntry/beforeUpdate.js.map +1 -1
- package/crud/contentEntry/entryDataValidation.js +1 -40
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentEntry/markLockedFields.d.ts +1 -1
- package/crud/contentEntry/markLockedFields.js +15 -28
- package/crud/contentEntry/markLockedFields.js.map +1 -1
- package/crud/contentEntry/referenceFieldsMapping.js +5 -61
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- package/crud/contentEntry/searchableFields.js +1 -12
- package/crud/contentEntry/searchableFields.js.map +1 -1
- package/crud/contentEntry.crud.d.ts +2 -1
- package/crud/contentEntry.crud.js +59 -166
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/afterCreate.js +0 -2
- package/crud/contentModel/afterCreate.js.map +1 -1
- package/crud/contentModel/afterCreateFrom.js +0 -2
- package/crud/contentModel/afterCreateFrom.js.map +1 -1
- package/crud/contentModel/afterDelete.js +0 -2
- package/crud/contentModel/afterDelete.js.map +1 -1
- package/crud/contentModel/afterUpdate.js +0 -2
- package/crud/contentModel/afterUpdate.js.map +1 -1
- package/crud/contentModel/beforeCreate.js +7 -32
- package/crud/contentModel/beforeCreate.js.map +1 -1
- package/crud/contentModel/beforeDelete.js +0 -10
- package/crud/contentModel/beforeDelete.js.map +1 -1
- package/crud/contentModel/beforeUpdate.js +4 -5
- package/crud/contentModel/beforeUpdate.js.map +1 -1
- package/crud/contentModel/compatibility/modelApiName.d.ts +3 -0
- package/crud/contentModel/compatibility/modelApiName.js +24 -0
- package/crud/contentModel/compatibility/modelApiName.js.map +1 -0
- package/crud/contentModel/contentModelManagerFactory.js +0 -7
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
- package/crud/contentModel/createFieldStorageId.js +0 -3
- package/crud/contentModel/createFieldStorageId.js.map +1 -1
- package/crud/contentModel/defaultFields.d.ts +5 -0
- package/crud/contentModel/defaultFields.js +58 -0
- package/crud/contentModel/defaultFields.js.map +1 -0
- package/crud/contentModel/fields/descriptionField.d.ts +2 -0
- package/crud/contentModel/fields/descriptionField.js +42 -0
- package/crud/contentModel/fields/descriptionField.js.map +1 -0
- package/crud/contentModel/fields/imageField.d.ts +2 -0
- package/crud/contentModel/fields/imageField.js +46 -0
- package/crud/contentModel/fields/imageField.js.map +1 -0
- package/crud/contentModel/fields/titleField.d.ts +2 -0
- package/crud/contentModel/fields/titleField.js +58 -0
- package/crud/contentModel/fields/titleField.js.map +1 -0
- package/crud/contentModel/validateLayout.js +0 -8
- package/crud/contentModel/validateLayout.js.map +1 -1
- package/crud/contentModel/validateModel.d.ts +1 -0
- package/crud/contentModel/validateModel.js +0 -8
- package/crud/contentModel/validateModel.js.map +1 -1
- package/crud/contentModel/validateModelFields.d.ts +2 -1
- package/crud/contentModel/validateModelFields.js +35 -128
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validation.d.ts +85 -43
- package/crud/contentModel/validation.js +57 -21
- package/crud/contentModel/validation.js.map +1 -1
- package/crud/contentModel.crud.js +46 -110
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup/beforeCreate.js +0 -12
- package/crud/contentModelGroup/beforeCreate.js.map +1 -1
- package/crud/contentModelGroup/beforeDelete.js +0 -8
- package/crud/contentModelGroup/beforeDelete.js.map +1 -1
- package/crud/contentModelGroup/beforeUpdate.js +0 -5
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
- package/crud/contentModelGroup/validation.js +0 -9
- package/crud/contentModelGroup/validation.js.map +1 -1
- package/crud/contentModelGroup.crud.js +5 -47
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/crud/settings.crud.js +0 -12
- package/crud/settings.crud.js.map +1 -1
- package/crud/system.crud.js +1 -96
- package/crud/system.crud.js.map +1 -1
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js +0 -13
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +0 -36
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +0 -53
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/index.js +0 -5
- package/fieldConverters/index.js.map +1 -1
- package/graphql/buildSchemaPlugins.js +4 -9
- package/graphql/buildSchemaPlugins.js.map +1 -1
- package/graphql/createExecutableSchema.js +2 -6
- package/graphql/createExecutableSchema.js.map +1 -1
- package/graphql/generateSchema.js +0 -7
- package/graphql/generateSchema.js.map +1 -1
- package/graphql/graphQLHandlerFactory.js +16 -39
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/index.js +0 -5
- package/graphql/index.js.map +1 -1
- package/graphql/schema/baseContentSchema.js +5 -17
- package/graphql/schema/baseContentSchema.js.map +1 -1
- package/graphql/schema/baseSchema.js +1 -8
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/contentEntries.js +107 -102
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.js +3 -20
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.js +22 -25
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.js +5 -28
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createManageResolvers.d.ts +1 -1
- package/graphql/schema/createManageResolvers.js +33 -43
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.d.ts +1 -0
- package/graphql/schema/createManageSDL.js +57 -63
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createPreviewResolvers.js +3 -17
- package/graphql/schema/createPreviewResolvers.js.map +1 -1
- package/graphql/schema/createReadResolvers.js +4 -18
- package/graphql/schema/createReadResolvers.js.map +1 -1
- package/graphql/schema/createReadSDL.d.ts +1 -0
- package/graphql/schema/createReadSDL.js +24 -32
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +3 -2
- package/graphql/schema/resolvers/commonFieldResolvers.js +2 -3
- package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreate.js +0 -3
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js +0 -3
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js +0 -6
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGet.js +0 -16
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.js +0 -3
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js +0 -3
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveList.js +0 -3
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolvePublish.js +0 -3
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.js +0 -3
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUnpublish.js +0 -3
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.js +0 -3
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveGet.js +0 -8
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveList.js +0 -3
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveGet.js +0 -8
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveList.js +0 -3
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
- package/graphql/schema/schemaPlugins.js +16 -26
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphql/system.js +1 -30
- package/graphql/system.js.map +1 -1
- package/graphqlFields/boolean.js +0 -12
- package/graphqlFields/boolean.js.map +1 -1
- package/graphqlFields/datetime.js +0 -17
- package/graphqlFields/datetime.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.js +15 -33
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +2 -18
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -1
- package/graphqlFields/dynamicZone/index.js +0 -2
- package/graphqlFields/dynamicZone/index.js.map +1 -1
- package/graphqlFields/file.js +0 -8
- package/graphqlFields/file.js.map +1 -1
- package/graphqlFields/helpers.js +0 -10
- package/graphqlFields/helpers.js.map +1 -1
- package/graphqlFields/index.js +0 -12
- package/graphqlFields/index.js.map +1 -1
- package/graphqlFields/longText.js +0 -10
- package/graphqlFields/longText.js.map +1 -1
- package/graphqlFields/number.js +0 -12
- package/graphqlFields/number.js.map +1 -1
- package/graphqlFields/object.js +7 -37
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/ref.js +59 -65
- package/graphqlFields/ref.js.map +1 -1
- package/graphqlFields/richText.js +0 -9
- package/graphqlFields/richText.js.map +1 -1
- package/graphqlFields/text.js +0 -11
- package/graphqlFields/text.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -21
- package/index.js.map +1 -1
- package/modelManager/DefaultCmsModelManager.js +0 -16
- package/modelManager/DefaultCmsModelManager.js.map +1 -1
- package/modelManager/index.js +0 -4
- package/modelManager/index.js.map +1 -1
- package/package.json +24 -25
- package/parameters/context.js +0 -4
- package/parameters/context.js.map +1 -1
- package/parameters/header.js +0 -11
- package/parameters/header.js.map +1 -1
- package/parameters/index.js +0 -8
- package/parameters/index.js.map +1 -1
- package/parameters/manual.js +1 -8
- package/parameters/manual.js.map +1 -1
- package/parameters/path.js +0 -11
- package/parameters/path.js.map +1 -1
- package/plugins/CmsGraphQLSchemaPlugin.js +0 -5
- package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -1
- package/plugins/CmsGraphQLSchemaSorterPlugin.js +0 -10
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
- package/plugins/CmsGroupPlugin.js +0 -8
- package/plugins/CmsGroupPlugin.js.map +1 -1
- package/plugins/CmsModelFieldConverterPlugin.js +0 -5
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.d.ts +11 -1
- package/plugins/CmsModelPlugin.js +15 -40
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/CmsParametersPlugin.js +0 -7
- package/plugins/CmsParametersPlugin.js.map +1 -1
- package/plugins/StorageTransformPlugin.js +0 -9
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/plugins/index.js +0 -14
- package/plugins/index.js.map +1 -1
- package/storage/default.js +0 -3
- package/storage/default.js.map +1 -1
- package/storage/object.js +0 -19
- package/storage/object.js.map +1 -1
- package/types.d.ts +77 -22
- package/types.js +1 -80
- package/types.js.map +1 -1
- package/utils/access.js +11 -25
- package/utils/access.js.map +1 -1
- package/utils/converters/Converter.js +0 -13
- package/utils/converters/Converter.js.map +1 -1
- package/utils/converters/ConverterCollection.js +9 -33
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.js +2 -27
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/createTypeFromFields.d.ts +1 -0
- package/utils/createTypeFromFields.js +11 -19
- package/utils/createTypeFromFields.js.map +1 -1
- package/utils/createTypeName.js +0 -9
- package/utils/createTypeName.js.map +1 -1
- package/utils/entryStorage.js +10 -26
- package/utils/entryStorage.js.map +1 -1
- package/utils/filterAsync.js +0 -5
- package/utils/filterAsync.js.map +1 -1
- package/utils/getBaseFieldType.js +0 -2
- package/utils/getBaseFieldType.js.map +1 -1
- package/utils/getEntryDescription.d.ts +2 -0
- package/utils/getEntryDescription.js +17 -0
- package/utils/getEntryDescription.js.map +1 -0
- package/utils/getEntryImage.d.ts +2 -0
- package/utils/getEntryImage.js +17 -0
- package/utils/getEntryImage.js.map +1 -0
- package/utils/getEntryTitle.js +0 -9
- package/utils/getEntryTitle.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.js +2 -11
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/ownership.d.ts +3 -3
- package/utils/ownership.js +0 -8
- package/utils/ownership.js.map +1 -1
- package/utils/permissions.js +8 -23
- package/utils/permissions.js.map +1 -1
- package/utils/removeNullValues.d.ts +1 -0
- package/utils/removeNullValues.js +17 -0
- package/utils/removeNullValues.js.map +1 -0
- package/utils/removeUndefinedValues.d.ts +1 -0
- package/utils/removeUndefinedValues.js +17 -0
- package/utils/removeUndefinedValues.js.map +1 -0
- package/utils/renderFields.d.ts +2 -1
- package/utils/renderFields.js +8 -10
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.js +0 -13
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.d.ts +2 -1
- package/utils/renderInputFields.js +4 -9
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.js +1 -10
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.js +0 -9
- package/utils/renderSortEnum.js.map +1 -1
- package/utils/toSlug.js +0 -4
- package/utils/toSlug.js.map +1 -1
- package/validators/dateGte.js +0 -7
- package/validators/dateGte.js.map +1 -1
- package/validators/dateLte.js +0 -7
- package/validators/dateLte.js.map +1 -1
- package/validators/dynamicZone.js +0 -4
- package/validators/dynamicZone.js.map +1 -1
- package/validators/gte.js +0 -8
- package/validators/gte.js.map +1 -1
- package/validators/in.js +0 -8
- package/validators/in.js.map +1 -1
- package/validators/index.js +0 -16
- package/validators/index.js.map +1 -1
- package/validators/lte.js +0 -8
- package/validators/lte.js.map +1 -1
- package/validators/maxLength.js +0 -8
- package/validators/maxLength.js.map +1 -1
- package/validators/minLength.js +0 -8
- package/validators/minLength.js.map +1 -1
- package/validators/pattern.js +0 -9
- package/validators/pattern.js.map +1 -1
- package/validators/patternPlugins/email.js +0 -2
- package/validators/patternPlugins/email.js.map +1 -1
- package/validators/patternPlugins/index.js +0 -8
- package/validators/patternPlugins/index.js.map +1 -1
- package/validators/patternPlugins/lowerCase.js +0 -2
- package/validators/patternPlugins/lowerCase.js.map +1 -1
- package/validators/patternPlugins/lowerCaseSpace.js +0 -2
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
- package/validators/patternPlugins/upperCase.js +0 -2
- package/validators/patternPlugins/upperCase.js.map +1 -1
- package/validators/patternPlugins/upperCaseSpace.js +0 -2
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
- package/validators/patternPlugins/url.js +0 -2
- package/validators/patternPlugins/url.js.map +1 -1
- package/validators/required.js +0 -5
- package/validators/required.js.map +1 -1
- package/validators/timeGte.js +0 -8
- package/validators/timeGte.js.map +1 -1
- package/validators/timeLte.js +0 -8
- package/validators/timeLte.js.map +1 -1
- package/validators/unique.js +0 -7
- package/validators/unique.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CmsParametersPlugin","Plugin","constructor","callable","getParameters","context"],"sources":["CmsParametersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ApiEndpoint, CmsContext } from \"~/types\";\n\n/**\n * Type can be null because it might be that Headless CMS context is loaded on a different Lambda where there is no GraphQL Schema generated.\n */\nexport type CmsParametersPluginResponseType = ApiEndpoint | null;\nexport type CmsParametersPluginResponseLocale = string;\n\nexport interface CmsParametersPluginResponse {\n type: CmsParametersPluginResponseType;\n locale: CmsParametersPluginResponseLocale;\n}\n\nexport interface CmsParametersPluginCallable {\n (context: CmsContext): Promise<CmsParametersPluginResponse | null>;\n}\n\nexport class CmsParametersPlugin extends Plugin {\n public static override readonly type: string = \"cms-parameters-plugin\";\n\n private readonly callable: CmsParametersPluginCallable;\n\n public constructor(callable: CmsParametersPluginCallable) {\n super();\n\n this.callable = callable;\n }\n\n public async getParameters(context: CmsContext): Promise<CmsParametersPluginResponse | null> {\n return this.callable(context);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CmsParametersPlugin","Plugin","constructor","callable","getParameters","context"],"sources":["CmsParametersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ApiEndpoint, CmsContext } from \"~/types\";\n\n/**\n * Type can be null because it might be that Headless CMS context is loaded on a different Lambda where there is no GraphQL Schema generated.\n */\nexport type CmsParametersPluginResponseType = ApiEndpoint | null;\nexport type CmsParametersPluginResponseLocale = string;\n\nexport interface CmsParametersPluginResponse {\n type: CmsParametersPluginResponseType;\n locale: CmsParametersPluginResponseLocale;\n}\n\nexport interface CmsParametersPluginCallable {\n (context: CmsContext): Promise<CmsParametersPluginResponse | null>;\n}\n\nexport class CmsParametersPlugin extends Plugin {\n public static override readonly type: string = \"cms-parameters-plugin\";\n\n private readonly callable: CmsParametersPluginCallable;\n\n public constructor(callable: CmsParametersPluginCallable) {\n super();\n\n this.callable = callable;\n }\n\n public async getParameters(context: CmsContext): Promise<CmsParametersPluginResponse | null> {\n return this.callable(context);\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAkBO,MAAMA,mBAAmB,SAASC,eAAM,CAAC;EAKrCC,WAAW,CAACC,QAAqC,EAAE;IACtD,KAAK,EAAE;IAAC;IAER,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAaC,aAAa,CAACC,OAAmB,EAA+C;IACzF,OAAO,IAAI,CAACF,QAAQ,CAACE,OAAO,CAAC;EACjC;AACJ;AAAC;AAAA,8BAdYL,mBAAmB,UACmB,uBAAuB"}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.StorageTransformPlugin = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _Plugin = require("@webiny/plugins/Plugin");
|
|
13
|
-
|
|
14
10
|
class StorageTransformPlugin extends _Plugin.Plugin {
|
|
15
11
|
get fieldType() {
|
|
16
12
|
return this.config.fieldType;
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
constructor(config) {
|
|
20
15
|
super();
|
|
21
16
|
(0, _defineProperty2.default)(this, "config", void 0);
|
|
22
17
|
this.name = config.name;
|
|
23
18
|
this.config = config;
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
toStorage(params) {
|
|
27
21
|
return this.config.toStorage(params);
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
fromStorage(params) {
|
|
31
24
|
return this.config.fromStorage(params);
|
|
32
25
|
}
|
|
33
|
-
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
exports.StorageTransformPlugin = StorageTransformPlugin;
|
|
37
28
|
(0, _defineProperty2.default)(StorageTransformPlugin, "type", "cms.storage.transform.plugin");
|
|
@@ -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, 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":"
|
|
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,sBAAsB,SAIzBC,cAAM,CAAC;EAEb,IAAWC,SAAS,GAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAIOE,WAAW,CAACD,MAA6C,EAAE;IAC9D,KAAK,EAAE;IAAC;IACR,IAAI,CAACE,IAAI,GAAGF,MAAM,CAACE,IAAI;IACvB,IAAI,CAACF,MAAM,GAAGA,MAAM;EACxB;EAEOG,SAAS,CAACC,MAA6B,EAAc;IACxD,OAAO,IAAI,CAACJ,MAAM,CAACG,SAAS,CAACC,MAAM,CAAC;EACxC;EAEOC,WAAW,CAACD,MAA+B,EAAc;IAC5D,OAAO,IAAI,CAACJ,MAAM,CAACK,WAAW,CAACD,MAAM,CAAC;EAC1C;AACJ;AAAC;AAAA,8BAzBYP,sBAAsB,UAKgB,8BAA8B"}
|
package/plugins/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _CmsGroupPlugin = require("./CmsGroupPlugin");
|
|
8
|
-
|
|
9
7
|
Object.keys(_CmsGroupPlugin).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _CmsGroupPlugin[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_CmsGroupPlugin).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _CmsModelPlugin = require("./CmsModelPlugin");
|
|
21
|
-
|
|
22
18
|
Object.keys(_CmsModelPlugin).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _CmsModelPlugin[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_CmsModelPlugin).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _StorageTransformPlugin = require("./StorageTransformPlugin");
|
|
34
|
-
|
|
35
29
|
Object.keys(_StorageTransformPlugin).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _StorageTransformPlugin[key]) return;
|
|
@@ -42,9 +36,7 @@ Object.keys(_StorageTransformPlugin).forEach(function (key) {
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
|
|
46
39
|
var _CmsParametersPlugin = require("./CmsParametersPlugin");
|
|
47
|
-
|
|
48
40
|
Object.keys(_CmsParametersPlugin).forEach(function (key) {
|
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
|
50
42
|
if (key in exports && exports[key] === _CmsParametersPlugin[key]) return;
|
|
@@ -55,9 +47,7 @@ Object.keys(_CmsParametersPlugin).forEach(function (key) {
|
|
|
55
47
|
}
|
|
56
48
|
});
|
|
57
49
|
});
|
|
58
|
-
|
|
59
50
|
var _CmsModelFieldConverterPlugin = require("./CmsModelFieldConverterPlugin");
|
|
60
|
-
|
|
61
51
|
Object.keys(_CmsModelFieldConverterPlugin).forEach(function (key) {
|
|
62
52
|
if (key === "default" || key === "__esModule") return;
|
|
63
53
|
if (key in exports && exports[key] === _CmsModelFieldConverterPlugin[key]) return;
|
|
@@ -68,9 +58,7 @@ Object.keys(_CmsModelFieldConverterPlugin).forEach(function (key) {
|
|
|
68
58
|
}
|
|
69
59
|
});
|
|
70
60
|
});
|
|
71
|
-
|
|
72
61
|
var _CmsGraphQLSchemaPlugin = require("./CmsGraphQLSchemaPlugin");
|
|
73
|
-
|
|
74
62
|
Object.keys(_CmsGraphQLSchemaPlugin).forEach(function (key) {
|
|
75
63
|
if (key === "default" || key === "__esModule") return;
|
|
76
64
|
if (key in exports && exports[key] === _CmsGraphQLSchemaPlugin[key]) return;
|
|
@@ -81,9 +69,7 @@ Object.keys(_CmsGraphQLSchemaPlugin).forEach(function (key) {
|
|
|
81
69
|
}
|
|
82
70
|
});
|
|
83
71
|
});
|
|
84
|
-
|
|
85
72
|
var _CmsGraphQLSchemaSorterPlugin = require("./CmsGraphQLSchemaSorterPlugin");
|
|
86
|
-
|
|
87
73
|
Object.keys(_CmsGraphQLSchemaSorterPlugin).forEach(function (key) {
|
|
88
74
|
if (key === "default" || key === "__esModule") return;
|
|
89
75
|
if (key in exports && exports[key] === _CmsGraphQLSchemaSorterPlugin[key]) return;
|
package/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsGroupPlugin\";\nexport * from \"./CmsModelPlugin\";\nexport * from \"./StorageTransformPlugin\";\nexport * from \"./CmsParametersPlugin\";\nexport * from \"./CmsModelFieldConverterPlugin\";\nexport * from \"./CmsGraphQLSchemaPlugin\";\nexport * from \"./CmsGraphQLSchemaSorterPlugin\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsGroupPlugin\";\nexport * from \"./CmsModelPlugin\";\nexport * from \"./StorageTransformPlugin\";\nexport * from \"./CmsParametersPlugin\";\nexport * from \"./CmsModelFieldConverterPlugin\";\nexport * from \"./CmsGraphQLSchemaPlugin\";\nexport * from \"./CmsGraphQLSchemaSorterPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/storage/default.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createDefaultStorageTransform = void 0;
|
|
7
|
-
|
|
8
7
|
var _StorageTransformPlugin = require("../plugins/StorageTransformPlugin");
|
|
9
|
-
|
|
10
8
|
const createDefaultStorageTransform = () => {
|
|
11
9
|
return new _StorageTransformPlugin.StorageTransformPlugin({
|
|
12
10
|
name: "headless-cms.storage-transform.all.default",
|
|
@@ -23,5 +21,4 @@ const createDefaultStorageTransform = () => {
|
|
|
23
21
|
}
|
|
24
22
|
});
|
|
25
23
|
};
|
|
26
|
-
|
|
27
24
|
exports.createDefaultStorageTransform = createDefaultStorageTransform;
|
package/storage/default.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createDefaultStorageTransform","StorageTransformPlugin","name","fieldType","fromStorage","value","toStorage"],"sources":["default.ts"],"sourcesContent":["import { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\n\nexport const createDefaultStorageTransform = (): StorageTransformPlugin => {\n return new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.all.default\",\n fieldType: \"*\",\n fromStorage: async ({ value }) => {\n return value;\n },\n toStorage: async ({ value }) => {\n return value;\n }\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createDefaultStorageTransform","StorageTransformPlugin","name","fieldType","fromStorage","value","toStorage"],"sources":["default.ts"],"sourcesContent":["import { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\n\nexport const createDefaultStorageTransform = (): StorageTransformPlugin => {\n return new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.all.default\",\n fieldType: \"*\",\n fromStorage: async ({ value }) => {\n return value;\n },\n toStorage: async ({ value }) => {\n return value;\n }\n });\n};\n"],"mappings":";;;;;;AAAA;AAEO,MAAMA,6BAA6B,GAAG,MAA8B;EACvE,OAAO,IAAIC,8CAAsB,CAAC;IAC9BC,IAAI,EAAE,4CAA4C;IAClDC,SAAS,EAAE,GAAG;IACdC,WAAW,EAAE,OAAO;MAAEC;IAAM,CAAC,KAAK;MAC9B,OAAOA,KAAK;IAChB,CAAC;IACDC,SAAS,EAAE,OAAO;MAAED;IAAM,CAAC,KAAK;MAC5B,OAAOA,KAAK;IAChB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
package/storage/object.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createObjectStorageTransform = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
-
|
|
12
9
|
var _pReduce = _interopRequireDefault(require("p-reduce"));
|
|
13
|
-
|
|
14
10
|
var _pMap = _interopRequireDefault(require("p-map"));
|
|
15
|
-
|
|
16
11
|
var _StorageTransformPlugin = require("../plugins/StorageTransformPlugin");
|
|
17
|
-
|
|
18
12
|
var _getBaseFieldType = require("../utils/getBaseFieldType");
|
|
19
|
-
|
|
20
13
|
const processValue = async params => {
|
|
21
14
|
const {
|
|
22
15
|
fields,
|
|
@@ -29,11 +22,9 @@ const processValue = async params => {
|
|
|
29
22
|
return await (0, _pReduce.default)(fields, async (values, field) => {
|
|
30
23
|
const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
|
|
31
24
|
const plugin = getStoragePlugin(baseType);
|
|
32
|
-
|
|
33
25
|
if (!plugin) {
|
|
34
26
|
throw new Error(`Missing storage plugin for field type "${baseType}".`);
|
|
35
27
|
}
|
|
36
|
-
|
|
37
28
|
const value = await plugin[operation]({
|
|
38
29
|
plugins,
|
|
39
30
|
model,
|
|
@@ -46,7 +37,6 @@ const processValue = async params => {
|
|
|
46
37
|
});
|
|
47
38
|
}, {});
|
|
48
39
|
};
|
|
49
|
-
|
|
50
40
|
const createObjectStorageTransform = () => {
|
|
51
41
|
return new _StorageTransformPlugin.StorageTransformPlugin({
|
|
52
42
|
name: "headless-cms.storage-transform.object.default",
|
|
@@ -59,13 +49,10 @@ const createObjectStorageTransform = () => {
|
|
|
59
49
|
plugins
|
|
60
50
|
}) => {
|
|
61
51
|
var _field$settings;
|
|
62
|
-
|
|
63
52
|
if (!value) {
|
|
64
53
|
return null;
|
|
65
54
|
}
|
|
66
|
-
|
|
67
55
|
const fields = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.fields) || [];
|
|
68
|
-
|
|
69
56
|
if (field.multipleValues) {
|
|
70
57
|
return await (0, _pMap.default)(value, value => processValue({
|
|
71
58
|
sourceValue: value,
|
|
@@ -76,7 +63,6 @@ const createObjectStorageTransform = () => {
|
|
|
76
63
|
fields
|
|
77
64
|
}));
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
return await processValue({
|
|
81
67
|
sourceValue: value,
|
|
82
68
|
getStoragePlugin,
|
|
@@ -94,13 +80,10 @@ const createObjectStorageTransform = () => {
|
|
|
94
80
|
model
|
|
95
81
|
}) => {
|
|
96
82
|
var _field$settings2;
|
|
97
|
-
|
|
98
83
|
if (!value) {
|
|
99
84
|
return null;
|
|
100
85
|
}
|
|
101
|
-
|
|
102
86
|
const fields = ((_field$settings2 = field.settings) === null || _field$settings2 === void 0 ? void 0 : _field$settings2.fields) || [];
|
|
103
|
-
|
|
104
87
|
if (field.multipleValues) {
|
|
105
88
|
return (0, _pMap.default)(value, value => processValue({
|
|
106
89
|
sourceValue: value,
|
|
@@ -111,7 +94,6 @@ const createObjectStorageTransform = () => {
|
|
|
111
94
|
fields
|
|
112
95
|
}));
|
|
113
96
|
}
|
|
114
|
-
|
|
115
97
|
return processValue({
|
|
116
98
|
sourceValue: value,
|
|
117
99
|
getStoragePlugin,
|
|
@@ -123,5 +105,4 @@ const createObjectStorageTransform = () => {
|
|
|
123
105
|
}
|
|
124
106
|
});
|
|
125
107
|
};
|
|
126
|
-
|
|
127
108
|
exports.createObjectStorageTransform = createObjectStorageTransform;
|
package/storage/object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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,MAAM,IAAI;EAC/C,MAAM;IAAEC,MAAM;IAAEC,WAAW;IAAEC,gBAAgB;IAAEC,OAAO;IAAEC,KAAK;IAAEC;EAAU,CAAC,GAAGN,MAAM;EACnF,OAAO,MAAM,IAAAO,gBAAO,EAChBN,MAAM,EACN,OAAOO,MAAM,EAAEC,KAAK,KAAK;IACrB,MAAMC,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGT,gBAAgB,CAACO,QAAQ,CAAC;IACzC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIC,KAAK,CAAE,0CAAyCH,QAAS,IAAG,CAAC;IAC3E;IACA,MAAMI,KAAK,GAAG,MAAMF,MAAM,CAACN,SAAS,CAAC,CAAC;MAClCF,OAAO;MACPC,KAAK;MACLI,KAAK;MACLK,KAAK,EAAEZ,WAAW,CAACO,KAAK,CAACM,OAAO,CAAC;MACjCZ;IACJ,CAAC,CAAC;IACF,mEAAYK,MAAM;MAAE,CAACC,KAAK,CAACM,OAAO,GAAGD;IAAK;EAC9C,CAAC,EACD,CAAC,CAAC,CACL;AACL,CAAC;AAEM,MAAME,4BAA4B,GAAG,MAA8B;EACtE,OAAO,IAAIC,8CAAsB,CAAC;IAC9BC,IAAI,EAAE,+CAA+C;IACrDC,SAAS,EAAE,QAAQ;IACnBC,SAAS,EAAE,OAAO;MAAEX,KAAK;MAAEK,KAAK;MAAEX,gBAAgB;MAAEE,KAAK;MAAED;IAAQ,CAAC,KAAK;MAAA;MACrE,IAAI,CAACU,KAAK,EAAE;QACR,OAAO,IAAI;MACf;MAEA,MAAMb,MAAM,GAAI,oBAAAQ,KAAK,CAACY,QAAQ,oDAAd,gBAAgBpB,MAAM,KAAI,EAAsB;MAEhE,IAAIQ,KAAK,CAACa,cAAc,EAAE;QACtB,OAAO,MAAM,IAAAC,aAAI,EAACT,KAAK,EAA2BA,KAAK,IACnDf,YAAY,CAAC;UACTG,WAAW,EAAEY,KAAK;UAClBX,gBAAgB;UAChBE,KAAK;UACLD,OAAO;UACPE,SAAS,EAAE,WAAW;UACtBL;QACJ,CAAC,CAAC,CACL;MACL;MAEA,OAAO,MAAMF,YAAY,CAAC;QACtBG,WAAW,EAAEY,KAAK;QAClBX,gBAAgB;QAChBE,KAAK;QACLD,OAAO;QACPE,SAAS,EAAE,WAAW;QACtBL;MACJ,CAAC,CAAC;IACN,CAAC;IACDuB,WAAW,EAAE,OAAO;MAAEf,KAAK;MAAEK,KAAK;MAAEX,gBAAgB;MAAEC,OAAO;MAAEC;IAAM,CAAC,KAAK;MAAA;MACvE,IAAI,CAACS,KAAK,EAAE;QACR,OAAO,IAAI;MACf;MAEA,MAAMb,MAAM,GAAI,qBAAAQ,KAAK,CAACY,QAAQ,qDAAd,iBAAgBpB,MAAM,KAAI,EAAsB;MAEhE,IAAIQ,KAAK,CAACa,cAAc,EAAE;QACtB,OAAO,IAAAC,aAAI,EAACT,KAAK,EAA2BA,KAAK,IAC7Cf,YAAY,CAAC;UACTG,WAAW,EAAEY,KAAK;UAClBX,gBAAgB;UAChBE,KAAK;UACLD,OAAO;UACPE,SAAS,EAAE,aAAa;UACxBL;QACJ,CAAC,CAAC,CACL;MACL;MAEA,OAAOF,YAAY,CAAC;QAChBG,WAAW,EAAEY,KAAK;QAClBX,gBAAgB;QAChBE,KAAK;QACLD,OAAO;QACPE,SAAS,EAAE,aAAa;QACxBL;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
package/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { GraphQLFieldResolver, GraphQLSchemaDefinition, Resolvers } from "@webin
|
|
|
5
5
|
import { SecurityPermission } from "@webiny/api-security/types";
|
|
6
6
|
import { DbContext } from "@webiny/handler-db/types";
|
|
7
7
|
import { FileManagerContext } from "@webiny/api-file-manager/types";
|
|
8
|
-
import { UpgradePlugin } from "@webiny/api-upgrade/types";
|
|
9
8
|
import { Topic } from "@webiny/pubsub/types";
|
|
10
9
|
import { CmsModelConverterCallable } from "./utils/converters/ConverterCollection";
|
|
11
10
|
export declare type ApiEndpoint = "manage" | "preview" | "read";
|
|
@@ -98,6 +97,10 @@ export interface CmsModelFieldSettings {
|
|
|
98
97
|
* Object field has child fields.
|
|
99
98
|
*/
|
|
100
99
|
fields?: CmsModelField[];
|
|
100
|
+
/**
|
|
101
|
+
* Is the file field images only one?
|
|
102
|
+
*/
|
|
103
|
+
imagesOnly?: boolean;
|
|
101
104
|
/**
|
|
102
105
|
* Object field has child fields - so it needs to have a layout.
|
|
103
106
|
*/
|
|
@@ -377,7 +380,7 @@ export interface CmsModelGroup {
|
|
|
377
380
|
name: string;
|
|
378
381
|
}
|
|
379
382
|
/**
|
|
380
|
-
*
|
|
383
|
+
* Base CMS Model. Should not be exported and used outside of this package.
|
|
381
384
|
*
|
|
382
385
|
* @category Database model
|
|
383
386
|
* @category CmsModel
|
|
@@ -391,6 +394,24 @@ export interface CmsModel {
|
|
|
391
394
|
* Unique ID for the content model. Created from name if not defined by user.
|
|
392
395
|
*/
|
|
393
396
|
modelId: string;
|
|
397
|
+
/**
|
|
398
|
+
* Name of the content model in singular form to be used in the API.
|
|
399
|
+
* example:
|
|
400
|
+
* - Article
|
|
401
|
+
* - Fruit
|
|
402
|
+
* - Vegetable
|
|
403
|
+
* - Car
|
|
404
|
+
*/
|
|
405
|
+
singularApiName: string;
|
|
406
|
+
/**
|
|
407
|
+
* Name of the content model in plural form to be used in the API.
|
|
408
|
+
* example:
|
|
409
|
+
* - Articles
|
|
410
|
+
* - Fruits
|
|
411
|
+
* - Vegetables
|
|
412
|
+
* - Cars
|
|
413
|
+
*/
|
|
414
|
+
pluralApiName: string;
|
|
394
415
|
/**
|
|
395
416
|
* Model tenant.
|
|
396
417
|
*/
|
|
@@ -403,10 +424,14 @@ export interface CmsModel {
|
|
|
403
424
|
* Cms Group reference object.
|
|
404
425
|
*/
|
|
405
426
|
group: CmsModelGroup;
|
|
427
|
+
/**
|
|
428
|
+
* Icon for the content model.
|
|
429
|
+
*/
|
|
430
|
+
icon?: string | null;
|
|
406
431
|
/**
|
|
407
432
|
* Description for the content model.
|
|
408
433
|
*/
|
|
409
|
-
description: string;
|
|
434
|
+
description: string | null;
|
|
410
435
|
/**
|
|
411
436
|
* Date created
|
|
412
437
|
*/
|
|
@@ -418,7 +443,7 @@ export interface CmsModel {
|
|
|
418
443
|
/**
|
|
419
444
|
* CreatedBy object wrapper. Contains id, name and type of the user.
|
|
420
445
|
*/
|
|
421
|
-
createdBy?:
|
|
446
|
+
createdBy?: CmsIdentity;
|
|
422
447
|
/**
|
|
423
448
|
* List of fields defining entry values.
|
|
424
449
|
*/
|
|
@@ -447,6 +472,16 @@ export interface CmsModel {
|
|
|
447
472
|
* It is picked as first available text field. Or user can select own field.
|
|
448
473
|
*/
|
|
449
474
|
titleFieldId: string;
|
|
475
|
+
/**
|
|
476
|
+
* The field which is displayed as the description one.
|
|
477
|
+
* Only way this is null or undefined is that there are no long-text fields to be set as description.
|
|
478
|
+
*/
|
|
479
|
+
descriptionFieldId?: string | null;
|
|
480
|
+
/**
|
|
481
|
+
* The field which is displayed as the image.
|
|
482
|
+
* Only way this is null or undefined is that there are no file fields, with images only set, to be set as image.
|
|
483
|
+
*/
|
|
484
|
+
imageFieldId?: string | null;
|
|
450
485
|
/**
|
|
451
486
|
* The version of Webiny which this record was stored with.
|
|
452
487
|
*/
|
|
@@ -619,6 +654,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
|
|
|
619
654
|
* ```
|
|
620
655
|
*/
|
|
621
656
|
createTypeField(params: {
|
|
657
|
+
models: CmsModel[];
|
|
622
658
|
model: CmsModel;
|
|
623
659
|
field: TField;
|
|
624
660
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
@@ -719,6 +755,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
|
|
|
719
755
|
* ```
|
|
720
756
|
*/
|
|
721
757
|
createTypeField: (params: {
|
|
758
|
+
models: CmsModel[];
|
|
722
759
|
model: CmsModel;
|
|
723
760
|
field: TField;
|
|
724
761
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
@@ -739,6 +776,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
|
|
|
739
776
|
* ```
|
|
740
777
|
*/
|
|
741
778
|
createInputField: (params: {
|
|
779
|
+
models: CmsModel[];
|
|
742
780
|
model: CmsModel;
|
|
743
781
|
field: TField;
|
|
744
782
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
@@ -806,7 +844,7 @@ export interface CmsFieldTypePlugins {
|
|
|
806
844
|
*
|
|
807
845
|
* @category General
|
|
808
846
|
*/
|
|
809
|
-
export interface
|
|
847
|
+
export interface CmsIdentity {
|
|
810
848
|
/**
|
|
811
849
|
* ID if the user.
|
|
812
850
|
*/
|
|
@@ -874,9 +912,7 @@ export interface OnSystemInstallErrorTopicParams {
|
|
|
874
912
|
export declare type CmsSystemContext = {
|
|
875
913
|
getSystemVersion: () => Promise<string | null>;
|
|
876
914
|
setSystemVersion: (version: string) => Promise<void>;
|
|
877
|
-
getReadAPIKey(): Promise<string | null>;
|
|
878
915
|
installSystem: () => Promise<void>;
|
|
879
|
-
upgradeSystem: (version: string) => Promise<boolean>;
|
|
880
916
|
/**
|
|
881
917
|
* Lifecycle events - deprecated
|
|
882
918
|
*/
|
|
@@ -957,7 +993,7 @@ export interface CmsGroup {
|
|
|
957
993
|
/**
|
|
958
994
|
* CreatedBy reference object.
|
|
959
995
|
*/
|
|
960
|
-
createdBy?:
|
|
996
|
+
createdBy?: CmsIdentity;
|
|
961
997
|
/**
|
|
962
998
|
* Date group was created on.
|
|
963
999
|
*/
|
|
@@ -1159,6 +1195,14 @@ export interface CmsModelCreateInput {
|
|
|
1159
1195
|
* Name of the content model.
|
|
1160
1196
|
*/
|
|
1161
1197
|
name: string;
|
|
1198
|
+
/**
|
|
1199
|
+
* Singular name of the content model to be used in the API.
|
|
1200
|
+
*/
|
|
1201
|
+
singularApiName: string;
|
|
1202
|
+
/**
|
|
1203
|
+
* Plural name of the content model to be used in the API.
|
|
1204
|
+
*/
|
|
1205
|
+
pluralApiName: string;
|
|
1162
1206
|
/**
|
|
1163
1207
|
* Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.
|
|
1164
1208
|
*/
|
|
@@ -1166,7 +1210,7 @@ export interface CmsModelCreateInput {
|
|
|
1166
1210
|
/**
|
|
1167
1211
|
* Description of the content model.
|
|
1168
1212
|
*/
|
|
1169
|
-
description?: string;
|
|
1213
|
+
description?: string | null;
|
|
1170
1214
|
/**
|
|
1171
1215
|
* Group where to put the content model in.
|
|
1172
1216
|
*/
|
|
@@ -1191,10 +1235,11 @@ export interface CmsModelCreateInput {
|
|
|
1191
1235
|
*/
|
|
1192
1236
|
tags?: string[];
|
|
1193
1237
|
/**
|
|
1194
|
-
*
|
|
1195
|
-
* It is picked as first available text field. Or user can select own field.
|
|
1238
|
+
* Fields fieldId which are picked to represent the CMS entry.
|
|
1196
1239
|
*/
|
|
1197
|
-
titleFieldId?: string;
|
|
1240
|
+
titleFieldId?: string | null;
|
|
1241
|
+
descriptionFieldId?: string | null;
|
|
1242
|
+
imageFieldId?: string | null;
|
|
1198
1243
|
}
|
|
1199
1244
|
/**
|
|
1200
1245
|
* A GraphQL `params.data` parameter received when creating content model from existing model.
|
|
@@ -1283,6 +1328,14 @@ export interface CmsModelUpdateInput {
|
|
|
1283
1328
|
* A new content model name.
|
|
1284
1329
|
*/
|
|
1285
1330
|
name?: string;
|
|
1331
|
+
/**
|
|
1332
|
+
* A new singular name of the content model to be used in the API.
|
|
1333
|
+
*/
|
|
1334
|
+
singularApiName?: string;
|
|
1335
|
+
/**
|
|
1336
|
+
* A new plural name of the content model to be used in the API.
|
|
1337
|
+
*/
|
|
1338
|
+
pluralApiName?: string;
|
|
1286
1339
|
/**
|
|
1287
1340
|
* A group we want to move the model to.
|
|
1288
1341
|
*/
|
|
@@ -1290,7 +1343,7 @@ export interface CmsModelUpdateInput {
|
|
|
1290
1343
|
/**
|
|
1291
1344
|
* A new description of the content model.
|
|
1292
1345
|
*/
|
|
1293
|
-
description?: string;
|
|
1346
|
+
description?: string | null;
|
|
1294
1347
|
/**
|
|
1295
1348
|
* A list of content model fields to define the entry values.
|
|
1296
1349
|
*/
|
|
@@ -1307,10 +1360,11 @@ export interface CmsModelUpdateInput {
|
|
|
1307
1360
|
*/
|
|
1308
1361
|
layout: string[][];
|
|
1309
1362
|
/**
|
|
1310
|
-
*
|
|
1311
|
-
* It is picked as first available text field. Or user can select own field.
|
|
1363
|
+
* Fields fieldId which are picked to represent the CMS entry.
|
|
1312
1364
|
*/
|
|
1313
|
-
titleFieldId?: string;
|
|
1365
|
+
titleFieldId?: string | null;
|
|
1366
|
+
descriptionFieldId?: string | null;
|
|
1367
|
+
imageFieldId?: string | null;
|
|
1314
1368
|
}
|
|
1315
1369
|
/**
|
|
1316
1370
|
* A plugin to load a CmsModelManager.
|
|
@@ -1374,11 +1428,15 @@ export interface CmsEntry<T = CmsEntryValues> {
|
|
|
1374
1428
|
/**
|
|
1375
1429
|
* CreatedBy object reference.
|
|
1376
1430
|
*/
|
|
1377
|
-
createdBy:
|
|
1431
|
+
createdBy: CmsIdentity;
|
|
1378
1432
|
/**
|
|
1379
1433
|
* OwnedBy object reference. Can be different from CreatedBy.
|
|
1380
1434
|
*/
|
|
1381
|
-
ownedBy:
|
|
1435
|
+
ownedBy: CmsIdentity;
|
|
1436
|
+
/**
|
|
1437
|
+
* ModifiedBy object reference. Last person who modified the entry.
|
|
1438
|
+
*/
|
|
1439
|
+
modifiedBy?: CmsIdentity | null;
|
|
1382
1440
|
/**
|
|
1383
1441
|
* A string of Date.toISOString() type.
|
|
1384
1442
|
* Populated on creation.
|
|
@@ -1973,6 +2031,7 @@ export interface EntryBeforeListTopicParams {
|
|
|
1973
2031
|
* @category CmsEntry
|
|
1974
2032
|
*/
|
|
1975
2033
|
export interface CreateCmsEntryInput {
|
|
2034
|
+
id?: string;
|
|
1976
2035
|
[key: string]: any;
|
|
1977
2036
|
}
|
|
1978
2037
|
/**
|
|
@@ -2632,9 +2691,5 @@ export interface HeadlessCmsStorageOperations<C = CmsContext> {
|
|
|
2632
2691
|
*/
|
|
2633
2692
|
beforeInit?: (context: C) => Promise<void>;
|
|
2634
2693
|
init?: (context: C) => Promise<void>;
|
|
2635
|
-
/**
|
|
2636
|
-
* An upgrade to run if necessary.
|
|
2637
|
-
*/
|
|
2638
|
-
upgrade?: UpgradePlugin | null;
|
|
2639
2694
|
}
|
|
2640
2695
|
export {};
|