@webiny/api-headless-cms 5.18.3 → 5.19.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/plugins/crud/contentEntry/afterDelete.d.ts +7 -0
- package/content/plugins/crud/contentEntry/afterDelete.js +41 -0
- package/content/plugins/crud/contentEntry/markLockedFields.d.ts +7 -3
- package/content/plugins/crud/contentEntry/markLockedFields.js +41 -7
- package/content/plugins/crud/contentEntry/referenceFieldsMapping.d.ts +12 -0
- package/content/plugins/crud/contentEntry/referenceFieldsMapping.js +251 -0
- package/content/plugins/crud/contentEntry.crud.d.ts +0 -4
- package/content/plugins/crud/contentEntry.crud.js +50 -51
- package/content/plugins/crud/contentModel/beforeCreate.js +1 -1
- package/content/plugins/crud/index.js +6 -4
- package/content/plugins/graphqlFields/ref.js +70 -34
- package/content/plugins/modelManager/DefaultCmsModelManager.js +7 -1
- package/content/plugins/schema/contentEntries.js +39 -28
- package/content/plugins/schema/createManageResolvers.js +1 -2
- package/content/plugins/schema/resolvers/manage/resolveDelete.js +7 -1
- package/content/plugins/utils/renderSortEnum.js +12 -12
- package/content/plugins/validators/patternPlugins/index.js +5 -1
- package/content/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +3 -0
- package/content/plugins/validators/patternPlugins/lowerCaseSpace.js +17 -0
- package/content/plugins/validators/patternPlugins/upperCaseSpace.d.ts +3 -0
- package/content/plugins/validators/patternPlugins/upperCaseSpace.js +17 -0
- package/index.d.ts +1 -1
- package/package.json +24 -23
- package/plugins/crud/index.js +20 -2
- package/plugins/crud/system.crud.js +2 -1
- package/types.d.ts +20 -36
- package/types.js +0 -6
|
@@ -25,6 +25,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
25
25
|
|
|
26
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
27
|
|
|
28
|
+
const debug = process.env.DEBUG === "true";
|
|
29
|
+
|
|
28
30
|
const createContentCruds = params => {
|
|
29
31
|
const {
|
|
30
32
|
storageOperations
|
|
@@ -35,7 +37,7 @@ const createContentCruds = params => {
|
|
|
35
37
|
* It is to make sure that we load setup context before the CRUD init in our internal code.
|
|
36
38
|
*/
|
|
37
39
|
if (!context.cms) {
|
|
38
|
-
console.log(`Missing initial "cms" on the context. Make sure that you set it up before creating Content CRUDs.`);
|
|
40
|
+
debug && console.log(`Missing initial "cms" on the context. Make sure that you set it up before creating Content CRUDs.`);
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -55,7 +57,9 @@ const createContentCruds = params => {
|
|
|
55
57
|
context.plugins.register(storageOperations.plugins);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
context.cms = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context.cms),
|
|
60
|
+
context.cms = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context.cms), {}, {
|
|
61
|
+
storageOperations
|
|
62
|
+
}, (0, _system.createSystemCrud)({
|
|
59
63
|
context,
|
|
60
64
|
getTenant,
|
|
61
65
|
getIdentity,
|
|
@@ -79,8 +83,6 @@ const createContentCruds = params => {
|
|
|
79
83
|
storageOperations
|
|
80
84
|
})), (0, _contentEntry.createContentEntryCrud)({
|
|
81
85
|
context,
|
|
82
|
-
getLocale,
|
|
83
|
-
getTenant,
|
|
84
86
|
getIdentity,
|
|
85
87
|
storageOperations
|
|
86
88
|
}));
|
|
@@ -11,6 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _createTypeName = require("../utils/createTypeName");
|
|
13
13
|
|
|
14
|
+
var _utils = require("@webiny/utils");
|
|
15
|
+
|
|
14
16
|
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; }
|
|
15
17
|
|
|
16
18
|
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; }
|
|
@@ -23,17 +25,30 @@ const createListFilters = ({
|
|
|
23
25
|
field
|
|
24
26
|
}) => {
|
|
25
27
|
return `
|
|
26
|
-
${field.fieldId}:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
${field.fieldId}: RefFieldWhereInput
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const createFilteringTypeDef = () => {
|
|
33
|
+
return `
|
|
34
|
+
input RefFieldWhereInput {
|
|
35
|
+
id: String
|
|
36
|
+
id_not: String
|
|
37
|
+
id_in: [String!]
|
|
38
|
+
id_not_in: [String]
|
|
39
|
+
entryId: String
|
|
40
|
+
entryId_not: String
|
|
41
|
+
entryId_in: [String!]
|
|
42
|
+
entryId_not_in: [String!]
|
|
43
|
+
}
|
|
30
44
|
`;
|
|
31
45
|
};
|
|
32
46
|
|
|
33
47
|
const appendTypename = (entries, typename) => {
|
|
34
48
|
return entries.map(item => {
|
|
35
|
-
item
|
|
36
|
-
|
|
49
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
50
|
+
__typename: typename
|
|
51
|
+
});
|
|
37
52
|
});
|
|
38
53
|
};
|
|
39
54
|
|
|
@@ -77,26 +92,27 @@ const plugin = {
|
|
|
77
92
|
return [];
|
|
78
93
|
}
|
|
79
94
|
|
|
80
|
-
const entriesByModel = value.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// Get model manager, to get access to CRUD methods
|
|
95
|
+
const entriesByModel = value.reduce((collection, ref) => {
|
|
96
|
+
if (!collection[ref.modelId]) {
|
|
97
|
+
collection[ref.modelId] = [];
|
|
98
|
+
} else if (collection[ref.modelId].includes(ref.entryId) === true) {
|
|
99
|
+
return collection;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
collection[ref.modelId].push(ref.entryId);
|
|
103
|
+
return collection;
|
|
104
|
+
}, {});
|
|
105
|
+
const getters = Object.keys(entriesByModel).map(async modelId => {
|
|
106
|
+
const idList = entriesByModel[modelId]; // Get model manager, to get access to CRUD methods
|
|
107
|
+
|
|
92
108
|
const model = await cms.getModelManager(modelId);
|
|
93
109
|
let entries; // `read` API works with `published` data
|
|
94
110
|
|
|
95
111
|
if (cms.READ) {
|
|
96
|
-
entries = await model.getPublishedByIds(
|
|
112
|
+
entries = await model.getPublishedByIds(idList);
|
|
97
113
|
} // `preview` and `manage` with `latest` data
|
|
98
114
|
else {
|
|
99
|
-
entries = await model.getLatestByIds(
|
|
115
|
+
entries = await model.getLatestByIds(idList);
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
return appendTypename(entries, modelIdToTypeName.get(modelId));
|
|
@@ -143,17 +159,19 @@ const plugin = {
|
|
|
143
159
|
}));
|
|
144
160
|
}
|
|
145
161
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
const unionFieldsTypeDef = unionFields.map(({
|
|
163
|
+
field,
|
|
164
|
+
typeName
|
|
165
|
+
}) => `union ${typeName} = ${field.settings.models.map(({
|
|
166
|
+
modelId
|
|
167
|
+
}) => (0, _createTypeName.createReadTypeName)(modelId)).join(" | ")}`).join("\n");
|
|
168
|
+
const filteringTypeDef = `
|
|
169
|
+
${createFilteringTypeDef()}
|
|
170
|
+
|
|
171
|
+
${unionFieldsTypeDef}
|
|
172
|
+
`;
|
|
150
173
|
return {
|
|
151
|
-
typeDefs:
|
|
152
|
-
field,
|
|
153
|
-
typeName
|
|
154
|
-
}) => `union ${typeName} = ${field.settings.models.map(({
|
|
155
|
-
modelId
|
|
156
|
-
}) => (0, _createTypeName.createReadTypeName)(modelId)).join(" | ")}`).join("\n"),
|
|
174
|
+
typeDefs: filteringTypeDef,
|
|
157
175
|
resolvers: {}
|
|
158
176
|
};
|
|
159
177
|
},
|
|
@@ -162,19 +180,37 @@ const plugin = {
|
|
|
162
180
|
},
|
|
163
181
|
manage: {
|
|
164
182
|
createSchema() {
|
|
183
|
+
/**
|
|
184
|
+
* entryId in RefFieldInput is deprecated but cannot mark it as GraphQL does not allow marking input fields as deprecated
|
|
185
|
+
*/
|
|
165
186
|
return {
|
|
166
187
|
typeDefs: `
|
|
167
188
|
type RefField {
|
|
168
189
|
modelId: String!
|
|
169
190
|
entryId: ID!
|
|
191
|
+
id: ID!
|
|
170
192
|
}
|
|
171
193
|
|
|
172
194
|
input RefFieldInput {
|
|
173
195
|
modelId: String!
|
|
174
|
-
|
|
196
|
+
id: ID!
|
|
175
197
|
}
|
|
198
|
+
|
|
199
|
+
${createFilteringTypeDef()}
|
|
176
200
|
`,
|
|
177
|
-
resolvers: {
|
|
201
|
+
resolvers: {
|
|
202
|
+
RefField: {
|
|
203
|
+
entryId: parent => {
|
|
204
|
+
const {
|
|
205
|
+
id
|
|
206
|
+
} = (0, _utils.parseIdentifier)(parent.entryId || parent.id);
|
|
207
|
+
return id;
|
|
208
|
+
},
|
|
209
|
+
id: parent => {
|
|
210
|
+
return parent.id || parent.entryId;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
178
214
|
};
|
|
179
215
|
},
|
|
180
216
|
|
|
@@ -182,7 +218,7 @@ const plugin = {
|
|
|
182
218
|
field
|
|
183
219
|
}) {
|
|
184
220
|
if (field.multipleValues) {
|
|
185
|
-
return `${field.fieldId}: [RefField]`;
|
|
221
|
+
return `${field.fieldId}: [RefField!]`;
|
|
186
222
|
}
|
|
187
223
|
|
|
188
224
|
return `${field.fieldId}: RefField`;
|
|
@@ -192,7 +228,7 @@ const plugin = {
|
|
|
192
228
|
field
|
|
193
229
|
}) {
|
|
194
230
|
if (field.multipleValues) {
|
|
195
|
-
return field.fieldId + ": [RefFieldInput]";
|
|
231
|
+
return field.fieldId + ": [RefFieldInput!]";
|
|
196
232
|
}
|
|
197
233
|
|
|
198
234
|
return field.fieldId + ": RefFieldInput";
|
|
@@ -9,6 +9,8 @@ exports.DefaultCmsModelManager = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
+
var _utils = require("@webiny/utils");
|
|
13
|
+
|
|
12
14
|
class DefaultCmsModelManager {
|
|
13
15
|
constructor(context, model) {
|
|
14
16
|
(0, _defineProperty2.default)(this, "_context", void 0);
|
|
@@ -22,7 +24,11 @@ class DefaultCmsModelManager {
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
async delete(id) {
|
|
25
|
-
|
|
27
|
+
const {
|
|
28
|
+
version
|
|
29
|
+
} = (0, _utils.parseIdentifier)(id);
|
|
30
|
+
|
|
31
|
+
if (version) {
|
|
26
32
|
return this._context.cms.deleteEntryRevision(this._model, id);
|
|
27
33
|
}
|
|
28
34
|
|
|
@@ -46,7 +46,7 @@ const plugin = context => {
|
|
|
46
46
|
|
|
47
47
|
input CmsModelEntryInput {
|
|
48
48
|
modelId: ID!
|
|
49
|
-
|
|
49
|
+
id: ID!
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
extend type Query {
|
|
@@ -101,7 +101,7 @@ const plugin = context => {
|
|
|
101
101
|
async getContentEntry(_, args, context) {
|
|
102
102
|
const {
|
|
103
103
|
modelId,
|
|
104
|
-
|
|
104
|
+
id
|
|
105
105
|
} = args.entry;
|
|
106
106
|
const models = await context.cms.listModels();
|
|
107
107
|
const model = models.find(m => m.modelId === modelId);
|
|
@@ -114,7 +114,7 @@ const plugin = context => {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
const [entry] = await context.cms.getEntriesByIds(model, [
|
|
117
|
+
const [entry] = await context.cms.getEntriesByIds(model, [id]);
|
|
118
118
|
return new _handlerGraphql.Response({
|
|
119
119
|
id: entry.id,
|
|
120
120
|
model: {
|
|
@@ -128,33 +128,44 @@ const plugin = context => {
|
|
|
128
128
|
|
|
129
129
|
async getContentEntries(_, args, context) {
|
|
130
130
|
const models = await context.cms.listModels();
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
const modelsMap = models.reduce((collection, model) => {
|
|
132
|
+
collection[model.modelId] = model;
|
|
133
|
+
return collection;
|
|
134
|
+
}, {});
|
|
135
|
+
const entriesByModel = args.entries.reduce((collection, ref) => {
|
|
136
|
+
if (!collection[ref.modelId]) {
|
|
137
|
+
collection[ref.modelId] = [];
|
|
138
|
+
} else if (collection[ref.modelId].includes(ref.id) === true) {
|
|
139
|
+
return collection;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
collection[ref.modelId].push(ref.id);
|
|
143
|
+
return collection;
|
|
144
|
+
}, {});
|
|
145
|
+
const getters = Object.keys(entriesByModel).map(async modelId => {
|
|
146
|
+
return context.cms.getEntriesByIds(modelsMap[modelId], entriesByModel[modelId]);
|
|
137
147
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
|
|
149
|
+
if (getters.length === 0) {
|
|
150
|
+
return new _handlerGraphql.Response([]);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const results = await Promise.all(getters);
|
|
154
|
+
const entries = results.reduce((collection, items) => {
|
|
155
|
+
return collection.concat(items.map(item => {
|
|
156
|
+
const model = modelsMap[item.modelId];
|
|
157
|
+
return {
|
|
158
|
+
id: item.id,
|
|
159
|
+
model: {
|
|
160
|
+
modelId: model.modelId,
|
|
161
|
+
name: model.name
|
|
162
|
+
},
|
|
163
|
+
status: item.status,
|
|
164
|
+
title: (0, _getEntryTitle.getEntryTitle)(model, item)
|
|
165
|
+
};
|
|
153
166
|
}));
|
|
154
|
-
});
|
|
155
|
-
return new _handlerGraphql.Response(
|
|
156
|
-
return results.reduce((result, item) => result.concat(item), []);
|
|
157
|
-
}));
|
|
167
|
+
}, []);
|
|
168
|
+
return new _handlerGraphql.Response(entries);
|
|
158
169
|
}
|
|
159
170
|
|
|
160
171
|
}
|
|
@@ -123,8 +123,7 @@ const createManageResolvers = ({
|
|
|
123
123
|
},
|
|
124
124
|
|
|
125
125
|
async revisions(entry, _, context) {
|
|
126
|
-
const
|
|
127
|
-
const revisions = await context.cms.getEntryRevisions(model, entryId);
|
|
126
|
+
const revisions = await context.cms.getEntryRevisions(model, entry.entryId);
|
|
128
127
|
return revisions.sort((a, b) => b.version - a.version);
|
|
129
128
|
}
|
|
130
129
|
|
|
@@ -7,6 +7,8 @@ exports.resolveDelete = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _responses = require("@webiny/handler-graphql/responses");
|
|
9
9
|
|
|
10
|
+
var _utils = require("@webiny/utils");
|
|
11
|
+
|
|
10
12
|
const resolveDelete = ({
|
|
11
13
|
model
|
|
12
14
|
}) => async (_, {
|
|
@@ -15,7 +17,11 @@ const resolveDelete = ({
|
|
|
15
17
|
cms
|
|
16
18
|
}) => {
|
|
17
19
|
try {
|
|
18
|
-
|
|
20
|
+
const {
|
|
21
|
+
version
|
|
22
|
+
} = (0, _utils.parseIdentifier)(revision);
|
|
23
|
+
|
|
24
|
+
if (version) {
|
|
19
25
|
await cms.deleteEntryRevision(model, revision);
|
|
20
26
|
} else {
|
|
21
27
|
await cms.deleteEntry(model, revision);
|
|
@@ -14,18 +14,18 @@ const renderSortEnum = ({
|
|
|
14
14
|
fieldTypePlugins
|
|
15
15
|
}) => {
|
|
16
16
|
const sorters = [`id_ASC`, `id_DESC`, "savedOn_ASC", "savedOn_DESC", "createdOn_ASC", "createdOn_DESC"];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
sorters.push(`${fieldId}
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
|
|
18
|
+
for (const field of model.fields) {
|
|
19
|
+
const isSortable = (0, _get.default)(fieldTypePlugins, `${field.type}.isSortable`);
|
|
20
|
+
|
|
21
|
+
if (!isSortable) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
sorters.push(`${field.fieldId}_ASC`);
|
|
26
|
+
sorters.push(`${field.fieldId}_DESC`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
29
|
return sorters.join("\n");
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -15,5 +15,9 @@ var _lowerCase = _interopRequireDefault(require("./lowerCase"));
|
|
|
15
15
|
|
|
16
16
|
var _upperCase = _interopRequireDefault(require("./upperCase"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _lowerCaseSpace = _interopRequireDefault(require("./lowerCaseSpace"));
|
|
19
|
+
|
|
20
|
+
var _upperCaseSpace = _interopRequireDefault(require("./upperCaseSpace"));
|
|
21
|
+
|
|
22
|
+
var _default = [_email.default, _url.default, _lowerCase.default, _upperCase.default, _lowerCaseSpace.default, _upperCaseSpace.default];
|
|
19
23
|
exports.default = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const plugin = {
|
|
8
|
+
type: "cms-model-field-validator-pattern",
|
|
9
|
+
name: "cms-model-field-validator-pattern-lower-case-space",
|
|
10
|
+
pattern: {
|
|
11
|
+
name: "lowerCaseSpace",
|
|
12
|
+
regex: `^([a-z\\s]+)$`,
|
|
13
|
+
flags: ""
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var _default = plugin;
|
|
17
|
+
exports.default = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const plugin = {
|
|
8
|
+
type: "cms-model-field-validator-pattern",
|
|
9
|
+
name: "cms-model-field-validator-pattern-upper-case-space",
|
|
10
|
+
pattern: {
|
|
11
|
+
name: "upperCaseSpace",
|
|
12
|
+
regex: `^([A-Z\\s]+)$`,
|
|
13
|
+
flags: ""
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var _default = plugin;
|
|
17
|
+
exports.default = _default;
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type AdminContextParams = CreateAdminCrudsParams;
|
|
|
6
6
|
export declare const createAdminHeadlessCmsContext: (params: AdminContextParams) => (import("@webiny/handler/plugins/ContextPlugin").ContextPlugin<import("./types").CmsContext> | import("@webiny/api-upgrade").UpgradePlugin<import("./types").CmsContext>[])[];
|
|
7
7
|
export declare const createAdminHeadlessCmsGraphQL: () => import("@webiny/handler-graphql/types").GraphQLSchemaPlugin<import("@webiny/handler/types").ContextInterface>;
|
|
8
8
|
export declare type ContentContextParams = CreateContentCrudsParams;
|
|
9
|
-
export declare const createContentHeadlessCmsContext: (params: ContentContextParams) => (import("./types").ModelManagerPlugin | import("@webiny/handler/plugins/ContextPlugin").ContextPlugin<import("./types").CmsContext> |
|
|
9
|
+
export declare const createContentHeadlessCmsContext: (params: ContentContextParams) => (import("./types").ModelManagerPlugin | import("./types").CmsModelFieldToGraphQLPlugin[] | StorageTransformPlugin<any, any> | import("@webiny/handler/plugins/ContextPlugin").ContextPlugin<import("./types").CmsContext> | (import("./types").CmsModelFieldValidatorPlugin | import("./types").CmsModelFieldPatternValidatorPlugin[])[])[];
|
|
10
10
|
export declare type ContentGraphQLParams = CreateGraphQLHandlerOptions;
|
|
11
11
|
export declare const createContentHeadlessCmsGraphQL: (params?: ContentGraphQLParams) => import("@webiny/plugins/types").PluginCollection;
|
|
12
12
|
export { StorageTransformPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.19.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms:base"
|
|
@@ -21,26 +21,27 @@
|
|
|
21
21
|
"@babel/runtime": "7.16.3",
|
|
22
22
|
"@commodo/fields": "1.1.2-beta.20",
|
|
23
23
|
"@graphql-tools/schema": "7.1.5",
|
|
24
|
-
"@webiny/api-file-manager": "5.
|
|
25
|
-
"@webiny/api-i18n": "5.
|
|
26
|
-
"@webiny/api-i18n-content": "5.
|
|
27
|
-
"@webiny/api-i18n-ddb": "5.
|
|
28
|
-
"@webiny/api-security": "5.
|
|
29
|
-
"@webiny/api-tenancy": "5.
|
|
30
|
-
"@webiny/api-upgrade": "5.
|
|
31
|
-
"@webiny/error": "5.
|
|
32
|
-
"@webiny/handler": "5.
|
|
33
|
-
"@webiny/handler-aws": "5.
|
|
34
|
-
"@webiny/handler-db": "5.
|
|
35
|
-
"@webiny/handler-graphql": "5.
|
|
36
|
-
"@webiny/handler-http": "5.
|
|
37
|
-
"@webiny/plugins": "5.
|
|
38
|
-
"@webiny/pubsub": "5.
|
|
39
|
-
"@webiny/utils": "5.
|
|
40
|
-
"@webiny/validation": "5.
|
|
24
|
+
"@webiny/api-file-manager": "5.19.0-beta.0",
|
|
25
|
+
"@webiny/api-i18n": "5.19.0-beta.0",
|
|
26
|
+
"@webiny/api-i18n-content": "5.19.0-beta.0",
|
|
27
|
+
"@webiny/api-i18n-ddb": "5.19.0-beta.0",
|
|
28
|
+
"@webiny/api-security": "5.19.0-beta.0",
|
|
29
|
+
"@webiny/api-tenancy": "5.19.0-beta.0",
|
|
30
|
+
"@webiny/api-upgrade": "5.19.0-beta.0",
|
|
31
|
+
"@webiny/error": "5.19.0-beta.0",
|
|
32
|
+
"@webiny/handler": "5.19.0-beta.0",
|
|
33
|
+
"@webiny/handler-aws": "5.19.0-beta.0",
|
|
34
|
+
"@webiny/handler-db": "5.19.0-beta.0",
|
|
35
|
+
"@webiny/handler-graphql": "5.19.0-beta.0",
|
|
36
|
+
"@webiny/handler-http": "5.19.0-beta.0",
|
|
37
|
+
"@webiny/plugins": "5.19.0-beta.0",
|
|
38
|
+
"@webiny/pubsub": "5.19.0-beta.0",
|
|
39
|
+
"@webiny/utils": "5.19.0-beta.0",
|
|
40
|
+
"@webiny/validation": "5.19.0-beta.0",
|
|
41
41
|
"boolean": "3.1.4",
|
|
42
42
|
"commodo-fields-object": "1.0.6",
|
|
43
43
|
"dataloader": "2.0.0",
|
|
44
|
+
"dot-prop": "6.0.1",
|
|
44
45
|
"lodash": "4.17.21",
|
|
45
46
|
"p-map": "4.0.0",
|
|
46
47
|
"p-reduce": "2.1.0",
|
|
@@ -53,10 +54,10 @@
|
|
|
53
54
|
"@babel/core": "^7.5.5",
|
|
54
55
|
"@babel/preset-env": "^7.5.5",
|
|
55
56
|
"@babel/preset-flow": "^7.0.0",
|
|
56
|
-
"@webiny/api-security-so-ddb": "^5.
|
|
57
|
-
"@webiny/api-tenancy-so-ddb": "^5.
|
|
58
|
-
"@webiny/cli": "^5.
|
|
59
|
-
"@webiny/project-utils": "^5.
|
|
57
|
+
"@webiny/api-security-so-ddb": "^5.19.0-beta.0",
|
|
58
|
+
"@webiny/api-tenancy-so-ddb": "^5.19.0-beta.0",
|
|
59
|
+
"@webiny/cli": "^5.19.0-beta.0",
|
|
60
|
+
"@webiny/project-utils": "^5.19.0-beta.0",
|
|
60
61
|
"apollo-graphql": "^0.4.1",
|
|
61
62
|
"get-yarn-workspaces": "^1.0.2",
|
|
62
63
|
"graphql": "^14.6.0",
|
|
@@ -76,5 +77,5 @@
|
|
|
76
77
|
"build": "yarn webiny run build",
|
|
77
78
|
"watch": "yarn webiny run watch"
|
|
78
79
|
},
|
|
79
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "6c834e0b356e9099800f4094f2023b05b951d8ea"
|
|
80
81
|
}
|
package/plugins/crud/index.js
CHANGED
|
@@ -17,10 +17,16 @@ var _ContextPlugin = require("@webiny/handler/plugins/ContextPlugin");
|
|
|
17
17
|
|
|
18
18
|
var _contentModelGroup = require("../../content/plugins/crud/contentModelGroup.crud");
|
|
19
19
|
|
|
20
|
+
var _contentModel = require("../../content/plugins/crud/contentModel.crud");
|
|
21
|
+
|
|
22
|
+
var _contentEntry = require("../../content/plugins/crud/contentEntry.crud");
|
|
23
|
+
|
|
20
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; }
|
|
21
25
|
|
|
22
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; }
|
|
23
27
|
|
|
28
|
+
const debug = process.env.DEBUG === "true";
|
|
29
|
+
|
|
24
30
|
const createAdminCruds = params => {
|
|
25
31
|
const {
|
|
26
32
|
storageOperations
|
|
@@ -31,7 +37,7 @@ const createAdminCruds = params => {
|
|
|
31
37
|
* It is to make sure that we load setup context before the CRUD init in our internal code.
|
|
32
38
|
*/
|
|
33
39
|
if (!context.cms) {
|
|
34
|
-
console.log(`Missing initial "cms" on the context. Make sure that you set it up before creating Admin CRUDs.`);
|
|
40
|
+
debug && console.log(`Missing initial "cms" on the context. Make sure that you set it up before creating Admin CRUDs.`);
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
37
43
|
|
|
@@ -51,7 +57,9 @@ const createAdminCruds = params => {
|
|
|
51
57
|
context.plugins.register(storageOperations.plugins);
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
context.cms = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context.cms),
|
|
60
|
+
context.cms = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context.cms), {}, {
|
|
61
|
+
storageOperations
|
|
62
|
+
}, (0, _system.createSystemCrud)({
|
|
55
63
|
context,
|
|
56
64
|
getTenant,
|
|
57
65
|
getIdentity,
|
|
@@ -67,6 +75,16 @@ const createAdminCruds = params => {
|
|
|
67
75
|
getLocale,
|
|
68
76
|
getIdentity,
|
|
69
77
|
storageOperations
|
|
78
|
+
})), (0, _contentModel.createModelsCrud)({
|
|
79
|
+
context,
|
|
80
|
+
getTenant,
|
|
81
|
+
getLocale,
|
|
82
|
+
getIdentity,
|
|
83
|
+
storageOperations
|
|
84
|
+
})), (0, _contentEntry.createContentEntryCrud)({
|
|
85
|
+
context,
|
|
86
|
+
getIdentity,
|
|
87
|
+
storageOperations
|
|
70
88
|
}));
|
|
71
89
|
|
|
72
90
|
if (!storageOperations.init) {
|
|
@@ -161,9 +161,10 @@ const createSystemCrud = params => {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const upgradePlugins = context.plugins.byType("api-upgrade").filter(pl => pl.app === "headless-cms");
|
|
164
|
+
const installedAppVersion = await this.getSystemVersion();
|
|
164
165
|
const plugin = (0, _apiUpgrade.getApplicablePlugin)({
|
|
165
166
|
deployedVersion: context.WEBINY_VERSION,
|
|
166
|
-
installedAppVersion
|
|
167
|
+
installedAppVersion,
|
|
167
168
|
upgradePlugins,
|
|
168
169
|
upgradeToVersion: version
|
|
169
170
|
});
|