@webiny/app-headless-cms-common 6.4.5 → 6.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/index.d.ts +1 -10
  2. package/index.js +1 -10
  3. package/package.json +10 -17
  4. package/types/index.d.ts +5 -338
  5. package/types/index.js +1 -1
  6. package/types/model.d.ts +9 -18
  7. package/types/model.js +1 -2
  8. package/types/model.js.map +1 -1
  9. package/types/shared.d.ts +6 -0
  10. package/Fields/ErrorBoundary.d.ts +0 -24
  11. package/Fields/ErrorBoundary.js +0 -35
  12. package/Fields/ErrorBoundary.js.map +0 -1
  13. package/Fields/FieldElement.d.ts +0 -64
  14. package/Fields/FieldElement.js +0 -54
  15. package/Fields/FieldElement.js.map +0 -1
  16. package/Fields/FieldElementError.d.ts +0 -7
  17. package/Fields/FieldElementError.js +0 -16
  18. package/Fields/FieldElementError.js.map +0 -1
  19. package/Fields/FieldRulesProvider.d.ts +0 -9
  20. package/Fields/FieldRulesProvider.js +0 -14
  21. package/Fields/FieldRulesProvider.js.map +0 -1
  22. package/Fields/Fields.d.ts +0 -11
  23. package/Fields/Fields.js +0 -93
  24. package/Fields/Fields.js.map +0 -1
  25. package/Fields/Label.d.ts +0 -6
  26. package/Fields/Label.js +0 -10
  27. package/Fields/Label.js.map +0 -1
  28. package/Fields/LayoutDescriptorCell.d.ts +0 -12
  29. package/Fields/LayoutDescriptorCell.js +0 -40
  30. package/Fields/LayoutDescriptorCell.js.map +0 -1
  31. package/Fields/evaluateExpression.d.ts +0 -23
  32. package/Fields/evaluateExpression.js +0 -66
  33. package/Fields/evaluateExpression.js.map +0 -1
  34. package/Fields/fieldOptions.d.ts +0 -36
  35. package/Fields/fieldOptions.js +0 -65
  36. package/Fields/fieldOptions.js.map +0 -1
  37. package/Fields/index.d.ts +0 -8
  38. package/Fields/index.js +0 -8
  39. package/Fields/layoutFieldRenderers/AlertFieldRenderer.d.ts +0 -7
  40. package/Fields/layoutFieldRenderers/AlertFieldRenderer.js +0 -10
  41. package/Fields/layoutFieldRenderers/AlertFieldRenderer.js.map +0 -1
  42. package/Fields/layoutFieldRenderers/SeparatorFieldRenderer.d.ts +0 -7
  43. package/Fields/layoutFieldRenderers/SeparatorFieldRenderer.js +0 -15
  44. package/Fields/layoutFieldRenderers/SeparatorFieldRenderer.js.map +0 -1
  45. package/Fields/layoutFieldRenderers/TabsFieldRenderer.d.ts +0 -12
  46. package/Fields/layoutFieldRenderers/TabsFieldRenderer.js +0 -61
  47. package/Fields/layoutFieldRenderers/TabsFieldRenderer.js.map +0 -1
  48. package/Fields/operatorOptions.d.ts +0 -10
  49. package/Fields/operatorOptions.js +0 -120
  50. package/Fields/operatorOptions.js.map +0 -1
  51. package/Fields/useBind.d.ts +0 -10
  52. package/Fields/useBind.js +0 -111
  53. package/Fields/useBind.js.map +0 -1
  54. package/Fields/useFieldRules.d.ts +0 -32
  55. package/Fields/useFieldRules.js +0 -99
  56. package/Fields/useFieldRules.js.map +0 -1
  57. package/Fields/useRenderPlugins.d.ts +0 -2
  58. package/Fields/useRenderPlugins.js +0 -8
  59. package/Fields/useRenderPlugins.js.map +0 -1
  60. package/ModelFieldProvider/CanEditField.d.ts +0 -5
  61. package/ModelFieldProvider/CanEditField.js +0 -10
  62. package/ModelFieldProvider/CanEditField.js.map +0 -1
  63. package/ModelFieldProvider/ModelFieldContext.d.ts +0 -39
  64. package/ModelFieldProvider/ModelFieldContext.js +0 -19
  65. package/ModelFieldProvider/ModelFieldContext.js.map +0 -1
  66. package/ModelFieldProvider/index.d.ts +0 -3
  67. package/ModelFieldProvider/index.js +0 -3
  68. package/ModelFieldProvider/useModelField.d.ts +0 -15
  69. package/ModelFieldProvider/useModelField.js +0 -23
  70. package/ModelFieldProvider/useModelField.js.map +0 -1
  71. package/ModelProvider/ModelContext.d.ts +0 -9
  72. package/ModelProvider/ModelContext.js +0 -14
  73. package/ModelProvider/ModelContext.js.map +0 -1
  74. package/ModelProvider/index.d.ts +0 -2
  75. package/ModelProvider/index.js +0 -2
  76. package/ModelProvider/useModel.d.ts +0 -9
  77. package/ModelProvider/useModel.js +0 -12
  78. package/ModelProvider/useModel.js.map +0 -1
  79. package/createFieldsList.d.ts +0 -12
  80. package/createFieldsList.js +0 -31
  81. package/createFieldsList.js.map +0 -1
  82. package/createValidationContainer.d.ts +0 -18
  83. package/createValidationContainer.js +0 -16
  84. package/createValidationContainer.js.map +0 -1
  85. package/createValidators.d.ts +0 -3
  86. package/createValidators.js +0 -47
  87. package/createValidators.js.map +0 -1
  88. package/entries.graphql.d.ts +0 -229
  89. package/entries.graphql.js +0 -335
  90. package/entries.graphql.js.map +0 -1
  91. package/exports/admin/cms/model.d.ts +0 -1
  92. package/exports/admin/cms/model.js +0 -1
  93. package/getModelTitleFieldId.d.ts +0 -2
  94. package/getModelTitleFieldId.js +0 -7
  95. package/getModelTitleFieldId.js.map +0 -1
  96. package/normalizeIcon.d.ts +0 -3
  97. package/normalizeIcon.js +0 -11
  98. package/normalizeIcon.js.map +0 -1
  99. package/prepareFormData.d.ts +0 -2
  100. package/prepareFormData.js +0 -49
  101. package/prepareFormData.js.map +0 -1
  102. package/types/validation.d.ts +0 -79
  103. package/types/validation.js +0 -0
@@ -1,335 +0,0 @@
1
- import graphql_tag 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 = `
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) optionalFields = `
17
- wbyAco_location {
18
- folderId
19
- }
20
- meta {
21
- ${CONTENT_META_FIELDS}
22
- }
23
- `;
24
- return `
25
- id
26
- entryId
27
- createdOn
28
- savedOn
29
- modifiedOn,
30
- deletedOn
31
- firstPublishedOn
32
- lastPublishedOn
33
- createdBy {
34
- id
35
- type
36
- displayName
37
- }
38
- savedBy {
39
- id
40
- type
41
- displayName
42
- }
43
- modifiedBy {
44
- id
45
- type
46
- displayName
47
- }
48
- deletedBy {
49
- id
50
- type
51
- displayName
52
- }
53
- firstPublishedBy {
54
- id
55
- type
56
- displayName
57
- }
58
- lastPublishedBy {
59
- id
60
- type
61
- displayName
62
- }
63
- revisionCreatedOn
64
- revisionSavedOn
65
- revisionModifiedOn
66
- revisionDeletedOn
67
- revisionFirstPublishedOn
68
- revisionLastPublishedOn
69
- revisionCreatedBy {
70
- id
71
- type
72
- displayName
73
- }
74
- revisionSavedBy {
75
- id
76
- type
77
- displayName
78
- }
79
- revisionModifiedBy {
80
- id
81
- type
82
- displayName
83
- }
84
- revisionDeletedBy {
85
- id
86
- type
87
- displayName
88
- }
89
- revisionFirstPublishedBy {
90
- id
91
- type
92
- displayName
93
- }
94
- revisionLastPublishedBy {
95
- id
96
- type
97
- displayName
98
- }
99
- ${optionalFields}
100
- live {
101
- version
102
- }
103
- revisionDescription
104
- `;
105
- };
106
- const ERROR_FIELD = `
107
- {
108
- message
109
- code
110
- data
111
- }
112
- `;
113
- const createReadQuery = (model)=>graphql_tag`
114
- query CmsEntriesGet${model.singularApiName}($revision: ID, $entryId: ID) {
115
- content: get${model.singularApiName}(revision: $revision, entryId: $entryId) {
116
- data {
117
- ${createEntrySystemFields(model)}
118
- values {
119
- ${createFieldsList({
120
- model,
121
- fields: model.fields
122
- })}
123
- }
124
- }
125
- error ${ERROR_FIELD}
126
- }
127
- }
128
- `;
129
- const createReadSingletonQuery = (model)=>graphql_tag`
130
- query CmsEntryGetSingleton${model.singularApiName} {
131
- content: get${model.singularApiName} {
132
- data {
133
- ${createEntrySystemFields(model)}
134
- values {
135
- ${createFieldsList({
136
- model,
137
- fields: model.fields
138
- })}
139
- }
140
- }
141
- error ${ERROR_FIELD}
142
- }
143
- }
144
- `;
145
- const createRevisionsQuery = (model)=>graphql_tag`
146
- query CmsEntriesGet${model.singularApiName}Revisions($id: ID!) {
147
- revisions: get${model.singularApiName}Revisions(id: $id) {
148
- data {
149
- ${createEntrySystemFields(model)}
150
- }
151
- error ${ERROR_FIELD}
152
- }
153
- }
154
- `;
155
- const createListQueryDataSelection = (model, fields)=>`
156
- ${createEntrySystemFields(model)}
157
- values {
158
- ${fields ? createFieldsList({
159
- model,
160
- fields
161
- }) : getModelTitleFieldId(model)}
162
- }
163
- `;
164
- const createListQuery = (model, fields, deleted)=>{
165
- const queryName = deleted ? `Deleted${model.pluralApiName}` : model.pluralApiName;
166
- const selection = createListQueryDataSelection(model, fields);
167
- return graphql_tag`
168
- query CmsEntriesList${queryName}($where: ${model.singularApiName}ListWhereInput, $sort: [${model.singularApiName}ListSorter], $limit: Int, $after: String, $search: String) {
169
- content: list${queryName}(
170
- where: $where
171
- sort: $sort
172
- limit: $limit
173
- after: $after
174
- search: $search
175
- ) {
176
- data {
177
- ${selection}
178
- }
179
- meta {
180
- cursor
181
- hasMoreItems
182
- totalCount
183
- }
184
- error ${ERROR_FIELD}
185
- }
186
- }
187
- `;
188
- };
189
- const createDeleteMutation = (model)=>graphql_tag`
190
- mutation CmsEntriesDelete${model.singularApiName}($revision: ID!, $permanently: Boolean) {
191
- content: delete${model.singularApiName}(revision: $revision, options: {permanently: $permanently}) {
192
- data
193
- error ${ERROR_FIELD}
194
- }
195
- }
196
- `;
197
- const createRestoreFromBinMutation = (model)=>graphql_tag`
198
- mutation CmsEntriesRestore${model.singularApiName}FromBin($revision: ID!) {
199
- content: restore${model.singularApiName}FromBin(revision: $revision) {
200
- data {
201
- ${createEntrySystemFields(model)}
202
- values {
203
- ${createFieldsList({
204
- model,
205
- fields: model.fields
206
- })}
207
- }
208
- }
209
- error ${ERROR_FIELD}
210
- }
211
- }
212
- `;
213
- const createCreateMutation = (model)=>{
214
- const createFields = createFieldsList({
215
- model,
216
- fields: model.fields
217
- });
218
- return graphql_tag`
219
- mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {
220
- content: create${model.singularApiName}(data: $data, options: $options) {
221
- data {
222
- ${createEntrySystemFields(model)}
223
- values {
224
- ${createFields}
225
- }
226
- }
227
- error ${ERROR_FIELD}
228
- }
229
- }
230
- `;
231
- };
232
- const createCreateFromMutation = (model)=>graphql_tag`
233
- mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${model.singularApiName}Input, $options: CreateRevisionCmsEntryOptionsInput) {
234
- content: create${model.singularApiName}From(revision: $revision, data: $data, options: $options) {
235
- data {
236
- ${createEntrySystemFields(model)}
237
- values {
238
- ${createFieldsList({
239
- model,
240
- fields: model.fields
241
- })}
242
- }
243
- }
244
- error ${ERROR_FIELD}
245
- }
246
- }`;
247
- const createUpdateMutation = (model)=>graphql_tag`
248
- mutation CmsUpdate${model.singularApiName}($revision: ID!, $data: ${model.singularApiName}Input!, $options: UpdateCmsEntryOptionsInput) {
249
- content: update${model.singularApiName}(revision: $revision, data: $data, options: $options) {
250
- data {
251
- ${createEntrySystemFields(model)}
252
- values {
253
- ${createFieldsList({
254
- model,
255
- fields: model.fields
256
- })}
257
- }
258
- }
259
- error ${ERROR_FIELD}
260
- }
261
- }
262
- `;
263
- const createUpdateSingletonMutation = (model)=>graphql_tag`
264
- mutation CmsUpdate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: UpdateCmsEntryOptionsInput) {
265
- content: update${model.singularApiName}(data: $data, options: $options) {
266
- data {
267
- ${createEntrySystemFields(model)}
268
- values {
269
- ${createFieldsList({
270
- model,
271
- fields: model.fields
272
- })}
273
- }
274
- }
275
- error ${ERROR_FIELD}
276
- }
277
- }
278
- `;
279
- const createUpdateRevisionDescriptionMutation = (model)=>graphql_tag`
280
- mutation CmsUpdate${model.singularApiName}RevisionDescription($revision: ID!, $revisionDescription: String!) {
281
- content: update${model.singularApiName}RevisionDescription(revision: $revision, revisionDescription: $revisionDescription) {
282
- data {
283
- ${createEntrySystemFields(model)}
284
- values {
285
- ${createFieldsList({
286
- model,
287
- fields: model.fields
288
- })}
289
- }
290
- }
291
- error ${ERROR_FIELD}
292
- }
293
- }`;
294
- const createPublishMutation = (model)=>graphql_tag`
295
- mutation CmsPublish${model.singularApiName}($revision: ID!) {
296
- content: publish${model.singularApiName}(revision: $revision) {
297
- data {
298
- ${createEntrySystemFields(model)}
299
- values {
300
- ${createFieldsList({
301
- model,
302
- fields: model.fields
303
- })}
304
- }
305
- }
306
- error ${ERROR_FIELD}
307
- }
308
- }`;
309
- const createUnpublishMutation = (model)=>graphql_tag`
310
- mutation CmsUnpublish${model.singularApiName}($revision: ID!) {
311
- content: unpublish${model.singularApiName}(revision: $revision) {
312
- data {
313
- ${createEntrySystemFields(model)}
314
- values {
315
- ${createFieldsList({
316
- model,
317
- fields: model.fields
318
- })}
319
- }
320
- }
321
- error ${ERROR_FIELD}
322
- }
323
- }`;
324
- const createBulkActionMutation = (model)=>graphql_tag`
325
- mutation CmsBulkAction${model.singularApiName}($action: BulkAction${model.singularApiName}Name!, $where: ${model.singularApiName}ListWhereInput, $search: String, $data: JSON) {
326
- content: bulkAction${model.singularApiName}(action: $action, where: $where, search: $search, data: $data) {
327
- data {
328
- id
329
- }
330
- error ${ERROR_FIELD}
331
- }
332
- }`;
333
- export { createBulkActionMutation, createCreateFromMutation, createCreateMutation, createDeleteMutation, createListQuery, createListQueryDataSelection, createPublishMutation, createReadQuery, createReadSingletonQuery, createRestoreFromBinMutation, createRevisionsQuery, createUnpublishMutation, createUpdateMutation, createUpdateRevisionDescriptionMutation, createUpdateSingletonMutation };
334
-
335
- //# sourceMappingURL=entries.graphql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entries.graphql.js","sources":["../src/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 live {\n version\n }\n revisionDescription\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\nexport interface CmsEntryUpdateRevisionDescriptionMutationResponse {\n content: {\n data?: CmsContentEntry;\n error?: CmsErrorResponse;\n };\n}\n\nexport interface CmsEntryUpdateRevisionDescriptionMutationVariables {\n revision: string;\n revisionDescription: string;\n}\n\nexport const createUpdateRevisionDescriptionMutation = (model: CmsEditorContentModel) => {\n return gql`\n mutation CmsUpdate${model.singularApiName}RevisionDescription($revision: ID!, $revisionDescription: String!) {\n content: update${model.singularApiName}RevisionDescription(revision: $revision, revisionDescription: $revisionDescription) {\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 * 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"],"names":["CONTENT_META_FIELDS","createEntrySystemFields","model","isSingletonModel","CMS_MODEL_SINGLETON_TAG","optionalFields","ERROR_FIELD","createReadQuery","gql","createFieldsList","createReadSingletonQuery","createRevisionsQuery","createListQueryDataSelection","fields","getModelTitleFieldId","createListQuery","deleted","queryName","selection","createDeleteMutation","createRestoreFromBinMutation","createCreateMutation","createFields","createCreateFromMutation","createUpdateMutation","createUpdateSingletonMutation","createUpdateRevisionDescriptionMutation","createPublishMutation","createUnpublishMutation","createBulkActionMutation"],"mappings":"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"}
@@ -1 +0,0 @@
1
- export { useFieldAccessControlRules, useFieldEffectiveRules } from "../../../Fields/index.js";
@@ -1 +0,0 @@
1
- export { useFieldAccessControlRules, useFieldEffectiveRules } from "../../../Fields/index.js";
@@ -1,2 +0,0 @@
1
- import type { CmsEditorContentModel } from "./types/index.js";
2
- export declare const getModelTitleFieldId: (model: CmsEditorContentModel) => string;
@@ -1,7 +0,0 @@
1
- const getModelTitleFieldId = (model)=>{
2
- if (!model.titleFieldId || "id" === model.titleFieldId) return "";
3
- return model.titleFieldId;
4
- };
5
- export { getModelTitleFieldId };
6
-
7
- //# sourceMappingURL=getModelTitleFieldId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getModelTitleFieldId.js","sources":["../src/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"],"names":["getModelTitleFieldId","model"],"mappings":"AAEO,MAAMA,uBAAuB,CAACC;IACjC,IAAI,CAACA,MAAM,YAAY,IAAIA,AAAuB,SAAvBA,MAAM,YAAY,EACzC,OAAO;IAEX,OAAOA,MAAM,YAAY;AAC7B"}
@@ -1,3 +0,0 @@
1
- import type { IconProp } from "@fortawesome/fontawesome-svg-core";
2
- import type { CmsIcon } from "./types/index.js";
3
- export declare const normalizeIcon: (icon: string | CmsIcon | undefined) => IconProp | undefined;
package/normalizeIcon.js DELETED
@@ -1,11 +0,0 @@
1
- const normalizeIcon = (icon)=>{
2
- let iconName;
3
- if (icon) {
4
- const name = "string" == typeof icon ? icon : icon.name;
5
- iconName = name.split("/");
6
- }
7
- return iconName;
8
- };
9
- export { normalizeIcon };
10
-
11
- //# sourceMappingURL=normalizeIcon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeIcon.js","sources":["../src/normalizeIcon.ts"],"sourcesContent":["import type { IconProp } from \"@fortawesome/fontawesome-svg-core\";\nimport type { CmsIcon } from \"~/types/index.js\";\n\nexport const normalizeIcon = (icon: string | CmsIcon | undefined) => {\n let iconName: IconProp | undefined = undefined;\n if (icon) {\n const name = typeof icon === \"string\" ? icon : icon.name;\n iconName = name.split(\"/\") as IconProp;\n }\n return iconName;\n};\n"],"names":["normalizeIcon","icon","iconName","name"],"mappings":"AAGO,MAAMA,gBAAgB,CAACC;IAC1B,IAAIC;IACJ,IAAID,MAAM;QACN,MAAME,OAAO,AAAgB,YAAhB,OAAOF,OAAoBA,OAAOA,KAAK,IAAI;QACxDC,WAAWC,KAAK,KAAK,CAAC;IAC1B;IACA,OAAOD;AACX"}
@@ -1,2 +0,0 @@
1
- import type { CmsModelField } from "./types/index.js";
2
- export declare const prepareFormData: <T extends Record<string, any>>(input: T, fields: CmsModelField[]) => T;
@@ -1,49 +0,0 @@
1
- import { plugins } from "@webiny/plugins";
2
- let availableTransformerPlugins;
3
- const getAvailableTransformerPlugins = ()=>{
4
- if (availableTransformerPlugins) return availableTransformerPlugins;
5
- availableTransformerPlugins = plugins.byType("cms-field-value-transformer").reduce((transformers, pl)=>{
6
- const fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [
7
- pl.fieldType
8
- ];
9
- for (const fieldType of fieldTypes){
10
- if (transformers[fieldType]) {
11
- console.warn(`Transformer for field type "${fieldType}" is already defined. There cannot be more than one transformer.`);
12
- continue;
13
- }
14
- transformers[fieldType] = pl;
15
- }
16
- return transformers;
17
- }, {});
18
- return availableTransformerPlugins;
19
- };
20
- let transformationRunner;
21
- const createTransformationRunner = ()=>{
22
- if (transformationRunner) return transformationRunner;
23
- const availablePlugins = getAvailableTransformerPlugins();
24
- transformationRunner = (field, value)=>{
25
- const transformer = availablePlugins[field.type];
26
- if (!transformer) return value;
27
- return transformer.transform(value, field);
28
- };
29
- return transformationRunner;
30
- };
31
- const prepareFormData = (input, fields)=>{
32
- const runTransformation = createTransformationRunner();
33
- return fields.reduce((output, field)=>{
34
- const inputValue = input[field.fieldId];
35
- const fieldId = field.fieldId;
36
- if (field.list) {
37
- const values = Array.isArray(inputValue) ? inputValue : void 0;
38
- if (!values) return output;
39
- if (1 === values.length && (null === values[0] || void 0 === values[0])) return output;
40
- output[fieldId] = values.map((value)=>runTransformation(field, value));
41
- return output;
42
- }
43
- output[fieldId] = runTransformation(field, inputValue);
44
- return output;
45
- }, {});
46
- };
47
- export { prepareFormData };
48
-
49
- //# sourceMappingURL=prepareFormData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepareFormData.js","sources":["../src/prepareFormData.ts"],"sourcesContent":["import type { CmsFieldValueTransformer, CmsModelField } from \"~/types/index.js\";\nimport { plugins } from \"@webiny/plugins\";\n\ninterface AvailableFieldTransformers {\n [fieldType: string]: CmsFieldValueTransformer;\n}\n\n/**\n * This method builds transformer plugins only once.\n * Really no need in building more than once because at this point all plugins are registered.\n */\nlet availableTransformerPlugins: AvailableFieldTransformers | undefined = undefined;\nconst getAvailableTransformerPlugins = (): AvailableFieldTransformers => {\n if (availableTransformerPlugins) {\n return availableTransformerPlugins;\n }\n availableTransformerPlugins = plugins\n .byType<CmsFieldValueTransformer>(\"cms-field-value-transformer\")\n .reduce<AvailableFieldTransformers>((transformers, pl) => {\n const fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];\n for (const fieldType of fieldTypes) {\n if (transformers[fieldType]) {\n console.warn(\n `Transformer for field type \"${fieldType}\" is already defined. There cannot be more than one transformer.`\n );\n continue;\n }\n transformers[fieldType] = pl;\n }\n return transformers;\n }, {});\n\n return availableTransformerPlugins;\n};\n\ninterface TransformationRunnerCallable {\n (field: CmsModelField, value: any): any;\n}\n\nlet transformationRunner: TransformationRunnerCallable;\nconst createTransformationRunner = (): TransformationRunnerCallable => {\n if (transformationRunner) {\n return transformationRunner;\n }\n const availablePlugins = getAvailableTransformerPlugins();\n\n transformationRunner = (field, value) => {\n const transformer = availablePlugins[field.type];\n if (!transformer) {\n return value;\n }\n return transformer.transform(value, field);\n };\n return transformationRunner;\n};\n\nexport const prepareFormData = <T extends Record<string, any>>(\n input: T,\n fields: CmsModelField[]\n): T => {\n const runTransformation = createTransformationRunner();\n\n return fields.reduce<Record<keyof T, any>>((output, field) => {\n const inputValue = input[field.fieldId];\n\n const fieldId: keyof T = field.fieldId;\n\n if (field.list) {\n const values = Array.isArray(inputValue) ? inputValue : undefined;\n if (!values) {\n return output;\n }\n /**\n * We need to skip sending the values if there is only one item in the array, and it is a null or undefined value.\n *\n * In case there are more items in the array, and they are null / undefined,\n * we must not do anything because it means the user added new items into the array,\n * and they want to have it like that - or is a mistake by user - in that case they will then remove the extra item(s).\n */\n //\n else if (values.length === 1 && (values[0] === null || values[0] === undefined)) {\n return output;\n }\n\n output[fieldId] = values.map(value => runTransformation(field, value));\n\n return output;\n }\n /**\n * Regular values, single values.\n */\n output[fieldId] = runTransformation(field, inputValue);\n\n return output;\n }, {} as T);\n};\n"],"names":["availableTransformerPlugins","getAvailableTransformerPlugins","plugins","transformers","pl","fieldTypes","Array","fieldType","console","transformationRunner","createTransformationRunner","availablePlugins","field","value","transformer","prepareFormData","input","fields","runTransformation","output","inputValue","fieldId","values","undefined"],"mappings":";AAWA,IAAIA;AACJ,MAAMC,iCAAiC;IACnC,IAAID,6BACA,OAAOA;IAEXA,8BAA8BE,QAAAA,MACnB,CAA2B,+BACjC,MAAM,CAA6B,CAACC,cAAcC;QAC/C,MAAMC,aAAaC,MAAM,OAAO,CAACF,GAAG,SAAS,IAAIA,GAAG,SAAS,GAAG;YAACA,GAAG,SAAS;SAAC;QAC9E,KAAK,MAAMG,aAAaF,WAAY;YAChC,IAAIF,YAAY,CAACI,UAAU,EAAE;gBACzBC,QAAQ,IAAI,CACR,CAAC,4BAA4B,EAAED,UAAU,gEAAgE,CAAC;gBAE9G;YACJ;YACAJ,YAAY,CAACI,UAAU,GAAGH;QAC9B;QACA,OAAOD;IACX,GAAG,CAAC;IAER,OAAOH;AACX;AAMA,IAAIS;AACJ,MAAMC,6BAA6B;IAC/B,IAAID,sBACA,OAAOA;IAEX,MAAME,mBAAmBV;IAEzBQ,uBAAuB,CAACG,OAAOC;QAC3B,MAAMC,cAAcH,gBAAgB,CAACC,MAAM,IAAI,CAAC;QAChD,IAAI,CAACE,aACD,OAAOD;QAEX,OAAOC,YAAY,SAAS,CAACD,OAAOD;IACxC;IACA,OAAOH;AACX;AAEO,MAAMM,kBAAkB,CAC3BC,OACAC;IAEA,MAAMC,oBAAoBR;IAE1B,OAAOO,OAAO,MAAM,CAAuB,CAACE,QAAQP;QAChD,MAAMQ,aAAaJ,KAAK,CAACJ,MAAM,OAAO,CAAC;QAEvC,MAAMS,UAAmBT,MAAM,OAAO;QAEtC,IAAIA,MAAM,IAAI,EAAE;YACZ,MAAMU,SAAShB,MAAM,OAAO,CAACc,cAAcA,aAAaG;YACxD,IAAI,CAACD,QACD,OAAOH;YAUN,IAAIG,AAAkB,MAAlBA,OAAO,MAAM,IAAWA,CAAAA,AAAc,SAAdA,MAAM,CAAC,EAAE,IAAaA,AAAcC,WAAdD,MAAM,CAAC,EAAE,AAAa,GACzE,OAAOH;YAGXA,MAAM,CAACE,QAAQ,GAAGC,OAAO,GAAG,CAACT,CAAAA,QAASK,kBAAkBN,OAAOC;YAE/D,OAAOM;QACX;QAIAA,MAAM,CAACE,QAAQ,GAAGH,kBAAkBN,OAAOQ;QAE3C,OAAOD;IACX,GAAG,CAAC;AACR"}
@@ -1,79 +0,0 @@
1
- import type * as React from "react";
2
- import type { Plugin } from "@webiny/plugins/types.js";
3
- import type { CmsModelField } from "../types/index.js";
4
- export interface CmsModelFieldValidatorConfigAdapter {
5
- isRequired(): boolean;
6
- getName(): string;
7
- getLabel(): string;
8
- getDescription(): string;
9
- getDefaultMessage(): string;
10
- getDefaultSettings(): Record<string, any> | undefined;
11
- getVariables(): CmsModelFieldValidatorVariable[];
12
- getVariableDescription(variableName: string): string | undefined;
13
- }
14
- export interface CmsModelFieldValidatorVariable {
15
- name: string;
16
- description: string;
17
- }
18
- /**
19
- * This interface is used in the validator configuration UI (Field dialog).
20
- */
21
- export interface CmsModelFieldValidatorConfig {
22
- name: string;
23
- required?: boolean;
24
- label?: string;
25
- description?: string;
26
- defaultMessage?: string;
27
- defaultSettings?: Record<string, any>;
28
- variables?: CmsModelFieldValidatorVariable[];
29
- }
30
- /**
31
- * This interface allows you to control the title, description, and validators located in the specific
32
- * validators group, like `validators` or `listValidators` within the Field dialog.
33
- */
34
- export interface CmsModelFieldValidatorsGroup {
35
- validators: (string | CmsModelFieldValidatorConfig)[];
36
- title?: string;
37
- description?: string;
38
- }
39
- /**
40
- * This interface allows you to generate validators based on the field configuration.
41
- */
42
- export interface CmsModelFieldValidatorsFactory {
43
- (field: CmsModelField): string[] | CmsModelFieldValidatorsGroup;
44
- }
45
- export interface CmsModelFieldValidator {
46
- name: string;
47
- message?: string;
48
- settings?: any;
49
- }
50
- export interface CmsModelFieldValidatorPlugin<T = any> extends Plugin {
51
- type: "cms-model-field-validator";
52
- validator: {
53
- name: string;
54
- label: string;
55
- description: string;
56
- defaultMessage: string;
57
- variables?: CmsModelFieldValidatorVariable[];
58
- defaultSettings?: Record<string, any>;
59
- getVariableValues?: (context: {
60
- validator: CmsModelFieldValidator;
61
- }) => Record<string, string>;
62
- renderSettings?: (config: CmsModelFieldValidatorConfigAdapter) => React.ReactElement;
63
- renderCustomUi?: () => React.ReactElement;
64
- validate: (value: T, context: {
65
- validator: CmsModelFieldValidator;
66
- field: CmsModelField;
67
- }) => Promise<any>;
68
- };
69
- }
70
- export interface CmsModelFieldRegexValidatorExpressionPlugin extends Plugin {
71
- type: "cms-model-field-regex-validator-expression";
72
- pattern: {
73
- name: string;
74
- message: string;
75
- label: string;
76
- regex: string;
77
- flags: string;
78
- };
79
- }
File without changes