@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.
- package/admin/components/ContentModelEditor/Editor.d.ts +1 -1
- package/admin/components/FieldEditor/Styled.d.ts +2 -2
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.d.ts +21 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js +61 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.d.ts +10 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js +36 -0
- package/admin/plugins/editor/defaultBar/Divider.d.ts +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +3 -3
- package/admin/plugins/fieldRenderers/file/File.d.ts +12 -11
- package/admin/plugins/fieldRenderers/file/File.js +19 -15
- package/admin/plugins/fieldRenderers/file/fileField.js +17 -12
- package/admin/plugins/fieldRenderers/file/fileFields.js +16 -20
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +17 -7
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.d.ts +5 -0
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.js +5 -0
- package/admin/plugins/fieldRenderers/ref/components/renderItem.d.ts +7 -1
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js +6 -2
- package/admin/plugins/fieldRenderers/ref/components/useReference.js +2 -2
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js +1 -1
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js +9 -0
- package/admin/plugins/fields/file.js +15 -1
- package/admin/plugins/fields/ref.js +3 -2
- package/admin/plugins/index.d.ts +2 -2
- package/admin/plugins/install.js +7 -0
- package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +1 -1
- package/admin/plugins/transformers/dateTransformer.js +114 -20
- package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.d.ts +7 -0
- package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js +53 -0
- package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.d.ts +7 -0
- package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js +49 -0
- package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.d.ts +2 -0
- package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js +12 -0
- package/admin/plugins/upgrades/5.19.0/createListModelsQuery.d.ts +1 -0
- package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js +8 -0
- package/admin/plugins/upgrades/5.19.0/createRepublishMutation.d.ts +1 -0
- package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js +10 -0
- package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.d.ts +1 -0
- package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js +8 -0
- package/admin/plugins/upgrades/5.19.0/fetchModelEntries.d.ts +7 -0
- package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js +122 -0
- package/admin/plugins/upgrades/5.19.0/types.d.ts +47 -0
- package/admin/plugins/upgrades/5.19.0/types.js +1 -0
- package/admin/plugins/upgrades/v5.19.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.19.0.js +647 -0
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js +9 -0
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.js +9 -0
- package/admin/views/contentEntries/ContentEntriesList.js +2 -2
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +7 -1
- package/admin/views/contentEntries/ContentEntry/cache.js +4 -1
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +1 -1
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +2 -2
- package/package.json +18 -16
- package/types.d.ts +2 -1
|
@@ -1,14 +1,117 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import WebinyError from "@webiny/error";
|
|
2
3
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var throwTransformError = function throwTransformError(params) {
|
|
5
|
+
var type = params.type,
|
|
6
|
+
value = params.value,
|
|
7
|
+
error = params.ex;
|
|
8
|
+
throw new WebinyError("Could not transform value to a date.", "TRANSFORM_ERROR", {
|
|
9
|
+
error: error,
|
|
10
|
+
type: type,
|
|
11
|
+
value: value
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var dateOnly = function dateOnly(value) {
|
|
16
|
+
try {
|
|
17
|
+
var date = new Date(value).toISOString();
|
|
18
|
+
return date.substr(0, 10);
|
|
19
|
+
} catch (ex) {
|
|
20
|
+
throwTransformError({
|
|
21
|
+
ex: ex,
|
|
22
|
+
value: value,
|
|
23
|
+
type: "date"
|
|
24
|
+
});
|
|
6
25
|
}
|
|
26
|
+
};
|
|
7
27
|
|
|
8
|
-
|
|
28
|
+
var extractTimeZone = function extractTimeZone(value) {
|
|
29
|
+
var result;
|
|
30
|
+
|
|
31
|
+
if (value.includes("+")) {
|
|
32
|
+
result = value.split("+");
|
|
33
|
+
} else {
|
|
34
|
+
result = value.split("-");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!result || result.length !== 2) {
|
|
38
|
+
throw new WebinyError("Could not determine time and timezone out of given value.", "TIME_ZONE_ERROR", {
|
|
39
|
+
value: value
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return result;
|
|
9
44
|
};
|
|
10
45
|
|
|
11
|
-
var
|
|
46
|
+
var extractTime = function extractTime(value) {
|
|
47
|
+
if (value.includes(":") === false) {
|
|
48
|
+
throw new WebinyError("Time value is missing : separators.", "TIME_ERROR", {
|
|
49
|
+
value: value
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var result = value.split(":");
|
|
54
|
+
|
|
55
|
+
if (result.length === 3) {
|
|
56
|
+
return value;
|
|
57
|
+
} else if (result.length === 2) {
|
|
58
|
+
return "".concat(value, ":00");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var dateTimeWithTimezone = function dateTimeWithTimezone(value) {
|
|
63
|
+
if (value.includes("T") === false) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var _value$split = value.split("T"),
|
|
68
|
+
_value$split2 = _slicedToArray(_value$split, 2),
|
|
69
|
+
initialDate = _value$split2[0],
|
|
70
|
+
initialTimeZone = _value$split2[1];
|
|
71
|
+
|
|
72
|
+
var date;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
var dateObj = new Date(initialDate);
|
|
76
|
+
date = dateObj.toISOString().substr(0, 10);
|
|
77
|
+
} catch (ex) {
|
|
78
|
+
throw new WebinyError("Could not transform received date into Date object.", "DATE_TRANSFORM_ERROR", {
|
|
79
|
+
value: value,
|
|
80
|
+
date: initialDate,
|
|
81
|
+
time: initialTimeZone
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var _extractTimeZone = extractTimeZone(initialTimeZone),
|
|
86
|
+
_extractTimeZone2 = _slicedToArray(_extractTimeZone, 1),
|
|
87
|
+
initialTime = _extractTimeZone2[0];
|
|
88
|
+
|
|
89
|
+
var time = extractTime(initialTime);
|
|
90
|
+
return value.replace(initialDate, date).replace(initialTime, time);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var dateTimeWithoutTimezone = function dateTimeWithoutTimezone(value) {
|
|
94
|
+
if (value.includes(" ") === false) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
return new Date("".concat(value.replace(" ", "T"), ".000Z")).toISOString();
|
|
100
|
+
} catch (ex) {
|
|
101
|
+
throwTransformError({
|
|
102
|
+
ex: ex,
|
|
103
|
+
value: value,
|
|
104
|
+
type: "dateTimeWithoutTimezone"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var transformers = {
|
|
110
|
+
time: null,
|
|
111
|
+
date: dateOnly,
|
|
112
|
+
dateTimeWithoutTimezone: dateTimeWithoutTimezone,
|
|
113
|
+
dateTimeWithTimezone: dateTimeWithTimezone
|
|
114
|
+
};
|
|
12
115
|
export default (function () {
|
|
13
116
|
return {
|
|
14
117
|
type: "cms-field-value-transformer",
|
|
@@ -21,24 +124,15 @@ export default (function () {
|
|
|
21
124
|
if (!value) {
|
|
22
125
|
console.log("Field \"".concat(field.fieldId, "\" has no value."));
|
|
23
126
|
return null;
|
|
24
|
-
} else if (excludeTypesTransformation.includes(type) === true) {
|
|
25
|
-
return value;
|
|
26
|
-
} else if (type === "dateTimeWithoutTimezone" && value.includes(" ")) {
|
|
27
|
-
/**
|
|
28
|
-
* Need to replace space and add .000Z to datetime value because it can look like: 2021-02-02 16:34:56
|
|
29
|
-
*/
|
|
30
|
-
value = "".concat(value.replace(" ", "T"), ".000Z");
|
|
31
127
|
}
|
|
32
128
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw new WebinyError("Could not transform \"".concat(value, "\" to a date."), "TRANSFORM_ERROR", {
|
|
38
|
-
message: ex.message,
|
|
39
|
-
code: ex.code
|
|
40
|
-
});
|
|
129
|
+
var transform = transformers[type];
|
|
130
|
+
|
|
131
|
+
if (!transform) {
|
|
132
|
+
return value;
|
|
41
133
|
}
|
|
134
|
+
|
|
135
|
+
return transform(value);
|
|
42
136
|
}
|
|
43
137
|
};
|
|
44
138
|
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
3
|
+
|
|
4
|
+
var findUpgradingModel = function findUpgradingModel(locales) {
|
|
5
|
+
for (var locale in locales) {
|
|
6
|
+
if (!locales[locale]) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
var modelsData = Object.values(locales[locale]);
|
|
11
|
+
|
|
12
|
+
for (var modelId in modelsData) {
|
|
13
|
+
if (modelsData[modelId].upgrading !== true) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
locale: locale,
|
|
19
|
+
model: modelsData[modelId].model,
|
|
20
|
+
total: modelsData[modelId].entries.length,
|
|
21
|
+
current: modelsData[modelId].entries.filter(function (item) {
|
|
22
|
+
return item.done;
|
|
23
|
+
}).length
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export var UpgradeItemsInfo = function UpgradeItemsInfo(props) {
|
|
32
|
+
var upgradeItems = props.upgradeItems;
|
|
33
|
+
|
|
34
|
+
if (!upgradeItems || upgradeItems.loadedModels !== true || !upgradeItems.locales) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var locales = upgradeItems.locales;
|
|
39
|
+
var result = findUpgradingModel(locales);
|
|
40
|
+
|
|
41
|
+
if (!result) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var locale = result.locale,
|
|
46
|
+
model = result.model,
|
|
47
|
+
current = result.current,
|
|
48
|
+
total = result.total;
|
|
49
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
50
|
+
use: "body1",
|
|
51
|
+
tag: "div"
|
|
52
|
+
}, "Upgrading model ", /*#__PURE__*/React.createElement("strong", null, model.name), " in locale ", /*#__PURE__*/React.createElement("strong", null, locale), " (", current, " of ", total, " updated)");
|
|
53
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import ApolloClient from "apollo-client";
|
|
2
|
+
export interface Params {
|
|
3
|
+
locale: string;
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
endpoint: "manage" | "read";
|
|
6
|
+
}
|
|
7
|
+
export declare const createCmsApolloClient: ({ locale, apiUrl, endpoint }: Params) => ApolloClient<import("apollo-cache-inmemory").NormalizedCacheObject>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import ApolloClient from "apollo-client";
|
|
2
|
+
import { ApolloLink } from "apollo-link";
|
|
3
|
+
import { ApolloDynamicLink } from "@webiny/app/plugins/ApolloDynamicLink";
|
|
4
|
+
import { InMemoryCache } from "@webiny/app/apollo-client/InMemoryCache";
|
|
5
|
+
import { plugins } from "@webiny/plugins";
|
|
6
|
+
import { ApolloCacheObjectIdPlugin } from "@webiny/app/plugins/ApolloCacheObjectIdPlugin";
|
|
7
|
+
import { BatchHttpLink } from "apollo-link-batch-http";
|
|
8
|
+
export var createCmsApolloClient = function createCmsApolloClient(_ref) {
|
|
9
|
+
var locale = _ref.locale,
|
|
10
|
+
apiUrl = _ref.apiUrl,
|
|
11
|
+
endpoint = _ref.endpoint;
|
|
12
|
+
return new ApolloClient({
|
|
13
|
+
link: ApolloLink.from([
|
|
14
|
+
/**
|
|
15
|
+
* This will process links from plugins on every request.
|
|
16
|
+
*/
|
|
17
|
+
new ApolloDynamicLink(),
|
|
18
|
+
/**
|
|
19
|
+
* This batches requests made to the API to pack multiple requests into a single HTTP request.
|
|
20
|
+
*/
|
|
21
|
+
new BatchHttpLink({
|
|
22
|
+
uri: "".concat(apiUrl, "/cms/").concat(endpoint, "/").concat(locale)
|
|
23
|
+
})]),
|
|
24
|
+
cache: new InMemoryCache({
|
|
25
|
+
addTypename: true,
|
|
26
|
+
dataIdFromObject: function dataIdFromObject(obj) {
|
|
27
|
+
/**
|
|
28
|
+
* Since every data type coming from API can have a different data structure,
|
|
29
|
+
* we cannot rely on having an `id` field.
|
|
30
|
+
*/
|
|
31
|
+
var getters = plugins.byType(ApolloCacheObjectIdPlugin.type);
|
|
32
|
+
|
|
33
|
+
for (var i = 0; i < getters.length; i++) {
|
|
34
|
+
var id = getters[i].getObjectId(obj);
|
|
35
|
+
|
|
36
|
+
if (typeof id !== "undefined") {
|
|
37
|
+
return id;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* As a fallback, try getting object's `id`.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
return obj.id || null;
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import upperFirst from "lodash/upperFirst";
|
|
6
|
+
import pluralize from "pluralize";
|
|
7
|
+
import gql from "graphql-tag";
|
|
8
|
+
export var createListEntriesQuery = function createListEntriesQuery(model) {
|
|
9
|
+
var ucFirstPluralizedModelId = upperFirst(pluralize(model.modelId));
|
|
10
|
+
var ucFirstModelId = upperFirst(model.modelId);
|
|
11
|
+
return gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query CmsEntriesList", "($where: ", "ListWhereInput, $sort: [", "ListSorter], $limit: Int, $after: String) {\n content: list", "(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n ) {\n data {\n id\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n "])), ucFirstPluralizedModelId, ucFirstModelId, ucFirstModelId, ucFirstPluralizedModelId);
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createListModelsQuery: () => import("graphql").DocumentNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import gql from "graphql-tag";
|
|
6
|
+
export var createListModelsQuery = function createListModelsQuery() {
|
|
7
|
+
return gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query CmsListContentModels {\n listContentModels {\n data {\n modelId\n name\n fields {\n id\n type\n }\n }\n error {\n message\n code\n data\n }\n }\n }\n "])));
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createRepublishMutation: (model: any) => import("graphql").DocumentNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import upperFirst from "lodash/upperFirst";
|
|
6
|
+
import gql from "graphql-tag";
|
|
7
|
+
export var createRepublishMutation = function createRepublishMutation(model) {
|
|
8
|
+
var ucFirstModelId = upperFirst(model.modelId);
|
|
9
|
+
return gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n mutation CmsRepublish", "($revision: ID!) {\n content: republish", "(revision: $revision) {\n data {\n id\n }\n error {\n message\n data\n code\n }\n }\n }"])), ucFirstModelId, ucFirstModelId);
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createUpgradeMutation: () => import("graphql").DocumentNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import gql from "graphql-tag";
|
|
6
|
+
export var createUpgradeMutation = function createUpgradeMutation() {
|
|
7
|
+
return gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n mutation UpgradeCMS($version: String!) {\n cms {\n upgrade(version: $version) {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n "])));
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CmsEditorContentModel } from "../../../../types";
|
|
2
|
+
import { ApolloClient } from "apollo-client";
|
|
3
|
+
export interface Params {
|
|
4
|
+
model: CmsEditorContentModel;
|
|
5
|
+
client: ApolloClient<any>;
|
|
6
|
+
}
|
|
7
|
+
export declare const fetchModelEntries: (params: Params) => Promise<string[]>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { createListEntriesQuery } from "./createListEntriesQuery";
|
|
5
|
+
|
|
6
|
+
var fetchEntries = /*#__PURE__*/function () {
|
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
8
|
+
var client, query, variables, response, _response$data$conten, items, error, meta;
|
|
9
|
+
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) {
|
|
12
|
+
switch (_context.prev = _context.next) {
|
|
13
|
+
case 0:
|
|
14
|
+
client = params.client, query = params.query, variables = params.variables;
|
|
15
|
+
_context.next = 3;
|
|
16
|
+
return client.query({
|
|
17
|
+
query: query,
|
|
18
|
+
variables: variables
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
case 3:
|
|
22
|
+
response = _context.sent;
|
|
23
|
+
_response$data$conten = response.data.content, items = _response$data$conten.data, error = _response$data$conten.error, meta = _response$data$conten.meta;
|
|
24
|
+
|
|
25
|
+
if (!error) {
|
|
26
|
+
_context.next = 8;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.error(error.message);
|
|
31
|
+
return _context.abrupt("return", null);
|
|
32
|
+
|
|
33
|
+
case 8:
|
|
34
|
+
return _context.abrupt("return", {
|
|
35
|
+
items: items || [],
|
|
36
|
+
hasMoreItems: meta.hasMoreItems,
|
|
37
|
+
cursor: meta.cursor,
|
|
38
|
+
totalCount: meta.totalCount
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
case 9:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
return function fetchEntries(_x) {
|
|
50
|
+
return _ref.apply(this, arguments);
|
|
51
|
+
};
|
|
52
|
+
}();
|
|
53
|
+
|
|
54
|
+
export var fetchModelEntries = /*#__PURE__*/function () {
|
|
55
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
|
|
56
|
+
var model, client, items, query, variables, result;
|
|
57
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
58
|
+
while (1) {
|
|
59
|
+
switch (_context2.prev = _context2.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
model = params.model, client = params.client;
|
|
62
|
+
items = [];
|
|
63
|
+
query = createListEntriesQuery(model);
|
|
64
|
+
variables = {
|
|
65
|
+
limit: 100,
|
|
66
|
+
after: null,
|
|
67
|
+
where: {}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
case 4:
|
|
71
|
+
_context2.next = 6;
|
|
72
|
+
return fetchEntries({
|
|
73
|
+
client: client,
|
|
74
|
+
query: query,
|
|
75
|
+
variables: variables
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
case 6:
|
|
79
|
+
if (!(result = _context2.sent)) {
|
|
80
|
+
_context2.next = 15;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (result) {
|
|
85
|
+
_context2.next = 9;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return _context2.abrupt("return", items);
|
|
90
|
+
|
|
91
|
+
case 9:
|
|
92
|
+
items.push.apply(items, _toConsumableArray(result.items.map(function (item) {
|
|
93
|
+
return item.id;
|
|
94
|
+
})));
|
|
95
|
+
|
|
96
|
+
if (!(result.hasMoreItems === false)) {
|
|
97
|
+
_context2.next = 12;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return _context2.abrupt("return", items);
|
|
102
|
+
|
|
103
|
+
case 12:
|
|
104
|
+
variables.after = result.cursor;
|
|
105
|
+
_context2.next = 4;
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case 15:
|
|
109
|
+
return _context2.abrupt("return", items);
|
|
110
|
+
|
|
111
|
+
case 16:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context2.stop();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, _callee2);
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
return function fetchModelEntries(_x2) {
|
|
120
|
+
return _ref2.apply(this, arguments);
|
|
121
|
+
};
|
|
122
|
+
}();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ApolloClient } from "apollo-client";
|
|
2
|
+
import { CmsEditorContentModel } from "../../../../types";
|
|
3
|
+
export interface Clients {
|
|
4
|
+
read: ApolloClient<any>;
|
|
5
|
+
manage: ApolloClient<any>;
|
|
6
|
+
}
|
|
7
|
+
export interface CurrentlyUpgrading {
|
|
8
|
+
locale: string;
|
|
9
|
+
model: CmsEditorContentModel;
|
|
10
|
+
running: boolean;
|
|
11
|
+
fetchingEntries: boolean;
|
|
12
|
+
after: string;
|
|
13
|
+
entry: string | null;
|
|
14
|
+
totalCount: number | null;
|
|
15
|
+
currentEntry: number | null;
|
|
16
|
+
error?: {
|
|
17
|
+
message: string;
|
|
18
|
+
code: string;
|
|
19
|
+
data: any;
|
|
20
|
+
};
|
|
21
|
+
entries: {
|
|
22
|
+
id: string;
|
|
23
|
+
done: boolean;
|
|
24
|
+
}[];
|
|
25
|
+
}
|
|
26
|
+
export interface UpgradeEntryItem {
|
|
27
|
+
id: string;
|
|
28
|
+
done: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface UpgradeModelItem {
|
|
31
|
+
model: CmsEditorContentModel;
|
|
32
|
+
entries: UpgradeEntryItem[];
|
|
33
|
+
done: boolean;
|
|
34
|
+
upgrading: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface UpgradeModelItems {
|
|
37
|
+
[modelId: string]: UpgradeModelItem;
|
|
38
|
+
}
|
|
39
|
+
export interface UpgradeItems {
|
|
40
|
+
loadedModels: boolean;
|
|
41
|
+
locales: Record<string, UpgradeModelItems>;
|
|
42
|
+
}
|
|
43
|
+
export interface ErrorValue {
|
|
44
|
+
code?: string;
|
|
45
|
+
data?: any;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|