@webiny/api-headless-cms 0.0.0-mt-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/content/contextSetup.d.ts +4 -0
- package/content/contextSetup.js +65 -0
- package/content/graphQLHandlerFactory.d.ts +5 -0
- package/content/graphQLHandlerFactory.js +173 -0
- package/content/plugins/CmsGroupPlugin.d.ts +11 -0
- package/content/plugins/CmsGroupPlugin.js +24 -0
- package/content/plugins/CmsModelPlugin.d.ts +11 -0
- package/content/plugins/CmsModelPlugin.js +24 -0
- package/content/plugins/buildSchemaPlugins.d.ts +7 -0
- package/content/plugins/buildSchemaPlugins.js +29 -0
- package/content/plugins/crud/contentEntry/afterDelete.d.ts +7 -0
- package/content/plugins/crud/contentEntry/afterDelete.js +41 -0
- package/content/plugins/crud/contentEntry/beforeCreate.d.ts +7 -0
- package/content/plugins/crud/contentEntry/beforeCreate.js +28 -0
- package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +7 -0
- package/content/plugins/crud/contentEntry/beforeUpdate.js +28 -0
- package/content/plugins/crud/contentEntry/entryDataValidation.d.ts +4 -0
- package/content/plugins/crud/contentEntry/entryDataValidation.js +188 -0
- package/content/plugins/crud/contentEntry/markLockedFields.d.ts +12 -0
- package/content/plugins/crud/contentEntry/markLockedFields.js +117 -0
- package/content/plugins/crud/contentEntry.crud.d.ts +17 -0
- package/content/plugins/crud/contentEntry.crud.js +931 -0
- package/content/plugins/crud/contentModel/afterCreate.d.ts +7 -0
- package/content/plugins/crud/contentModel/afterCreate.js +18 -0
- package/content/plugins/crud/contentModel/afterDelete.d.ts +7 -0
- package/content/plugins/crud/contentModel/afterDelete.js +18 -0
- package/content/plugins/crud/contentModel/afterUpdate.d.ts +7 -0
- package/content/plugins/crud/contentModel/afterUpdate.js +18 -0
- package/content/plugins/crud/contentModel/beforeCreate.d.ts +9 -0
- package/content/plugins/crud/contentModel/beforeCreate.js +146 -0
- package/content/plugins/crud/contentModel/beforeDelete.d.ts +9 -0
- package/content/plugins/crud/contentModel/beforeDelete.js +56 -0
- package/content/plugins/crud/contentModel/beforeUpdate.d.ts +9 -0
- package/content/plugins/crud/contentModel/beforeUpdate.js +128 -0
- package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +2 -0
- package/content/plugins/crud/contentModel/contentModelManagerFactory.js +29 -0
- package/content/plugins/crud/contentModel/createFieldModels.d.ts +2 -0
- package/content/plugins/crud/contentModel/createFieldModels.js +22 -0
- package/content/plugins/crud/contentModel/idValidation.d.ts +2 -0
- package/content/plugins/crud/contentModel/idValidation.js +22 -0
- package/content/plugins/crud/contentModel/models.d.ts +3 -0
- package/content/plugins/crud/contentModel/models.js +141 -0
- package/content/plugins/crud/contentModel/validateLayout.d.ts +2 -0
- package/content/plugins/crud/contentModel/validateLayout.js +38 -0
- package/content/plugins/crud/contentModel.crud.d.ts +12 -0
- package/content/plugins/crud/contentModel.crud.js +425 -0
- package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +9 -0
- package/content/plugins/crud/contentModelGroup/beforeCreate.js +66 -0
- package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +9 -0
- package/content/plugins/crud/contentModelGroup/beforeDelete.js +48 -0
- package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +8 -0
- package/content/plugins/crud/contentModelGroup/beforeUpdate.js +28 -0
- package/content/plugins/crud/contentModelGroup.crud.d.ts +12 -0
- package/content/plugins/crud/contentModelGroup.crud.js +351 -0
- package/content/plugins/crud/index.d.ts +6 -0
- package/content/plugins/crud/index.js +100 -0
- package/content/plugins/graphqlFields/boolean.d.ts +3 -0
- package/content/plugins/graphqlFields/boolean.js +69 -0
- package/content/plugins/graphqlFields/datetime.d.ts +3 -0
- package/content/plugins/graphqlFields/datetime.js +83 -0
- package/content/plugins/graphqlFields/file.d.ts +3 -0
- package/content/plugins/graphqlFields/file.js +49 -0
- package/content/plugins/graphqlFields/index.d.ts +2 -0
- package/content/plugins/graphqlFields/index.js +30 -0
- package/content/plugins/graphqlFields/longText.d.ts +3 -0
- package/content/plugins/graphqlFields/longText.js +62 -0
- package/content/plugins/graphqlFields/number.d.ts +3 -0
- package/content/plugins/graphqlFields/number.js +75 -0
- package/content/plugins/graphqlFields/object.d.ts +3 -0
- package/content/plugins/graphqlFields/object.js +180 -0
- package/content/plugins/graphqlFields/ref.d.ts +3 -0
- package/content/plugins/graphqlFields/ref.js +205 -0
- package/content/plugins/graphqlFields/richText.d.ts +3 -0
- package/content/plugins/graphqlFields/richText.js +55 -0
- package/content/plugins/graphqlFields/text.d.ts +3 -0
- package/content/plugins/graphqlFields/text.js +72 -0
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.d.ts +8 -0
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +54 -0
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.d.ts +7 -0
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +35 -0
- package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +15 -0
- package/content/plugins/modelManager/DefaultCmsModelManager.js +62 -0
- package/content/plugins/modelManager/index.d.ts +3 -0
- package/content/plugins/modelManager/index.js +20 -0
- package/content/plugins/schema/baseSchema.d.ts +4 -0
- package/content/plugins/schema/baseSchema.js +98 -0
- package/content/plugins/schema/contentEntries.d.ts +4 -0
- package/content/plugins/schema/contentEntries.js +166 -0
- package/content/plugins/schema/contentModelGroups.d.ts +4 -0
- package/content/plugins/schema/contentModelGroups.js +153 -0
- package/content/plugins/schema/contentModels.d.ts +4 -0
- package/content/plugins/schema/contentModels.js +225 -0
- package/content/plugins/schema/createFieldResolvers.d.ts +19 -0
- package/content/plugins/schema/createFieldResolvers.js +92 -0
- package/content/plugins/schema/createManageResolvers.d.ts +11 -0
- package/content/plugins/schema/createManageResolvers.js +135 -0
- package/content/plugins/schema/createManageSDL.d.ts +9 -0
- package/content/plugins/schema/createManageSDL.js +153 -0
- package/content/plugins/schema/createPreviewResolvers.d.ts +10 -0
- package/content/plugins/schema/createPreviewResolvers.js +55 -0
- package/content/plugins/schema/createReadResolvers.d.ts +10 -0
- package/content/plugins/schema/createReadResolvers.js +55 -0
- package/content/plugins/schema/createReadSDL.d.ts +9 -0
- package/content/plugins/schema/createReadSDL.js +96 -0
- package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +6 -0
- package/content/plugins/schema/resolvers/commonFieldResolvers.js +14 -0
- package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +6 -0
- package/content/plugins/schema/resolvers/manage/resolveCreate.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +7 -0
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolveDelete.js +30 -0
- package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolveGet.js +21 -0
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolveList.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolveList.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolvePublish.js +21 -0
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.d.ts +6 -0
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.d.ts +6 -0
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.js +23 -0
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +2 -0
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.js +21 -0
- package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +7 -0
- package/content/plugins/schema/resolvers/manage/resolveUpdate.js +23 -0
- package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +2 -0
- package/content/plugins/schema/resolvers/preview/resolveGet.js +38 -0
- package/content/plugins/schema/resolvers/preview/resolveList.d.ts +2 -0
- package/content/plugins/schema/resolvers/preview/resolveList.js +23 -0
- package/content/plugins/schema/resolvers/read/resolveGet.d.ts +2 -0
- package/content/plugins/schema/resolvers/read/resolveGet.js +38 -0
- package/content/plugins/schema/resolvers/read/resolveList.d.ts +2 -0
- package/content/plugins/schema/resolvers/read/resolveList.js +23 -0
- package/content/plugins/schema/schemaPlugins.d.ts +3 -0
- package/content/plugins/schema/schemaPlugins.js +92 -0
- package/content/plugins/storage/StorageTransformPlugin.d.ts +30 -0
- package/content/plugins/storage/StorageTransformPlugin.js +36 -0
- package/content/plugins/storage/default.d.ts +3 -0
- package/content/plugins/storage/default.js +28 -0
- package/content/plugins/storage/object.d.ts +3 -0
- package/content/plugins/storage/object.js +119 -0
- package/content/plugins/utils/createTypeName.d.ts +3 -0
- package/content/plugins/utils/createTypeName.js +28 -0
- package/content/plugins/utils/entryStorage.d.ts +17 -0
- package/content/plugins/utils/entryStorage.js +125 -0
- package/content/plugins/utils/getEntryTitle.d.ts +2 -0
- package/content/plugins/utils/getEntryTitle.js +42 -0
- package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +11 -0
- package/content/plugins/utils/getSchemaFromFieldPlugins.js +30 -0
- package/content/plugins/utils/pluralizedTypeName.d.ts +1 -0
- package/content/plugins/utils/pluralizedTypeName.js +26 -0
- package/content/plugins/utils/renderFields.d.ts +16 -0
- package/content/plugins/utils/renderFields.js +51 -0
- package/content/plugins/utils/renderGetFilterFields.d.ts +9 -0
- package/content/plugins/utils/renderGetFilterFields.js +41 -0
- package/content/plugins/utils/renderInputFields.d.ts +14 -0
- package/content/plugins/utils/renderInputFields.js +53 -0
- package/content/plugins/utils/renderListFilterFields.d.ts +10 -0
- package/content/plugins/utils/renderListFilterFields.js +39 -0
- package/content/plugins/utils/renderSortEnum.d.ts +9 -0
- package/content/plugins/utils/renderSortEnum.js +32 -0
- package/content/plugins/validators/dateGte.d.ts +3 -0
- package/content/plugins/validators/dateGte.js +37 -0
- package/content/plugins/validators/dateLte.d.ts +3 -0
- package/content/plugins/validators/dateLte.js +37 -0
- package/content/plugins/validators/gte.d.ts +3 -0
- package/content/plugins/validators/gte.js +32 -0
- package/content/plugins/validators/in.d.ts +3 -0
- package/content/plugins/validators/in.js +32 -0
- package/content/plugins/validators/index.d.ts +2 -0
- package/content/plugins/validators/index.js +36 -0
- package/content/plugins/validators/lte.d.ts +3 -0
- package/content/plugins/validators/lte.js +32 -0
- package/content/plugins/validators/maxLength.d.ts +3 -0
- package/content/plugins/validators/maxLength.js +32 -0
- package/content/plugins/validators/minLength.d.ts +3 -0
- package/content/plugins/validators/minLength.js +32 -0
- package/content/plugins/validators/pattern.d.ts +3 -0
- package/content/plugins/validators/pattern.js +47 -0
- package/content/plugins/validators/patternPlugins/email.d.ts +3 -0
- package/content/plugins/validators/patternPlugins/email.js +17 -0
- package/content/plugins/validators/patternPlugins/index.d.ts +2 -0
- package/content/plugins/validators/patternPlugins/index.js +19 -0
- package/content/plugins/validators/patternPlugins/lowerCase.d.ts +3 -0
- package/content/plugins/validators/patternPlugins/lowerCase.js +17 -0
- package/content/plugins/validators/patternPlugins/upperCase.d.ts +3 -0
- package/content/plugins/validators/patternPlugins/upperCase.js +17 -0
- package/content/plugins/validators/patternPlugins/url.d.ts +3 -0
- package/content/plugins/validators/patternPlugins/url.js +17 -0
- package/content/plugins/validators/required.d.ts +3 -0
- package/content/plugins/validators/required.js +25 -0
- package/content/plugins/validators/timeGte.d.ts +3 -0
- package/content/plugins/validators/timeGte.js +32 -0
- package/content/plugins/validators/timeLte.d.ts +3 -0
- package/content/plugins/validators/timeLte.js +32 -0
- package/index.d.ts +12 -0
- package/index.js +66 -0
- package/migrateCMSPermissions.d.ts +17 -0
- package/migrateCMSPermissions.js +193 -0
- package/package.json +80 -0
- package/plugins/context.d.ts +4 -0
- package/plugins/context.js +34 -0
- package/plugins/crud/index.d.ts +6 -0
- package/plugins/crud/index.js +100 -0
- package/plugins/crud/settings.crud.d.ts +10 -0
- package/plugins/crud/settings.crud.js +93 -0
- package/plugins/crud/system.crud.d.ts +10 -0
- package/plugins/crud/system.crud.js +182 -0
- package/plugins/graphql/system.d.ts +17 -0
- package/plugins/graphql/system.js +72 -0
- package/plugins/graphql.d.ts +2 -0
- package/plugins/graphql.js +79 -0
- package/plugins/upgrades/index.d.ts +2 -0
- package/plugins/upgrades/index.js +14 -0
- package/plugins/upgrades/v5.5.0/helpers.d.ts +6 -0
- package/plugins/upgrades/v5.5.0/helpers.js +10 -0
- package/plugins/upgrades/v5.5.0/index.d.ts +4 -0
- package/plugins/upgrades/v5.5.0/index.js +129 -0
- package/transformers.d.ts +2 -0
- package/transformers.js +25 -0
- package/types.d.ts +2149 -0
- package/types.js +366 -0
- package/utils.d.ts +25 -0
- package/utils.js +251 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createModelGroupsCrud = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _fields = require("@commodo/fields");
|
|
13
|
+
|
|
14
|
+
var _validation = require("@webiny/validation");
|
|
15
|
+
|
|
16
|
+
var _mdbid = _interopRequireDefault(require("mdbid"));
|
|
17
|
+
|
|
18
|
+
var utils = _interopRequireWildcard(require("../../../utils"));
|
|
19
|
+
|
|
20
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
21
|
+
|
|
22
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
23
|
+
|
|
24
|
+
var _CmsGroupPlugin = require("../CmsGroupPlugin");
|
|
25
|
+
|
|
26
|
+
var _pubsub = require("@webiny/pubsub");
|
|
27
|
+
|
|
28
|
+
var _beforeUpdate = require("./contentModelGroup/beforeUpdate");
|
|
29
|
+
|
|
30
|
+
var _beforeCreate = require("./contentModelGroup/beforeCreate");
|
|
31
|
+
|
|
32
|
+
var _beforeDelete = require("./contentModelGroup/beforeDelete");
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
39
|
+
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
41
|
+
|
|
42
|
+
const CreateContentModelGroupModel = (0, _fields.withFields)({
|
|
43
|
+
name: (0, _fields.string)({
|
|
44
|
+
validation: _validation.validation.create("required,maxLength:100")
|
|
45
|
+
}),
|
|
46
|
+
slug: (0, _fields.string)({
|
|
47
|
+
validation: _validation.validation.create("maxLength:100")
|
|
48
|
+
}),
|
|
49
|
+
description: (0, _fields.string)({
|
|
50
|
+
validation: _validation.validation.create("maxLength:255")
|
|
51
|
+
}),
|
|
52
|
+
icon: (0, _fields.string)({
|
|
53
|
+
validation: _validation.validation.create("required,maxLength:255")
|
|
54
|
+
})
|
|
55
|
+
})();
|
|
56
|
+
const UpdateContentModelGroupModel = (0, _fields.withFields)({
|
|
57
|
+
name: (0, _fields.string)({
|
|
58
|
+
validation: _validation.validation.create("maxLength:100")
|
|
59
|
+
}),
|
|
60
|
+
description: (0, _fields.string)({
|
|
61
|
+
validation: _validation.validation.create("maxLength:255")
|
|
62
|
+
}),
|
|
63
|
+
icon: (0, _fields.string)({
|
|
64
|
+
validation: _validation.validation.create("maxLength:255")
|
|
65
|
+
})
|
|
66
|
+
})();
|
|
67
|
+
|
|
68
|
+
const createModelGroupsCrud = params => {
|
|
69
|
+
const {
|
|
70
|
+
getTenant,
|
|
71
|
+
getIdentity,
|
|
72
|
+
getLocale,
|
|
73
|
+
storageOperations,
|
|
74
|
+
context
|
|
75
|
+
} = params;
|
|
76
|
+
|
|
77
|
+
const getGroupsAsPlugins = () => {
|
|
78
|
+
const tenant = getTenant().id;
|
|
79
|
+
const locale = getLocale().code;
|
|
80
|
+
return context.plugins.byType(_CmsGroupPlugin.CmsGroupPlugin.type)
|
|
81
|
+
/**
|
|
82
|
+
* We need to filter out groups that are not for this tenant or locale.
|
|
83
|
+
* If it does not have tenant or locale define, it is for every locale and tenant
|
|
84
|
+
*/
|
|
85
|
+
.filter(plugin => {
|
|
86
|
+
const {
|
|
87
|
+
tenant: t,
|
|
88
|
+
locale: l
|
|
89
|
+
} = plugin.contentModelGroup;
|
|
90
|
+
|
|
91
|
+
if (t && t !== tenant) {
|
|
92
|
+
return false;
|
|
93
|
+
} else if (l && l !== locale) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return true;
|
|
98
|
+
}).map(plugin => {
|
|
99
|
+
return _objectSpread(_objectSpread({}, plugin.contentModelGroup), {}, {
|
|
100
|
+
tenant,
|
|
101
|
+
locale,
|
|
102
|
+
webinyVersion: context.WEBINY_VERSION
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const checkPermissions = check => {
|
|
108
|
+
return utils.checkPermissions(context, "cms.contentModelGroup", {
|
|
109
|
+
rwd: check
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const groupsGet = async id => {
|
|
114
|
+
const groupPlugin = getGroupsAsPlugins().find(group => group.id === id);
|
|
115
|
+
|
|
116
|
+
if (groupPlugin) {
|
|
117
|
+
return groupPlugin;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const tenant = getTenant().id;
|
|
121
|
+
const locale = getLocale().code;
|
|
122
|
+
let group = null;
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
group = await storageOperations.groups.get({
|
|
126
|
+
tenant,
|
|
127
|
+
locale,
|
|
128
|
+
id
|
|
129
|
+
});
|
|
130
|
+
} catch (ex) {
|
|
131
|
+
throw new _error.default(ex.message, ex.code || "GET_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
132
|
+
id
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!group) {
|
|
137
|
+
throw new _handlerGraphql.NotFoundError(`Cms Group "${id}" was not found!`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
|
141
|
+
tenant: group.tenant || tenant,
|
|
142
|
+
locale: group.locale || locale
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const groupsList = async params => {
|
|
147
|
+
const {
|
|
148
|
+
where
|
|
149
|
+
} = params || {};
|
|
150
|
+
const tenant = getTenant().id;
|
|
151
|
+
const locale = getLocale().code;
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
const pluginsGroups = getGroupsAsPlugins();
|
|
155
|
+
const databaseGroups = await storageOperations.groups.list({
|
|
156
|
+
where: _objectSpread(_objectSpread({}, where || {}), {}, {
|
|
157
|
+
tenant: where ? where.tenant : tenant,
|
|
158
|
+
locale: where ? where.locale : locale
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
return pluginsGroups.concat(databaseGroups.map(group => {
|
|
162
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
|
163
|
+
tenant: group.tenant || tenant,
|
|
164
|
+
locale: group.locale || locale
|
|
165
|
+
});
|
|
166
|
+
}));
|
|
167
|
+
} catch (ex) {
|
|
168
|
+
throw new _error.default(ex.message, ex.code || "LIST_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
169
|
+
where
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const onBeforeCreate = (0, _pubsub.createTopic)();
|
|
175
|
+
const onAfterCreate = (0, _pubsub.createTopic)();
|
|
176
|
+
const onBeforeUpdate = (0, _pubsub.createTopic)();
|
|
177
|
+
const onAfterUpdate = (0, _pubsub.createTopic)();
|
|
178
|
+
const onBeforeDelete = (0, _pubsub.createTopic)();
|
|
179
|
+
const onAfterDelete = (0, _pubsub.createTopic)();
|
|
180
|
+
/**
|
|
181
|
+
* We need to assign some default behaviors.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
(0, _beforeCreate.assignBeforeGroupCreate)({
|
|
185
|
+
onBeforeCreate,
|
|
186
|
+
plugins: context.plugins,
|
|
187
|
+
storageOperations
|
|
188
|
+
});
|
|
189
|
+
(0, _beforeUpdate.assignBeforeGroupUpdate)({
|
|
190
|
+
onBeforeUpdate,
|
|
191
|
+
plugins: context.plugins
|
|
192
|
+
});
|
|
193
|
+
(0, _beforeDelete.assignBeforeGroupDelete)({
|
|
194
|
+
onBeforeDelete,
|
|
195
|
+
plugins: context.plugins,
|
|
196
|
+
storageOperations
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
onBeforeGroupCreate: onBeforeCreate,
|
|
200
|
+
onAfterGroupCreate: onAfterCreate,
|
|
201
|
+
onBeforeGroupUpdate: onBeforeUpdate,
|
|
202
|
+
onAfterGroupUpdate: onAfterUpdate,
|
|
203
|
+
onBeforeGroupDelete: onBeforeDelete,
|
|
204
|
+
onAfterGroupDelete: onAfterDelete,
|
|
205
|
+
getGroup: async id => {
|
|
206
|
+
const permission = await checkPermissions("r");
|
|
207
|
+
const group = await groupsGet(id);
|
|
208
|
+
utils.checkOwnership(context, permission, group);
|
|
209
|
+
utils.validateGroupAccess(context, permission, group);
|
|
210
|
+
return group;
|
|
211
|
+
},
|
|
212
|
+
listGroups: async params => {
|
|
213
|
+
const {
|
|
214
|
+
where
|
|
215
|
+
} = params || {};
|
|
216
|
+
const {
|
|
217
|
+
tenant,
|
|
218
|
+
locale
|
|
219
|
+
} = where || {};
|
|
220
|
+
const permission = await checkPermissions("r");
|
|
221
|
+
const response = await groupsList(_objectSpread(_objectSpread({}, params || {}), {}, {
|
|
222
|
+
where: _objectSpread(_objectSpread({}, where || {}), {}, {
|
|
223
|
+
tenant: tenant || getTenant().id,
|
|
224
|
+
locale: locale || getLocale().code
|
|
225
|
+
})
|
|
226
|
+
}));
|
|
227
|
+
return response.filter(group => {
|
|
228
|
+
if (!utils.validateOwnership(context, permission, group)) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return utils.validateGroupAccess(context, permission, group);
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
createGroup: async inputData => {
|
|
236
|
+
await checkPermissions("w");
|
|
237
|
+
const createdData = new CreateContentModelGroupModel().populate(_objectSpread(_objectSpread({}, inputData), {}, {
|
|
238
|
+
slug: inputData.slug ? utils.toSlug(inputData.slug) : ""
|
|
239
|
+
}));
|
|
240
|
+
await createdData.validate();
|
|
241
|
+
const input = await createdData.toJSON();
|
|
242
|
+
const identity = getIdentity();
|
|
243
|
+
const id = (0, _mdbid.default)();
|
|
244
|
+
|
|
245
|
+
const group = _objectSpread(_objectSpread({}, input), {}, {
|
|
246
|
+
id,
|
|
247
|
+
tenant: getTenant().id,
|
|
248
|
+
locale: getLocale().code,
|
|
249
|
+
createdOn: new Date().toISOString(),
|
|
250
|
+
savedOn: new Date().toISOString(),
|
|
251
|
+
createdBy: {
|
|
252
|
+
id: identity.id,
|
|
253
|
+
displayName: identity.displayName,
|
|
254
|
+
type: identity.type
|
|
255
|
+
},
|
|
256
|
+
webinyVersion: context.WEBINY_VERSION
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
await onBeforeCreate.publish({
|
|
261
|
+
group
|
|
262
|
+
});
|
|
263
|
+
const result = await storageOperations.groups.create({
|
|
264
|
+
input,
|
|
265
|
+
group
|
|
266
|
+
});
|
|
267
|
+
await onAfterCreate.publish({
|
|
268
|
+
group: result
|
|
269
|
+
});
|
|
270
|
+
return group;
|
|
271
|
+
} catch (ex) {
|
|
272
|
+
throw new _error.default(ex.message || "Could not save data model group.", ex.code || "ERROR_ON_CREATE", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
273
|
+
group,
|
|
274
|
+
input
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
updateGroup: async (id, inputData) => {
|
|
279
|
+
const permission = await checkPermissions("w");
|
|
280
|
+
const original = await groupsGet(id);
|
|
281
|
+
utils.checkOwnership(context, permission, original);
|
|
282
|
+
const input = new UpdateContentModelGroupModel().populate(inputData);
|
|
283
|
+
await input.validate();
|
|
284
|
+
const updatedDataJson = await input.toJSON({
|
|
285
|
+
onlyDirty: true
|
|
286
|
+
});
|
|
287
|
+
/**
|
|
288
|
+
* No need to continue if no values were changed
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
if (Object.keys(updatedDataJson).length === 0) {
|
|
292
|
+
return original;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const group = _objectSpread(_objectSpread(_objectSpread({}, original), updatedDataJson), {}, {
|
|
296
|
+
locale: getLocale().code,
|
|
297
|
+
tenant: getTenant().id,
|
|
298
|
+
savedOn: new Date().toISOString()
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
try {
|
|
302
|
+
await onBeforeUpdate.publish({
|
|
303
|
+
original,
|
|
304
|
+
group
|
|
305
|
+
});
|
|
306
|
+
const updatedGroup = await storageOperations.groups.update({
|
|
307
|
+
original,
|
|
308
|
+
group,
|
|
309
|
+
input
|
|
310
|
+
});
|
|
311
|
+
await onAfterUpdate.publish({
|
|
312
|
+
original,
|
|
313
|
+
group: updatedGroup
|
|
314
|
+
});
|
|
315
|
+
return updatedGroup;
|
|
316
|
+
} catch (ex) {
|
|
317
|
+
throw new _error.default(ex.message, ex.code || "UPDATE_ERROR", {
|
|
318
|
+
error: ex,
|
|
319
|
+
original,
|
|
320
|
+
group,
|
|
321
|
+
input
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
deleteGroup: async id => {
|
|
326
|
+
const permission = await checkPermissions("d");
|
|
327
|
+
const group = await groupsGet(id);
|
|
328
|
+
utils.checkOwnership(context, permission, group);
|
|
329
|
+
|
|
330
|
+
try {
|
|
331
|
+
await onBeforeDelete.publish({
|
|
332
|
+
group
|
|
333
|
+
});
|
|
334
|
+
await storageOperations.groups.delete({
|
|
335
|
+
group
|
|
336
|
+
});
|
|
337
|
+
await onAfterDelete.publish({
|
|
338
|
+
group
|
|
339
|
+
});
|
|
340
|
+
} catch (ex) {
|
|
341
|
+
throw new _error.default(ex.message, ex.code || "DELETE_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
342
|
+
id
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
exports.createModelGroupsCrud = createModelGroupsCrud;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContextPlugin } from "@webiny/handler/plugins/ContextPlugin";
|
|
2
|
+
import { CmsContext, HeadlessCmsStorageOperations } from "../../../types";
|
|
3
|
+
export interface Params {
|
|
4
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
5
|
+
}
|
|
6
|
+
export declare const createContentCruds: (params: Params) => ContextPlugin<CmsContext>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createContentCruds = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _ContextPlugin = require("@webiny/handler/plugins/ContextPlugin");
|
|
13
|
+
|
|
14
|
+
var _contentModelGroup = require("./contentModelGroup.crud");
|
|
15
|
+
|
|
16
|
+
var _contentModel = require("./contentModel.crud");
|
|
17
|
+
|
|
18
|
+
var _contentEntry = require("./contentEntry.crud");
|
|
19
|
+
|
|
20
|
+
var _system = require("../../../plugins/crud/system.crud");
|
|
21
|
+
|
|
22
|
+
var _settings = require("../../../plugins/crud/settings.crud");
|
|
23
|
+
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
|
+
|
|
28
|
+
const debug = process.env.DEBUG === "true";
|
|
29
|
+
|
|
30
|
+
const createContentCruds = params => {
|
|
31
|
+
const {
|
|
32
|
+
storageOperations
|
|
33
|
+
} = params;
|
|
34
|
+
return new _ContextPlugin.ContextPlugin(async context => {
|
|
35
|
+
/**
|
|
36
|
+
* This should never happen in the actual project.
|
|
37
|
+
* It is to make sure that we load setup context before the CRUD init in our internal code.
|
|
38
|
+
*/
|
|
39
|
+
if (!context.cms) {
|
|
40
|
+
debug && console.log(`Missing initial "cms" on the context. Make sure that you set it up before creating Content CRUDs.`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const getLocale = () => {
|
|
45
|
+
return context.i18n.getCurrentLocale();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const getIdentity = () => {
|
|
49
|
+
return context.security.getIdentity();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getTenant = () => {
|
|
53
|
+
return context.tenancy.getCurrentTenant();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
if (storageOperations.plugins && storageOperations.plugins.length > 0) {
|
|
57
|
+
context.plugins.register(storageOperations.plugins);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
context.cms = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context.cms), {}, {
|
|
61
|
+
storageOperations
|
|
62
|
+
}, (0, _system.createSystemCrud)({
|
|
63
|
+
context,
|
|
64
|
+
getTenant,
|
|
65
|
+
getIdentity,
|
|
66
|
+
storageOperations
|
|
67
|
+
})), (0, _settings.createSettingsCrud)({
|
|
68
|
+
context,
|
|
69
|
+
getTenant,
|
|
70
|
+
getLocale,
|
|
71
|
+
storageOperations
|
|
72
|
+
})), (0, _contentModelGroup.createModelGroupsCrud)({
|
|
73
|
+
context,
|
|
74
|
+
getTenant,
|
|
75
|
+
getLocale,
|
|
76
|
+
getIdentity,
|
|
77
|
+
storageOperations
|
|
78
|
+
})), (0, _contentModel.createModelsCrud)({
|
|
79
|
+
context,
|
|
80
|
+
getLocale,
|
|
81
|
+
getTenant,
|
|
82
|
+
getIdentity,
|
|
83
|
+
storageOperations
|
|
84
|
+
})), (0, _contentEntry.createContentEntryCrud)({
|
|
85
|
+
context,
|
|
86
|
+
getLocale,
|
|
87
|
+
getTenant,
|
|
88
|
+
getIdentity,
|
|
89
|
+
storageOperations
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
if (!storageOperations.init) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
await storageOperations.init(context.cms);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.createContentCruds = createContentCruds;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
const createListFilters = ({
|
|
9
|
+
field
|
|
10
|
+
}) => {
|
|
11
|
+
return `
|
|
12
|
+
${field.fieldId}: Boolean
|
|
13
|
+
${field.fieldId}_not: Boolean
|
|
14
|
+
`;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const plugin = {
|
|
18
|
+
name: "cms-model-field-to-graphql-boolean",
|
|
19
|
+
type: "cms-model-field-to-graphql",
|
|
20
|
+
fieldType: "boolean",
|
|
21
|
+
isSortable: true,
|
|
22
|
+
isSearchable: true,
|
|
23
|
+
read: {
|
|
24
|
+
createListFilters,
|
|
25
|
+
|
|
26
|
+
createGetFilters({
|
|
27
|
+
field
|
|
28
|
+
}) {
|
|
29
|
+
return `${field.fieldId}: Boolean`;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
createTypeField({
|
|
33
|
+
field
|
|
34
|
+
}) {
|
|
35
|
+
if (field.multipleValues) {
|
|
36
|
+
return `${field.fieldId}: [Boolean]`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return `${field.fieldId}: Boolean`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
},
|
|
43
|
+
manage: {
|
|
44
|
+
createListFilters,
|
|
45
|
+
|
|
46
|
+
createTypeField({
|
|
47
|
+
field
|
|
48
|
+
}) {
|
|
49
|
+
if (field.multipleValues) {
|
|
50
|
+
return field.fieldId + ": [Boolean]";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return field.fieldId + ": Boolean";
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
createInputField({
|
|
57
|
+
field
|
|
58
|
+
}) {
|
|
59
|
+
if (field.multipleValues) {
|
|
60
|
+
return field.fieldId + ": [Boolean]";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return field.fieldId + ": Boolean";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var _default = plugin;
|
|
69
|
+
exports.default = _default;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const fieldGraphQLTypes = {
|
|
8
|
+
time: "Time",
|
|
9
|
+
dateTimeWithoutTimezone: "DateTime",
|
|
10
|
+
dateTimeWithTimezone: "DateTimeZ",
|
|
11
|
+
date: "Date"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const getFieldGraphQLType = field => {
|
|
15
|
+
const type = field.settings.type;
|
|
16
|
+
|
|
17
|
+
if (!type || !fieldGraphQLTypes[type]) {
|
|
18
|
+
return "DateTime";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return fieldGraphQLTypes[type];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const createListFilters = ({
|
|
25
|
+
field
|
|
26
|
+
}) => {
|
|
27
|
+
return `
|
|
28
|
+
${field.fieldId}: ${getFieldGraphQLType(field)}
|
|
29
|
+
${field.fieldId}_not: ${getFieldGraphQLType(field)}
|
|
30
|
+
${field.fieldId}_in: [${getFieldGraphQLType(field)}]
|
|
31
|
+
${field.fieldId}_not_in: [${getFieldGraphQLType(field)}]
|
|
32
|
+
${field.fieldId}_lt: ${getFieldGraphQLType(field)}
|
|
33
|
+
${field.fieldId}_lte: ${getFieldGraphQLType(field)}
|
|
34
|
+
${field.fieldId}_gt: ${getFieldGraphQLType(field)}
|
|
35
|
+
${field.fieldId}_gte: ${getFieldGraphQLType(field)}
|
|
36
|
+
`;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const plugin = {
|
|
40
|
+
name: "cms-model-field-to-graphql-datetime",
|
|
41
|
+
type: "cms-model-field-to-graphql",
|
|
42
|
+
fieldType: "datetime",
|
|
43
|
+
isSortable: true,
|
|
44
|
+
isSearchable: true,
|
|
45
|
+
read: {
|
|
46
|
+
createListFilters,
|
|
47
|
+
|
|
48
|
+
createGetFilters({
|
|
49
|
+
field
|
|
50
|
+
}) {
|
|
51
|
+
return `${field.fieldId}: ${getFieldGraphQLType(field)}`;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
createTypeField({
|
|
55
|
+
field
|
|
56
|
+
}) {
|
|
57
|
+
if (field.multipleValues) {
|
|
58
|
+
return `${field.fieldId}: [${getFieldGraphQLType(field)}]`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return `${field.fieldId}: ${getFieldGraphQLType(field)}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
},
|
|
65
|
+
manage: {
|
|
66
|
+
createListFilters,
|
|
67
|
+
|
|
68
|
+
createTypeField({
|
|
69
|
+
field
|
|
70
|
+
}) {
|
|
71
|
+
return `${field.fieldId}: ${getFieldGraphQLType(field)}`;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
createInputField({
|
|
75
|
+
field
|
|
76
|
+
}) {
|
|
77
|
+
return `${field.fieldId}: ${getFieldGraphQLType(field)}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var _default = plugin;
|
|
83
|
+
exports.default = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const plugin = {
|
|
8
|
+
name: "cms-model-field-to-graphql-file",
|
|
9
|
+
type: "cms-model-field-to-graphql",
|
|
10
|
+
fieldType: "file",
|
|
11
|
+
isSortable: false,
|
|
12
|
+
isSearchable: false,
|
|
13
|
+
read: {
|
|
14
|
+
createTypeField({
|
|
15
|
+
field
|
|
16
|
+
}) {
|
|
17
|
+
if (field.multipleValues) {
|
|
18
|
+
return `${field.fieldId}: [String]`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return `${field.fieldId}: String`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
manage: {
|
|
26
|
+
createTypeField({
|
|
27
|
+
field
|
|
28
|
+
}) {
|
|
29
|
+
if (field.multipleValues) {
|
|
30
|
+
return field.fieldId + ": [String]";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return field.fieldId + ": String";
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
createInputField({
|
|
37
|
+
field
|
|
38
|
+
}) {
|
|
39
|
+
if (field.multipleValues) {
|
|
40
|
+
return field.fieldId + ": [String]";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return field.fieldId + ": String";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var _default = plugin;
|
|
49
|
+
exports.default = _default;
|