@webiny/app-headless-cms-common 5.43.2 → 6.0.0-alpha.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/Fields/ErrorBoundary.js +32 -52
- package/Fields/ErrorBoundary.js.map +1 -1
- package/Fields/FieldElement.js +43 -52
- package/Fields/FieldElement.js.map +1 -1
- package/Fields/FieldElementError.js +6 -13
- package/Fields/FieldElementError.js.map +1 -1
- package/Fields/Fields.js +29 -39
- package/Fields/Fields.js.map +1 -1
- package/Fields/Label.js +7 -31
- package/Fields/Label.js.map +1 -1
- package/Fields/index.js +3 -38
- package/Fields/index.js.map +1 -1
- package/Fields/useBind.js +59 -64
- package/Fields/useBind.js.map +1 -1
- package/Fields/useRenderPlugins.js +4 -12
- package/Fields/useRenderPlugins.js.map +1 -1
- package/ModelFieldProvider/ModelFieldContext.d.ts +1 -1
- package/ModelFieldProvider/ModelFieldContext.js +16 -21
- package/ModelFieldProvider/ModelFieldContext.js.map +1 -1
- package/ModelFieldProvider/index.js +2 -27
- package/ModelFieldProvider/index.js.map +1 -1
- package/ModelFieldProvider/useModelField.js +15 -23
- package/ModelFieldProvider/useModelField.js.map +1 -1
- package/ModelProvider/ModelContext.js +7 -13
- package/ModelProvider/ModelContext.js.map +1 -1
- package/ModelProvider/index.js +2 -27
- package/ModelProvider/index.js.map +1 -1
- package/ModelProvider/useModel.js +6 -12
- package/ModelProvider/useModel.js.map +1 -1
- package/constants.js +1 -7
- package/constants.js.map +1 -1
- package/createFieldsList.js +23 -26
- package/createFieldsList.js.map +1 -1
- package/createValidationContainer.js +11 -16
- package/createValidationContainer.js.map +1 -1
- package/createValidators.js +18 -28
- package/createValidators.js.map +1 -1
- package/entries.graphql.js +292 -70
- package/entries.graphql.js.map +1 -1
- package/getModelTitleFieldId.js +1 -7
- package/getModelTitleFieldId.js.map +1 -1
- package/index.js +10 -115
- package/index.js.map +1 -1
- package/package.json +12 -13
- package/prepareFormData.js +22 -41
- package/prepareFormData.js.map +1 -1
- package/types/index.d.ts +7 -1
- package/types/index.js +54 -38
- package/types/index.js.map +1 -1
- package/types/model.js +1 -5
- package/types/shared.js +1 -5
- package/types/validation.js +1 -5
package/entries.graphql.js
CHANGED
|
@@ -1,40 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var isSingletonModel = model.tags.includes(_constants.CMS_MODEL_SINGLETON_TAG);
|
|
17
|
-
var optionalFields = "";
|
|
1
|
+
import gql from "graphql-tag";
|
|
2
|
+
import { createFieldsList } from "./createFieldsList";
|
|
3
|
+
import { getModelTitleFieldId } from "./getModelTitleFieldId";
|
|
4
|
+
import { CMS_MODEL_SINGLETON_TAG } from "./constants";
|
|
5
|
+
const CONTENT_META_FIELDS = /* GraphQL */`
|
|
6
|
+
title
|
|
7
|
+
description
|
|
8
|
+
image
|
|
9
|
+
version
|
|
10
|
+
locked
|
|
11
|
+
status
|
|
12
|
+
`;
|
|
13
|
+
const createEntrySystemFields = model => {
|
|
14
|
+
const isSingletonModel = model.tags.includes(CMS_MODEL_SINGLETON_TAG);
|
|
15
|
+
let optionalFields = "";
|
|
18
16
|
if (!isSingletonModel) {
|
|
19
|
-
optionalFields =
|
|
17
|
+
optionalFields = `
|
|
18
|
+
wbyAco_location {
|
|
19
|
+
folderId
|
|
20
|
+
}
|
|
21
|
+
meta {
|
|
22
|
+
${CONTENT_META_FIELDS}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
20
25
|
}
|
|
21
|
-
return /* GraphQL
|
|
26
|
+
return /* GraphQL */`
|
|
27
|
+
id
|
|
28
|
+
entryId
|
|
29
|
+
createdOn
|
|
30
|
+
savedOn
|
|
31
|
+
modifiedOn,
|
|
32
|
+
deletedOn
|
|
33
|
+
firstPublishedOn
|
|
34
|
+
lastPublishedOn
|
|
35
|
+
createdBy {
|
|
36
|
+
id
|
|
37
|
+
type
|
|
38
|
+
displayName
|
|
39
|
+
}
|
|
40
|
+
savedBy {
|
|
41
|
+
id
|
|
42
|
+
type
|
|
43
|
+
displayName
|
|
44
|
+
}
|
|
45
|
+
modifiedBy {
|
|
46
|
+
id
|
|
47
|
+
type
|
|
48
|
+
displayName
|
|
49
|
+
}
|
|
50
|
+
deletedBy {
|
|
51
|
+
id
|
|
52
|
+
type
|
|
53
|
+
displayName
|
|
54
|
+
}
|
|
55
|
+
firstPublishedBy {
|
|
56
|
+
id
|
|
57
|
+
type
|
|
58
|
+
displayName
|
|
59
|
+
}
|
|
60
|
+
lastPublishedBy {
|
|
61
|
+
id
|
|
62
|
+
type
|
|
63
|
+
displayName
|
|
64
|
+
}
|
|
65
|
+
revisionCreatedOn
|
|
66
|
+
revisionSavedOn
|
|
67
|
+
revisionModifiedOn
|
|
68
|
+
revisionDeletedOn
|
|
69
|
+
revisionFirstPublishedOn
|
|
70
|
+
revisionLastPublishedOn
|
|
71
|
+
revisionCreatedBy {
|
|
72
|
+
id
|
|
73
|
+
type
|
|
74
|
+
displayName
|
|
75
|
+
}
|
|
76
|
+
revisionSavedBy {
|
|
77
|
+
id
|
|
78
|
+
type
|
|
79
|
+
displayName
|
|
80
|
+
}
|
|
81
|
+
revisionModifiedBy {
|
|
82
|
+
id
|
|
83
|
+
type
|
|
84
|
+
displayName
|
|
85
|
+
}
|
|
86
|
+
revisionDeletedBy {
|
|
87
|
+
id
|
|
88
|
+
type
|
|
89
|
+
displayName
|
|
90
|
+
}
|
|
91
|
+
revisionFirstPublishedBy {
|
|
92
|
+
id
|
|
93
|
+
type
|
|
94
|
+
displayName
|
|
95
|
+
}
|
|
96
|
+
revisionLastPublishedBy {
|
|
97
|
+
id
|
|
98
|
+
type
|
|
99
|
+
displayName
|
|
100
|
+
}
|
|
101
|
+
${optionalFields}
|
|
102
|
+
`;
|
|
22
103
|
};
|
|
23
|
-
|
|
104
|
+
const ERROR_FIELD = /* GraphQL */`
|
|
105
|
+
{
|
|
106
|
+
message
|
|
107
|
+
code
|
|
108
|
+
data
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
24
111
|
|
|
25
112
|
/**
|
|
26
113
|
* ############################################
|
|
27
114
|
* Get CMS Entry Query
|
|
28
115
|
*/
|
|
29
116
|
|
|
30
|
-
|
|
117
|
+
export const createReadQuery = model => {
|
|
31
118
|
/**
|
|
32
119
|
* This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).
|
|
33
120
|
*/
|
|
34
|
-
return
|
|
35
|
-
|
|
121
|
+
return gql`
|
|
122
|
+
query CmsEntriesGet${model.singularApiName}($revision: ID, $entryId: ID) {
|
|
123
|
+
content: get${model.singularApiName}(revision: $revision, entryId: $entryId) {
|
|
124
|
+
data {
|
|
125
|
+
${createEntrySystemFields(model)}
|
|
126
|
+
${createFieldsList({
|
|
127
|
+
model,
|
|
36
128
|
fields: model.fields
|
|
37
|
-
})
|
|
129
|
+
})}
|
|
130
|
+
}
|
|
131
|
+
error ${ERROR_FIELD}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
38
135
|
};
|
|
39
136
|
|
|
40
137
|
/**
|
|
@@ -42,11 +139,21 @@ var createReadQuery = exports.createReadQuery = function createReadQuery(model)
|
|
|
42
139
|
* Get CMS Singleton Entry Query
|
|
43
140
|
*/
|
|
44
141
|
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
142
|
+
export const createReadSingletonQuery = model => {
|
|
143
|
+
return gql`
|
|
144
|
+
query CmsEntryGetSingleton${model.singularApiName} {
|
|
145
|
+
content: get${model.singularApiName} {
|
|
146
|
+
data {
|
|
147
|
+
${createEntrySystemFields(model)}
|
|
148
|
+
${createFieldsList({
|
|
149
|
+
model,
|
|
48
150
|
fields: model.fields
|
|
49
|
-
})
|
|
151
|
+
})}
|
|
152
|
+
}
|
|
153
|
+
error ${ERROR_FIELD}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
50
157
|
};
|
|
51
158
|
|
|
52
159
|
/**
|
|
@@ -54,8 +161,17 @@ var createReadSingletonQuery = exports.createReadSingletonQuery = function creat
|
|
|
54
161
|
* List CMS Entry Revisions Query
|
|
55
162
|
*/
|
|
56
163
|
|
|
57
|
-
|
|
58
|
-
return
|
|
164
|
+
export const createRevisionsQuery = model => {
|
|
165
|
+
return gql`
|
|
166
|
+
query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {
|
|
167
|
+
revisions: get${model.singularApiName}Revisions(id: $id) {
|
|
168
|
+
data {
|
|
169
|
+
${createEntrySystemFields(model)}
|
|
170
|
+
}
|
|
171
|
+
error ${ERROR_FIELD}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
59
175
|
};
|
|
60
176
|
|
|
61
177
|
/**
|
|
@@ -63,15 +179,39 @@ var createRevisionsQuery = exports.createRevisionsQuery = function createRevisio
|
|
|
63
179
|
* List CMS Entries Query
|
|
64
180
|
*/
|
|
65
181
|
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
182
|
+
export const createListQueryDataSelection = (model, fields) => {
|
|
183
|
+
return `
|
|
184
|
+
${createEntrySystemFields(model)}
|
|
185
|
+
${fields ? createFieldsList({
|
|
186
|
+
model,
|
|
187
|
+
fields
|
|
188
|
+
}) : ""}
|
|
189
|
+
${!fields ? getModelTitleFieldId(model) : ""}
|
|
190
|
+
`;
|
|
71
191
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
192
|
+
export const createListQuery = (model, fields, deleted) => {
|
|
193
|
+
const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;
|
|
194
|
+
return gql`
|
|
195
|
+
query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${model.singularApiName}ListSorter], $limit: Int, $after: String, $search: String) {
|
|
196
|
+
content: list${queryName}(
|
|
197
|
+
where: $where
|
|
198
|
+
sort: $sort
|
|
199
|
+
limit: $limit
|
|
200
|
+
after: $after
|
|
201
|
+
search: $search
|
|
202
|
+
) {
|
|
203
|
+
data {
|
|
204
|
+
${createListQueryDataSelection(model, fields)}
|
|
205
|
+
}
|
|
206
|
+
meta {
|
|
207
|
+
cursor
|
|
208
|
+
hasMoreItems
|
|
209
|
+
totalCount
|
|
210
|
+
}
|
|
211
|
+
error ${ERROR_FIELD}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
75
215
|
};
|
|
76
216
|
|
|
77
217
|
/**
|
|
@@ -79,8 +219,15 @@ var createListQuery = exports.createListQuery = function createListQuery(model,
|
|
|
79
219
|
* Delete Mutation
|
|
80
220
|
*/
|
|
81
221
|
|
|
82
|
-
|
|
83
|
-
return
|
|
222
|
+
export const createDeleteMutation = model => {
|
|
223
|
+
return gql`
|
|
224
|
+
mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {
|
|
225
|
+
content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {
|
|
226
|
+
data
|
|
227
|
+
error ${ERROR_FIELD}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
`;
|
|
84
231
|
};
|
|
85
232
|
|
|
86
233
|
/**
|
|
@@ -88,11 +235,21 @@ var createDeleteMutation = exports.createDeleteMutation = function createDeleteM
|
|
|
88
235
|
* Restore from bin Mutation
|
|
89
236
|
*/
|
|
90
237
|
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
|
|
238
|
+
export const createRestoreFromBinMutation = model => {
|
|
239
|
+
return gql`
|
|
240
|
+
mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {
|
|
241
|
+
content: restore${model.singularApiName}FromBin(revision: $revision) {
|
|
242
|
+
data {
|
|
243
|
+
${createEntrySystemFields(model)}
|
|
244
|
+
${createFieldsList({
|
|
245
|
+
model,
|
|
94
246
|
fields: model.fields
|
|
95
|
-
})
|
|
247
|
+
})}
|
|
248
|
+
}
|
|
249
|
+
error ${ERROR_FIELD}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
`;
|
|
96
253
|
};
|
|
97
254
|
|
|
98
255
|
/**
|
|
@@ -100,12 +257,22 @@ var createRestoreFromBinMutation = exports.createRestoreFromBinMutation = functi
|
|
|
100
257
|
* Create Mutation
|
|
101
258
|
*/
|
|
102
259
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
model
|
|
260
|
+
export const createCreateMutation = model => {
|
|
261
|
+
const createFields = createFieldsList({
|
|
262
|
+
model,
|
|
106
263
|
fields: model.fields
|
|
107
264
|
});
|
|
108
|
-
return
|
|
265
|
+
return gql`
|
|
266
|
+
mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {
|
|
267
|
+
content: create${model.singularApiName}(data: $data, options: $options) {
|
|
268
|
+
data {
|
|
269
|
+
${createEntrySystemFields(model)}
|
|
270
|
+
${createFields}
|
|
271
|
+
}
|
|
272
|
+
error ${ERROR_FIELD}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
109
276
|
};
|
|
110
277
|
|
|
111
278
|
/**
|
|
@@ -113,11 +280,20 @@ var createCreateMutation = exports.createCreateMutation = function createCreateM
|
|
|
113
280
|
* Create From Mutation
|
|
114
281
|
*/
|
|
115
282
|
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
|
|
283
|
+
export const createCreateFromMutation = model => {
|
|
284
|
+
return gql`
|
|
285
|
+
mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${model.singularApiName}Input, $options: CreateRevisionCmsEntryOptionsInput) {
|
|
286
|
+
content: create${model.singularApiName}From(revision: $revision, data: $data, options: $options) {
|
|
287
|
+
data {
|
|
288
|
+
${createEntrySystemFields(model)}
|
|
289
|
+
${createFieldsList({
|
|
290
|
+
model,
|
|
119
291
|
fields: model.fields
|
|
120
|
-
})
|
|
292
|
+
})}
|
|
293
|
+
}
|
|
294
|
+
error ${ERROR_FIELD}
|
|
295
|
+
}
|
|
296
|
+
}`;
|
|
121
297
|
};
|
|
122
298
|
|
|
123
299
|
/**
|
|
@@ -125,11 +301,21 @@ var createCreateFromMutation = exports.createCreateFromMutation = function creat
|
|
|
125
301
|
* Update Mutation
|
|
126
302
|
*/
|
|
127
303
|
|
|
128
|
-
|
|
129
|
-
return
|
|
130
|
-
|
|
304
|
+
export const createUpdateMutation = model => {
|
|
305
|
+
return gql`
|
|
306
|
+
mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${model.singularApiName}Input!, $options: UpdateCmsEntryOptionsInput) {
|
|
307
|
+
content: update${model.singularApiName}(revision: $revision, data: $data, options: $options) {
|
|
308
|
+
data {
|
|
309
|
+
${createEntrySystemFields(model)}
|
|
310
|
+
${createFieldsList({
|
|
311
|
+
model,
|
|
131
312
|
fields: model.fields
|
|
132
|
-
})
|
|
313
|
+
})}
|
|
314
|
+
}
|
|
315
|
+
error ${ERROR_FIELD}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
`;
|
|
133
319
|
};
|
|
134
320
|
|
|
135
321
|
/**
|
|
@@ -137,11 +323,21 @@ var createUpdateMutation = exports.createUpdateMutation = function createUpdateM
|
|
|
137
323
|
* Update Singleton Mutation
|
|
138
324
|
*/
|
|
139
325
|
|
|
140
|
-
|
|
141
|
-
return
|
|
142
|
-
|
|
326
|
+
export const createUpdateSingletonMutation = model => {
|
|
327
|
+
return gql`
|
|
328
|
+
mutation CmsUpdate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: UpdateCmsEntryOptionsInput) {
|
|
329
|
+
content: update${model.singularApiName}(data: $data, options: $options) {
|
|
330
|
+
data {
|
|
331
|
+
${createEntrySystemFields(model)}
|
|
332
|
+
${createFieldsList({
|
|
333
|
+
model,
|
|
143
334
|
fields: model.fields
|
|
144
|
-
})
|
|
335
|
+
})}
|
|
336
|
+
}
|
|
337
|
+
error ${ERROR_FIELD}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
`;
|
|
145
341
|
};
|
|
146
342
|
|
|
147
343
|
/**
|
|
@@ -149,11 +345,20 @@ var createUpdateSingletonMutation = exports.createUpdateSingletonMutation = func
|
|
|
149
345
|
* Publish Mutation
|
|
150
346
|
*/
|
|
151
347
|
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
|
|
348
|
+
export const createPublishMutation = model => {
|
|
349
|
+
return gql`
|
|
350
|
+
mutation CmsPublish${model.singularApiName}($revision: ID!) {
|
|
351
|
+
content: publish${model.singularApiName}(revision: $revision) {
|
|
352
|
+
data {
|
|
353
|
+
${createEntrySystemFields(model)}
|
|
354
|
+
${createFieldsList({
|
|
355
|
+
model,
|
|
155
356
|
fields: model.fields
|
|
156
|
-
})
|
|
357
|
+
})}
|
|
358
|
+
}
|
|
359
|
+
error ${ERROR_FIELD}
|
|
360
|
+
}
|
|
361
|
+
}`;
|
|
157
362
|
};
|
|
158
363
|
|
|
159
364
|
/**
|
|
@@ -161,11 +366,20 @@ var createPublishMutation = exports.createPublishMutation = function createPubli
|
|
|
161
366
|
* Unpublish Mutation
|
|
162
367
|
*/
|
|
163
368
|
|
|
164
|
-
|
|
165
|
-
return
|
|
166
|
-
|
|
369
|
+
export const createUnpublishMutation = model => {
|
|
370
|
+
return gql`
|
|
371
|
+
mutation CmsUnpublish${model.singularApiName}($revision: ID!) {
|
|
372
|
+
content: unpublish${model.singularApiName}(revision: $revision) {
|
|
373
|
+
data {
|
|
374
|
+
${createEntrySystemFields(model)}
|
|
375
|
+
${createFieldsList({
|
|
376
|
+
model,
|
|
167
377
|
fields: model.fields
|
|
168
|
-
})
|
|
378
|
+
})}
|
|
379
|
+
}
|
|
380
|
+
error ${ERROR_FIELD}
|
|
381
|
+
}
|
|
382
|
+
}`;
|
|
169
383
|
};
|
|
170
384
|
|
|
171
385
|
/**
|
|
@@ -173,8 +387,16 @@ var createUnpublishMutation = exports.createUnpublishMutation = function createU
|
|
|
173
387
|
* Bulk Action Mutation
|
|
174
388
|
*/
|
|
175
389
|
|
|
176
|
-
|
|
177
|
-
return
|
|
390
|
+
export const createBulkActionMutation = model => {
|
|
391
|
+
return gql`
|
|
392
|
+
mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {
|
|
393
|
+
content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {
|
|
394
|
+
data {
|
|
395
|
+
id
|
|
396
|
+
}
|
|
397
|
+
error ${ERROR_FIELD}
|
|
398
|
+
}
|
|
399
|
+
}`;
|
|
178
400
|
};
|
|
179
401
|
|
|
180
402
|
//# sourceMappingURL=entries.graphql.js.map
|
package/entries.graphql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_createFieldsList","_getModelTitleFieldId","_constants","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","CONTENT_META_FIELDS","createEntrySystemFields","model","isSingletonModel","tags","includes","CMS_MODEL_SINGLETON_TAG","optionalFields","concat","ERROR_FIELD","createReadQuery","exports","gql","_taggedTemplateLiteral2","default","singularApiName","createFieldsList","fields","createReadSingletonQuery","createRevisionsQuery","createListQueryDataSelection","getModelTitleFieldId","createListQuery","deleted","queryName","pluralApiName","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createUpdateSingletonMutation","createPublishMutation","createUnpublishMutation","createBulkActionMutation"],"sources":["entries.graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport {\n CmsContentEntryRevision,\n CmsContentEntry,\n CmsEditorContentModel,\n CmsErrorResponse,\n CmsMetaResponse,\n CmsModelField,\n CmsModel\n} from \"~/types\";\nimport { createFieldsList } from \"./createFieldsList\";\nimport { getModelTitleFieldId } from \"./getModelTitleFieldId\";\nimport { FormValidationOptions } from \"@webiny/form\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"./constants\";\n\nconst CONTENT_META_FIELDS = /* GraphQL */ `\n title\n description\n image\n version\n locked\n status\n`;\n\nconst createEntrySystemFields = (model: CmsModel) => {\n const isSingletonModel = model.tags.includes(CMS_MODEL_SINGLETON_TAG);\n\n let optionalFields = \"\";\n if (!isSingletonModel) {\n optionalFields = `\n wbyAco_location {\n folderId\n }\n meta {\n ${CONTENT_META_FIELDS}\n }\n `;\n }\n\n return /* GraphQL */ `\n id\n entryId\n createdOn\n savedOn\n modifiedOn,\n deletedOn\n firstPublishedOn\n lastPublishedOn\n createdBy {\n id\n type\n displayName\n }\n savedBy {\n id\n type\n displayName\n }\n modifiedBy {\n id\n type\n displayName\n }\n deletedBy {\n id\n type\n displayName\n }\n firstPublishedBy {\n id\n type\n displayName\n }\n lastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionDeletedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionDeletedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n ${optionalFields}\n `;\n};\n\nconst ERROR_FIELD = /* GraphQL */ `\n {\n message\n code\n data\n }\n`;\n\n/**\n * ############################################\n * Get CMS Entry Query\n */\nexport interface CmsEntryGetQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryGetQueryVariables {\n revision?: string;\n entryId?: string;\n}\n\nexport const createReadQuery = (model: CmsEditorContentModel) => {\n /**\n * This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).\n */\n return gql`\n query CmsEntriesGet${model.singularApiName}($revision: ID, $entryId: ID) {\n content: get${model.singularApiName}(revision: $revision, entryId: $entryId) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Get CMS Singleton Entry Query\n */\nexport interface CmsEntryGetSingletonQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport const createReadSingletonQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntryGetSingleton${model.singularApiName} {\n content: get${model.singularApiName} {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entry Revisions Query\n */\nexport interface CmsEntriesListRevisionsQueryResponse {\n revisions: {\n data: CmsContentEntryRevision[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListRevisionsQueryVariables {\n id: string;\n}\n\nexport const createRevisionsQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {\n revisions: get${model.singularApiName}Revisions(id: $id) {\n data {\n ${createEntrySystemFields(model)}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entries Query\n */\nexport interface CmsEntriesListQueryResponse {\n content: {\n data: CmsContentEntry[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListQueryVariables {\n // TODO @ts-refactor better list types\n where?: {\n [key: string]: any;\n };\n sort?: string[];\n limit?: number;\n after?: string;\n}\n\nexport const createListQueryDataSelection = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[]\n) => {\n return `\n ${createEntrySystemFields(model)}\n ${fields ? createFieldsList({ model, fields }) : \"\"}\n ${!fields ? getModelTitleFieldId(model) : \"\"}\n `;\n};\n\nexport const createListQuery = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[],\n deleted?: boolean\n) => {\n const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;\n\n return gql`\n query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${\n model.singularApiName\n }ListSorter], $limit: Int, $after: String, $search: String) {\n content: list${queryName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${createListQueryDataSelection(model, fields)}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Delete Mutation\n */\nexport interface CmsEntryDeleteMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryDeleteMutationVariables {\n revision: string;\n permanently?: boolean;\n}\n\nexport const createDeleteMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {\n content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {\n data\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Restore from bin Mutation\n */\nexport interface CmsEntryRestoreFromBinMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryRestoreFromBinMutationVariables {\n revision: string;\n}\n\nexport const createRestoreFromBinMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {\n content: restore${model.singularApiName}FromBin(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create Mutation\n */\nexport interface CmsEntryCreateMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryCreateMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateMutation = (model: CmsEditorContentModel) => {\n const createFields = createFieldsList({ model, fields: model.fields });\n\n return gql`\n mutation CmsEntriesCreate${model.singularApiName}($data: ${\n model.singularApiName\n }Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFields}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create From Mutation\n */\nexport interface CmsEntryCreateFromMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryCreateFromMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data?: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateFromMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${\n model.singularApiName\n }Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create${\n model.singularApiName\n }From(revision: $revision, data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Update Mutation\n */\nexport interface CmsEntryUpdateMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${\n model.singularApiName\n }(revision: $revision, data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Update Singleton Mutation\n */\nexport interface CmsEntryUpdateSingletonMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateSingletonMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateSingletonMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${model.singularApiName}(data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Publish Mutation\n */\nexport interface CmsEntryPublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryPublishMutationVariables {\n revision: string;\n}\n\nexport const createPublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsPublish${model.singularApiName}($revision: ID!) {\n content: publish${model.singularApiName}(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Unpublish Mutation\n */\nexport interface CmsEntryUnpublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUnpublishMutationVariables {\n revision: string;\n}\n\nexport const createUnpublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUnpublish${model.singularApiName}($revision: ID!) {\n content: unpublish${model.singularApiName}(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Bulk Action Mutation\n */\nexport interface CmsEntryBulkActionMutationResponse {\n content: {\n data?: {\n id: string;\n };\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryBulkActionMutationVariables {\n action: string;\n where?: {\n [key: string]: any;\n };\n search?: string;\n data?: {\n [key: string]: any;\n };\n}\n\nexport const createBulkActionMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {\n content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {\n data {\n id\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAAsD,IAAAI,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA;AAEtD,IAAMC,mBAAmB,GAAG,6FAO3B;AAED,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIC,KAAe,EAAK;EACjD,IAAMC,gBAAgB,GAAGD,KAAK,CAACE,IAAI,CAACC,QAAQ,CAACC,kCAAuB,CAAC;EAErE,IAAIC,cAAc,GAAG,EAAE;EACvB,IAAI,CAACJ,gBAAgB,EAAE;IACnBI,cAAc,qHAAAC,MAAA,CAKJR,mBAAmB,8BAE5B;EACL;EAEA,OAAO,g/CAAAQ,MAAA,CA2EDD,cAAc;AAExB,CAAC;AAED,IAAME,WAAW,GAAG,4EAMnB;;AAED;AACA;AACA;AACA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CAAC;;AAED;AACA;AACA;AACA;;AAYO,IAAMyB,uBAAuB,GAAAvB,OAAA,CAAAuB,uBAAA,GAAG,SAA1BA,uBAAuBA,CAAIhC,KAA4B,EAAK;EACrE,WAAOU,mBAAG,EAAAd,iBAAA,KAAAA,iBAAA,OAAAe,uBAAA,CAAAC,OAAA,gRACiBZ,KAAK,CAACa,eAAe,EACpBb,KAAK,CAACa,eAAe,EAE/Bd,uBAAuB,CAACC,KAAK,CAAC,EAC9B,IAAAc,kCAAgB,EAAC;IAAEd,KAAK,EAALA,KAAK;IAAEe,MAAM,EAAEf,KAAK,CAACe;EAAO,CAAC,CAAC,EAE/CR,WAAW;AAGnC,CAAC;;AAED;AACA;AACA;AACA;;AAqBO,IAAM0B,wBAAwB,GAAAxB,OAAA,CAAAwB,wBAAA,GAAG,SAA3BA,wBAAwBA,CAAIjC,KAA4B,EAAK;EACtE,WAAOU,mBAAG,EAAAb,iBAAA,KAAAA,iBAAA,OAAAc,uBAAA,CAAAC,OAAA,uWACkBZ,KAAK,CAACa,eAAe,EAAuBb,KAAK,CAACa,eAAe,EAAkBb,KAAK,CAACa,eAAe,EACvGb,KAAK,CAACa,eAAe,EAI9BN,WAAW;AAGnC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["gql","createFieldsList","getModelTitleFieldId","CMS_MODEL_SINGLETON_TAG","CONTENT_META_FIELDS","createEntrySystemFields","model","isSingletonModel","tags","includes","optionalFields","ERROR_FIELD","createReadQuery","singularApiName","fields","createReadSingletonQuery","createRevisionsQuery","createListQueryDataSelection","createListQuery","deleted","queryName","pluralApiName","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createUpdateSingletonMutation","createPublishMutation","createUnpublishMutation","createBulkActionMutation"],"sources":["entries.graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport {\n CmsContentEntryRevision,\n CmsContentEntry,\n CmsEditorContentModel,\n CmsErrorResponse,\n CmsMetaResponse,\n CmsModelField,\n CmsModel\n} from \"~/types\";\nimport { createFieldsList } from \"./createFieldsList\";\nimport { getModelTitleFieldId } from \"./getModelTitleFieldId\";\nimport { FormValidationOptions } from \"@webiny/form\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"./constants\";\n\nconst CONTENT_META_FIELDS = /* GraphQL */ `\n title\n description\n image\n version\n locked\n status\n`;\n\nconst createEntrySystemFields = (model: CmsModel) => {\n const isSingletonModel = model.tags.includes(CMS_MODEL_SINGLETON_TAG);\n\n let optionalFields = \"\";\n if (!isSingletonModel) {\n optionalFields = `\n wbyAco_location {\n folderId\n }\n meta {\n ${CONTENT_META_FIELDS}\n }\n `;\n }\n\n return /* GraphQL */ `\n id\n entryId\n createdOn\n savedOn\n modifiedOn,\n deletedOn\n firstPublishedOn\n lastPublishedOn\n createdBy {\n id\n type\n displayName\n }\n savedBy {\n id\n type\n displayName\n }\n modifiedBy {\n id\n type\n displayName\n }\n deletedBy {\n id\n type\n displayName\n }\n firstPublishedBy {\n id\n type\n displayName\n }\n lastPublishedBy {\n id\n type\n displayName\n }\n revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\n revisionDeletedOn\n revisionFirstPublishedOn\n revisionLastPublishedOn\n revisionCreatedBy {\n id\n type\n displayName\n }\n revisionSavedBy {\n id\n type\n displayName\n }\n revisionModifiedBy {\n id\n type\n displayName\n }\n revisionDeletedBy {\n id\n type\n displayName\n }\n revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n ${optionalFields}\n `;\n};\n\nconst ERROR_FIELD = /* GraphQL */ `\n {\n message\n code\n data\n }\n`;\n\n/**\n * ############################################\n * Get CMS Entry Query\n */\nexport interface CmsEntryGetQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryGetQueryVariables {\n revision?: string;\n entryId?: string;\n}\n\nexport const createReadQuery = (model: CmsEditorContentModel) => {\n /**\n * This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).\n */\n return gql`\n query CmsEntriesGet${model.singularApiName}($revision: ID, $entryId: ID) {\n content: get${model.singularApiName}(revision: $revision, entryId: $entryId) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Get CMS Singleton Entry Query\n */\nexport interface CmsEntryGetSingletonQueryResponse {\n content: {\n data: CmsContentEntry;\n error: CmsErrorResponse | null;\n };\n}\n\nexport const createReadSingletonQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntryGetSingleton${model.singularApiName} {\n content: get${model.singularApiName} {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entry Revisions Query\n */\nexport interface CmsEntriesListRevisionsQueryResponse {\n revisions: {\n data: CmsContentEntryRevision[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListRevisionsQueryVariables {\n id: string;\n}\n\nexport const createRevisionsQuery = (model: CmsEditorContentModel) => {\n return gql`\n query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {\n revisions: get${model.singularApiName}Revisions(id: $id) {\n data {\n ${createEntrySystemFields(model)}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * List CMS Entries Query\n */\nexport interface CmsEntriesListQueryResponse {\n content: {\n data: CmsContentEntry[];\n error: CmsErrorResponse | null;\n meta: CmsMetaResponse;\n };\n}\n\nexport interface CmsEntriesListQueryVariables {\n // TODO @ts-refactor better list types\n where?: {\n [key: string]: any;\n };\n sort?: string[];\n limit?: number;\n after?: string;\n}\n\nexport const createListQueryDataSelection = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[]\n) => {\n return `\n ${createEntrySystemFields(model)}\n ${fields ? createFieldsList({ model, fields }) : \"\"}\n ${!fields ? getModelTitleFieldId(model) : \"\"}\n `;\n};\n\nexport const createListQuery = (\n model: CmsEditorContentModel,\n fields?: CmsModelField[],\n deleted?: boolean\n) => {\n const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;\n\n return gql`\n query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${\n model.singularApiName\n }ListSorter], $limit: Int, $after: String, $search: String) {\n content: list${queryName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${createListQueryDataSelection(model, fields)}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Delete Mutation\n */\nexport interface CmsEntryDeleteMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryDeleteMutationVariables {\n revision: string;\n permanently?: boolean;\n}\n\nexport const createDeleteMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {\n content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {\n data\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Restore from bin Mutation\n */\nexport interface CmsEntryRestoreFromBinMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryRestoreFromBinMutationVariables {\n revision: string;\n}\n\nexport const createRestoreFromBinMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {\n content: restore${model.singularApiName}FromBin(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create Mutation\n */\nexport interface CmsEntryCreateMutationResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport interface CmsEntryCreateMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateMutation = (model: CmsEditorContentModel) => {\n const createFields = createFieldsList({ model, fields: model.fields });\n\n return gql`\n mutation CmsEntriesCreate${model.singularApiName}($data: ${\n model.singularApiName\n }Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFields}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Create From Mutation\n */\nexport interface CmsEntryCreateFromMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryCreateFromMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data?: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createCreateFromMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${\n model.singularApiName\n }Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create${\n model.singularApiName\n }From(revision: $revision, data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Update Mutation\n */\nexport interface CmsEntryUpdateMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateMutationVariables {\n revision: string;\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${\n model.singularApiName\n }(revision: $revision, data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Update Singleton Mutation\n */\nexport interface CmsEntryUpdateSingletonMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateSingletonMutationVariables {\n /**\n * We have any here because we do not know which fields does entry have\n */\n data: Record<string, any>;\n options?: FormValidationOptions;\n}\n\nexport const createUpdateSingletonMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}($data: ${\n model.singularApiName\n }Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update${model.singularApiName}(data: $data, options: $options) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }\n `;\n};\n\n/**\n * ############################################\n * Publish Mutation\n */\nexport interface CmsEntryPublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryPublishMutationVariables {\n revision: string;\n}\n\nexport const createPublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsPublish${model.singularApiName}($revision: ID!) {\n content: publish${model.singularApiName}(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Unpublish Mutation\n */\nexport interface CmsEntryUnpublishMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUnpublishMutationVariables {\n revision: string;\n}\n\nexport const createUnpublishMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUnpublish${model.singularApiName}($revision: ID!) {\n content: unpublish${model.singularApiName}(revision: $revision) {\n data {\n ${createEntrySystemFields(model)}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n\n/**\n * ############################################\n * Bulk Action Mutation\n */\nexport interface CmsEntryBulkActionMutationResponse {\n content: {\n data?: {\n id: string;\n };\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryBulkActionMutationVariables {\n action: string;\n where?: {\n [key: string]: any;\n };\n search?: string;\n data?: {\n [key: string]: any;\n };\n}\n\nexport const createBulkActionMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {\n content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {\n data {\n id\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,aAAa;AAU7B,SAASC,gBAAgB;AACzB,SAASC,oBAAoB;AAE7B,SAASC,uBAAuB;AAEhC,MAAMC,mBAAmB,GAAG,aAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,uBAAuB,GAAIC,KAAe,IAAK;EACjD,MAAMC,gBAAgB,GAAGD,KAAK,CAACE,IAAI,CAACC,QAAQ,CAACN,uBAAuB,CAAC;EAErE,IAAIO,cAAc,GAAG,EAAE;EACvB,IAAI,CAACH,gBAAgB,EAAE;IACnBG,cAAc,GAAG;AACzB;AACA;AACA;AACA;AACA,kBAAkBN,mBAAmB;AACrC;AACA,SAAS;EACL;EAEA,OAAO,aAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ACd,gCAAgCM,KAAK,CAACO,eAAe,uBAAuBP,KAAK,CAACO,eAAe,kBAAkBP,KAAK,CAACO,eAAe;AACxI,iCAAiCP,KAAK,CAACO,eAAe;AACtD;AACA;AACA;AACA,wBAAwBF,WAAW;AACnC;AACA,UAAU;AACV,CAAC","ignoreList":[]}
|
package/getModelTitleFieldId.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getModelTitleFieldId = void 0;
|
|
7
|
-
var getModelTitleFieldId = exports.getModelTitleFieldId = function getModelTitleFieldId(model) {
|
|
1
|
+
export const getModelTitleFieldId = model => {
|
|
8
2
|
if (!model.titleFieldId || model.titleFieldId === "id") {
|
|
9
3
|
return "";
|
|
10
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getModelTitleFieldId","
|
|
1
|
+
{"version":3,"names":["getModelTitleFieldId","model","titleFieldId"],"sources":["getModelTitleFieldId.ts"],"sourcesContent":["import { CmsEditorContentModel } from \"~/types\";\n\nexport const getModelTitleFieldId = (model: CmsEditorContentModel): string => {\n if (!model.titleFieldId || model.titleFieldId === \"id\") {\n return \"\";\n }\n return model.titleFieldId;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,oBAAoB,GAAIC,KAA4B,IAAa;EAC1E,IAAI,CAACA,KAAK,CAACC,YAAY,IAAID,KAAK,CAACC,YAAY,KAAK,IAAI,EAAE;IACpD,OAAO,EAAE;EACb;EACA,OAAOD,KAAK,CAACC,YAAY;AAC7B,CAAC","ignoreList":[]}
|