@webiny/app-headless-cms-common 6.0.0-beta.0 → 6.0.0-rc.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.
Files changed (81) hide show
  1. package/Fields/ErrorBoundary.d.ts +24 -0
  2. package/Fields/ErrorBoundary.js +40 -0
  3. package/Fields/ErrorBoundary.js.map +1 -0
  4. package/Fields/FieldElement.d.ts +64 -0
  5. package/Fields/FieldElement.js +77 -0
  6. package/Fields/FieldElement.js.map +1 -0
  7. package/Fields/FieldElementError.d.ts +7 -0
  8. package/Fields/FieldElementError.js +25 -0
  9. package/Fields/FieldElementError.js.map +1 -0
  10. package/Fields/Fields.d.ts +11 -0
  11. package/Fields/Fields.js +43 -0
  12. package/Fields/Fields.js.map +1 -0
  13. package/Fields/Label.d.ts +6 -0
  14. package/Fields/Label.js +10 -0
  15. package/Fields/Label.js.map +1 -0
  16. package/Fields/index.d.ts +3 -0
  17. package/Fields/index.js +5 -0
  18. package/Fields/index.js.map +1 -0
  19. package/Fields/useBind.d.ts +9 -0
  20. package/Fields/useBind.js +113 -0
  21. package/Fields/useBind.js.map +1 -0
  22. package/Fields/useRenderPlugins.d.ts +1 -0
  23. package/Fields/useRenderPlugins.js +7 -0
  24. package/Fields/useRenderPlugins.js.map +1 -0
  25. package/ModelFieldProvider/ModelFieldContext.d.ts +38 -0
  26. package/ModelFieldProvider/ModelFieldContext.js +26 -0
  27. package/ModelFieldProvider/ModelFieldContext.js.map +1 -0
  28. package/ModelFieldProvider/index.d.ts +2 -0
  29. package/ModelFieldProvider/index.js +4 -0
  30. package/ModelFieldProvider/index.js.map +1 -0
  31. package/ModelFieldProvider/useModelField.d.ts +15 -0
  32. package/ModelFieldProvider/useModelField.js +29 -0
  33. package/ModelFieldProvider/useModelField.js.map +1 -0
  34. package/ModelProvider/ModelContext.d.ts +9 -0
  35. package/ModelProvider/ModelContext.js +12 -0
  36. package/ModelProvider/ModelContext.js.map +1 -0
  37. package/ModelProvider/index.d.ts +2 -0
  38. package/ModelProvider/index.js +4 -0
  39. package/ModelProvider/index.js.map +1 -0
  40. package/ModelProvider/useModel.d.ts +9 -0
  41. package/ModelProvider/useModel.js +16 -0
  42. package/ModelProvider/useModel.js.map +1 -0
  43. package/README.md +6 -13
  44. package/constants.d.ts +1 -0
  45. package/constants.js +3 -0
  46. package/constants.js.map +1 -0
  47. package/createFieldsList.d.ts +6 -2
  48. package/createFieldsList.js +31 -32
  49. package/createFieldsList.js.map +1 -1
  50. package/createValidationContainer.d.ts +18 -0
  51. package/createValidationContainer.js +23 -0
  52. package/createValidationContainer.js.map +1 -0
  53. package/createValidators.d.ts +3 -0
  54. package/createValidators.js +52 -0
  55. package/createValidators.js.map +1 -0
  56. package/entries.graphql.d.ts +54 -2
  57. package/entries.graphql.js +338 -55
  58. package/entries.graphql.js.map +1 -1
  59. package/exports/admin/cms.d.ts +1 -0
  60. package/exports/admin/cms.js +3 -0
  61. package/exports/admin/cms.js.map +1 -0
  62. package/getModelTitleFieldId.d.ts +1 -1
  63. package/getModelTitleFieldId.js +1 -7
  64. package/getModelTitleFieldId.js.map +1 -1
  65. package/index.d.ts +10 -4
  66. package/index.js +10 -49
  67. package/index.js.map +1 -1
  68. package/package.json +20 -25
  69. package/prepareFormData.d.ts +1 -1
  70. package/prepareFormData.js +23 -42
  71. package/prepareFormData.js.map +1 -1
  72. package/types/index.d.ts +53 -43
  73. package/types/index.js +1 -38
  74. package/types/index.js.map +1 -1
  75. package/types/model.d.ts +23 -17
  76. package/types/model.js +1 -5
  77. package/types/model.js.map +1 -1
  78. package/types/shared.js +1 -5
  79. package/types/validation.d.ts +3 -3
  80. package/types/validation.js +1 -5
  81. package/types/validation.js.map +1 -1
@@ -1,32 +1,163 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createUpdateMutation = exports.createUnpublishMutation = exports.createRevisionsQuery = exports.createRestoreFromBinMutation = exports.createReadQuery = exports.createPublishMutation = exports.createListQueryDataSelection = exports.createListQuery = exports.createDeleteMutation = exports.createCreateMutation = exports.createCreateFromMutation = 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 _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
13
- var CONTENT_META_FIELDS = /* GraphQL */"\n meta {\n title\n description\n image\n version\n locked\n status\n }\n";
14
- var CONTENT_ENTRY_SYSTEM_FIELDS = /* 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 revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\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 revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n wbyAco_location {\n folderId\n }\n ".concat(CONTENT_META_FIELDS, "\n");
15
- var ERROR_FIELD = /* GraphQL */"\n {\n message\n code\n data\n }\n";
1
+ import gql from "graphql-tag";
2
+ import { createFieldsList } from "./createFieldsList.js";
3
+ import { getModelTitleFieldId } from "./getModelTitleFieldId.js";
4
+ import { CMS_MODEL_SINGLETON_TAG } from "./constants.js";
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 = "";
16
+ if (!isSingletonModel) {
17
+ optionalFields = `
18
+ wbyAco_location {
19
+ folderId
20
+ }
21
+ meta {
22
+ ${CONTENT_META_FIELDS}
23
+ }
24
+ `;
25
+ }
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
+ `;
103
+ };
104
+ const ERROR_FIELD = /* GraphQL */`
105
+ {
106
+ message
107
+ code
108
+ data
109
+ }
110
+ `;
16
111
 
17
112
  /**
18
113
  * ############################################
19
114
  * Get CMS Entry Query
20
115
  */
21
116
 
22
- var createReadQuery = exports.createReadQuery = function createReadQuery(model) {
117
+ export const createReadQuery = model => {
23
118
  /**
24
119
  * This query now accepts both revision or entryId as we can load exact revision or latest (if entryId was sent).
25
120
  */
26
- 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, CONTENT_ENTRY_SYSTEM_FIELDS, (0, _createFieldsList.createFieldsList)({
27
- 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
+ values {
127
+ ${createFieldsList({
128
+ model,
28
129
  fields: model.fields
29
- }), ERROR_FIELD);
130
+ })}
131
+ }
132
+ }
133
+ error ${ERROR_FIELD}
134
+ }
135
+ }
136
+ `;
137
+ };
138
+
139
+ /**
140
+ * ############################################
141
+ * Get CMS Singleton Entry Query
142
+ */
143
+
144
+ export const createReadSingletonQuery = model => {
145
+ return gql`
146
+ query CmsEntryGetSingleton${model.singularApiName} {
147
+ content: get${model.singularApiName} {
148
+ data {
149
+ ${createEntrySystemFields(model)}
150
+ values {
151
+ ${createFieldsList({
152
+ model,
153
+ fields: model.fields
154
+ })}
155
+ }
156
+ }
157
+ error ${ERROR_FIELD}
158
+ }
159
+ }
160
+ `;
30
161
  };
31
162
 
32
163
  /**
@@ -34,8 +165,17 @@ var createReadQuery = exports.createReadQuery = function createReadQuery(model)
34
165
  * List CMS Entry Revisions Query
35
166
  */
36
167
 
37
- var createRevisionsQuery = exports.createRevisionsQuery = function createRevisionsQuery(model) {
38
- return (0, _graphqlTag.default)(_templateObject2 || (_templateObject2 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, ERROR_FIELD);
168
+ export const createRevisionsQuery = model => {
169
+ return gql`
170
+ query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {
171
+ revisions: get${model.singularApiName}Revisions(id: $id) {
172
+ data {
173
+ ${createEntrySystemFields(model)}
174
+ }
175
+ error ${ERROR_FIELD}
176
+ }
177
+ }
178
+ `;
39
179
  };
40
180
 
41
181
  /**
@@ -43,15 +183,41 @@ var createRevisionsQuery = exports.createRevisionsQuery = function createRevisio
43
183
  * List CMS Entries Query
44
184
  */
45
185
 
46
- var createListQueryDataSelection = exports.createListQueryDataSelection = function createListQueryDataSelection(model, fields) {
47
- return "\n ".concat(CONTENT_ENTRY_SYSTEM_FIELDS, "\n ").concat(fields ? (0, _createFieldsList.createFieldsList)({
48
- model: model,
49
- fields: fields
50
- }) : "", "\n ").concat(!fields ? (0, _getModelTitleFieldId.getModelTitleFieldId)(model) : "", "\n ");
186
+ export const createListQueryDataSelection = (model, fields) => {
187
+ return `
188
+ ${createEntrySystemFields(model)}
189
+ values {
190
+ ${fields ? createFieldsList({
191
+ model,
192
+ fields
193
+ }) : getModelTitleFieldId(model)}
194
+ }
195
+ `;
51
196
  };
52
- var createListQuery = exports.createListQuery = function createListQuery(model, fields, deleted) {
53
- var queryName = deleted ? "Deleted".concat(model.pluralApiName) : model.pluralApiName;
54
- return (0, _graphqlTag.default)(_templateObject3 || (_templateObject3 = (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);
197
+ export const createListQuery = (model, fields, deleted) => {
198
+ const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;
199
+ const selection = createListQueryDataSelection(model, fields);
200
+ return gql`
201
+ query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${model.singularApiName}ListSorter], $limit: Int, $after: String, $search: String) {
202
+ content: list${queryName}(
203
+ where: $where
204
+ sort: $sort
205
+ limit: $limit
206
+ after: $after
207
+ search: $search
208
+ ) {
209
+ data {
210
+ ${selection}
211
+ }
212
+ meta {
213
+ cursor
214
+ hasMoreItems
215
+ totalCount
216
+ }
217
+ error ${ERROR_FIELD}
218
+ }
219
+ }
220
+ `;
55
221
  };
56
222
 
57
223
  /**
@@ -59,8 +225,15 @@ var createListQuery = exports.createListQuery = function createListQuery(model,
59
225
  * Delete Mutation
60
226
  */
61
227
 
62
- var createDeleteMutation = exports.createDeleteMutation = function createDeleteMutation(model) {
63
- return (0, _graphqlTag.default)(_templateObject4 || (_templateObject4 = (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);
228
+ export const createDeleteMutation = model => {
229
+ return gql`
230
+ mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {
231
+ content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {
232
+ data
233
+ error ${ERROR_FIELD}
234
+ }
235
+ }
236
+ `;
64
237
  };
65
238
 
66
239
  /**
@@ -68,11 +241,23 @@ var createDeleteMutation = exports.createDeleteMutation = function createDeleteM
68
241
  * Restore from bin Mutation
69
242
  */
70
243
 
71
- var createRestoreFromBinMutation = exports.createRestoreFromBinMutation = function createRestoreFromBinMutation(model) {
72
- return (0, _graphqlTag.default)(_templateObject5 || (_templateObject5 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, (0, _createFieldsList.createFieldsList)({
73
- model: model,
244
+ export const createRestoreFromBinMutation = model => {
245
+ return gql`
246
+ mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {
247
+ content: restore${model.singularApiName}FromBin(revision: $revision) {
248
+ data {
249
+ ${createEntrySystemFields(model)}
250
+ values {
251
+ ${createFieldsList({
252
+ model,
74
253
  fields: model.fields
75
- }), ERROR_FIELD);
254
+ })}
255
+ }
256
+ }
257
+ error ${ERROR_FIELD}
258
+ }
259
+ }
260
+ `;
76
261
  };
77
262
 
78
263
  /**
@@ -80,12 +265,24 @@ var createRestoreFromBinMutation = exports.createRestoreFromBinMutation = functi
80
265
  * Create Mutation
81
266
  */
82
267
 
83
- var createCreateMutation = exports.createCreateMutation = function createCreateMutation(model) {
84
- var createFields = (0, _createFieldsList.createFieldsList)({
85
- model: model,
268
+ export const createCreateMutation = model => {
269
+ const createFields = createFieldsList({
270
+ model,
86
271
  fields: model.fields
87
272
  });
88
- return (0, _graphqlTag.default)(_templateObject6 || (_templateObject6 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, createFields, ERROR_FIELD);
273
+ return gql`
274
+ mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {
275
+ content: create${model.singularApiName}(data: $data, options: $options) {
276
+ data {
277
+ ${createEntrySystemFields(model)}
278
+ values {
279
+ ${createFields}
280
+ }
281
+ }
282
+ error ${ERROR_FIELD}
283
+ }
284
+ }
285
+ `;
89
286
  };
90
287
 
91
288
  /**
@@ -93,11 +290,22 @@ var createCreateMutation = exports.createCreateMutation = function createCreateM
93
290
  * Create From Mutation
94
291
  */
95
292
 
96
- var createCreateFromMutation = exports.createCreateFromMutation = function createCreateFromMutation(model) {
97
- return (0, _graphqlTag.default)(_templateObject7 || (_templateObject7 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, (0, _createFieldsList.createFieldsList)({
98
- model: model,
293
+ export const createCreateFromMutation = model => {
294
+ return gql`
295
+ mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${model.singularApiName}Input, $options: CreateRevisionCmsEntryOptionsInput) {
296
+ content: create${model.singularApiName}From(revision: $revision, data: $data, options: $options) {
297
+ data {
298
+ ${createEntrySystemFields(model)}
299
+ values {
300
+ ${createFieldsList({
301
+ model,
99
302
  fields: model.fields
100
- }), ERROR_FIELD);
303
+ })}
304
+ }
305
+ }
306
+ error ${ERROR_FIELD}
307
+ }
308
+ }`;
101
309
  };
102
310
 
103
311
  /**
@@ -105,11 +313,47 @@ var createCreateFromMutation = exports.createCreateFromMutation = function creat
105
313
  * Update Mutation
106
314
  */
107
315
 
108
- var createUpdateMutation = exports.createUpdateMutation = function createUpdateMutation(model) {
109
- return (0, _graphqlTag.default)(_templateObject8 || (_templateObject8 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, (0, _createFieldsList.createFieldsList)({
110
- model: model,
316
+ export const createUpdateMutation = model => {
317
+ return gql`
318
+ mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${model.singularApiName}Input!, $options: UpdateCmsEntryOptionsInput) {
319
+ content: update${model.singularApiName}(revision: $revision, data: $data, options: $options) {
320
+ data {
321
+ ${createEntrySystemFields(model)}
322
+ values {
323
+ ${createFieldsList({
324
+ model,
111
325
  fields: model.fields
112
- }), ERROR_FIELD);
326
+ })}
327
+ }
328
+ }
329
+ error ${ERROR_FIELD}
330
+ }
331
+ }
332
+ `;
333
+ };
334
+
335
+ /**
336
+ * ############################################
337
+ * Update Singleton Mutation
338
+ */
339
+
340
+ export const createUpdateSingletonMutation = model => {
341
+ return gql`
342
+ mutation CmsUpdate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: UpdateCmsEntryOptionsInput) {
343
+ content: update${model.singularApiName}(data: $data, options: $options) {
344
+ data {
345
+ ${createEntrySystemFields(model)}
346
+ values {
347
+ ${createFieldsList({
348
+ model,
349
+ fields: model.fields
350
+ })}
351
+ }
352
+ }
353
+ error ${ERROR_FIELD}
354
+ }
355
+ }
356
+ `;
113
357
  };
114
358
 
115
359
  /**
@@ -117,11 +361,22 @@ var createUpdateMutation = exports.createUpdateMutation = function createUpdateM
117
361
  * Publish Mutation
118
362
  */
119
363
 
120
- var createPublishMutation = exports.createPublishMutation = function createPublishMutation(model) {
121
- return (0, _graphqlTag.default)(_templateObject9 || (_templateObject9 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, (0, _createFieldsList.createFieldsList)({
122
- model: model,
364
+ export const createPublishMutation = model => {
365
+ return gql`
366
+ mutation CmsPublish${model.singularApiName}($revision: ID!) {
367
+ content: publish${model.singularApiName}(revision: $revision) {
368
+ data {
369
+ ${createEntrySystemFields(model)}
370
+ values {
371
+ ${createFieldsList({
372
+ model,
123
373
  fields: model.fields
124
- }), ERROR_FIELD);
374
+ })}
375
+ }
376
+ }
377
+ error ${ERROR_FIELD}
378
+ }
379
+ }`;
125
380
  };
126
381
 
127
382
  /**
@@ -129,11 +384,39 @@ var createPublishMutation = exports.createPublishMutation = function createPubli
129
384
  * Unpublish Mutation
130
385
  */
131
386
 
132
- var createUnpublishMutation = exports.createUnpublishMutation = function createUnpublishMutation(model) {
133
- return (0, _graphqlTag.default)(_templateObject10 || (_templateObject10 = (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, CONTENT_ENTRY_SYSTEM_FIELDS, (0, _createFieldsList.createFieldsList)({
134
- model: model,
387
+ export const createUnpublishMutation = model => {
388
+ return gql`
389
+ mutation CmsUnpublish${model.singularApiName}($revision: ID!) {
390
+ content: unpublish${model.singularApiName}(revision: $revision) {
391
+ data {
392
+ ${createEntrySystemFields(model)}
393
+ values {
394
+ ${createFieldsList({
395
+ model,
135
396
  fields: model.fields
136
- }), ERROR_FIELD);
397
+ })}
398
+ }
399
+ }
400
+ error ${ERROR_FIELD}
401
+ }
402
+ }`;
403
+ };
404
+
405
+ /**
406
+ * ############################################
407
+ * Bulk Action Mutation
408
+ */
409
+
410
+ export const createBulkActionMutation = model => {
411
+ return gql`
412
+ mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {
413
+ content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {
414
+ data {
415
+ id
416
+ }
417
+ error ${ERROR_FIELD}
418
+ }
419
+ }`;
137
420
  };
138
421
 
139
422
  //# sourceMappingURL=entries.graphql.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_createFieldsList","_getModelTitleFieldId","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","CONTENT_META_FIELDS","CONTENT_ENTRY_SYSTEM_FIELDS","concat","ERROR_FIELD","createReadQuery","exports","model","gql","_taggedTemplateLiteral2","default","singularApiName","createFieldsList","fields","createRevisionsQuery","createListQueryDataSelection","getModelTitleFieldId","createListQuery","deleted","queryName","pluralApiName","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createPublishMutation","createUnpublishMutation"],"sources":["entries.graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport {\n CmsContentEntryRevision,\n CmsContentEntry,\n CmsEditorContentModel,\n CmsErrorResponse,\n CmsMetaResponse,\n CmsModelField\n} from \"~/types\";\nimport { createFieldsList } from \"./createFieldsList\";\nimport { getModelTitleFieldId } from \"./getModelTitleFieldId\";\nimport { FormValidationOptions } from \"@webiny/form\";\n\nconst CONTENT_META_FIELDS = /* GraphQL */ `\n meta {\n title\n description\n image\n version\n locked\n status\n }\n`;\n\nconst CONTENT_ENTRY_SYSTEM_FIELDS = /* 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 revisionCreatedOn\n revisionSavedOn\n revisionModifiedOn\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 revisionFirstPublishedBy {\n id\n type\n displayName\n }\n revisionLastPublishedBy {\n id\n type\n displayName\n }\n wbyAco_location {\n folderId\n }\n ${CONTENT_META_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\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 ${CONTENT_ENTRY_SYSTEM_FIELDS}\n ${createFieldsList({ model, fields: model.fields })}\n }\n error ${ERROR_FIELD}\n }\n }`;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AASA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAA8D,IAAAG,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,iBAAA;AAG9D,IAAMC,mBAAmB,GAAG,wIAS3B;AAED,IAAMC,2BAA2B,GAAG,0wDAAAC,MAAA,CA4G9BF,mBAAmB,OACxB;AAED,IAAMG,WAAW,GAAG,4EAMnB;;AAED;AACA;AACA;AACA;;AAaO,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAIE,KAA4B,EAAK;EAC7D;AACJ;AACA;EACI,WAAOC,mBAAG,EAAAjB,eAAA,KAAAA,eAAA,OAAAkB,uBAAA,CAAAC,OAAA,6SACeH,KAAK,CAACI,eAAe,EACxBJ,KAAK,CAACI,eAAe,EAEzBT,2BAA2B,EAC3B,IAAAU,kCAAgB,EAAC;IAAEL,KAAK,EAALA,KAAK;IAAEM,MAAM,EAAEN,KAAK,CAACM;EAAO,CAAC,CAAC,EAE/CT,WAAW;AAInC,CAAC;;AAED;AACA;AACA;AACA;;AAaO,IAAMU,oBAAoB,GAAAR,OAAA,CAAAQ,oBAAA,GAAG,SAAvBA,oBAAoBA,CAAIP,KAA4B,EAAK;EAClE,WAAOC,mBAAG,EAAAhB,gB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EM,MAAM,EAAEN,KAAK,CAACM;EAAO,CAAC,CAAC,EAE/CT,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","selection","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createUpdateSingletonMutation","createPublishMutation","createUnpublishMutation","createBulkActionMutation"],"sources":["entries.graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport type {\n CmsContentEntry,\n CmsContentEntryRevision,\n CmsEditorContentModel,\n CmsErrorResponse,\n CmsMetaResponse,\n CmsModel,\n CmsModelField\n} from \"~/types/index.js\";\nimport { createFieldsList } from \"./createFieldsList.js\";\nimport { getModelTitleFieldId } from \"./getModelTitleFieldId.js\";\nimport type { FormValidationOptions } from \"@webiny/form\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"./constants.js\";\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${fields ? createFieldsList({ model, fields }) : getModelTitleFieldId(model)}\n }\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 const selection = createListQueryDataSelection(model, fields);\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 ${selection}\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${createFields}\n }\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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 values {\n ${createFieldsList({ model, fields: model.fields })}\n }\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUM,cAAc;AACxB,KAAK;AACL,CAAC;AAED,MAAMC,WAAW,GAAG,aAAc;AAClC;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,eAAe,GAAIN,KAA4B,IAAK;EAC7D;AACJ;AACA;EACI,OAAON,GAAG;AACd,6BAA6BM,KAAK,CAACO,eAAe;AAClD,0BAA0BP,KAAK,CAACO,eAAe;AAC/C;AACA,sBAAsBR,uBAAuB,CAACC,KAAK,CAAC;AACpD;AACA,0BAA0BL,gBAAgB,CAAC;IAAEK,KAAK;IAAEQ,MAAM,EAAER,KAAK,CAACQ;EAAO,CAAC,CAAC;AAC3E;AACA;AACA,wBAAwBH,WAAW;AACnC;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA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6BM,KAAK,CAACO,eAAe;AAClD,8BAA8BP,KAAK,CAACO,eAAe;AACnD;AACA,sBAAsBR,uBAAuB,CAACC,KAAK,CAAC;AACpD;AACA,0BAA0BL,gBAAgB,CAAC;IAAEK,KAAK;IAAEQ,MAAM,EAAER,KAAK,CAACQ;EAAO,CAAC,CAAC;AAC3E;AACA;AACA,wBAAwBH,WAAW;AACnC;AACA,UAAU;AACV,CAAC;;AAED;AACA;AACA;AACA;;AAYA,OAAO,MAAMoB,uBAAuB,GAAIzB,KAA4B,IAAK;EACrE,OAAON,GAAG;AACd,+BAA+BM,KAAK,CAACO,eAAe;AACpD,gCAAgCP,KAAK,CAACO,eAAe;AACrD;AACA,sBAAsBR,uBAAuB,CAACC,KAAK,CAAC;AACpD;AACA,0BAA0BL,gBAAgB,CAAC;IAAEK,KAAK;IAAEQ,MAAM,EAAER,KAAK,CAACQ;EAAO,CAAC,CAAC;AAC3E;AACA;AACA,wBAAwBH,WAAW;AACnC;AACA,UAAU;AACV,CAAC;;AAED;AACA;AACA;AACA;;AAqBA,OAAO,MAAMqB,wBAAwB,GAAI1B,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":[]}
@@ -0,0 +1 @@
1
+ export type { CmsContentEntry, CmsModel, CmsModelField, CmsIdentity } from "../../types/index.ts";
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=cms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["cms.ts"],"sourcesContent":["export type { CmsContentEntry, CmsModel, CmsModelField, CmsIdentity } from \"~/types/index.ts\";\n"],"mappings":"","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEditorContentModel } from "./types";
1
+ import type { CmsEditorContentModel } from "./types/index.js";
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/index.js\";\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":[]}
package/index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
- export * from "./entries.graphql";
2
- export * from "./getModelTitleFieldId";
3
- export * from "./createFieldsList";
4
- export * from "./prepareFormData";
1
+ export * from "./Fields/index.js";
2
+ export * from "./ModelFieldProvider/index.js";
3
+ export * from "./ModelProvider/index.js";
4
+ export * from "./entries.graphql.js";
5
+ export * from "./getModelTitleFieldId.js";
6
+ export * from "./createFieldsList.js";
7
+ export * from "./createValidationContainer.js";
8
+ export * from "./createValidators.js";
9
+ export * from "./prepareFormData.js";
10
+ export * from "./constants.js";