@webiny/app-headless-cms-common 5.43.3 → 6.0.0-alpha.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.
Files changed (67) hide show
  1. package/Fields/ErrorBoundary.d.ts +2 -1
  2. package/Fields/ErrorBoundary.js +32 -52
  3. package/Fields/ErrorBoundary.js.map +1 -1
  4. package/Fields/FieldElement.d.ts +1 -1
  5. package/Fields/FieldElement.js +43 -52
  6. package/Fields/FieldElement.js.map +1 -1
  7. package/Fields/FieldElementError.js +6 -13
  8. package/Fields/FieldElementError.js.map +1 -1
  9. package/Fields/Fields.js +29 -39
  10. package/Fields/Fields.js.map +1 -1
  11. package/Fields/Label.js +7 -31
  12. package/Fields/Label.js.map +1 -1
  13. package/Fields/index.js +3 -38
  14. package/Fields/index.js.map +1 -1
  15. package/Fields/useBind.d.ts +1 -1
  16. package/Fields/useBind.js +59 -64
  17. package/Fields/useBind.js.map +1 -1
  18. package/Fields/useRenderPlugins.js +4 -12
  19. package/Fields/useRenderPlugins.js.map +1 -1
  20. package/ModelFieldProvider/ModelFieldContext.d.ts +2 -2
  21. package/ModelFieldProvider/ModelFieldContext.js +16 -21
  22. package/ModelFieldProvider/ModelFieldContext.js.map +1 -1
  23. package/ModelFieldProvider/index.js +2 -27
  24. package/ModelFieldProvider/index.js.map +1 -1
  25. package/ModelFieldProvider/useModelField.d.ts +1 -1
  26. package/ModelFieldProvider/useModelField.js +15 -23
  27. package/ModelFieldProvider/useModelField.js.map +1 -1
  28. package/ModelProvider/ModelContext.d.ts +1 -1
  29. package/ModelProvider/ModelContext.js +7 -13
  30. package/ModelProvider/ModelContext.js.map +1 -1
  31. package/ModelProvider/index.js +2 -27
  32. package/ModelProvider/index.js.map +1 -1
  33. package/ModelProvider/useModel.d.ts +1 -1
  34. package/ModelProvider/useModel.js +6 -12
  35. package/ModelProvider/useModel.js.map +1 -1
  36. package/constants.js +1 -7
  37. package/constants.js.map +1 -1
  38. package/createFieldsList.d.ts +1 -1
  39. package/createFieldsList.js +23 -26
  40. package/createFieldsList.js.map +1 -1
  41. package/createValidationContainer.js +11 -16
  42. package/createValidationContainer.js.map +1 -1
  43. package/createValidators.d.ts +2 -2
  44. package/createValidators.js +18 -28
  45. package/createValidators.js.map +1 -1
  46. package/entries.graphql.d.ts +2 -2
  47. package/entries.graphql.js +292 -70
  48. package/entries.graphql.js.map +1 -1
  49. package/getModelTitleFieldId.d.ts +1 -1
  50. package/getModelTitleFieldId.js +1 -7
  51. package/getModelTitleFieldId.js.map +1 -1
  52. package/index.js +10 -115
  53. package/index.js.map +1 -1
  54. package/package.json +12 -13
  55. package/prepareFormData.d.ts +1 -1
  56. package/prepareFormData.js +22 -41
  57. package/prepareFormData.js.map +1 -1
  58. package/types/index.d.ts +16 -10
  59. package/types/index.js +54 -38
  60. package/types/index.js.map +1 -1
  61. package/types/model.d.ts +4 -4
  62. package/types/model.js +1 -5
  63. package/types/model.js.map +1 -1
  64. package/types/shared.js +1 -5
  65. package/types/validation.d.ts +3 -3
  66. package/types/validation.js +1 -5
  67. package/types/validation.js.map +1 -1
@@ -1,40 +1,137 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createUpdateSingletonMutation = exports.createUpdateMutation = exports.createUnpublishMutation = exports.createRevisionsQuery = exports.createRestoreFromBinMutation = exports.createReadSingletonQuery = exports.createReadQuery = exports.createPublishMutation = exports.createListQueryDataSelection = exports.createListQuery = exports.createDeleteMutation = exports.createCreateMutation = exports.createCreateFromMutation = exports.createBulkActionMutation = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
10
- var _createFieldsList = require("./createFieldsList");
11
- var _getModelTitleFieldId = require("./getModelTitleFieldId");
12
- var _constants = require("./constants");
13
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
14
- var CONTENT_META_FIELDS = /* GraphQL */"\n title\n description\n image\n version\n locked\n status\n";
15
- var createEntrySystemFields = function createEntrySystemFields(model) {
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 = "\n wbyAco_location {\n folderId\n }\n meta {\n ".concat(CONTENT_META_FIELDS, "\n }\n ");
17
+ optionalFields = `
18
+ wbyAco_location {
19
+ folderId
20
+ }
21
+ meta {
22
+ ${CONTENT_META_FIELDS}
23
+ }
24
+ `;
20
25
  }
21
- 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 ".concat(optionalFields, "\n ");
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
- var ERROR_FIELD = /* GraphQL */"\n {\n message\n code\n data\n }\n";
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
- var createReadQuery = exports.createReadQuery = function createReadQuery(model) {
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 (0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesGet", "($revision: ID, $entryId: ID) {\n content: get", "(revision: $revision, entryId: $entryId) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
35
- model: model,
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
- }), ERROR_FIELD);
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
- var createReadSingletonQuery = exports.createReadSingletonQuery = function createReadSingletonQuery(model) {
46
- return (0, _graphqlTag.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntryGetSingleton", " {\n content: get", " {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
47
- model: model,
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
- }), ERROR_FIELD);
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
- var createRevisionsQuery = exports.createRevisionsQuery = function createRevisionsQuery(model) {
58
- return (0, _graphqlTag.default)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesGet", "Revisions($id: ID!) {\n revisions: get", "Revisions(id: $id) {\n data {\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), ERROR_FIELD);
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
- var createListQueryDataSelection = exports.createListQueryDataSelection = function createListQueryDataSelection(model, fields) {
67
- return "\n ".concat(createEntrySystemFields(model), "\n ").concat(fields ? (0, _createFieldsList.createFieldsList)({
68
- model: model,
69
- fields: fields
70
- }) : "", "\n ").concat(!fields ? (0, _getModelTitleFieldId.getModelTitleFieldId)(model) : "", "\n ");
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
- var createListQuery = exports.createListQuery = function createListQuery(model, fields, deleted) {
73
- var queryName = deleted ? "Deleted".concat(model.pluralApiName) : model.pluralApiName;
74
- return (0, _graphqlTag.default)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n query CmsEntriesList", "($where: ", "ListWhereInput, $sort: [", "ListSorter], $limit: Int, $after: String, $search: String) {\n content: list", "(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ", "\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error ", "\n }\n }\n "])), queryName, model.singularApiName, model.singularApiName, queryName, createListQueryDataSelection(model, fields), ERROR_FIELD);
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
- var createDeleteMutation = exports.createDeleteMutation = function createDeleteMutation(model) {
83
- return (0, _graphqlTag.default)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsEntriesDelete", "($revision: ID!, $permanently: Boolean) {\n content: delete", "(revision: $revision, options: {permanently: $permanently}) {\n data\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, ERROR_FIELD);
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
- var createRestoreFromBinMutation = exports.createRestoreFromBinMutation = function createRestoreFromBinMutation(model) {
92
- return (0, _graphqlTag.default)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsEntriesRestore", "FromBin($revision: ID!) {\n content: restore", "FromBin(revision: $revision) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
93
- model: model,
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
- }), ERROR_FIELD);
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
- var createCreateMutation = exports.createCreateMutation = function createCreateMutation(model) {
104
- var createFields = (0, _createFieldsList.createFieldsList)({
105
- model: model,
260
+ export const createCreateMutation = model => {
261
+ const createFields = createFieldsList({
262
+ model,
106
263
  fields: model.fields
107
264
  });
108
- return (0, _graphqlTag.default)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsEntriesCreate", "($data: ", "Input!, $options: CreateCmsEntryOptionsInput) {\n content: create", "(data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), createFields, ERROR_FIELD);
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
- var createCreateFromMutation = exports.createCreateFromMutation = function createCreateFromMutation(model) {
117
- return (0, _graphqlTag.default)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsCreate", "From($revision: ID!, $data: ", "Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create", "From(revision: $revision, data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
118
- model: model,
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
- }), ERROR_FIELD);
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
- var createUpdateMutation = exports.createUpdateMutation = function createUpdateMutation(model) {
129
- return (0, _graphqlTag.default)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsUpdate", "($revision: ID!, $data: ", "Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update", "(revision: $revision, data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
130
- model: model,
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
- }), ERROR_FIELD);
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
- var createUpdateSingletonMutation = exports.createUpdateSingletonMutation = function createUpdateSingletonMutation(model) {
141
- return (0, _graphqlTag.default)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsUpdate", "($data: ", "Input!, $options: UpdateCmsEntryOptionsInput) {\n content: update", "(data: $data, options: $options) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }\n "])), model.singularApiName, model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
142
- model: model,
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
- }), ERROR_FIELD);
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
- var createPublishMutation = exports.createPublishMutation = function createPublishMutation(model) {
153
- return (0, _graphqlTag.default)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsPublish", "($revision: ID!) {\n content: publish", "(revision: $revision) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
154
- model: model,
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
- }), ERROR_FIELD);
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
- var createUnpublishMutation = exports.createUnpublishMutation = function createUnpublishMutation(model) {
165
- return (0, _graphqlTag.default)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsUnpublish", "($revision: ID!) {\n content: unpublish", "(revision: $revision) {\n data {\n ", "\n ", "\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, createEntrySystemFields(model), (0, _createFieldsList.createFieldsList)({
166
- model: model,
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
- }), ERROR_FIELD);
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
- var createBulkActionMutation = exports.createBulkActionMutation = function createBulkActionMutation(model) {
177
- return (0, _graphqlTag.default)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n mutation CmsBulkAction", "($action: BulkAction", "Name!, $where: ", "ListWhereInput, $search: String, $data: JSON) {\n content: bulkAction", "(action: $action, where: $where, search: $search, data: $data) {\n data {\n id\n }\n error ", "\n }\n }"])), model.singularApiName, model.singularApiName, model.singularApiName, model.singularApiName, ERROR_FIELD);
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
@@ -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,MA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A,KAAK;IAAEe,MAAM,EAAEf,KAAK,CAACe;EAAO,CAAC,CAAC,EAE/CR,WAAW;AAGnC,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 type {\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 type { 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;AAC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ACA;;AAqBA,OAAO,MAAMoB,wBAAwB,GAAIzB,KAA4B,IAAK;EACtE,OAAON,GAAG;AACd,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":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEditorContentModel } from "./types";
1
+ import type { CmsEditorContentModel } from "./types";
2
2
  export declare const getModelTitleFieldId: (model: CmsEditorContentModel) => string;
@@ -1,10 +1,4 @@
1
- "use strict";
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","exports","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":";;;;;;AAEO,IAAMA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,SAAvBA,oBAAoBA,CAAIE,KAA4B,EAAa;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":[]}
1
+ {"version":3,"names":["getModelTitleFieldId","model","titleFieldId"],"sources":["getModelTitleFieldId.ts"],"sourcesContent":["import type { 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":[]}