@payloadcms/graphql 3.0.0-beta.71 → 3.0.0-beta.72
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/exports/types.d.ts +1 -1
- package/dist/exports/types.d.ts.map +1 -1
- package/dist/exports/types.js +1 -1
- package/dist/exports/types.js.map +1 -1
- package/dist/resolvers/collections/restoreVersion.d.ts +1 -0
- package/dist/resolvers/collections/restoreVersion.d.ts.map +1 -1
- package/dist/resolvers/collections/restoreVersion.js +1 -0
- package/dist/resolvers/collections/restoreVersion.js.map +1 -1
- package/dist/resolvers/globals/restoreVersion.d.ts +1 -0
- package/dist/resolvers/globals/restoreVersion.d.ts.map +1 -1
- package/dist/resolvers/globals/restoreVersion.js +1 -0
- package/dist/resolvers/globals/restoreVersion.js.map +1 -1
- package/dist/schema/initCollections.d.ts.map +1 -1
- package/dist/schema/initCollections.js +3 -0
- package/dist/schema/initCollections.js.map +1 -1
- package/dist/schema/initGlobals.d.ts.map +1 -1
- package/dist/schema/initGlobals.js +6 -0
- package/dist/schema/initGlobals.js.map +1 -1
- package/package.json +3 -3
package/dist/exports/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { GraphQLJSON, GraphQLJSONObject } from '../packages/graphql-type-json/index.js';
|
|
2
2
|
export { buildPaginatedListType } from '../schema/buildPaginatedListType.js';
|
|
3
|
-
export
|
|
3
|
+
export * as GraphQL from 'graphql';
|
|
4
4
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA"}
|
package/dist/exports/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { GraphQLJSON, GraphQLJSONObject } from '../packages/graphql-type-json/index.js';
|
|
2
2
|
export { buildPaginatedListType } from '../schema/buildPaginatedListType.js';
|
|
3
|
-
export
|
|
3
|
+
export * as GraphQL from 'graphql';
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export { GraphQLJSON, GraphQLJSONObject } from '../packages/graphql-type-json/index.js'\nexport { buildPaginatedListType } from '../schema/buildPaginatedListType.js'\nexport
|
|
1
|
+
{"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export { GraphQLJSON, GraphQLJSONObject } from '../packages/graphql-type-json/index.js'\nexport { buildPaginatedListType } from '../schema/buildPaginatedListType.js'\nexport * as GraphQL from 'graphql'\n"],"names":["GraphQLJSON","GraphQLJSONObject","buildPaginatedListType","GraphQL"],"mappings":"AAAA,SAASA,WAAW,EAAEC,iBAAiB,QAAQ,yCAAwC;AACvF,SAASC,sBAAsB,QAAQ,sCAAqC;AAC5E,OAAO,KAAKC,OAAO,MAAM,UAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/resolvers/collections/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAMzD,MAAM,MAAM,QAAQ,GAAG,CACrB,CAAC,EAAE,OAAO,EACV,IAAI,EAAE;IACJ,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB,EACD,OAAO,EAAE;IACP,GAAG,EAAE,cAAc,CAAA;CACpB,KACE,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEtB,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/resolvers/collections/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAMzD,MAAM,MAAM,QAAQ,GAAG,CACrB,CAAC,EAAE,OAAO,EACV,IAAI,EAAE;IACJ,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB,EACD,OAAO,EAAE;IACP,GAAG,EAAE,cAAc,CAAA;CACpB,KACE,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEtB,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,CAe/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/collections/restoreVersion.ts"],"sourcesContent":["import type { Collection, PayloadRequest } from 'payload'\n\nimport { isolateObjectProperty, restoreVersionOperation } from 'payload'\n\nimport type { Context } from '../types.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n id: number | string\n },\n context: {\n req: PayloadRequest\n },\n) => Promise<Document>\n\nexport default function restoreVersionResolver(collection: Collection): Resolver {\n async function resolver(_, args, context: Context) {\n const options = {\n id: args.id,\n collection,\n depth: 0,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await restoreVersionOperation(options)\n return result\n }\n\n return resolver\n}\n"],"names":["isolateObjectProperty","restoreVersionOperation","restoreVersionResolver","collection","resolver","_","args","context","options","id","depth","req","result"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,uBAAuB,QAAQ,UAAS;
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/collections/restoreVersion.ts"],"sourcesContent":["import type { Collection, PayloadRequest } from 'payload'\n\nimport { isolateObjectProperty, restoreVersionOperation } from 'payload'\n\nimport type { Context } from '../types.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n id: number | string\n },\n context: {\n req: PayloadRequest\n },\n) => Promise<Document>\n\nexport default function restoreVersionResolver(collection: Collection): Resolver {\n async function resolver(_, args, context: Context) {\n const options = {\n id: args.id,\n collection,\n depth: 0,\n draft: args.draft,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await restoreVersionOperation(options)\n return result\n }\n\n return resolver\n}\n"],"names":["isolateObjectProperty","restoreVersionOperation","restoreVersionResolver","collection","resolver","_","args","context","options","id","depth","draft","req","result"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,uBAAuB,QAAQ,UAAS;AAexE,eAAe,SAASC,uBAAuBC,UAAsB;IACnE,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAgB;QAC/C,MAAMC,UAAU;YACdC,IAAIH,KAAKG,EAAE;YACXN;YACAO,OAAO;YACPC,OAAOL,KAAKK,KAAK;YACjBC,KAAKZ,sBAAsBO,QAAQK,GAAG,EAAE;QAC1C;QAEA,MAAMC,SAAS,MAAMZ,wBAAwBO;QAC7C,OAAOK;IACT;IAEA,OAAOT;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/resolvers/globals/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAM9E,KAAK,QAAQ,GAAG,CACd,CAAC,EAAE,OAAO,EACV,IAAI,EAAE;IACJ,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB,EACD,OAAO,EAAE;IACP,GAAG,EAAE,cAAc,CAAA;CACpB,KACE,OAAO,CAAC,QAAQ,CAAC,CAAA;AACtB,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,YAAY,EAAE,qBAAqB,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/resolvers/globals/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAM9E,KAAK,QAAQ,GAAG,CACd,CAAC,EAAE,OAAO,EACV,IAAI,EAAE;IACJ,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB,EACD,OAAO,EAAE;IACP,GAAG,EAAE,cAAc,CAAA;CACpB,KACE,OAAO,CAAC,QAAQ,CAAC,CAAA;AACtB,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,YAAY,EAAE,qBAAqB,GAAG,QAAQ,CAa5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/globals/restoreVersion.ts"],"sourcesContent":["import type { Document, PayloadRequest, SanitizedGlobalConfig } from 'payload'\n\nimport { isolateObjectProperty, restoreVersionOperationGlobal } from 'payload'\n\nimport type { Context } from '../types.js'\n\ntype Resolver = (\n _: unknown,\n args: {\n id: number | string\n },\n context: {\n req: PayloadRequest\n },\n) => Promise<Document>\nexport default function restoreVersionResolver(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context: Context) {\n const options = {\n id: args.id,\n depth: 0,\n globalConfig,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await restoreVersionOperationGlobal(options)\n return result\n }\n}\n"],"names":["isolateObjectProperty","restoreVersionOperationGlobal","restoreVersionResolver","globalConfig","resolver","_","args","context","options","id","depth","req","result"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,6BAA6B,QAAQ,UAAS;
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/globals/restoreVersion.ts"],"sourcesContent":["import type { Document, PayloadRequest, SanitizedGlobalConfig } from 'payload'\n\nimport { isolateObjectProperty, restoreVersionOperationGlobal } from 'payload'\n\nimport type { Context } from '../types.js'\n\ntype Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n id: number | string\n },\n context: {\n req: PayloadRequest\n },\n) => Promise<Document>\nexport default function restoreVersionResolver(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context: Context) {\n const options = {\n id: args.id,\n depth: 0,\n draft: args.draft,\n globalConfig,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await restoreVersionOperationGlobal(options)\n return result\n }\n}\n"],"names":["isolateObjectProperty","restoreVersionOperationGlobal","restoreVersionResolver","globalConfig","resolver","_","args","context","options","id","depth","draft","req","result"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,6BAA6B,QAAQ,UAAS;AAc9E,eAAe,SAASC,uBAAuBC,YAAmC;IAChF,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAgB;QACtD,MAAMC,UAAU;YACdC,IAAIH,KAAKG,EAAE;YACXC,OAAO;YACPC,OAAOL,KAAKK,KAAK;YACjBR;YACAS,KAAKZ,sBAAsBO,QAAQK,GAAG,EAAE;QAC1C;QAEA,MAAMC,SAAS,MAAMZ,8BAA8BO;QACnD,OAAOK;IACT;AACF"}
|
|
@@ -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,iBAAS,sBAAsB,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,iBAAS,sBAAsB,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,0BAA0B,GAAG,IAAI,CAgd3F;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -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 } 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}\nfunction initCollectionsGraphQL({ 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) return\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: 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 if (collectionConfig.auth && !collectionConfig.auth.disableLocalStrategy) {\n fields.push({\n name: 'password',\n type: 'text',\n label: 'Password',\n required: true,\n })\n }\n\n const createMutationInputType = buildMutationInputType({\n name: singularName,\n config,\n fields,\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: fields.filter((field) => !(fieldAffectsData(field) && field.name === 'id')),\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 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 },\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(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 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 },\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 =\n !collectionConfig.auth.loginWithUsername ||\n collectionConfig.auth.loginWithUsername?.allowEmailLogin\n const canLoginWithUsername = collectionConfig.auth.loginWithUsername\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\nexport default initCollectionsGraphQL\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLObjectType","GraphQLString","buildVersionCollectionFields","flattenTopLevelFields","formatNames","toWords","fieldAffectsData","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","initCollectionsGraphQL","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","auth","disableLocalStrategy","label","required","createMutationInputType","mutationInputType","updateMutationInputType","filter","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","resolve","where","limit","page","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,QAAQ,iBAAgB;AAIjD,OAAOC,oBAAoB,sCAAqC;AAChE,OAAOC,UAAU,4BAA2B;AAC5C,OAAOC,WAAW,6BAA4B;AAC9C,OAAOC,YAAY,8BAA6B;AAChD,OAAOC,QAAQ,0BAAyB;AACxC,OAAOC,aAAa,+BAA8B;AAClD,OAAOC,mBAAmB,qCAAoC;AAC9D,OAAOC,YAAY,8BAA6B;AAChD,OAAOC,iBAAiB,mCAAkC;AAC1D,SAASC,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,oBAAoB,qCAAoC;AAC/D,SAASC,iBAAiB,QAAQ,qCAAoC;AACtE,SAASC,iBAAiB,QAAQ,wCAAuC;AACzE,OAAOC,uBAAuB,wCAAuC;AACrE,SAASC,YAAY,QAAQ,mCAAkC;AAC/D,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,uBAAuB,QAAQ,8CAA6C;AACrF,SAASC,oBAAoB,QAAQ,2CAA0C;AAC/E,OAAOC,4BAA4B,6CAA4C;AAC/E,SAASC,cAAc,QAAQ,qCAAoC;AACnE,OAAOC,gBAAgB,6BAA4B;AACnD,SAASC,sBAAsB,EAAEC,mBAAmB,QAAQ,8BAA6B;AACzF,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,8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AAC;wBACvCG,QAAQ;4BACNoE,OAAO;gCAAElD,MAAM7D;4BAAc;4BAC7BgH,MAAM;gCAAEnD,MAAMpB,WAAWG,OAAO,CAACiB,IAAI;4BAAC;wBACxC;oBACF;oBACAkB,MAAM;wBACJuC,UAAU;4BAAEzD,MAAM7D;wBAAc;wBAChC+G,OAAO;4BAAElD,MAAM7D;wBAAc;oBAC/B;oBACAuF,SAAS3E,cAAc6B;gBACzB;gBAEAN,cAAc6D,QAAQ,CAACrD,MAAM,CAAC,CAAC,WAAW,EAAEG,aAAa,CAAC,CAAC,GAAG;oBAC5De,MAAMjE;oBACNmF,MAAM;wBACJgC,OAAO;4BAAElD,MAAM7D;wBAAc;oBAC/B;oBACAuF,SAASzE,YAAY2B;gBACvB;YACF;QACF;IACF;AACF;AAEA,eAAeR,uBAAsB"}
|
|
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 } 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}\nfunction initCollectionsGraphQL({ 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) return\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: 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 if (collectionConfig.auth && !collectionConfig.auth.disableLocalStrategy) {\n fields.push({\n name: 'password',\n type: 'text',\n label: 'Password',\n required: true,\n })\n }\n\n const createMutationInputType = buildMutationInputType({\n name: singularName,\n config,\n fields,\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: fields.filter((field) => !(fieldAffectsData(field) && field.name === 'id')),\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 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 },\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(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 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 =\n !collectionConfig.auth.loginWithUsername ||\n collectionConfig.auth.loginWithUsername?.allowEmailLogin\n const canLoginWithUsername = collectionConfig.auth.loginWithUsername\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\nexport default initCollectionsGraphQL\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLObjectType","GraphQLString","buildVersionCollectionFields","flattenTopLevelFields","formatNames","toWords","fieldAffectsData","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","initCollectionsGraphQL","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","auth","disableLocalStrategy","label","required","createMutationInputType","mutationInputType","updateMutationInputType","filter","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","resolve","where","limit","page","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,QAAQ,iBAAgB;AAIjD,OAAOC,oBAAoB,sCAAqC;AAChE,OAAOC,UAAU,4BAA2B;AAC5C,OAAOC,WAAW,6BAA4B;AAC9C,OAAOC,YAAY,8BAA6B;AAChD,OAAOC,QAAQ,0BAAyB;AACxC,OAAOC,aAAa,+BAA8B;AAClD,OAAOC,mBAAmB,qCAAoC;AAC9D,OAAOC,YAAY,8BAA6B;AAChD,OAAOC,iBAAiB,mCAAkC;AAC1D,SAASC,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,oBAAoB,qCAAoC;AAC/D,SAASC,iBAAiB,QAAQ,qCAAoC;AACtE,SAASC,iBAAiB,QAAQ,wCAAuC;AACzE,OAAOC,uBAAuB,wCAAuC;AACrE,SAASC,YAAY,QAAQ,mCAAkC;AAC/D,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,uBAAuB,QAAQ,8CAA6C;AACrF,SAASC,oBAAoB,QAAQ,2CAA0C;AAC/E,OAAOC,4BAA4B,6CAA4C;AAC/E,SAASC,cAAc,QAAQ,qCAAoC;AACnE,OAAOC,gBA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gBAEAN,cAAc6D,QAAQ,CAACrD,MAAM,CAAC,CAAC,aAAa,EAAEG,aAAa,CAAC,CAAC,GAAG;oBAC9De,MAAM,IAAI9D,kBAAkB;wBAC1BuD,MAAM5B,WAAW,CAAC,EAAEc,KAAK,aAAa,CAAC;wBACvCG,QAAQ;4BACNoE,OAAO;gCAAElD,MAAM7D;4BAAc;4BAC7BgH,MAAM;gCAAEnD,MAAMpB,WAAWG,OAAO,CAACiB,IAAI;4BAAC;wBACxC;oBACF;oBACAkB,MAAM;wBACJuC,UAAU;4BAAEzD,MAAM7D;wBAAc;wBAChC+G,OAAO;4BAAElD,MAAM7D;wBAAc;oBAC/B;oBACAuF,SAAS3E,cAAc6B;gBACzB;gBAEAN,cAAc6D,QAAQ,CAACrD,MAAM,CAAC,CAAC,WAAW,EAAEG,aAAa,CAAC,CAAC,GAAG;oBAC5De,MAAMjE;oBACNmF,MAAM;wBACJgC,OAAO;4BAAElD,MAAM7D;wBAAc;oBAC/B;oBACAuF,SAASzE,YAAY2B;gBACvB;YACF;QACF;IACF;AACF;AAEA,eAAeR,uBAAsB"}
|
|
@@ -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,iBAAS,kBAAkB,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,iBAAS,kBAAkB,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,sBAAsB,GAAG,IAAI,CA2JnF;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -120,6 +120,9 @@ function initGlobalsGraphQL({ config, graphqlResult }) {
|
|
|
120
120
|
id: {
|
|
121
121
|
type: idType
|
|
122
122
|
},
|
|
123
|
+
draft: {
|
|
124
|
+
type: GraphQLBoolean
|
|
125
|
+
},
|
|
123
126
|
...config.localization ? {
|
|
124
127
|
fallbackLocale: {
|
|
125
128
|
type: graphqlResult.types.fallbackLocaleInputType
|
|
@@ -166,6 +169,9 @@ function initGlobalsGraphQL({ config, graphqlResult }) {
|
|
|
166
169
|
args: {
|
|
167
170
|
id: {
|
|
168
171
|
type: idType
|
|
172
|
+
},
|
|
173
|
+
draft: {
|
|
174
|
+
type: GraphQLBoolean
|
|
169
175
|
}
|
|
170
176
|
},
|
|
171
177
|
resolve: restoreVersionResolver(global)
|
|
@@ -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 findOneResolver from '../resolvers/globals/findOne.js'\nimport findVersionByIDResolver from '../resolvers/globals/findVersionByID.js'\nimport findVersionsResolver from '../resolvers/globals/findVersions.js'\nimport restoreVersionResolver from '../resolvers/globals/restoreVersion.js'\nimport updateResolver 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}\nfunction initGlobalsGraphQL({ 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) graphqlResult.globals.graphQL = {}\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: findOneResolver(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: updateResolver(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(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 ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: findVersionByIDResolver(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 sort: { type: GraphQLString },\n },\n resolve: findVersionsResolver(global),\n }\n graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n id: { type: idType },\n },\n resolve: restoreVersionResolver(global),\n }\n }\n })\n}\n\nexport default initGlobalsGraphQL\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLString","pluralize","singular","buildVersionGlobalFields","toWords","docAccessResolver","findOneResolver","findVersionByIDResolver","findVersionsResolver","restoreVersionResolver","updateResolver","formatName","buildMutationInputType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initGlobalsGraphQL","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","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,OAAOC,qBAAqB,kCAAiC;AAC7D,OAAOC,6BAA6B,0CAAyC;AAC7E,OAAOC,0BAA0B,uCAAsC;AACvE,OAAOC,4BAA4B,yCAAwC;AAC3E,OAAOC,oBAAoB,iCAAgC;AAC3D,OAAOC,gBAAgB,6BAA4B;AACnD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,yBAAwB;AACxD,OAAOC,yBAAyB,2BAA0B;AAM1D,SAASC,mBAAmB,EAAEC,MAAM,EAAEC,aAAa,EAA0B;IAC3EC,OAAOC,IAAI,CAACF,cAAcG,OAAO,CAACJ,MAAM,EAAEK,OAAO,CAAC,CAACC;QACjD,MAAMC,SAAgCN,cAAcG,OAAO,CAACJ,MAAM,CAACM,KAAK;QACxE,MAAM,EAAEE,MAAM,EAAEC,OAAO,EAAEC,QAA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|
|
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 findOneResolver from '../resolvers/globals/findOne.js'\nimport findVersionByIDResolver from '../resolvers/globals/findVersionByID.js'\nimport findVersionsResolver from '../resolvers/globals/findVersions.js'\nimport restoreVersionResolver from '../resolvers/globals/restoreVersion.js'\nimport updateResolver 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}\nfunction initGlobalsGraphQL({ 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) graphqlResult.globals.graphQL = {}\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: findOneResolver(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: updateResolver(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(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: findVersionByIDResolver(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 sort: { type: GraphQLString },\n },\n resolve: findVersionsResolver(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: restoreVersionResolver(global),\n }\n }\n })\n}\n\nexport default initGlobalsGraphQL\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLString","pluralize","singular","buildVersionGlobalFields","toWords","docAccessResolver","findOneResolver","findVersionByIDResolver","findVersionsResolver","restoreVersionResolver","updateResolver","formatName","buildMutationInputType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initGlobalsGraphQL","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","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,OAAOC,qBAAqB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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,MAAM;wBAAE5B,MAAMpC;oBAAc;gBAC9B;gBACAgD,SAASxC,qBAAqBiB;YAChC;YACAN,cAAc8B,QAAQ,CAACvB,MAAM,CAAC,CAAC,cAAc,EAAEf,WAAWkB,eAAe,CAAC,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,uBAAuBgB;YAClC;QACF;IACF;AACF;AAEA,eAAeR,mBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/graphql",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.72",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@types/pluralize": "^0.0.33",
|
|
43
43
|
"graphql-http": "^1.22.0",
|
|
44
44
|
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
|
45
|
-
"payload": "3.0.0-beta.
|
|
45
|
+
"payload": "3.0.0-beta.72"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"graphql": "^16.8.1",
|
|
49
|
-
"payload": "3.0.0-beta.
|
|
49
|
+
"payload": "3.0.0-beta.72"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "pnpm build:types && pnpm build:swc",
|