@webiny/app-headless-cms 5.18.3 → 5.19.0-beta.3

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 (59) hide show
  1. package/admin/components/ContentModelEditor/Editor.d.ts +1 -1
  2. package/admin/components/FieldEditor/Styled.d.ts +2 -2
  3. package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.d.ts +21 -0
  4. package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js +61 -0
  5. package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.d.ts +10 -0
  6. package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js +36 -0
  7. package/admin/plugins/editor/defaultBar/Divider.d.ts +1 -1
  8. package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +2 -2
  9. package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +3 -3
  10. package/admin/plugins/fieldRenderers/file/File.d.ts +12 -11
  11. package/admin/plugins/fieldRenderers/file/File.js +19 -15
  12. package/admin/plugins/fieldRenderers/file/fileField.js +17 -12
  13. package/admin/plugins/fieldRenderers/file/fileFields.js +16 -20
  14. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +17 -7
  15. package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.d.ts +5 -0
  16. package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.js +5 -0
  17. package/admin/plugins/fieldRenderers/ref/components/renderItem.d.ts +7 -1
  18. package/admin/plugins/fieldRenderers/ref/components/renderItem.js +6 -2
  19. package/admin/plugins/fieldRenderers/ref/components/useReference.js +2 -2
  20. package/admin/plugins/fieldRenderers/ref/components/useReferences.js +1 -1
  21. package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.d.ts +3 -0
  22. package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js +9 -0
  23. package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.d.ts +3 -0
  24. package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js +9 -0
  25. package/admin/plugins/fields/file.js +15 -1
  26. package/admin/plugins/fields/ref.js +3 -2
  27. package/admin/plugins/index.d.ts +2 -2
  28. package/admin/plugins/install.js +7 -0
  29. package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +1 -1
  30. package/admin/plugins/transformers/dateTransformer.js +114 -20
  31. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.d.ts +7 -0
  32. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js +53 -0
  33. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.d.ts +7 -0
  34. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js +49 -0
  35. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.d.ts +2 -0
  36. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js +12 -0
  37. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.d.ts +1 -0
  38. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js +8 -0
  39. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.d.ts +1 -0
  40. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js +10 -0
  41. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.d.ts +1 -0
  42. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js +8 -0
  43. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.d.ts +7 -0
  44. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js +122 -0
  45. package/admin/plugins/upgrades/5.19.0/types.d.ts +47 -0
  46. package/admin/plugins/upgrades/5.19.0/types.js +1 -0
  47. package/admin/plugins/upgrades/v5.19.0.d.ts +5 -0
  48. package/admin/plugins/upgrades/v5.19.0.js +647 -0
  49. package/admin/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +10 -0
  50. package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js +9 -0
  51. package/admin/plugins/validators/patternPlugins/upperCaseSpace.d.ts +10 -0
  52. package/admin/plugins/validators/patternPlugins/upperCaseSpace.js +9 -0
  53. package/admin/views/contentEntries/ContentEntriesList.js +2 -2
  54. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +7 -1
  55. package/admin/views/contentEntries/ContentEntry/cache.js +4 -1
  56. package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +1 -1
  57. package/admin/views/contentEntries/hooks/useContentEntriesList.js +2 -2
  58. package/package.json +18 -16
  59. package/types.d.ts +2 -1
@@ -0,0 +1,647 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
7
+
8
+ var _templateObject, _templateObject2;
9
+
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
+ import React, { useCallback, useEffect, useState } from "react";
12
+ import { i18n } from "@webiny/app/i18n";
13
+ import { SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader } from "@webiny/app-admin/components/SimpleForm";
14
+ import { useApolloClient } from "@apollo/react-hooks";
15
+ import { Alert } from "@webiny/ui/Alert";
16
+ import { CircularProgress } from "@webiny/ui/Progress";
17
+ import { Cell, Grid } from "@webiny/ui/Grid";
18
+ import { ButtonPrimary } from "@webiny/ui/Button";
19
+ import { Typography } from "@webiny/ui/Typography";
20
+ import { createCmsApolloClient } from "./5.19.0/createCmsApolloClient";
21
+ import { config as appConfig } from "@webiny/app/config";
22
+ import { LIST_LOCALES } from "@webiny/app-i18n/admin/views/locales/hooks/graphql";
23
+ import { UpgradeItemsInfo } from "./5.19.0/UpgradeItemsInfo";
24
+ import { fetchModelEntries } from "./5.19.0/fetchModelEntries";
25
+ import { createRepublishMutation } from "./5.19.0/createRepublishMutation";
26
+ import { createUpgradeMutation } from "./5.19.0/createUpgradeMutation";
27
+ import { createListModelsQuery } from "./5.19.0/createListModelsQuery";
28
+ var t = i18n.ns("app-headless-cms/admin/installation");
29
+ var clients = {};
30
+
31
+ var getClient = function getClient(locale) {
32
+ if (!clients[locale]) {
33
+ throw new Error("There are no clients for locale \"".concat(locale, "\"."));
34
+ }
35
+
36
+ return clients[locale];
37
+ };
38
+
39
+ var getManageClient = function getManageClient(locale) {
40
+ return getClient(locale).manage;
41
+ };
42
+
43
+ var getReadClient = function getReadClient(locale) {
44
+ return getClient(locale).read;
45
+ };
46
+
47
+ var createUpgradeItems = function createUpgradeItems(params) {
48
+ var locales = params.locales;
49
+ var items = {
50
+ loadedModels: false,
51
+ locales: {}
52
+ };
53
+ var apiUrl = appConfig.getKey("API_URL", process.env.REACT_APP_API_URL);
54
+
55
+ var _iterator = _createForOfIteratorHelper(locales),
56
+ _step;
57
+
58
+ try {
59
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
60
+ var locale = _step.value;
61
+ items.locales[locale.code] = null;
62
+ clients[locale.code] = {
63
+ read: createCmsApolloClient({
64
+ locale: locale.code,
65
+ apiUrl: apiUrl,
66
+ endpoint: "read"
67
+ }),
68
+ manage: createCmsApolloClient({
69
+ locale: locale.code,
70
+ apiUrl: apiUrl,
71
+ endpoint: "manage"
72
+ })
73
+ };
74
+ }
75
+ } catch (err) {
76
+ _iterator.e(err);
77
+ } finally {
78
+ _iterator.f();
79
+ }
80
+
81
+ return items;
82
+ };
83
+
84
+ var updateUpgradeItems = function updateUpgradeItems(params) {
85
+ var previous = params.previous,
86
+ models = params.models;
87
+ var locales = {};
88
+
89
+ for (var locale in previous.locales) {
90
+ locales[locale] = (models[locale] || []).reduce(function (collection, model) {
91
+ collection[model.modelId] = {
92
+ model: model,
93
+ done: false,
94
+ entries: [],
95
+ upgrading: false
96
+ };
97
+ return collection;
98
+ }, {});
99
+ }
100
+
101
+ return {
102
+ loadedModels: true,
103
+ locales: locales
104
+ };
105
+ };
106
+
107
+ var Upgrade = function Upgrade(_ref) {
108
+ var onInstalled = _ref.onInstalled;
109
+ var client = useApolloClient();
110
+
111
+ var _useState = useState(null),
112
+ _useState2 = _slicedToArray(_useState, 2),
113
+ error = _useState2[0],
114
+ setError = _useState2[1];
115
+
116
+ var _useState3 = useState(false),
117
+ _useState4 = _slicedToArray(_useState3, 2),
118
+ loading = _useState4[0],
119
+ setLoading = _useState4[1];
120
+
121
+ var _useState5 = useState(false),
122
+ _useState6 = _slicedToArray(_useState5, 2),
123
+ upgrade = _useState6[0],
124
+ setUpgrade = _useState6[1];
125
+
126
+ var _useState7 = useState("pending"),
127
+ _useState8 = _slicedToArray(_useState7, 2),
128
+ status = _useState8[0],
129
+ setStatus = _useState8[1];
130
+
131
+ var _useState9 = useState(null),
132
+ _useState10 = _slicedToArray(_useState9, 2),
133
+ upgradeItems = _useState10[0],
134
+ setUpgradeItems = _useState10[1];
135
+
136
+ useEffect(function () {
137
+ /**
138
+ * Never do this if we have upgrade items.
139
+ */
140
+ if (upgradeItems || loading === true) {
141
+ return;
142
+ }
143
+
144
+ setLoading(true);
145
+
146
+ var fetchLocales = /*#__PURE__*/function () {
147
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
148
+ var response;
149
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
150
+ while (1) {
151
+ switch (_context.prev = _context.next) {
152
+ case 0:
153
+ _context.next = 2;
154
+ return client.query({
155
+ query: LIST_LOCALES
156
+ });
157
+
158
+ case 2:
159
+ response = _context.sent;
160
+
161
+ if (!(!response || !response.data || !response.data.i18n || !response.data.i18n.listI18NLocales)) {
162
+ _context.next = 8;
163
+ break;
164
+ }
165
+
166
+ console.error("Missing response when fetching locales.");
167
+ return _context.abrupt("return");
168
+
169
+ case 8:
170
+ if (!response.data.i18n.listI18NLocales.error) {
171
+ _context.next = 12;
172
+ break;
173
+ }
174
+
175
+ console.error(response.data.i18n.listI18NLocales.error.message);
176
+ setError(error);
177
+ return _context.abrupt("return");
178
+
179
+ case 12:
180
+ /**
181
+ * New state for the upgrade items.
182
+ */
183
+ setUpgradeItems(function () {
184
+ return createUpgradeItems({
185
+ locales: response.data.i18n.listI18NLocales.data
186
+ });
187
+ });
188
+ /**
189
+ * And stop the spinner.
190
+ */
191
+
192
+ setLoading(false);
193
+
194
+ case 14:
195
+ case "end":
196
+ return _context.stop();
197
+ }
198
+ }
199
+ }, _callee);
200
+ }));
201
+
202
+ return function fetchLocales() {
203
+ return _ref2.apply(this, arguments);
204
+ };
205
+ }();
206
+
207
+ fetchLocales();
208
+ }, []);
209
+ useEffect(function () {
210
+ if (!upgradeItems || !upgradeItems.locales || upgradeItems.loadedModels === true || loading === true) {
211
+ return;
212
+ }
213
+
214
+ setLoading(true);
215
+
216
+ var fetchModels = /*#__PURE__*/function () {
217
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
218
+ var models, locales, query, locale, response, _ref4, listContentModels, data, _error;
219
+
220
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
221
+ while (1) {
222
+ switch (_context2.prev = _context2.next) {
223
+ case 0:
224
+ models = {};
225
+ /**
226
+ * Load all models from locales, one by one so we dont nuke API too much.
227
+ */
228
+
229
+ locales = upgradeItems.locales;
230
+ /**
231
+ * Query does not care about locale so we can create it before the loop.
232
+ */
233
+
234
+ query = createListModelsQuery();
235
+ /**
236
+ *
237
+ */
238
+
239
+ _context2.t0 = _regeneratorRuntime.keys(locales);
240
+
241
+ case 4:
242
+ if ((_context2.t1 = _context2.t0()).done) {
243
+ _context2.next = 26;
244
+ break;
245
+ }
246
+
247
+ locale = _context2.t1.value;
248
+ _context2.next = 8;
249
+ return getManageClient(locale).query({
250
+ query: query
251
+ });
252
+
253
+ case 8:
254
+ response = _context2.sent;
255
+ _ref4 = response.data || {}, listContentModels = _ref4.listContentModels;
256
+ data = listContentModels.data, _error = listContentModels.error;
257
+
258
+ if (!_error) {
259
+ _context2.next = 16;
260
+ break;
261
+ }
262
+
263
+ setError(_error);
264
+ return _context2.abrupt("return");
265
+
266
+ case 16:
267
+ if (data) {
268
+ _context2.next = 21;
269
+ break;
270
+ }
271
+
272
+ setError({
273
+ message: "No data received when loading all models in locale \"".concat(locale, "\".")
274
+ });
275
+ return _context2.abrupt("return");
276
+
277
+ case 21:
278
+ if (!(data.length === 0)) {
279
+ _context2.next = 23;
280
+ break;
281
+ }
282
+
283
+ return _context2.abrupt("continue", 4);
284
+
285
+ case 23:
286
+ /**
287
+ * We only need models that have at least one ref field or an object field that MIGHT contain ref fields.
288
+ */
289
+ models[locale] = data.filter(function (model) {
290
+ return model.fields.some(function (field) {
291
+ return field.type === "object" || field.type === "ref";
292
+ });
293
+ });
294
+ _context2.next = 4;
295
+ break;
296
+
297
+ case 26:
298
+ /**
299
+ * We add models only once to skip unnecessary state changes.
300
+ */
301
+ setUpgradeItems(function (previous) {
302
+ return updateUpgradeItems({
303
+ previous: previous,
304
+ models: models
305
+ });
306
+ });
307
+ setLoading(false);
308
+
309
+ case 28:
310
+ case "end":
311
+ return _context2.stop();
312
+ }
313
+ }
314
+ }, _callee2);
315
+ }));
316
+
317
+ return function fetchModels() {
318
+ return _ref3.apply(this, arguments);
319
+ };
320
+ }();
321
+
322
+ fetchModels();
323
+ }, [upgradeItems, loading]);
324
+ var startUpgrade = useCallback(function () {
325
+ if (!upgradeItems || upgradeItems.loadedModels !== true || upgrade === true) {
326
+ return;
327
+ }
328
+
329
+ setUpgrade(true);
330
+ }, [upgradeItems]);
331
+ useEffect(function () {
332
+ if (!upgrade || !upgradeItems || !upgradeItems.locales || upgradeItems.loadedModels === false || status !== "pending") {
333
+ return;
334
+ }
335
+
336
+ var locales = upgradeItems.locales;
337
+ setStatus("upgrading");
338
+
339
+ var republish = /*#__PURE__*/function () {
340
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
341
+ var _loop, locale, _ret, response, error;
342
+
343
+ return _regeneratorRuntime.wrap(function _callee3$(_context6) {
344
+ while (1) {
345
+ switch (_context6.prev = _context6.next) {
346
+ case 0:
347
+ _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(locale) {
348
+ var localeData, manageClient, readClient, _loop2, modelId, _ret2;
349
+
350
+ return _regeneratorRuntime.wrap(function _loop$(_context5) {
351
+ while (1) {
352
+ switch (_context5.prev = _context5.next) {
353
+ case 0:
354
+ localeData = locales[locale];
355
+ manageClient = getManageClient(locale);
356
+ readClient = getReadClient(locale);
357
+ _loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2(modelId) {
358
+ var modelData, entries, mutation, _iterator2, _step2, _loop3, _ret3;
359
+
360
+ return _regeneratorRuntime.wrap(function _loop2$(_context4) {
361
+ while (1) {
362
+ switch (_context4.prev = _context4.next) {
363
+ case 0:
364
+ modelData = localeData[modelId];
365
+ /**
366
+ * This should never be true but let's check just in case of some missed loop breaks.
367
+ */
368
+
369
+ if (!(modelData.done || modelData.upgrading)) {
370
+ _context4.next = 3;
371
+ break;
372
+ }
373
+
374
+ return _context4.abrupt("return", "continue");
375
+
376
+ case 3:
377
+ _context4.next = 5;
378
+ return fetchModelEntries({
379
+ model: modelData.model,
380
+ client: readClient
381
+ });
382
+
383
+ case 5:
384
+ entries = _context4.sent;
385
+ setUpgradeItems(function (previous) {
386
+ return _objectSpread(_objectSpread({}, previous), {}, {
387
+ locales: _objectSpread(_objectSpread({}, previous.locales), {}, _defineProperty({}, locale, _objectSpread(_objectSpread({}, previous.locales[locale]), {}, _defineProperty({}, modelId, {
388
+ model: modelData.model,
389
+ done: false,
390
+ upgrading: true,
391
+ entries: entries.map(function (id) {
392
+ return {
393
+ id: id,
394
+ done: false
395
+ };
396
+ })
397
+ }))))
398
+ });
399
+ });
400
+ mutation = createRepublishMutation(modelData.model);
401
+ _iterator2 = _createForOfIteratorHelper(entries);
402
+ _context4.prev = 9;
403
+ _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
404
+ var id, republishResponse, error;
405
+ return _regeneratorRuntime.wrap(function _loop3$(_context3) {
406
+ while (1) {
407
+ switch (_context3.prev = _context3.next) {
408
+ case 0:
409
+ id = _step2.value;
410
+ _context3.next = 3;
411
+ return manageClient.mutate({
412
+ mutation: mutation,
413
+ variables: {
414
+ revision: id
415
+ }
416
+ });
417
+
418
+ case 3:
419
+ republishResponse = _context3.sent;
420
+ error = republishResponse.data.content.error;
421
+
422
+ if (!error) {
423
+ _context3.next = 8;
424
+ break;
425
+ }
426
+
427
+ setError(error);
428
+ return _context3.abrupt("return", {
429
+ v: {
430
+ v: {
431
+ v: void 0
432
+ }
433
+ }
434
+ });
435
+
436
+ case 8:
437
+ setUpgradeItems(function (previous) {
438
+ return _objectSpread(_objectSpread({}, previous), {}, {
439
+ locales: _objectSpread(_objectSpread({}, previous.locales), {}, _defineProperty({}, locale, _objectSpread(_objectSpread({}, previous.locales[locale]), {}, _defineProperty({}, modelId, {
440
+ model: previous.locales[locale][modelId].model,
441
+ entries: previous.locales[locale][modelId].entries.map(function (info) {
442
+ return {
443
+ id: info.id,
444
+ done: info.done === true || id === info.id
445
+ };
446
+ }),
447
+ done: false,
448
+ upgrading: true
449
+ }))))
450
+ });
451
+ });
452
+
453
+ case 9:
454
+ case "end":
455
+ return _context3.stop();
456
+ }
457
+ }
458
+ }, _loop3);
459
+ });
460
+
461
+ _iterator2.s();
462
+
463
+ case 12:
464
+ if ((_step2 = _iterator2.n()).done) {
465
+ _context4.next = 19;
466
+ break;
467
+ }
468
+
469
+ return _context4.delegateYield(_loop3(), "t0", 14);
470
+
471
+ case 14:
472
+ _ret3 = _context4.t0;
473
+
474
+ if (!(typeof _ret3 === "object")) {
475
+ _context4.next = 17;
476
+ break;
477
+ }
478
+
479
+ return _context4.abrupt("return", _ret3.v);
480
+
481
+ case 17:
482
+ _context4.next = 12;
483
+ break;
484
+
485
+ case 19:
486
+ _context4.next = 24;
487
+ break;
488
+
489
+ case 21:
490
+ _context4.prev = 21;
491
+ _context4.t1 = _context4["catch"](9);
492
+
493
+ _iterator2.e(_context4.t1);
494
+
495
+ case 24:
496
+ _context4.prev = 24;
497
+
498
+ _iterator2.f();
499
+
500
+ return _context4.finish(24);
501
+
502
+ case 27:
503
+ setUpgradeItems(function (previous) {
504
+ return _objectSpread(_objectSpread({}, previous), {}, {
505
+ locales: _objectSpread(_objectSpread({}, previous.locales), {}, _defineProperty({}, locale, _objectSpread(_objectSpread({}, previous.locales[locale]), {}, _defineProperty({}, modelId, {
506
+ model: modelData.model,
507
+ entries: [],
508
+ done: true,
509
+ upgrading: false
510
+ }))))
511
+ });
512
+ });
513
+
514
+ case 28:
515
+ case "end":
516
+ return _context4.stop();
517
+ }
518
+ }
519
+ }, _loop2, null, [[9, 21, 24, 27]]);
520
+ });
521
+ _context5.t0 = _regeneratorRuntime.keys(localeData);
522
+
523
+ case 5:
524
+ if ((_context5.t1 = _context5.t0()).done) {
525
+ _context5.next = 15;
526
+ break;
527
+ }
528
+
529
+ modelId = _context5.t1.value;
530
+ return _context5.delegateYield(_loop2(modelId), "t2", 8);
531
+
532
+ case 8:
533
+ _ret2 = _context5.t2;
534
+
535
+ if (!(_ret2 === "continue")) {
536
+ _context5.next = 11;
537
+ break;
538
+ }
539
+
540
+ return _context5.abrupt("continue", 5);
541
+
542
+ case 11:
543
+ if (!(typeof _ret2 === "object")) {
544
+ _context5.next = 13;
545
+ break;
546
+ }
547
+
548
+ return _context5.abrupt("return", _ret2.v);
549
+
550
+ case 13:
551
+ _context5.next = 5;
552
+ break;
553
+
554
+ case 15:
555
+ case "end":
556
+ return _context5.stop();
557
+ }
558
+ }
559
+ }, _loop);
560
+ });
561
+ _context6.t0 = _regeneratorRuntime.keys(locales);
562
+
563
+ case 2:
564
+ if ((_context6.t1 = _context6.t0()).done) {
565
+ _context6.next = 10;
566
+ break;
567
+ }
568
+
569
+ locale = _context6.t1.value;
570
+ return _context6.delegateYield(_loop(locale), "t2", 5);
571
+
572
+ case 5:
573
+ _ret = _context6.t2;
574
+
575
+ if (!(typeof _ret === "object")) {
576
+ _context6.next = 8;
577
+ break;
578
+ }
579
+
580
+ return _context6.abrupt("return", _ret.v);
581
+
582
+ case 8:
583
+ _context6.next = 2;
584
+ break;
585
+
586
+ case 10:
587
+ _context6.next = 12;
588
+ return client.mutate({
589
+ mutation: createUpgradeMutation(),
590
+ variables: {
591
+ version: "5.19.0"
592
+ }
593
+ });
594
+
595
+ case 12:
596
+ response = _context6.sent;
597
+ error = response.data.cms.upgrade.error;
598
+ setStatus("completed");
599
+
600
+ if (!error) {
601
+ _context6.next = 18;
602
+ break;
603
+ }
604
+
605
+ setError(error);
606
+ return _context6.abrupt("return");
607
+
608
+ case 18:
609
+ onInstalled();
610
+
611
+ case 19:
612
+ case "end":
613
+ return _context6.stop();
614
+ }
615
+ }
616
+ }, _callee3);
617
+ }));
618
+
619
+ return function republish() {
620
+ return _ref5.apply(this, arguments);
621
+ };
622
+ }();
623
+
624
+ republish();
625
+ }, [upgrade, upgradeItems, status]);
626
+ var label = error ? /*#__PURE__*/React.createElement(Alert, {
627
+ title: t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Something went wrong"]))),
628
+ type: "danger"
629
+ }, error.message) : upgrade ? t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Upgrading Headless CMS..."]))) : "Loading Headless CMS information";
630
+ return /*#__PURE__*/React.createElement(SimpleForm, null, (loading || error) && /*#__PURE__*/React.createElement(CircularProgress, {
631
+ label: label
632
+ }), /*#__PURE__*/React.createElement(SimpleFormHeader, {
633
+ title: "Upgrade Headless CMS"
634
+ }), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
635
+ span: 12
636
+ }, /*#__PURE__*/React.createElement(Typography, {
637
+ use: "body1",
638
+ tag: "div"
639
+ }, "This upgrade will do the following:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "update entries")), /*#__PURE__*/React.createElement(UpgradeItemsInfo, {
640
+ upgradeItems: upgradeItems
641
+ }))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(ButtonPrimary, {
642
+ disabled: loading || upgrade,
643
+ onClick: startUpgrade
644
+ }, "Upgrade")));
645
+ };
646
+
647
+ export default Upgrade;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ type: string;
3
+ name: string;
4
+ pattern: {
5
+ name: string;
6
+ regex: string;
7
+ flags: string;
8
+ };
9
+ };
10
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export default {
2
+ type: "cms-model-field-validator-pattern",
3
+ name: "cms-model-field-validator-pattern-lower-case-space",
4
+ pattern: {
5
+ name: "lowerCaseSpace",
6
+ regex: "^([a-z\\s]+)$",
7
+ flags: ""
8
+ }
9
+ };
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ type: string;
3
+ name: string;
4
+ pattern: {
5
+ name: string;
6
+ regex: string;
7
+ flags: string;
8
+ };
9
+ };
10
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export default {
2
+ type: "cms-model-field-validator-pattern",
3
+ name: "cms-model-field-validator-pattern-upper-case-space",
4
+ pattern: {
5
+ name: "upperCaseSpace",
6
+ regex: "^([A-Z\\s]+)$",
7
+ flags: ""
8
+ }
9
+ };