@payloadcms/graphql 3.12.1-canary.b1b1cbf → 3.13.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.
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +2 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/schema/initCollections.d.ts.map +1 -1
- package/dist/schema/initCollections.js +319 -305
- package/dist/schema/initCollections.js.map +1 -1
- package/dist/schema/initGlobals.d.ts.map +1 -1
- package/dist/schema/initGlobals.js +110 -100
- package/dist/schema/initGlobals.js.map +1 -1
- package/package.json +3 -3
package/dist/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,GAAG,qBAcf,CAAA"}
|
package/dist/bin/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */ import minimist from 'minimist';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
2
3
|
import { findConfig, loadEnv } from 'payload/node';
|
|
3
4
|
import { generateSchema } from './generateSchema.js';
|
|
4
5
|
export const bin = async ()=>{
|
|
5
6
|
loadEnv();
|
|
6
7
|
const configPath = findConfig();
|
|
7
|
-
const config = await (await import(configPath)).default;
|
|
8
|
+
const config = await (await import(pathToFileURL(configPath).toString())).default;
|
|
8
9
|
const args = minimist(process.argv.slice(2));
|
|
9
10
|
const script = (typeof args._[0] === 'string' ? args._[0] : '').toLowerCase();
|
|
10
11
|
if (script === 'generate:schema') {
|
package/dist/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport minimist from 'minimist'\nimport { findConfig, loadEnv } from 'payload/node'\n\nimport { generateSchema } from './generateSchema.js'\n\nexport const bin = async () => {\n loadEnv()\n const configPath = findConfig()\n const config = await (await import(configPath)).default\n\n const args = minimist(process.argv.slice(2))\n const script = (typeof args._[0] === 'string' ? args._[0] : '').toLowerCase()\n\n if (script === 'generate:schema') {\n return generateSchema(config)\n }\n\n console.log(`Unknown script: \"${script}\".`)\n process.exit(1)\n}\n"],"names":["minimist","findConfig","loadEnv","generateSchema","bin","configPath","config","default","args","process","argv","slice","script","_","toLowerCase","console","log","exit"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,cAAc,WAAU;AAC/B,SAASC,UAAU,EAAEC,OAAO,QAAQ,eAAc;AAElD,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,MAAMC,MAAM;IACjBF;IACA,MAAMG,aAAaJ;IACnB,MAAMK,SAAS,MAAM,AAAC,CAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport minimist from 'minimist'\nimport { pathToFileURL } from 'node:url'\nimport { findConfig, loadEnv } from 'payload/node'\n\nimport { generateSchema } from './generateSchema.js'\n\nexport const bin = async () => {\n loadEnv()\n const configPath = findConfig()\n const config = await (await import(pathToFileURL(configPath).toString())).default\n\n const args = minimist(process.argv.slice(2))\n const script = (typeof args._[0] === 'string' ? args._[0] : '').toLowerCase()\n\n if (script === 'generate:schema') {\n return generateSchema(config)\n }\n\n console.log(`Unknown script: \"${script}\".`)\n process.exit(1)\n}\n"],"names":["minimist","pathToFileURL","findConfig","loadEnv","generateSchema","bin","configPath","config","toString","default","args","process","argv","slice","script","_","toLowerCase","console","log","exit"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,cAAc,WAAU;AAC/B,SAASC,aAAa,QAAQ,WAAU;AACxC,SAASC,UAAU,EAAEC,OAAO,QAAQ,eAAc;AAElD,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,MAAMC,MAAM;IACjBF;IACA,MAAMG,aAAaJ;IACnB,MAAMK,SAAS,MAAM,AAAC,CAAA,MAAM,MAAM,CAACN,cAAcK,YAAYE,QAAQ,GAAE,EAAGC,OAAO;IAEjF,MAAMC,OAAOV,SAASW,QAAQC,IAAI,CAACC,KAAK,CAAC;IACzC,MAAMC,SAAS,AAAC,CAAA,OAAOJ,KAAKK,CAAC,CAAC,EAAE,KAAK,WAAWL,KAAKK,CAAC,CAAC,EAAE,GAAG,EAAC,EAAGC,WAAW;IAE3E,IAAIF,WAAW,mBAAmB;QAChC,OAAOV,eAAeG;IACxB;IAEAU,QAAQC,GAAG,CAAC,CAAC,iBAAiB,EAAEJ,OAAO,EAAE,CAAC;IAC1CH,QAAQQ,IAAI,CAAC;AACf,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initCollections.d.ts","sourceRoot":"","sources":["../../src/schema/initCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,WAAW,EAEX,eAAe,EAChB,MAAM,SAAS,CAAA;AAyChB,KAAK,0BAA0B,GAAG;IAChC,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,WAAW,CAAA;CAC3B,CAAA;AACD,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,0BAA0B,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"initCollections.d.ts","sourceRoot":"","sources":["../../src/schema/initCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,WAAW,EAEX,eAAe,EAChB,MAAM,SAAS,CAAA;AAyChB,KAAK,0BAA0B,GAAG;IAChC,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,WAAW,CAAA;CAC3B,CAAA;AACD,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,0BAA0B,GAAG,IAAI,CAsf3F"}
|
|
@@ -118,164 +118,170 @@ export function initCollections({ config, graphqlResult }) {
|
|
|
118
118
|
if (updateMutationInputType) {
|
|
119
119
|
collection.graphQL.updateMutationInputType = new GraphQLNonNull(updateMutationInputType);
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
...config.localization ? {
|
|
131
|
-
fallbackLocale: {
|
|
132
|
-
type: graphqlResult.types.fallbackLocaleInputType
|
|
121
|
+
const queriesEnabled = typeof collectionConfig.graphQL !== 'object' || !collectionConfig.graphQL.disableQueries;
|
|
122
|
+
const mutationsEnabled = typeof collectionConfig.graphQL !== 'object' || !collectionConfig.graphQL.disableMutations;
|
|
123
|
+
if (queriesEnabled) {
|
|
124
|
+
graphqlResult.Query.fields[singularName] = {
|
|
125
|
+
type: collection.graphQL.type,
|
|
126
|
+
args: {
|
|
127
|
+
id: {
|
|
128
|
+
type: new GraphQLNonNull(idType)
|
|
133
129
|
},
|
|
134
|
-
|
|
135
|
-
type:
|
|
136
|
-
}
|
|
137
|
-
} : {}
|
|
138
|
-
},
|
|
139
|
-
resolve: findByIDResolver(collection)
|
|
140
|
-
};
|
|
141
|
-
graphqlResult.Query.fields[pluralName] = {
|
|
142
|
-
type: buildPaginatedListType(pluralName, collection.graphQL.type),
|
|
143
|
-
args: {
|
|
144
|
-
draft: {
|
|
145
|
-
type: GraphQLBoolean
|
|
146
|
-
},
|
|
147
|
-
where: {
|
|
148
|
-
type: collection.graphQL.whereInputType
|
|
149
|
-
},
|
|
150
|
-
...config.localization ? {
|
|
151
|
-
fallbackLocale: {
|
|
152
|
-
type: graphqlResult.types.fallbackLocaleInputType
|
|
130
|
+
draft: {
|
|
131
|
+
type: GraphQLBoolean
|
|
153
132
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
type: GraphQLInt
|
|
163
|
-
},
|
|
164
|
-
pagination: {
|
|
165
|
-
type: GraphQLBoolean
|
|
133
|
+
...config.localization ? {
|
|
134
|
+
fallbackLocale: {
|
|
135
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
136
|
+
},
|
|
137
|
+
locale: {
|
|
138
|
+
type: graphqlResult.types.localeInputType
|
|
139
|
+
}
|
|
140
|
+
} : {}
|
|
166
141
|
},
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
142
|
+
resolve: findByIDResolver(collection)
|
|
143
|
+
};
|
|
144
|
+
graphqlResult.Query.fields[pluralName] = {
|
|
145
|
+
type: buildPaginatedListType(pluralName, collection.graphQL.type),
|
|
146
|
+
args: {
|
|
147
|
+
draft: {
|
|
148
|
+
type: GraphQLBoolean
|
|
149
|
+
},
|
|
150
|
+
where: {
|
|
151
|
+
type: collection.graphQL.whereInputType
|
|
152
|
+
},
|
|
153
|
+
...config.localization ? {
|
|
154
|
+
fallbackLocale: {
|
|
155
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
156
|
+
},
|
|
157
|
+
locale: {
|
|
158
|
+
type: graphqlResult.types.localeInputType
|
|
159
|
+
}
|
|
160
|
+
} : {},
|
|
161
|
+
limit: {
|
|
178
162
|
type: GraphQLInt
|
|
163
|
+
},
|
|
164
|
+
page: {
|
|
165
|
+
type: GraphQLInt
|
|
166
|
+
},
|
|
167
|
+
pagination: {
|
|
168
|
+
type: GraphQLBoolean
|
|
169
|
+
},
|
|
170
|
+
sort: {
|
|
171
|
+
type: GraphQLString
|
|
179
172
|
}
|
|
180
|
-
}
|
|
181
|
-
}),
|
|
182
|
-
args: {
|
|
183
|
-
draft: {
|
|
184
|
-
type: GraphQLBoolean
|
|
185
173
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
resolve: countResolver(collection)
|
|
196
|
-
};
|
|
197
|
-
graphqlResult.Query.fields[`docAccess${singularName}`] = {
|
|
198
|
-
type: buildPolicyType({
|
|
199
|
-
type: 'collection',
|
|
200
|
-
entity: collectionConfig,
|
|
201
|
-
scope: 'docAccess',
|
|
202
|
-
typeSuffix: 'DocAccess'
|
|
203
|
-
}),
|
|
204
|
-
args: {
|
|
205
|
-
id: {
|
|
206
|
-
type: new GraphQLNonNull(idType)
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
resolve: docAccessResolver(collection)
|
|
210
|
-
};
|
|
211
|
-
graphqlResult.Mutation.fields[`create${singularName}`] = {
|
|
212
|
-
type: collection.graphQL.type,
|
|
213
|
-
args: {
|
|
214
|
-
...createMutationInputType ? {
|
|
215
|
-
data: {
|
|
216
|
-
type: collection.graphQL.mutationInputType
|
|
174
|
+
resolve: findResolver(collection)
|
|
175
|
+
};
|
|
176
|
+
graphqlResult.Query.fields[`count${pluralName}`] = {
|
|
177
|
+
type: new GraphQLObjectType({
|
|
178
|
+
name: `count${pluralName}`,
|
|
179
|
+
fields: {
|
|
180
|
+
totalDocs: {
|
|
181
|
+
type: GraphQLInt
|
|
182
|
+
}
|
|
217
183
|
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
184
|
+
}),
|
|
185
|
+
args: {
|
|
186
|
+
draft: {
|
|
187
|
+
type: GraphQLBoolean
|
|
188
|
+
},
|
|
189
|
+
where: {
|
|
190
|
+
type: collection.graphQL.whereInputType
|
|
191
|
+
},
|
|
192
|
+
...config.localization ? {
|
|
193
|
+
locale: {
|
|
194
|
+
type: graphqlResult.types.localeInputType
|
|
195
|
+
}
|
|
196
|
+
} : {}
|
|
221
197
|
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
198
|
+
resolve: countResolver(collection)
|
|
199
|
+
};
|
|
200
|
+
graphqlResult.Query.fields[`docAccess${singularName}`] = {
|
|
201
|
+
type: buildPolicyType({
|
|
202
|
+
type: 'collection',
|
|
203
|
+
entity: collectionConfig,
|
|
204
|
+
scope: 'docAccess',
|
|
205
|
+
typeSuffix: 'DocAccess'
|
|
206
|
+
}),
|
|
207
|
+
args: {
|
|
208
|
+
id: {
|
|
209
|
+
type: new GraphQLNonNull(idType)
|
|
225
210
|
}
|
|
226
|
-
} : {}
|
|
227
|
-
},
|
|
228
|
-
resolve: createResolver(collection)
|
|
229
|
-
};
|
|
230
|
-
graphqlResult.Mutation.fields[`update${singularName}`] = {
|
|
231
|
-
type: collection.graphQL.type,
|
|
232
|
-
args: {
|
|
233
|
-
id: {
|
|
234
|
-
type: new GraphQLNonNull(idType)
|
|
235
|
-
},
|
|
236
|
-
autosave: {
|
|
237
|
-
type: GraphQLBoolean
|
|
238
211
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
212
|
+
resolve: docAccessResolver(collection)
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (mutationsEnabled) {
|
|
216
|
+
graphqlResult.Mutation.fields[`create${singularName}`] = {
|
|
217
|
+
type: collection.graphQL.type,
|
|
218
|
+
args: {
|
|
219
|
+
...createMutationInputType ? {
|
|
220
|
+
data: {
|
|
221
|
+
type: collection.graphQL.mutationInputType
|
|
222
|
+
}
|
|
223
|
+
} : {},
|
|
224
|
+
draft: {
|
|
225
|
+
type: GraphQLBoolean
|
|
226
|
+
},
|
|
227
|
+
...config.localization ? {
|
|
228
|
+
locale: {
|
|
229
|
+
type: graphqlResult.types.localeInputType
|
|
230
|
+
}
|
|
231
|
+
} : {}
|
|
246
232
|
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
} : {}
|
|
252
|
-
},
|
|
253
|
-
resolve: updateResolver(collection)
|
|
254
|
-
};
|
|
255
|
-
graphqlResult.Mutation.fields[`delete${singularName}`] = {
|
|
256
|
-
type: collection.graphQL.type,
|
|
257
|
-
args: {
|
|
258
|
-
id: {
|
|
259
|
-
type: new GraphQLNonNull(idType)
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
resolve: getDeleteResolver(collection)
|
|
263
|
-
};
|
|
264
|
-
if (collectionConfig.disableDuplicate !== true) {
|
|
265
|
-
graphqlResult.Mutation.fields[`duplicate${singularName}`] = {
|
|
233
|
+
resolve: createResolver(collection)
|
|
234
|
+
};
|
|
235
|
+
graphqlResult.Mutation.fields[`update${singularName}`] = {
|
|
266
236
|
type: collection.graphQL.type,
|
|
267
237
|
args: {
|
|
268
238
|
id: {
|
|
269
239
|
type: new GraphQLNonNull(idType)
|
|
270
240
|
},
|
|
271
|
-
|
|
241
|
+
autosave: {
|
|
242
|
+
type: GraphQLBoolean
|
|
243
|
+
},
|
|
244
|
+
...updateMutationInputType ? {
|
|
272
245
|
data: {
|
|
273
|
-
type: collection.graphQL.
|
|
246
|
+
type: collection.graphQL.updateMutationInputType
|
|
247
|
+
}
|
|
248
|
+
} : {},
|
|
249
|
+
draft: {
|
|
250
|
+
type: GraphQLBoolean
|
|
251
|
+
},
|
|
252
|
+
...config.localization ? {
|
|
253
|
+
locale: {
|
|
254
|
+
type: graphqlResult.types.localeInputType
|
|
274
255
|
}
|
|
275
256
|
} : {}
|
|
276
257
|
},
|
|
277
|
-
resolve:
|
|
258
|
+
resolve: updateResolver(collection)
|
|
259
|
+
};
|
|
260
|
+
graphqlResult.Mutation.fields[`delete${singularName}`] = {
|
|
261
|
+
type: collection.graphQL.type,
|
|
262
|
+
args: {
|
|
263
|
+
id: {
|
|
264
|
+
type: new GraphQLNonNull(idType)
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
resolve: getDeleteResolver(collection)
|
|
278
268
|
};
|
|
269
|
+
if (collectionConfig.disableDuplicate !== true) {
|
|
270
|
+
graphqlResult.Mutation.fields[`duplicate${singularName}`] = {
|
|
271
|
+
type: collection.graphQL.type,
|
|
272
|
+
args: {
|
|
273
|
+
id: {
|
|
274
|
+
type: new GraphQLNonNull(idType)
|
|
275
|
+
},
|
|
276
|
+
...createMutationInputType ? {
|
|
277
|
+
data: {
|
|
278
|
+
type: collection.graphQL.mutationInputType
|
|
279
|
+
}
|
|
280
|
+
} : {}
|
|
281
|
+
},
|
|
282
|
+
resolve: duplicateResolver(collection)
|
|
283
|
+
};
|
|
284
|
+
}
|
|
279
285
|
}
|
|
280
286
|
if (collectionConfig.versions) {
|
|
281
287
|
const versionIDType = config.db.defaultIDType === 'text' ? GraphQLString : GraphQLInt;
|
|
@@ -304,68 +310,72 @@ export function initCollections({ config, graphqlResult }) {
|
|
|
304
310
|
graphqlResult,
|
|
305
311
|
parentName: `${singularName}Version`
|
|
306
312
|
});
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
if (queriesEnabled) {
|
|
314
|
+
graphqlResult.Query.fields[`version${formatName(singularName)}`] = {
|
|
315
|
+
type: collection.graphQL.versionType,
|
|
316
|
+
args: {
|
|
317
|
+
id: {
|
|
318
|
+
type: versionIDType
|
|
319
|
+
},
|
|
320
|
+
...config.localization ? {
|
|
321
|
+
fallbackLocale: {
|
|
322
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
323
|
+
},
|
|
324
|
+
locale: {
|
|
325
|
+
type: graphqlResult.types.localeInputType
|
|
326
|
+
}
|
|
327
|
+
} : {}
|
|
312
328
|
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
329
|
+
resolve: findVersionByIDResolver(collection)
|
|
330
|
+
};
|
|
331
|
+
graphqlResult.Query.fields[`versions${pluralName}`] = {
|
|
332
|
+
type: buildPaginatedListType(`versions${formatName(pluralName)}`, collection.graphQL.versionType),
|
|
333
|
+
args: {
|
|
334
|
+
where: {
|
|
335
|
+
type: buildWhereInputType({
|
|
336
|
+
name: `versions${singularName}`,
|
|
337
|
+
fields: versionCollectionFields,
|
|
338
|
+
parentName: `versions${singularName}`
|
|
339
|
+
})
|
|
316
340
|
},
|
|
317
|
-
|
|
318
|
-
|
|
341
|
+
...config.localization ? {
|
|
342
|
+
fallbackLocale: {
|
|
343
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
344
|
+
},
|
|
345
|
+
locale: {
|
|
346
|
+
type: graphqlResult.types.localeInputType
|
|
347
|
+
}
|
|
348
|
+
} : {},
|
|
349
|
+
limit: {
|
|
350
|
+
type: GraphQLInt
|
|
351
|
+
},
|
|
352
|
+
page: {
|
|
353
|
+
type: GraphQLInt
|
|
354
|
+
},
|
|
355
|
+
pagination: {
|
|
356
|
+
type: GraphQLBoolean
|
|
357
|
+
},
|
|
358
|
+
sort: {
|
|
359
|
+
type: GraphQLString
|
|
319
360
|
}
|
|
320
|
-
} : {}
|
|
321
|
-
},
|
|
322
|
-
resolve: findVersionByIDResolver(collection)
|
|
323
|
-
};
|
|
324
|
-
graphqlResult.Query.fields[`versions${pluralName}`] = {
|
|
325
|
-
type: buildPaginatedListType(`versions${formatName(pluralName)}`, collection.graphQL.versionType),
|
|
326
|
-
args: {
|
|
327
|
-
where: {
|
|
328
|
-
type: buildWhereInputType({
|
|
329
|
-
name: `versions${singularName}`,
|
|
330
|
-
fields: versionCollectionFields,
|
|
331
|
-
parentName: `versions${singularName}`
|
|
332
|
-
})
|
|
333
361
|
},
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
362
|
+
resolve: findVersionsResolver(collection)
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
if (mutationsEnabled) {
|
|
366
|
+
graphqlResult.Mutation.fields[`restoreVersion${formatName(singularName)}`] = {
|
|
367
|
+
type: collection.graphQL.type,
|
|
368
|
+
args: {
|
|
369
|
+
id: {
|
|
370
|
+
type: versionIDType
|
|
337
371
|
},
|
|
338
|
-
|
|
339
|
-
type:
|
|
372
|
+
draft: {
|
|
373
|
+
type: GraphQLBoolean
|
|
340
374
|
}
|
|
341
|
-
} : {},
|
|
342
|
-
limit: {
|
|
343
|
-
type: GraphQLInt
|
|
344
|
-
},
|
|
345
|
-
page: {
|
|
346
|
-
type: GraphQLInt
|
|
347
|
-
},
|
|
348
|
-
pagination: {
|
|
349
|
-
type: GraphQLBoolean
|
|
350
|
-
},
|
|
351
|
-
sort: {
|
|
352
|
-
type: GraphQLString
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
resolve: findVersionsResolver(collection)
|
|
356
|
-
};
|
|
357
|
-
graphqlResult.Mutation.fields[`restoreVersion${formatName(singularName)}`] = {
|
|
358
|
-
type: collection.graphQL.type,
|
|
359
|
-
args: {
|
|
360
|
-
id: {
|
|
361
|
-
type: versionIDType
|
|
362
375
|
},
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
},
|
|
367
|
-
resolve: restoreVersionResolver(collection)
|
|
368
|
-
};
|
|
376
|
+
resolve: restoreVersionResolver(collection)
|
|
377
|
+
};
|
|
378
|
+
}
|
|
369
379
|
}
|
|
370
380
|
if (collectionConfig.auth) {
|
|
371
381
|
const authFields = collectionConfig.auth.disableLocalStrategy || collectionConfig.auth.loginWithUsername && !collectionConfig.auth.loginWithUsername.allowEmailLogin && !collectionConfig.auth.loginWithUsername.requireEmail ? [] : [
|
|
@@ -390,84 +400,20 @@ export function initCollections({ config, graphqlResult }) {
|
|
|
390
400
|
graphqlResult,
|
|
391
401
|
parentName: formatName(`${slug}JWT`)
|
|
392
402
|
});
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
name: formatName(`${slug}Me`),
|
|
396
|
-
fields: {
|
|
397
|
-
collection: {
|
|
398
|
-
type: GraphQLString
|
|
399
|
-
},
|
|
400
|
-
exp: {
|
|
401
|
-
type: GraphQLInt
|
|
402
|
-
},
|
|
403
|
-
strategy: {
|
|
404
|
-
type: GraphQLString
|
|
405
|
-
},
|
|
406
|
-
token: {
|
|
407
|
-
type: GraphQLString
|
|
408
|
-
},
|
|
409
|
-
user: {
|
|
410
|
-
type: collection.graphQL.type
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}),
|
|
414
|
-
resolve: me(collection)
|
|
415
|
-
};
|
|
416
|
-
graphqlResult.Query.fields[`initialized${singularName}`] = {
|
|
417
|
-
type: GraphQLBoolean,
|
|
418
|
-
resolve: init(collection.config.slug)
|
|
419
|
-
};
|
|
420
|
-
graphqlResult.Mutation.fields[`refreshToken${singularName}`] = {
|
|
421
|
-
type: new GraphQLObjectType({
|
|
422
|
-
name: formatName(`${slug}Refreshed${singularName}`),
|
|
423
|
-
fields: {
|
|
424
|
-
exp: {
|
|
425
|
-
type: GraphQLInt
|
|
426
|
-
},
|
|
427
|
-
refreshedToken: {
|
|
428
|
-
type: GraphQLString
|
|
429
|
-
},
|
|
430
|
-
strategy: {
|
|
431
|
-
type: GraphQLString
|
|
432
|
-
},
|
|
433
|
-
user: {
|
|
434
|
-
type: collection.graphQL.JWT
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}),
|
|
438
|
-
resolve: refresh(collection)
|
|
439
|
-
};
|
|
440
|
-
graphqlResult.Mutation.fields[`logout${singularName}`] = {
|
|
441
|
-
type: GraphQLString,
|
|
442
|
-
resolve: logout(collection)
|
|
443
|
-
};
|
|
444
|
-
if (!collectionConfig.auth.disableLocalStrategy) {
|
|
445
|
-
const authArgs = {};
|
|
446
|
-
const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(collectionConfig.auth.loginWithUsername);
|
|
447
|
-
if (canLoginWithEmail) {
|
|
448
|
-
authArgs['email'] = {
|
|
449
|
-
type: new GraphQLNonNull(GraphQLString)
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
if (canLoginWithUsername) {
|
|
453
|
-
authArgs['username'] = {
|
|
454
|
-
type: new GraphQLNonNull(GraphQLString)
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
if (collectionConfig.auth.maxLoginAttempts > 0) {
|
|
458
|
-
graphqlResult.Mutation.fields[`unlock${singularName}`] = {
|
|
459
|
-
type: new GraphQLNonNull(GraphQLBoolean),
|
|
460
|
-
args: authArgs,
|
|
461
|
-
resolve: unlock(collection)
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
graphqlResult.Mutation.fields[`login${singularName}`] = {
|
|
403
|
+
if (queriesEnabled) {
|
|
404
|
+
graphqlResult.Query.fields[`me${singularName}`] = {
|
|
465
405
|
type: new GraphQLObjectType({
|
|
466
|
-
name: formatName(`${slug}
|
|
406
|
+
name: formatName(`${slug}Me`),
|
|
467
407
|
fields: {
|
|
408
|
+
collection: {
|
|
409
|
+
type: GraphQLString
|
|
410
|
+
},
|
|
468
411
|
exp: {
|
|
469
412
|
type: GraphQLInt
|
|
470
413
|
},
|
|
414
|
+
strategy: {
|
|
415
|
+
type: GraphQLString
|
|
416
|
+
},
|
|
471
417
|
token: {
|
|
472
418
|
type: GraphQLString
|
|
473
419
|
},
|
|
@@ -476,58 +422,126 @@ export function initCollections({ config, graphqlResult }) {
|
|
|
476
422
|
}
|
|
477
423
|
}
|
|
478
424
|
}),
|
|
479
|
-
|
|
480
|
-
...authArgs,
|
|
481
|
-
password: {
|
|
482
|
-
type: GraphQLString
|
|
483
|
-
}
|
|
484
|
-
},
|
|
485
|
-
resolve: login(collection)
|
|
425
|
+
resolve: me(collection)
|
|
486
426
|
};
|
|
487
|
-
graphqlResult.
|
|
488
|
-
type:
|
|
489
|
-
|
|
490
|
-
disableEmail: {
|
|
491
|
-
type: GraphQLBoolean
|
|
492
|
-
},
|
|
493
|
-
expiration: {
|
|
494
|
-
type: GraphQLInt
|
|
495
|
-
},
|
|
496
|
-
...authArgs
|
|
497
|
-
},
|
|
498
|
-
resolve: forgotPassword(collection)
|
|
427
|
+
graphqlResult.Query.fields[`initialized${singularName}`] = {
|
|
428
|
+
type: GraphQLBoolean,
|
|
429
|
+
resolve: init(collection.config.slug)
|
|
499
430
|
};
|
|
500
|
-
|
|
431
|
+
}
|
|
432
|
+
if (mutationsEnabled) {
|
|
433
|
+
graphqlResult.Mutation.fields[`refreshToken${singularName}`] = {
|
|
501
434
|
type: new GraphQLObjectType({
|
|
502
|
-
name: formatName(`${slug}
|
|
435
|
+
name: formatName(`${slug}Refreshed${singularName}`),
|
|
503
436
|
fields: {
|
|
504
|
-
|
|
437
|
+
exp: {
|
|
438
|
+
type: GraphQLInt
|
|
439
|
+
},
|
|
440
|
+
refreshedToken: {
|
|
441
|
+
type: GraphQLString
|
|
442
|
+
},
|
|
443
|
+
strategy: {
|
|
505
444
|
type: GraphQLString
|
|
506
445
|
},
|
|
507
446
|
user: {
|
|
508
|
-
type: collection.graphQL.
|
|
447
|
+
type: collection.graphQL.JWT
|
|
509
448
|
}
|
|
510
449
|
}
|
|
511
450
|
}),
|
|
512
|
-
|
|
513
|
-
password: {
|
|
514
|
-
type: GraphQLString
|
|
515
|
-
},
|
|
516
|
-
token: {
|
|
517
|
-
type: GraphQLString
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
resolve: resetPassword(collection)
|
|
451
|
+
resolve: refresh(collection)
|
|
521
452
|
};
|
|
522
|
-
graphqlResult.Mutation.fields[`
|
|
523
|
-
type:
|
|
524
|
-
|
|
525
|
-
token: {
|
|
526
|
-
type: GraphQLString
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
resolve: verifyEmail(collection)
|
|
453
|
+
graphqlResult.Mutation.fields[`logout${singularName}`] = {
|
|
454
|
+
type: GraphQLString,
|
|
455
|
+
resolve: logout(collection)
|
|
530
456
|
};
|
|
457
|
+
if (!collectionConfig.auth.disableLocalStrategy) {
|
|
458
|
+
const authArgs = {};
|
|
459
|
+
const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(collectionConfig.auth.loginWithUsername);
|
|
460
|
+
if (canLoginWithEmail) {
|
|
461
|
+
authArgs['email'] = {
|
|
462
|
+
type: new GraphQLNonNull(GraphQLString)
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
if (canLoginWithUsername) {
|
|
466
|
+
authArgs['username'] = {
|
|
467
|
+
type: new GraphQLNonNull(GraphQLString)
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
if (collectionConfig.auth.maxLoginAttempts > 0) {
|
|
471
|
+
graphqlResult.Mutation.fields[`unlock${singularName}`] = {
|
|
472
|
+
type: new GraphQLNonNull(GraphQLBoolean),
|
|
473
|
+
args: authArgs,
|
|
474
|
+
resolve: unlock(collection)
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
graphqlResult.Mutation.fields[`login${singularName}`] = {
|
|
478
|
+
type: new GraphQLObjectType({
|
|
479
|
+
name: formatName(`${slug}LoginResult`),
|
|
480
|
+
fields: {
|
|
481
|
+
exp: {
|
|
482
|
+
type: GraphQLInt
|
|
483
|
+
},
|
|
484
|
+
token: {
|
|
485
|
+
type: GraphQLString
|
|
486
|
+
},
|
|
487
|
+
user: {
|
|
488
|
+
type: collection.graphQL.type
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}),
|
|
492
|
+
args: {
|
|
493
|
+
...authArgs,
|
|
494
|
+
password: {
|
|
495
|
+
type: GraphQLString
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
resolve: login(collection)
|
|
499
|
+
};
|
|
500
|
+
graphqlResult.Mutation.fields[`forgotPassword${singularName}`] = {
|
|
501
|
+
type: new GraphQLNonNull(GraphQLBoolean),
|
|
502
|
+
args: {
|
|
503
|
+
disableEmail: {
|
|
504
|
+
type: GraphQLBoolean
|
|
505
|
+
},
|
|
506
|
+
expiration: {
|
|
507
|
+
type: GraphQLInt
|
|
508
|
+
},
|
|
509
|
+
...authArgs
|
|
510
|
+
},
|
|
511
|
+
resolve: forgotPassword(collection)
|
|
512
|
+
};
|
|
513
|
+
graphqlResult.Mutation.fields[`resetPassword${singularName}`] = {
|
|
514
|
+
type: new GraphQLObjectType({
|
|
515
|
+
name: formatName(`${slug}ResetPassword`),
|
|
516
|
+
fields: {
|
|
517
|
+
token: {
|
|
518
|
+
type: GraphQLString
|
|
519
|
+
},
|
|
520
|
+
user: {
|
|
521
|
+
type: collection.graphQL.type
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}),
|
|
525
|
+
args: {
|
|
526
|
+
password: {
|
|
527
|
+
type: GraphQLString
|
|
528
|
+
},
|
|
529
|
+
token: {
|
|
530
|
+
type: GraphQLString
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
resolve: resetPassword(collection)
|
|
534
|
+
};
|
|
535
|
+
graphqlResult.Mutation.fields[`verifyEmail${singularName}`] = {
|
|
536
|
+
type: GraphQLBoolean,
|
|
537
|
+
args: {
|
|
538
|
+
token: {
|
|
539
|
+
type: GraphQLString
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
resolve: verifyEmail(collection)
|
|
543
|
+
};
|
|
544
|
+
}
|
|
531
545
|
}
|
|
532
546
|
}
|
|
533
547
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/initCollections.ts"],"sourcesContent":["import type {\n Collection,\n Field,\n GraphQLInfo,\n SanitizedCollectionConfig,\n SanitizedConfig,\n} from 'payload'\n\nimport {\n GraphQLBoolean,\n GraphQLInt,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLString,\n} from 'graphql'\nimport { buildVersionCollectionFields, flattenTopLevelFields, formatNames, toWords } from 'payload'\nimport { fieldAffectsData, getLoginOptions } from 'payload/shared'\n\nimport type { ObjectTypeConfig } from './buildObjectType.js'\n\nimport { forgotPassword } from '../resolvers/auth/forgotPassword.js'\nimport { init } from '../resolvers/auth/init.js'\nimport { login } from '../resolvers/auth/login.js'\nimport { logout } from '../resolvers/auth/logout.js'\nimport { me } from '../resolvers/auth/me.js'\nimport { refresh } from '../resolvers/auth/refresh.js'\nimport { resetPassword } from '../resolvers/auth/resetPassword.js'\nimport { unlock } from '../resolvers/auth/unlock.js'\nimport { verifyEmail } from '../resolvers/auth/verifyEmail.js'\nimport { countResolver } from '../resolvers/collections/count.js'\nimport { createResolver } from '../resolvers/collections/create.js'\nimport { getDeleteResolver } from '../resolvers/collections/delete.js'\nimport { docAccessResolver } from '../resolvers/collections/docAccess.js'\nimport { duplicateResolver } from '../resolvers/collections/duplicate.js'\nimport { findResolver } from '../resolvers/collections/find.js'\nimport { findByIDResolver } from '../resolvers/collections/findByID.js'\nimport { findVersionByIDResolver } from '../resolvers/collections/findVersionByID.js'\nimport { findVersionsResolver } from '../resolvers/collections/findVersions.js'\nimport { restoreVersionResolver } from '../resolvers/collections/restoreVersion.js'\nimport { updateResolver } from '../resolvers/collections/update.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { buildMutationInputType, getCollectionIDType } from './buildMutationInputType.js'\nimport { buildObjectType } from './buildObjectType.js'\nimport { buildPaginatedListType } from './buildPaginatedListType.js'\nimport { buildPolicyType } from './buildPoliciesType.js'\nimport { buildWhereInputType } from './buildWhereInputType.js'\n\ntype InitCollectionsGraphQLArgs = {\n config: SanitizedConfig\n graphqlResult: GraphQLInfo\n}\nexport function initCollections({ config, graphqlResult }: InitCollectionsGraphQLArgs): void {\n Object.keys(graphqlResult.collections).forEach((slug) => {\n const collection: Collection = graphqlResult.collections[slug]\n const {\n config: collectionConfig,\n config: { fields, graphQL = {} as SanitizedCollectionConfig['graphQL'], versions },\n } = collection\n\n if (!graphQL) {\n return\n }\n\n let singularName\n let pluralName\n const fromSlug = formatNames(collection.config.slug)\n if (graphQL.singularName) {\n singularName = toWords(graphQL.singularName, true)\n } else {\n singularName = fromSlug.singular\n }\n if (graphQL.pluralName) {\n pluralName = toWords(graphQL.pluralName, true)\n } else {\n pluralName = fromSlug.plural\n }\n\n // For collections named 'Media' or similar,\n // there is a possibility that the singular name\n // will equal the plural name. Append `all` to the beginning\n // of potential conflicts\n if (singularName === pluralName) {\n pluralName = `all${singularName}`\n }\n\n collection.graphQL = {} as Collection['graphQL']\n\n const hasIDField =\n flattenTopLevelFields(fields).findIndex(\n (field) => fieldAffectsData(field) && field.name === 'id',\n ) > -1\n\n const idType = getCollectionIDType(config.db.defaultIDType, collectionConfig)\n\n const baseFields: ObjectTypeConfig = {}\n\n const whereInputFields = [...fields]\n\n if (!hasIDField) {\n baseFields.id = { type: new GraphQLNonNull(idType) }\n whereInputFields.push({\n name: 'id',\n type: config.db.defaultIDType as 'text',\n })\n }\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n collection.graphQL.type = buildObjectType({\n name: singularName,\n baseFields,\n config,\n fields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: singularName,\n })\n\n collection.graphQL.paginatedType = buildPaginatedListType(pluralName, collection.graphQL.type)\n\n collection.graphQL.whereInputType = buildWhereInputType({\n name: singularName,\n fields: whereInputFields,\n parentName: singularName,\n })\n\n const mutationInputFields = [...fields]\n\n if (\n collectionConfig.auth &&\n (!collectionConfig.auth.disableLocalStrategy ||\n (typeof collectionConfig.auth.disableLocalStrategy === 'object' &&\n collectionConfig.auth.disableLocalStrategy.optionalPassword))\n ) {\n mutationInputFields.push({\n name: 'password',\n type: 'text',\n label: 'Password',\n required: !(\n typeof collectionConfig.auth.disableLocalStrategy === 'object' &&\n collectionConfig.auth.disableLocalStrategy.optionalPassword\n ),\n })\n }\n\n const createMutationInputType = buildMutationInputType({\n name: singularName,\n config,\n fields: mutationInputFields,\n graphqlResult,\n parentName: singularName,\n })\n if (createMutationInputType) {\n collection.graphQL.mutationInputType = new GraphQLNonNull(createMutationInputType)\n }\n\n const updateMutationInputType = buildMutationInputType({\n name: `${singularName}Update`,\n config,\n fields: mutationInputFields.filter(\n (field) => !(fieldAffectsData(field) && field.name === 'id'),\n ),\n forceNullable: true,\n graphqlResult,\n parentName: `${singularName}Update`,\n })\n if (updateMutationInputType) {\n collection.graphQL.updateMutationInputType = new GraphQLNonNull(updateMutationInputType)\n }\n\n graphqlResult.Query.fields[singularName] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findByIDResolver(collection),\n }\n\n graphqlResult.Query.fields[pluralName] = {\n type: buildPaginatedListType(pluralName, collection.graphQL.type),\n args: {\n draft: { type: GraphQLBoolean },\n where: { type: collection.graphQL.whereInputType },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findResolver(collection),\n }\n\n graphqlResult.Query.fields[`count${pluralName}`] = {\n type: new GraphQLObjectType({\n name: `count${pluralName}`,\n fields: {\n totalDocs: { type: GraphQLInt },\n },\n }),\n args: {\n draft: { type: GraphQLBoolean },\n where: { type: collection.graphQL.whereInputType },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: countResolver(collection),\n }\n\n graphqlResult.Query.fields[`docAccess${singularName}`] = {\n type: buildPolicyType({\n type: 'collection',\n entity: collectionConfig,\n scope: 'docAccess',\n typeSuffix: 'DocAccess',\n }),\n args: {\n id: { type: new GraphQLNonNull(idType) },\n },\n resolve: docAccessResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`create${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n ...(createMutationInputType\n ? { data: { type: collection.graphQL.mutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: createResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`update${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n autosave: { type: GraphQLBoolean },\n ...(updateMutationInputType\n ? { data: { type: collection.graphQL.updateMutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: updateResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`delete${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n },\n resolve: getDeleteResolver(collection),\n }\n\n if (collectionConfig.disableDuplicate !== true) {\n graphqlResult.Mutation.fields[`duplicate${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n ...(createMutationInputType\n ? { data: { type: collection.graphQL.mutationInputType } }\n : {}),\n },\n resolve: duplicateResolver(collection),\n }\n }\n\n if (collectionConfig.versions) {\n const versionIDType = config.db.defaultIDType === 'text' ? GraphQLString : GraphQLInt\n const versionCollectionFields: Field[] = [\n ...buildVersionCollectionFields(config, collectionConfig),\n {\n name: 'id',\n type: config.db.defaultIDType as 'text',\n },\n {\n name: 'createdAt',\n type: 'date',\n label: 'Created At',\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: 'Updated At',\n },\n ]\n\n collection.graphQL.versionType = buildObjectType({\n name: `${singularName}Version`,\n config,\n fields: versionCollectionFields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: `${singularName}Version`,\n })\n\n graphqlResult.Query.fields[`version${formatName(singularName)}`] = {\n type: collection.graphQL.versionType,\n args: {\n id: { type: versionIDType },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findVersionByIDResolver(collection),\n }\n graphqlResult.Query.fields[`versions${pluralName}`] = {\n type: buildPaginatedListType(\n `versions${formatName(pluralName)}`,\n collection.graphQL.versionType,\n ),\n args: {\n where: {\n type: buildWhereInputType({\n name: `versions${singularName}`,\n fields: versionCollectionFields,\n parentName: `versions${singularName}`,\n }),\n },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findVersionsResolver(collection),\n }\n graphqlResult.Mutation.fields[`restoreVersion${formatName(singularName)}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: versionIDType },\n draft: { type: GraphQLBoolean },\n },\n resolve: restoreVersionResolver(collection),\n }\n }\n\n if (collectionConfig.auth) {\n const authFields: Field[] =\n collectionConfig.auth.disableLocalStrategy ||\n (collectionConfig.auth.loginWithUsername &&\n !collectionConfig.auth.loginWithUsername.allowEmailLogin &&\n !collectionConfig.auth.loginWithUsername.requireEmail)\n ? []\n : [\n {\n name: 'email',\n type: 'email',\n required: true,\n },\n ]\n collection.graphQL.JWT = buildObjectType({\n name: formatName(`${slug}JWT`),\n config,\n fields: [\n ...collectionConfig.fields.filter((field) => fieldAffectsData(field) && field.saveToJWT),\n ...authFields,\n {\n name: 'collection',\n type: 'text',\n required: true,\n },\n ],\n graphqlResult,\n parentName: formatName(`${slug}JWT`),\n })\n\n graphqlResult.Query.fields[`me${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}Me`),\n fields: {\n collection: {\n type: GraphQLString,\n },\n exp: {\n type: GraphQLInt,\n },\n strategy: {\n type: GraphQLString,\n },\n token: {\n type: GraphQLString,\n },\n user: {\n type: collection.graphQL.type,\n },\n },\n }),\n resolve: me(collection),\n }\n\n graphqlResult.Query.fields[`initialized${singularName}`] = {\n type: GraphQLBoolean,\n resolve: init(collection.config.slug),\n }\n\n graphqlResult.Mutation.fields[`refreshToken${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}Refreshed${singularName}`),\n fields: {\n exp: {\n type: GraphQLInt,\n },\n refreshedToken: {\n type: GraphQLString,\n },\n strategy: {\n type: GraphQLString,\n },\n user: {\n type: collection.graphQL.JWT,\n },\n },\n }),\n resolve: refresh(collection),\n }\n\n graphqlResult.Mutation.fields[`logout${singularName}`] = {\n type: GraphQLString,\n resolve: logout(collection),\n }\n\n if (!collectionConfig.auth.disableLocalStrategy) {\n const authArgs = {}\n\n const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(\n collectionConfig.auth.loginWithUsername,\n )\n\n if (canLoginWithEmail) {\n authArgs['email'] = { type: new GraphQLNonNull(GraphQLString) }\n }\n if (canLoginWithUsername) {\n authArgs['username'] = { type: new GraphQLNonNull(GraphQLString) }\n }\n\n if (collectionConfig.auth.maxLoginAttempts > 0) {\n graphqlResult.Mutation.fields[`unlock${singularName}`] = {\n type: new GraphQLNonNull(GraphQLBoolean),\n args: authArgs,\n resolve: unlock(collection),\n }\n }\n\n graphqlResult.Mutation.fields[`login${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}LoginResult`),\n fields: {\n exp: {\n type: GraphQLInt,\n },\n token: {\n type: GraphQLString,\n },\n user: {\n type: collection.graphQL.type,\n },\n },\n }),\n args: {\n ...authArgs,\n password: { type: GraphQLString },\n },\n resolve: login(collection),\n }\n\n graphqlResult.Mutation.fields[`forgotPassword${singularName}`] = {\n type: new GraphQLNonNull(GraphQLBoolean),\n args: {\n disableEmail: { type: GraphQLBoolean },\n expiration: { type: GraphQLInt },\n ...authArgs,\n },\n resolve: forgotPassword(collection),\n }\n\n graphqlResult.Mutation.fields[`resetPassword${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}ResetPassword`),\n fields: {\n token: { type: GraphQLString },\n user: { type: collection.graphQL.type },\n },\n }),\n args: {\n password: { type: GraphQLString },\n token: { type: GraphQLString },\n },\n resolve: resetPassword(collection),\n }\n\n graphqlResult.Mutation.fields[`verifyEmail${singularName}`] = {\n type: GraphQLBoolean,\n args: {\n token: { type: GraphQLString },\n },\n resolve: verifyEmail(collection),\n }\n }\n }\n })\n}\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLObjectType","GraphQLString","buildVersionCollectionFields","flattenTopLevelFields","formatNames","toWords","fieldAffectsData","getLoginOptions","forgotPassword","init","login","logout","me","refresh","resetPassword","unlock","verifyEmail","countResolver","createResolver","getDeleteResolver","docAccessResolver","duplicateResolver","findResolver","findByIDResolver","findVersionByIDResolver","findVersionsResolver","restoreVersionResolver","updateResolver","formatName","buildMutationInputType","getCollectionIDType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initCollections","config","graphqlResult","Object","keys","collections","forEach","slug","collection","collectionConfig","fields","graphQL","versions","singularName","pluralName","fromSlug","singular","plural","hasIDField","findIndex","field","name","idType","db","defaultIDType","baseFields","whereInputFields","id","type","push","forceNullableObjectType","Boolean","drafts","forceNullable","parentName","paginatedType","whereInputType","mutationInputFields","auth","disableLocalStrategy","optionalPassword","label","required","createMutationInputType","mutationInputType","updateMutationInputType","filter","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","resolve","where","limit","page","pagination","sort","totalDocs","entity","scope","typeSuffix","Mutation","data","autosave","disableDuplicate","versionIDType","versionCollectionFields","versionType","authFields","loginWithUsername","allowEmailLogin","requireEmail","JWT","saveToJWT","exp","strategy","token","user","refreshedToken","authArgs","canLoginWithEmail","canLoginWithUsername","maxLoginAttempts","password","disableEmail","expiration"],"mappings":"AAQA,SACEA,cAAc,EACdC,UAAU,EACVC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,QACR,UAAS;AAChB,SAASC,4BAA4B,EAAEC,qBAAqB,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAS;AACnG,SAASC,gBAAgB,EAAEC,eAAe,QAAQ,iBAAgB;AAIlE,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SAASC,IAAI,QAAQ,4BAA2B;AAChD,SAASC,KAAK,QAAQ,6BAA4B;AAClD,SAASC,MAAM,QAAQ,8BAA6B;AACpD,SAASC,EAAE,QAAQ,0BAAyB;AAC5C,SAASC,OAAO,QAAQ,+BAA8B;AACtD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC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AAC,GAAG;oBAC5De,MAAMlE;oBACNsF,MAAM;wBACJiC,OAAO;4BAAErD,MAAM9D;wBAAc;oBAC/B;oBACA0F,SAAS3E,YAAY2B;gBACvB;YACF;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/initCollections.ts"],"sourcesContent":["import type {\n Collection,\n Field,\n GraphQLInfo,\n SanitizedCollectionConfig,\n SanitizedConfig,\n} from 'payload'\n\nimport {\n GraphQLBoolean,\n GraphQLInt,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLString,\n} from 'graphql'\nimport { buildVersionCollectionFields, flattenTopLevelFields, formatNames, toWords } from 'payload'\nimport { fieldAffectsData, getLoginOptions } from 'payload/shared'\n\nimport type { ObjectTypeConfig } from './buildObjectType.js'\n\nimport { forgotPassword } from '../resolvers/auth/forgotPassword.js'\nimport { init } from '../resolvers/auth/init.js'\nimport { login } from '../resolvers/auth/login.js'\nimport { logout } from '../resolvers/auth/logout.js'\nimport { me } from '../resolvers/auth/me.js'\nimport { refresh } from '../resolvers/auth/refresh.js'\nimport { resetPassword } from '../resolvers/auth/resetPassword.js'\nimport { unlock } from '../resolvers/auth/unlock.js'\nimport { verifyEmail } from '../resolvers/auth/verifyEmail.js'\nimport { countResolver } from '../resolvers/collections/count.js'\nimport { createResolver } from '../resolvers/collections/create.js'\nimport { getDeleteResolver } from '../resolvers/collections/delete.js'\nimport { docAccessResolver } from '../resolvers/collections/docAccess.js'\nimport { duplicateResolver } from '../resolvers/collections/duplicate.js'\nimport { findResolver } from '../resolvers/collections/find.js'\nimport { findByIDResolver } from '../resolvers/collections/findByID.js'\nimport { findVersionByIDResolver } from '../resolvers/collections/findVersionByID.js'\nimport { findVersionsResolver } from '../resolvers/collections/findVersions.js'\nimport { restoreVersionResolver } from '../resolvers/collections/restoreVersion.js'\nimport { updateResolver } from '../resolvers/collections/update.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { buildMutationInputType, getCollectionIDType } from './buildMutationInputType.js'\nimport { buildObjectType } from './buildObjectType.js'\nimport { buildPaginatedListType } from './buildPaginatedListType.js'\nimport { buildPolicyType } from './buildPoliciesType.js'\nimport { buildWhereInputType } from './buildWhereInputType.js'\n\ntype InitCollectionsGraphQLArgs = {\n config: SanitizedConfig\n graphqlResult: GraphQLInfo\n}\nexport function initCollections({ config, graphqlResult }: InitCollectionsGraphQLArgs): void {\n Object.keys(graphqlResult.collections).forEach((slug) => {\n const collection: Collection = graphqlResult.collections[slug]\n const {\n config: collectionConfig,\n config: { fields, graphQL = {} as SanitizedCollectionConfig['graphQL'], versions },\n } = collection\n\n if (!graphQL) {\n return\n }\n\n let singularName\n let pluralName\n\n const fromSlug = formatNames(collection.config.slug)\n\n if (graphQL.singularName) {\n singularName = toWords(graphQL.singularName, true)\n } else {\n singularName = fromSlug.singular\n }\n if (graphQL.pluralName) {\n pluralName = toWords(graphQL.pluralName, true)\n } else {\n pluralName = fromSlug.plural\n }\n\n // For collections named 'Media' or similar,\n // there is a possibility that the singular name\n // will equal the plural name. Append `all` to the beginning\n // of potential conflicts\n if (singularName === pluralName) {\n pluralName = `all${singularName}`\n }\n\n collection.graphQL = {} as Collection['graphQL']\n\n const hasIDField =\n flattenTopLevelFields(fields).findIndex(\n (field) => fieldAffectsData(field) && field.name === 'id',\n ) > -1\n\n const idType = getCollectionIDType(config.db.defaultIDType, collectionConfig)\n\n const baseFields: ObjectTypeConfig = {}\n\n const whereInputFields = [...fields]\n\n if (!hasIDField) {\n baseFields.id = { type: new GraphQLNonNull(idType) }\n whereInputFields.push({\n name: 'id',\n type: config.db.defaultIDType as 'text',\n })\n }\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n collection.graphQL.type = buildObjectType({\n name: singularName,\n baseFields,\n config,\n fields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: singularName,\n })\n\n collection.graphQL.paginatedType = buildPaginatedListType(pluralName, collection.graphQL.type)\n\n collection.graphQL.whereInputType = buildWhereInputType({\n name: singularName,\n fields: whereInputFields,\n parentName: singularName,\n })\n\n const mutationInputFields = [...fields]\n\n if (\n collectionConfig.auth &&\n (!collectionConfig.auth.disableLocalStrategy ||\n (typeof collectionConfig.auth.disableLocalStrategy === 'object' &&\n collectionConfig.auth.disableLocalStrategy.optionalPassword))\n ) {\n mutationInputFields.push({\n name: 'password',\n type: 'text',\n label: 'Password',\n required: !(\n typeof collectionConfig.auth.disableLocalStrategy === 'object' &&\n collectionConfig.auth.disableLocalStrategy.optionalPassword\n ),\n })\n }\n\n const createMutationInputType = buildMutationInputType({\n name: singularName,\n config,\n fields: mutationInputFields,\n graphqlResult,\n parentName: singularName,\n })\n if (createMutationInputType) {\n collection.graphQL.mutationInputType = new GraphQLNonNull(createMutationInputType)\n }\n\n const updateMutationInputType = buildMutationInputType({\n name: `${singularName}Update`,\n config,\n fields: mutationInputFields.filter(\n (field) => !(fieldAffectsData(field) && field.name === 'id'),\n ),\n forceNullable: true,\n graphqlResult,\n parentName: `${singularName}Update`,\n })\n if (updateMutationInputType) {\n collection.graphQL.updateMutationInputType = new GraphQLNonNull(updateMutationInputType)\n }\n\n const queriesEnabled =\n typeof collectionConfig.graphQL !== 'object' || !collectionConfig.graphQL.disableQueries\n const mutationsEnabled =\n typeof collectionConfig.graphQL !== 'object' || !collectionConfig.graphQL.disableMutations\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[singularName] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findByIDResolver(collection),\n }\n\n graphqlResult.Query.fields[pluralName] = {\n type: buildPaginatedListType(pluralName, collection.graphQL.type),\n args: {\n draft: { type: GraphQLBoolean },\n where: { type: collection.graphQL.whereInputType },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findResolver(collection),\n }\n\n graphqlResult.Query.fields[`count${pluralName}`] = {\n type: new GraphQLObjectType({\n name: `count${pluralName}`,\n fields: {\n totalDocs: { type: GraphQLInt },\n },\n }),\n args: {\n draft: { type: GraphQLBoolean },\n where: { type: collection.graphQL.whereInputType },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: countResolver(collection),\n }\n\n graphqlResult.Query.fields[`docAccess${singularName}`] = {\n type: buildPolicyType({\n type: 'collection',\n entity: collectionConfig,\n scope: 'docAccess',\n typeSuffix: 'DocAccess',\n }),\n args: {\n id: { type: new GraphQLNonNull(idType) },\n },\n resolve: docAccessResolver(collection),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`create${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n ...(createMutationInputType\n ? { data: { type: collection.graphQL.mutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: createResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`update${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n autosave: { type: GraphQLBoolean },\n ...(updateMutationInputType\n ? { data: { type: collection.graphQL.updateMutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: updateResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`delete${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n },\n resolve: getDeleteResolver(collection),\n }\n\n if (collectionConfig.disableDuplicate !== true) {\n graphqlResult.Mutation.fields[`duplicate${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n ...(createMutationInputType\n ? { data: { type: collection.graphQL.mutationInputType } }\n : {}),\n },\n resolve: duplicateResolver(collection),\n }\n }\n }\n\n if (collectionConfig.versions) {\n const versionIDType = config.db.defaultIDType === 'text' ? GraphQLString : GraphQLInt\n const versionCollectionFields: Field[] = [\n ...buildVersionCollectionFields(config, collectionConfig),\n {\n name: 'id',\n type: config.db.defaultIDType as 'text',\n },\n {\n name: 'createdAt',\n type: 'date',\n label: 'Created At',\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: 'Updated At',\n },\n ]\n\n collection.graphQL.versionType = buildObjectType({\n name: `${singularName}Version`,\n config,\n fields: versionCollectionFields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: `${singularName}Version`,\n })\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[`version${formatName(singularName)}`] = {\n type: collection.graphQL.versionType,\n args: {\n id: { type: versionIDType },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findVersionByIDResolver(collection),\n }\n graphqlResult.Query.fields[`versions${pluralName}`] = {\n type: buildPaginatedListType(\n `versions${formatName(pluralName)}`,\n collection.graphQL.versionType,\n ),\n args: {\n where: {\n type: buildWhereInputType({\n name: `versions${singularName}`,\n fields: versionCollectionFields,\n parentName: `versions${singularName}`,\n }),\n },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findVersionsResolver(collection),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`restoreVersion${formatName(singularName)}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: versionIDType },\n draft: { type: GraphQLBoolean },\n },\n resolve: restoreVersionResolver(collection),\n }\n }\n }\n\n if (collectionConfig.auth) {\n const authFields: Field[] =\n collectionConfig.auth.disableLocalStrategy ||\n (collectionConfig.auth.loginWithUsername &&\n !collectionConfig.auth.loginWithUsername.allowEmailLogin &&\n !collectionConfig.auth.loginWithUsername.requireEmail)\n ? []\n : [\n {\n name: 'email',\n type: 'email',\n required: true,\n },\n ]\n collection.graphQL.JWT = buildObjectType({\n name: formatName(`${slug}JWT`),\n config,\n fields: [\n ...collectionConfig.fields.filter((field) => fieldAffectsData(field) && field.saveToJWT),\n ...authFields,\n {\n name: 'collection',\n type: 'text',\n required: true,\n },\n ],\n graphqlResult,\n parentName: formatName(`${slug}JWT`),\n })\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[`me${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}Me`),\n fields: {\n collection: {\n type: GraphQLString,\n },\n exp: {\n type: GraphQLInt,\n },\n strategy: {\n type: GraphQLString,\n },\n token: {\n type: GraphQLString,\n },\n user: {\n type: collection.graphQL.type,\n },\n },\n }),\n resolve: me(collection),\n }\n\n graphqlResult.Query.fields[`initialized${singularName}`] = {\n type: GraphQLBoolean,\n resolve: init(collection.config.slug),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`refreshToken${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}Refreshed${singularName}`),\n fields: {\n exp: {\n type: GraphQLInt,\n },\n refreshedToken: {\n type: GraphQLString,\n },\n strategy: {\n type: GraphQLString,\n },\n user: {\n type: collection.graphQL.JWT,\n },\n },\n }),\n resolve: refresh(collection),\n }\n\n graphqlResult.Mutation.fields[`logout${singularName}`] = {\n type: GraphQLString,\n resolve: logout(collection),\n }\n\n if (!collectionConfig.auth.disableLocalStrategy) {\n const authArgs = {}\n\n const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(\n collectionConfig.auth.loginWithUsername,\n )\n\n if (canLoginWithEmail) {\n authArgs['email'] = { type: new GraphQLNonNull(GraphQLString) }\n }\n if (canLoginWithUsername) {\n authArgs['username'] = { type: new GraphQLNonNull(GraphQLString) }\n }\n\n if (collectionConfig.auth.maxLoginAttempts > 0) {\n graphqlResult.Mutation.fields[`unlock${singularName}`] = {\n type: new GraphQLNonNull(GraphQLBoolean),\n args: authArgs,\n resolve: unlock(collection),\n }\n }\n\n graphqlResult.Mutation.fields[`login${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}LoginResult`),\n fields: {\n exp: {\n type: GraphQLInt,\n },\n token: {\n type: GraphQLString,\n },\n user: {\n type: collection.graphQL.type,\n },\n },\n }),\n args: {\n ...authArgs,\n password: { type: GraphQLString },\n },\n resolve: login(collection),\n }\n\n graphqlResult.Mutation.fields[`forgotPassword${singularName}`] = {\n type: new GraphQLNonNull(GraphQLBoolean),\n args: {\n disableEmail: { type: GraphQLBoolean },\n expiration: { type: GraphQLInt },\n ...authArgs,\n },\n resolve: forgotPassword(collection),\n }\n\n graphqlResult.Mutation.fields[`resetPassword${singularName}`] = {\n type: new GraphQLObjectType({\n name: formatName(`${slug}ResetPassword`),\n fields: {\n token: { type: GraphQLString },\n user: { type: collection.graphQL.type },\n },\n }),\n args: {\n password: { type: GraphQLString },\n token: { type: GraphQLString },\n },\n resolve: resetPassword(collection),\n }\n\n graphqlResult.Mutation.fields[`verifyEmail${singularName}`] = {\n type: GraphQLBoolean,\n args: {\n token: { type: GraphQLString },\n },\n resolve: verifyEmail(collection),\n }\n }\n }\n }\n })\n}\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLObjectType","GraphQLString","buildVersionCollectionFields","flattenTopLevelFields","formatNames","toWords","fieldAffectsData","getLoginOptions","forgotPassword","init","login","logout","me","refresh","resetPassword","unlock","verifyEmail","countResolver","createResolver","getDeleteResolver","docAccessResolver","duplicateResolver","findResolver","findByIDResolver","findVersionByIDResolver","findVersionsResolver","restoreVersionResolver","updateResolver","formatName","buildMutationInputType","getCollectionIDType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initCollections","config","graphqlResult","Object","keys","collections","forEach","slug","collection","collectionConfig","fields","graphQL","versions","singularName","pluralName","fromSlug","singular","plural","hasIDField","findIndex","field","name","idType","db","defaultIDType","baseFields","whereInputFields","id","type","push","forceNullableObjectType","Boolean","drafts","forceNullable","parentName","paginatedType","whereInputType","mutationInputFields","auth","disableLocalStrategy","optionalPassword","label","required","createMutationInputType","mutationInputType","updateMutationInputType","filter","queriesEnabled","disableQueries","mutationsEnabled","disableMutations","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","resolve","where","limit","page","pagination","sort","totalDocs","entity","scope","typeSuffix","Mutation","data","autosave","disableDuplicate","versionIDType","versionCollectionFields","versionType","authFields","loginWithUsername","allowEmailLogin","requireEmail","JWT","saveToJWT","exp","strategy","token","user","refreshedToken","authArgs","canLoginWithEmail","canLoginWithUsername","maxLoginAttempts","password","disableEmail","expiration"],"mappings":"AAQA,SACEA,cAAc,EACdC,UAAU,EACVC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,QACR,UAAS;AAChB,SAASC,4BAA4B,EAAEC,qBAAqB,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAS;AACnG,SAASC,gBAAgB,EAAEC,eAAe,QAAQ,iBAAgB;AAIlE,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SAASC,IAAI,QAAQ,4BAA2B;AAChD,SAASC,KAAK,QAAQ,6BAA4B;AAClD,SAASC,MAAM,QAAQ,8BAA6B;AACpD,SAASC,EAAE,QAAQ,0BAAyB;AAC5C,SAASC,OAAO,QAAQ,+BAA8B;AACtD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,MAAM,QAAQ,8BAA6B;AACpD,SAASC,WAAW,QAAQ,mCAAkC;AAC9D,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,qCAAoC;AACnE,SAASC,iBAAiB,QA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Ac;gCAC7BwH,MAAM;oCAAE1D,MAAMpB,WAAWG,OAAO,CAACiB,IAAI;gCAAC;4BACxC;wBACF;wBACAwB,MAAM;4BACJwC,UAAU;gCAAEhE,MAAM9D;4BAAc;4BAChCuH,OAAO;gCAAEzD,MAAM9D;4BAAc;wBAC/B;wBACA8F,SAASjF,cAAc6B;oBACzB;oBAEAN,cAAcoE,QAAQ,CAAC5D,MAAM,CAAC,CAAC,WAAW,EAAEG,cAAc,CAAC,GAAG;wBAC5De,MAAMlE;wBACN0F,MAAM;4BACJiC,OAAO;gCAAEzD,MAAM9D;4BAAc;wBAC/B;wBACA8F,SAAS/E,YAAY2B;oBACvB;gBACF;YACF;QACF;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initGlobals.d.ts","sourceRoot":"","sources":["../../src/schema/initGlobals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,WAAW,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAA;AAiBzF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,WAAW,CAAA;CAC3B,CAAA;AACD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,sBAAsB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"initGlobals.d.ts","sourceRoot":"","sources":["../../src/schema/initGlobals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,WAAW,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAA;AAiBzF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,WAAW,CAAA;CAC3B,CAAA;AACD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,sBAAsB,GAAG,IAAI,CA0KnF"}
|
|
@@ -44,51 +44,57 @@ export function initGlobals({ config, graphqlResult }) {
|
|
|
44
44
|
}),
|
|
45
45
|
mutationInputType: updateMutationInputType ? new GraphQLNonNull(updateMutationInputType) : null
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const queriesEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableQueries;
|
|
48
|
+
const mutationsEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableMutations;
|
|
49
|
+
if (queriesEnabled) {
|
|
50
|
+
graphqlResult.Query.fields[formattedName] = {
|
|
51
|
+
type: graphqlResult.globals.graphQL[slug].type,
|
|
52
|
+
args: {
|
|
53
|
+
draft: {
|
|
54
|
+
type: GraphQLBoolean
|
|
55
|
+
},
|
|
56
|
+
...config.localization ? {
|
|
57
|
+
fallbackLocale: {
|
|
58
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
59
|
+
},
|
|
60
|
+
locale: {
|
|
61
|
+
type: graphqlResult.types.localeInputType
|
|
62
|
+
}
|
|
63
|
+
} : {}
|
|
52
64
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
resolve: findOne(global)
|
|
66
|
+
};
|
|
67
|
+
graphqlResult.Query.fields[`docAccess${formattedName}`] = {
|
|
68
|
+
type: buildPolicyType({
|
|
69
|
+
type: 'global',
|
|
70
|
+
entity: global,
|
|
71
|
+
scope: 'docAccess',
|
|
72
|
+
typeSuffix: 'DocAccess'
|
|
73
|
+
}),
|
|
74
|
+
resolve: docAccessResolver(global)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (mutationsEnabled) {
|
|
78
|
+
graphqlResult.Mutation.fields[`update${formattedName}`] = {
|
|
79
|
+
type: graphqlResult.globals.graphQL[slug].type,
|
|
80
|
+
args: {
|
|
81
|
+
...updateMutationInputType ? {
|
|
82
|
+
data: {
|
|
83
|
+
type: graphqlResult.globals.graphQL[slug].mutationInputType
|
|
84
|
+
}
|
|
85
|
+
} : {},
|
|
86
|
+
draft: {
|
|
87
|
+
type: GraphQLBoolean
|
|
56
88
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
resolve: findOne(global)
|
|
63
|
-
};
|
|
64
|
-
graphqlResult.Mutation.fields[`update${formattedName}`] = {
|
|
65
|
-
type: graphqlResult.globals.graphQL[slug].type,
|
|
66
|
-
args: {
|
|
67
|
-
...updateMutationInputType ? {
|
|
68
|
-
data: {
|
|
69
|
-
type: graphqlResult.globals.graphQL[slug].mutationInputType
|
|
70
|
-
}
|
|
71
|
-
} : {},
|
|
72
|
-
draft: {
|
|
73
|
-
type: GraphQLBoolean
|
|
89
|
+
...config.localization ? {
|
|
90
|
+
locale: {
|
|
91
|
+
type: graphqlResult.types.localeInputType
|
|
92
|
+
}
|
|
93
|
+
} : {}
|
|
74
94
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
} : {}
|
|
80
|
-
},
|
|
81
|
-
resolve: update(global)
|
|
82
|
-
};
|
|
83
|
-
graphqlResult.Query.fields[`docAccess${formattedName}`] = {
|
|
84
|
-
type: buildPolicyType({
|
|
85
|
-
type: 'global',
|
|
86
|
-
entity: global,
|
|
87
|
-
scope: 'docAccess',
|
|
88
|
-
typeSuffix: 'DocAccess'
|
|
89
|
-
}),
|
|
90
|
-
resolve: docAccessResolver(global)
|
|
91
|
-
};
|
|
95
|
+
resolve: update(global)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
92
98
|
if (global.versions) {
|
|
93
99
|
const idType = config.db.defaultIDType === 'number' ? GraphQLInt : GraphQLString;
|
|
94
100
|
const versionGlobalFields = [
|
|
@@ -116,71 +122,75 @@ export function initGlobals({ config, graphqlResult }) {
|
|
|
116
122
|
graphqlResult,
|
|
117
123
|
parentName: `${formattedName}Version`
|
|
118
124
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
if (queriesEnabled) {
|
|
126
|
+
graphqlResult.Query.fields[`version${formatName(formattedName)}`] = {
|
|
127
|
+
type: graphqlResult.globals.graphQL[slug].versionType,
|
|
128
|
+
args: {
|
|
129
|
+
id: {
|
|
130
|
+
type: idType
|
|
131
|
+
},
|
|
132
|
+
draft: {
|
|
133
|
+
type: GraphQLBoolean
|
|
134
|
+
},
|
|
135
|
+
...config.localization ? {
|
|
136
|
+
fallbackLocale: {
|
|
137
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
138
|
+
},
|
|
139
|
+
locale: {
|
|
140
|
+
type: graphqlResult.types.localeInputType
|
|
141
|
+
}
|
|
142
|
+
} : {}
|
|
127
143
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
resolve: findVersionByID(global)
|
|
145
|
+
};
|
|
146
|
+
graphqlResult.Query.fields[`versions${formattedName}`] = {
|
|
147
|
+
type: buildPaginatedListType(`versions${formatName(formattedName)}`, graphqlResult.globals.graphQL[slug].versionType),
|
|
148
|
+
args: {
|
|
149
|
+
where: {
|
|
150
|
+
type: buildWhereInputType({
|
|
151
|
+
name: `versions${formattedName}`,
|
|
152
|
+
fields: versionGlobalFields,
|
|
153
|
+
parentName: `versions${formattedName}`
|
|
154
|
+
})
|
|
131
155
|
},
|
|
132
|
-
|
|
133
|
-
|
|
156
|
+
...config.localization ? {
|
|
157
|
+
fallbackLocale: {
|
|
158
|
+
type: graphqlResult.types.fallbackLocaleInputType
|
|
159
|
+
},
|
|
160
|
+
locale: {
|
|
161
|
+
type: graphqlResult.types.localeInputType
|
|
162
|
+
}
|
|
163
|
+
} : {},
|
|
164
|
+
limit: {
|
|
165
|
+
type: GraphQLInt
|
|
166
|
+
},
|
|
167
|
+
page: {
|
|
168
|
+
type: GraphQLInt
|
|
169
|
+
},
|
|
170
|
+
pagination: {
|
|
171
|
+
type: GraphQLBoolean
|
|
172
|
+
},
|
|
173
|
+
sort: {
|
|
174
|
+
type: GraphQLString
|
|
134
175
|
}
|
|
135
|
-
} : {}
|
|
136
|
-
},
|
|
137
|
-
resolve: findVersionByID(global)
|
|
138
|
-
};
|
|
139
|
-
graphqlResult.Query.fields[`versions${formattedName}`] = {
|
|
140
|
-
type: buildPaginatedListType(`versions${formatName(formattedName)}`, graphqlResult.globals.graphQL[slug].versionType),
|
|
141
|
-
args: {
|
|
142
|
-
where: {
|
|
143
|
-
type: buildWhereInputType({
|
|
144
|
-
name: `versions${formattedName}`,
|
|
145
|
-
fields: versionGlobalFields,
|
|
146
|
-
parentName: `versions${formattedName}`
|
|
147
|
-
})
|
|
148
176
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
177
|
+
resolve: findVersions(global)
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (mutationsEnabled) {
|
|
181
|
+
graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {
|
|
182
|
+
type: graphqlResult.globals.graphQL[slug].type,
|
|
183
|
+
args: {
|
|
184
|
+
id: {
|
|
185
|
+
type: idType
|
|
152
186
|
},
|
|
153
|
-
|
|
154
|
-
type:
|
|
187
|
+
draft: {
|
|
188
|
+
type: GraphQLBoolean
|
|
155
189
|
}
|
|
156
|
-
} : {},
|
|
157
|
-
limit: {
|
|
158
|
-
type: GraphQLInt
|
|
159
190
|
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
pagination: {
|
|
164
|
-
type: GraphQLBoolean
|
|
165
|
-
},
|
|
166
|
-
sort: {
|
|
167
|
-
type: GraphQLString
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
resolve: findVersions(global)
|
|
171
|
-
};
|
|
172
|
-
graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {
|
|
173
|
-
type: graphqlResult.globals.graphQL[slug].type,
|
|
174
|
-
args: {
|
|
175
|
-
id: {
|
|
176
|
-
type: idType
|
|
177
|
-
},
|
|
178
|
-
draft: {
|
|
179
|
-
type: GraphQLBoolean
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
resolve: restoreVersion(global)
|
|
183
|
-
};
|
|
191
|
+
resolve: restoreVersion(global)
|
|
192
|
+
};
|
|
193
|
+
}
|
|
184
194
|
}
|
|
185
195
|
});
|
|
186
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/initGlobals.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLInt, GraphQLNonNull, GraphQLString } from 'graphql'\nimport pluralize from 'pluralize'\nconst { singular } = pluralize\n\nimport type { Field, GraphQLInfo, SanitizedConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { buildVersionGlobalFields, toWords } from 'payload'\n\nimport { docAccessResolver } from '../resolvers/globals/docAccess.js'\nimport { findOne } from '../resolvers/globals/findOne.js'\nimport { findVersionByID } from '../resolvers/globals/findVersionByID.js'\nimport { findVersions } from '../resolvers/globals/findVersions.js'\nimport { restoreVersion } from '../resolvers/globals/restoreVersion.js'\nimport { update } from '../resolvers/globals/update.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { buildMutationInputType } from './buildMutationInputType.js'\nimport { buildObjectType } from './buildObjectType.js'\nimport { buildPaginatedListType } from './buildPaginatedListType.js'\nimport { buildPolicyType } from './buildPoliciesType.js'\nimport { buildWhereInputType } from './buildWhereInputType.js'\n\ntype InitGlobalsGraphQLArgs = {\n config: SanitizedConfig\n graphqlResult: GraphQLInfo\n}\nexport function initGlobals({ config, graphqlResult }: InitGlobalsGraphQLArgs): void {\n Object.keys(graphqlResult.globals.config).forEach((slug) => {\n const global: SanitizedGlobalConfig = graphqlResult.globals.config[slug]\n const { fields, graphQL, versions } = global\n\n if (graphQL === false) {\n return\n }\n\n const formattedName = graphQL?.name ? graphQL.name : singular(toWords(global.slug, true))\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n if (!graphqlResult.globals.graphQL) {\n graphqlResult.globals.graphQL = {}\n }\n\n const updateMutationInputType = buildMutationInputType({\n name: formattedName,\n config,\n fields,\n graphqlResult,\n parentName: formattedName,\n })\n graphqlResult.globals.graphQL[slug] = {\n type: buildObjectType({\n name: formattedName,\n config,\n fields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: formattedName,\n }),\n mutationInputType: updateMutationInputType\n ? new GraphQLNonNull(updateMutationInputType)\n : null,\n }\n\n graphqlResult.Query.fields[formattedName] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findOne(global),\n }\n\n graphqlResult.Mutation.fields[`update${formattedName}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n ...(updateMutationInputType\n ? { data: { type: graphqlResult.globals.graphQL[slug].mutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: update(global),\n }\n\n graphqlResult.Query.fields[`docAccess${formattedName}`] = {\n type: buildPolicyType({\n type: 'global',\n entity: global,\n scope: 'docAccess',\n typeSuffix: 'DocAccess',\n }),\n resolve: docAccessResolver(global),\n }\n\n if (global.versions) {\n const idType = config.db.defaultIDType === 'number' ? GraphQLInt : GraphQLString\n\n const versionGlobalFields: Field[] = [\n ...buildVersionGlobalFields(config, global),\n {\n name: 'id',\n type: config.db.defaultIDType as 'text',\n },\n {\n name: 'createdAt',\n type: 'date',\n label: 'Created At',\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: 'Updated At',\n },\n ]\n\n graphqlResult.globals.graphQL[slug].versionType = buildObjectType({\n name: `${formattedName}Version`,\n config,\n fields: versionGlobalFields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: `${formattedName}Version`,\n })\n\n graphqlResult.Query.fields[`version${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].versionType,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findVersionByID(global),\n }\n graphqlResult.Query.fields[`versions${formattedName}`] = {\n type: buildPaginatedListType(\n `versions${formatName(formattedName)}`,\n graphqlResult.globals.graphQL[slug].versionType,\n ),\n args: {\n where: {\n type: buildWhereInputType({\n name: `versions${formattedName}`,\n fields: versionGlobalFields,\n parentName: `versions${formattedName}`,\n }),\n },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findVersions(global),\n }\n graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n },\n resolve: restoreVersion(global),\n }\n }\n })\n}\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLString","pluralize","singular","buildVersionGlobalFields","toWords","docAccessResolver","findOne","findVersionByID","findVersions","restoreVersion","update","formatName","buildMutationInputType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initGlobals","config","graphqlResult","Object","keys","globals","forEach","slug","global","fields","graphQL","versions","formattedName","name","forceNullableObjectType","Boolean","drafts","updateMutationInputType","parentName","type","forceNullable","mutationInputType","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","resolve","Mutation","data","entity","scope","typeSuffix","idType","db","defaultIDType","versionGlobalFields","label","versionType","id","where","limit","page","pagination","sort"],"mappings":"AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,UAAS;AACnF,OAAO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AMpB,oBAAoB;4BACxBc,MAAM,CAAC,QAAQ,EAAED,eAAe;4BAChCH,QAAQ+B;4BACRtB,YAAY,CAAC,QAAQ,EAAEN,eAAe;wBACxC;oBACF;oBACA,GAAIX,OAAOwB,YAAY,GACnB;wBACEC,gBAAgB;4BAAEP,MAAMjB,cAAcyB,KAAK,CAACC,uBAAuB;wBAAC;wBACpEC,QAAQ;4BAAEV,MAAMjB,cAAcyB,KAAK,CAACG,eAAe;wBAAC;oBACtD,IACA,CAAC,CAAC;oBACNe,OAAO;wBAAE1B,MAAMtC;oBAAW;oBAC1BiE,MAAM;wBAAE3B,MAAMtC;oBAAW;oBACzBkE,YAAY;wBAAE5B,MAAMvC;oBAAe;oBACnCoE,MAAM;wBAAE7B,MAAMpC;oBAAc;gBAC9B;gBACAgD,SAASxC,aAAaiB;YACxB;YACAN,cAAc8B,QAAQ,CAACvB,MAAM,CAAC,CAAC,cAAc,EAAEf,WAAWkB,gBAAgB,CAAC,GAAG;gBAC5EO,MAAMjB,cAAcG,OAAO,CAACK,OAAO,CAACH,KAAK,CAACY,IAAI;gBAC9CI,MAAM;oBACJoB,IAAI;wBAAExB,MAAMkB;oBAAO;oBACnBb,OAAO;wBAAEL,MAAMvC;oBAAe;gBAChC;gBACAmD,SAASvC,eAAegB;YAC1B;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/initGlobals.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLInt, GraphQLNonNull, GraphQLString } from 'graphql'\nimport pluralize from 'pluralize'\nconst { singular } = pluralize\n\nimport type { Field, GraphQLInfo, SanitizedConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { buildVersionGlobalFields, toWords } from 'payload'\n\nimport { docAccessResolver } from '../resolvers/globals/docAccess.js'\nimport { findOne } from '../resolvers/globals/findOne.js'\nimport { findVersionByID } from '../resolvers/globals/findVersionByID.js'\nimport { findVersions } from '../resolvers/globals/findVersions.js'\nimport { restoreVersion } from '../resolvers/globals/restoreVersion.js'\nimport { update } from '../resolvers/globals/update.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { buildMutationInputType } from './buildMutationInputType.js'\nimport { buildObjectType } from './buildObjectType.js'\nimport { buildPaginatedListType } from './buildPaginatedListType.js'\nimport { buildPolicyType } from './buildPoliciesType.js'\nimport { buildWhereInputType } from './buildWhereInputType.js'\n\ntype InitGlobalsGraphQLArgs = {\n config: SanitizedConfig\n graphqlResult: GraphQLInfo\n}\nexport function initGlobals({ config, graphqlResult }: InitGlobalsGraphQLArgs): void {\n Object.keys(graphqlResult.globals.config).forEach((slug) => {\n const global: SanitizedGlobalConfig = graphqlResult.globals.config[slug]\n const { fields, graphQL, versions } = global\n\n if (graphQL === false) {\n return\n }\n\n const formattedName = graphQL?.name ? graphQL.name : singular(toWords(global.slug, true))\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n if (!graphqlResult.globals.graphQL) {\n graphqlResult.globals.graphQL = {}\n }\n\n const updateMutationInputType = buildMutationInputType({\n name: formattedName,\n config,\n fields,\n graphqlResult,\n parentName: formattedName,\n })\n graphqlResult.globals.graphQL[slug] = {\n type: buildObjectType({\n name: formattedName,\n config,\n fields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: formattedName,\n }),\n mutationInputType: updateMutationInputType\n ? new GraphQLNonNull(updateMutationInputType)\n : null,\n }\n\n const queriesEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableQueries\n const mutationsEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableMutations\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[formattedName] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findOne(global),\n }\n\n graphqlResult.Query.fields[`docAccess${formattedName}`] = {\n type: buildPolicyType({\n type: 'global',\n entity: global,\n scope: 'docAccess',\n typeSuffix: 'DocAccess',\n }),\n resolve: docAccessResolver(global),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`update${formattedName}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n ...(updateMutationInputType\n ? { data: { type: graphqlResult.globals.graphQL[slug].mutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: update(global),\n }\n }\n\n if (global.versions) {\n const idType = config.db.defaultIDType === 'number' ? GraphQLInt : GraphQLString\n\n const versionGlobalFields: Field[] = [\n ...buildVersionGlobalFields(config, global),\n {\n name: 'id',\n type: config.db.defaultIDType as 'text',\n },\n {\n name: 'createdAt',\n type: 'date',\n label: 'Created At',\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: 'Updated At',\n },\n ]\n\n graphqlResult.globals.graphQL[slug].versionType = buildObjectType({\n name: `${formattedName}Version`,\n config,\n fields: versionGlobalFields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: `${formattedName}Version`,\n })\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[`version${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].versionType,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findVersionByID(global),\n }\n graphqlResult.Query.fields[`versions${formattedName}`] = {\n type: buildPaginatedListType(\n `versions${formatName(formattedName)}`,\n graphqlResult.globals.graphQL[slug].versionType,\n ),\n args: {\n where: {\n type: buildWhereInputType({\n name: `versions${formattedName}`,\n fields: versionGlobalFields,\n parentName: `versions${formattedName}`,\n }),\n },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findVersions(global),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n },\n resolve: restoreVersion(global),\n }\n }\n }\n })\n}\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLString","pluralize","singular","buildVersionGlobalFields","toWords","docAccessResolver","findOne","findVersionByID","findVersions","restoreVersion","update","formatName","buildMutationInputType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initGlobals","config","graphqlResult","Object","keys","globals","forEach","slug","global","fields","graphQL","versions","formattedName","name","forceNullableObjectType","Boolean","drafts","updateMutationInputType","parentName","type","forceNullable","mutationInputType","queriesEnabled","disableQueries","mutationsEnabled","disableMutations","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","resolve","entity","scope","typeSuffix","Mutation","data","idType","db","defaultIDType","versionGlobalFields","label","versionType","id","where","limit","page","pagination","sort"],"mappings":"AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,UAAS;AACnF,OAAOC,eAAe,YAAW;AACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AAIrB,SAASE,wBAAwB,EAAEC,OAAO,QAAQ,UAAS;AAE3D,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,eAAe,QAAQ,0CAAyC;AACzE,SAASC,YAAY,QAAQ,uCAAsC;AACnE,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,UAAU,QAAQ,6BAA4B;AACvD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAA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wBACF;wBACA,GAAIX,OAAO4B,YAAY,GACnB;4BACEC,gBAAgB;gCAAEX,MAAMjB,cAAc6B,KAAK,CAACC,uBAAuB;4BAAC;4BACpEC,QAAQ;gCAAEd,MAAMjB,cAAc6B,KAAK,CAACG,eAAe;4BAAC;wBACtD,IACA,CAAC,CAAC;wBACNe,OAAO;4BAAE9B,MAAMtC;wBAAW;wBAC1BqE,MAAM;4BAAE/B,MAAMtC;wBAAW;wBACzBsE,YAAY;4BAAEhC,MAAMvC;wBAAe;wBACnCwE,MAAM;4BAAEjC,MAAMpC;wBAAc;oBAC9B;oBACAoD,SAAS5C,aAAaiB;gBACxB;YACF;YAEA,IAAIgB,kBAAkB;gBACpBtB,cAAcqC,QAAQ,CAAC9B,MAAM,CAAC,CAAC,cAAc,EAAEf,WAAWkB,gBAAgB,CAAC,GAAG;oBAC5EO,MAAMjB,cAAcG,OAAO,CAACK,OAAO,CAACH,KAAK,CAACY,IAAI;oBAC9CQ,MAAM;wBACJoB,IAAI;4BAAE5B,MAAMsB;wBAAO;wBACnBb,OAAO;4BAAET,MAAMvC;wBAAe;oBAChC;oBACAuD,SAAS3C,eAAegB;gBAC1B;YACF;QACF;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/graphql",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@types/pluralize": "^0.0.33",
|
|
53
53
|
"graphql-http": "^1.22.0",
|
|
54
54
|
"@payloadcms/eslint-config": "3.9.0",
|
|
55
|
-
"payload": "3.
|
|
55
|
+
"payload": "3.13.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"graphql": "^16.8.1",
|
|
59
|
-
"payload": "3.
|
|
59
|
+
"payload": "3.13.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "pnpm build:types && pnpm build:swc",
|