payload 1.5.2 → 1.5.4
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.
|
@@ -16,7 +16,7 @@ const CodeEditor = (props) => {
|
|
|
16
16
|
className,
|
|
17
17
|
(rest === null || rest === void 0 ? void 0 : rest.defaultLanguage) ? `language--${rest.defaultLanguage}` : '',
|
|
18
18
|
].filter(Boolean).join(' ');
|
|
19
|
-
return (react_1.default.createElement(react_2.default, { height: "35vh", className: classes, options: {
|
|
19
|
+
return (react_1.default.createElement(react_2.default, { height: "35vh", className: classes, theme: theme === 'dark' ? 'vs-dark' : 'vs', options: {
|
|
20
20
|
detectIndentation: true,
|
|
21
21
|
minimap: {
|
|
22
22
|
enabled: false,
|
|
@@ -24,7 +24,6 @@ const CodeEditor = (props) => {
|
|
|
24
24
|
readOnly: Boolean(readOnly),
|
|
25
25
|
scrollBeyondLastLine: false,
|
|
26
26
|
tabSize: 2,
|
|
27
|
-
theme: theme === 'dark' ? 'vs-dark' : 'vs',
|
|
28
27
|
wordWrap: 'on',
|
|
29
28
|
...options,
|
|
30
29
|
}, ...rest }));
|
package/dist/config/types.d.ts
CHANGED
|
@@ -82,17 +82,18 @@ export type GlobalConfig = {
|
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
export interface SanitizedGlobalConfig extends Omit<DeepRequired<GlobalConfig>, 'fields' | 'versions'
|
|
85
|
+
export interface SanitizedGlobalConfig extends Omit<DeepRequired<GlobalConfig>, 'fields' | 'versions'> {
|
|
86
86
|
fields: Field[];
|
|
87
87
|
versions: SanitizedGlobalVersions;
|
|
88
|
-
graphQL?: {
|
|
89
|
-
name?: string;
|
|
90
|
-
type: GraphQLObjectType;
|
|
91
|
-
mutationInputType: GraphQLNonNull<any>;
|
|
92
|
-
versionType?: GraphQLObjectType;
|
|
93
|
-
};
|
|
94
88
|
}
|
|
95
89
|
export type Globals = {
|
|
96
90
|
Model: GlobalModel;
|
|
97
91
|
config: SanitizedGlobalConfig[];
|
|
92
|
+
graphQL?: {
|
|
93
|
+
[slug: string]: {
|
|
94
|
+
type: GraphQLObjectType;
|
|
95
|
+
mutationInputType: GraphQLNonNull<any>;
|
|
96
|
+
versionType?: GraphQLObjectType;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
98
99
|
};
|
|
@@ -27,18 +27,21 @@ function initGlobalsGraphQL(payload) {
|
|
|
27
27
|
const global = payload.globals.config[slug];
|
|
28
28
|
const { fields, versions, } = global;
|
|
29
29
|
const formattedName = ((_a = global.graphQL) === null || _a === void 0 ? void 0 : _a.name) ? global.graphQL.name : (0, pluralize_1.singular)((0, formatLabels_1.toWords)(global.slug, true));
|
|
30
|
-
global.graphQL = {};
|
|
31
30
|
const forceNullableObjectType = Boolean(versions === null || versions === void 0 ? void 0 : versions.drafts);
|
|
32
|
-
|
|
33
|
-
payload
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
if (!payload.globals.graphQL)
|
|
32
|
+
payload.globals.graphQL = {};
|
|
33
|
+
payload.globals.graphQL[slug] = {
|
|
34
|
+
type: (0, buildObjectType_1.default)({
|
|
35
|
+
payload,
|
|
36
|
+
name: formattedName,
|
|
37
|
+
parentName: formattedName,
|
|
38
|
+
fields,
|
|
39
|
+
forceNullable: forceNullableObjectType,
|
|
40
|
+
}),
|
|
41
|
+
mutationInputType: new graphql_1.GraphQLNonNull((0, buildMutationInputType_1.default)(payload, formattedName, fields, formattedName)),
|
|
42
|
+
};
|
|
40
43
|
payload.Query.fields[formattedName] = {
|
|
41
|
-
type:
|
|
44
|
+
type: payload.globals.graphQL[slug].type,
|
|
42
45
|
args: {
|
|
43
46
|
draft: { type: graphql_1.GraphQLBoolean },
|
|
44
47
|
...(payload.config.localization ? {
|
|
@@ -49,9 +52,9 @@ function initGlobalsGraphQL(payload) {
|
|
|
49
52
|
resolve: (0, findOne_1.default)(global),
|
|
50
53
|
};
|
|
51
54
|
payload.Mutation.fields[`update${formattedName}`] = {
|
|
52
|
-
type:
|
|
55
|
+
type: payload.globals.graphQL[slug].type,
|
|
53
56
|
args: {
|
|
54
|
-
data: { type:
|
|
57
|
+
data: { type: payload.globals.graphQL[slug].mutationInputType },
|
|
55
58
|
draft: { type: graphql_1.GraphQLBoolean },
|
|
56
59
|
...(payload.config.localization ? {
|
|
57
60
|
locale: { type: payload.types.localeInputType },
|
|
@@ -86,7 +89,7 @@ function initGlobalsGraphQL(payload) {
|
|
|
86
89
|
type: 'date',
|
|
87
90
|
},
|
|
88
91
|
];
|
|
89
|
-
|
|
92
|
+
payload.globals.graphQL[slug].versionType = (0, buildObjectType_1.default)({
|
|
90
93
|
payload,
|
|
91
94
|
name: `${formattedName}Version`,
|
|
92
95
|
parentName: `${formattedName}Version`,
|
|
@@ -94,7 +97,7 @@ function initGlobalsGraphQL(payload) {
|
|
|
94
97
|
forceNullable: forceNullableObjectType,
|
|
95
98
|
});
|
|
96
99
|
payload.Query.fields[`version${(0, formatName_1.default)(formattedName)}`] = {
|
|
97
|
-
type:
|
|
100
|
+
type: payload.globals.graphQL[slug].versionType,
|
|
98
101
|
args: {
|
|
99
102
|
id: { type: graphql_1.GraphQLString },
|
|
100
103
|
...(payload.config.localization ? {
|
|
@@ -105,7 +108,7 @@ function initGlobalsGraphQL(payload) {
|
|
|
105
108
|
resolve: (0, findVersionByID_1.default)(global),
|
|
106
109
|
};
|
|
107
110
|
payload.Query.fields[`versions${formattedName}`] = {
|
|
108
|
-
type: (0, buildPaginatedListType_1.default)(`versions${(0, formatName_1.default)(formattedName)}`,
|
|
111
|
+
type: (0, buildPaginatedListType_1.default)(`versions${(0, formatName_1.default)(formattedName)}`, payload.globals.graphQL[slug].versionType),
|
|
109
112
|
args: {
|
|
110
113
|
where: {
|
|
111
114
|
type: (0, buildWhereInputType_1.default)(`versions${formattedName}`, versionGlobalFields, `versions${formattedName}`),
|
|
@@ -121,7 +124,7 @@ function initGlobalsGraphQL(payload) {
|
|
|
121
124
|
resolve: (0, findVersions_1.default)(global),
|
|
122
125
|
};
|
|
123
126
|
payload.Mutation.fields[`restoreVersion${(0, formatName_1.default)(formattedName)}`] = {
|
|
124
|
-
type:
|
|
127
|
+
type: payload.globals.graphQL[slug].type,
|
|
125
128
|
args: {
|
|
126
129
|
id: { type: graphql_1.GraphQLString },
|
|
127
130
|
},
|
package/dist/init.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.initSync = exports.initAsync = exports.init = void 0;
|
|
|
7
7
|
/* eslint-disable no-param-reassign */
|
|
8
8
|
const express_1 = __importDefault(require("express"));
|
|
9
9
|
const crypto_1 = __importDefault(require("crypto"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
10
11
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
11
12
|
const authenticate_1 = __importDefault(require("./express/middleware/authenticate"));
|
|
12
13
|
const connect_1 = __importDefault(require("./mongoose/connect"));
|
|
@@ -31,6 +32,7 @@ const logger_1 = __importDefault(require("./utilities/logger"));
|
|
|
31
32
|
const dataloader_1 = require("./collections/dataloader");
|
|
32
33
|
const mountEndpoints_1 = __importDefault(require("./express/mountEndpoints"));
|
|
33
34
|
const model_1 = __importDefault(require("./preferences/model"));
|
|
35
|
+
const find_1 = __importDefault(require("./config/find"));
|
|
34
36
|
const init = (payload, options) => {
|
|
35
37
|
payload.logger.info('Starting Payload...');
|
|
36
38
|
if (!options.secret) {
|
|
@@ -46,7 +48,21 @@ const init = (payload, options) => {
|
|
|
46
48
|
.digest('hex')
|
|
47
49
|
.slice(0, 32);
|
|
48
50
|
payload.local = options.local;
|
|
49
|
-
|
|
51
|
+
if (options.config) {
|
|
52
|
+
payload.config = options.config;
|
|
53
|
+
const configPath = (0, find_1.default)();
|
|
54
|
+
payload.config = {
|
|
55
|
+
...options.config,
|
|
56
|
+
paths: {
|
|
57
|
+
configDir: path_1.default.dirname(configPath),
|
|
58
|
+
config: configPath,
|
|
59
|
+
rawConfig: configPath,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
payload.config = (0, load_1.default)(payload.logger);
|
|
65
|
+
}
|
|
50
66
|
// If not initializing locally, scaffold router
|
|
51
67
|
if (!payload.local) {
|
|
52
68
|
payload.router = express_1.default.Router();
|