@payloadcms/graphql 4.0.0-beta.6 → 4.0.0-beta.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/resolvers/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,wBAAgB,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CA8BjD"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/resolvers/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,wBAAgB,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CA+BjD"}
@@ -19,6 +19,7 @@ export function login(collection) {
19
19
  });
20
20
  context.headers['Set-Cookie'] = cookie;
21
21
  if (collection.config.auth.removeTokenFromResponses) {
22
+ delete result.refreshToken;
22
23
  delete result.token;
23
24
  }
24
25
  return result;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/resolvers/auth/login.ts"],"sourcesContent":["import type { Collection } from 'payload'\n\nimport { generatePayloadCookie, isolateObjectProperty, loginOperation } from 'payload'\n\nimport type { Context } from '../types.js'\n\nexport function login(collection: Collection): any {\n async function resolver(_, args, context: Context) {\n const options = {\n collection,\n data: {\n email: args.email,\n password: args.password,\n username: args.username,\n },\n depth: 0,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await loginOperation(options)\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: context.req.payload.config.cookiePrefix,\n token: result.token,\n })\n\n context.headers['Set-Cookie'] = cookie\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return result\n }\n\n return resolver\n}\n"],"names":["generatePayloadCookie","isolateObjectProperty","loginOperation","login","collection","resolver","_","args","context","options","data","email","password","username","depth","req","result","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","token","headers","removeTokenFromResponses"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,qBAAqB,EAAEC,cAAc,QAAQ,UAAS;AAItF,OAAO,SAASC,MAAMC,UAAsB;IAC1C,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAgB;QAC/C,MAAMC,UAAU;YACdL;YACAM,MAAM;gBACJC,OAAOJ,KAAKI,KAAK;gBACjBC,UAAUL,KAAKK,QAAQ;gBACvBC,UAAUN,KAAKM,QAAQ;YACzB;YACAC,OAAO;YACPC,KAAKd,sBAAsBO,QAAQO,GAAG,EAAE;QAC1C;QAEA,MAAMC,SAAS,MAAMd,eAAeO;QACpC,MAAMQ,SAASjB,sBAAsB;YACnCkB,sBAAsBd,WAAWe,MAAM,CAACC,IAAI;YAC5CC,cAAcb,QAAQO,GAAG,CAACO,OAAO,CAACH,MAAM,CAACE,YAAY;YACrDE,OAAOP,OAAOO,KAAK;QACrB;QAEAf,QAAQgB,OAAO,CAAC,aAAa,GAAGP;QAEhC,IAAIb,WAAWe,MAAM,CAACC,IAAI,CAACK,wBAAwB,EAAE;YACnD,OAAOT,OAAOO,KAAK;QACrB;QAEA,OAAOP;IACT;IAEA,OAAOX;AACT"}
1
+ {"version":3,"sources":["../../../src/resolvers/auth/login.ts"],"sourcesContent":["import type { Collection } from 'payload'\n\nimport { generatePayloadCookie, isolateObjectProperty, loginOperation } from 'payload'\n\nimport type { Context } from '../types.js'\n\nexport function login(collection: Collection): any {\n async function resolver(_, args, context: Context) {\n const options = {\n collection,\n data: {\n email: args.email,\n password: args.password,\n username: args.username,\n },\n depth: 0,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await loginOperation(options)\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: context.req.payload.config.cookiePrefix,\n token: result.token,\n })\n\n context.headers['Set-Cookie'] = cookie\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.refreshToken\n delete result.token\n }\n\n return result\n }\n\n return resolver\n}\n"],"names":["generatePayloadCookie","isolateObjectProperty","loginOperation","login","collection","resolver","_","args","context","options","data","email","password","username","depth","req","result","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","token","headers","removeTokenFromResponses","refreshToken"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,qBAAqB,EAAEC,cAAc,QAAQ,UAAS;AAItF,OAAO,SAASC,MAAMC,UAAsB;IAC1C,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAgB;QAC/C,MAAMC,UAAU;YACdL;YACAM,MAAM;gBACJC,OAAOJ,KAAKI,KAAK;gBACjBC,UAAUL,KAAKK,QAAQ;gBACvBC,UAAUN,KAAKM,QAAQ;YACzB;YACAC,OAAO;YACPC,KAAKd,sBAAsBO,QAAQO,GAAG,EAAE;QAC1C;QAEA,MAAMC,SAAS,MAAMd,eAAeO;QACpC,MAAMQ,SAASjB,sBAAsB;YACnCkB,sBAAsBd,WAAWe,MAAM,CAACC,IAAI;YAC5CC,cAAcb,QAAQO,GAAG,CAACO,OAAO,CAACH,MAAM,CAACE,YAAY;YACrDE,OAAOP,OAAOO,KAAK;QACrB;QAEAf,QAAQgB,OAAO,CAAC,aAAa,GAAGP;QAEhC,IAAIb,WAAWe,MAAM,CAACC,IAAI,CAACK,wBAAwB,EAAE;YACnD,OAAOT,OAAOU,YAAY;YAC1B,OAAOV,OAAOO,KAAK;QACrB;QAEA,OAAOP;IACT;IAEA,OAAOX;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/resolvers/auth/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,wBAAgB,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAwBnD"}
1
+ {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/resolvers/auth/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,wBAAgB,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CA0BnD"}
@@ -1,9 +1,10 @@
1
1
  import { generatePayloadCookie, isolateObjectProperty, refreshOperation } from 'payload';
2
2
  export function refresh(collection) {
3
- async function resolver(_, __, context) {
3
+ async function resolver(_, args, context) {
4
4
  const options = {
5
5
  collection,
6
6
  depth: 0,
7
+ refreshToken: args.refreshToken,
7
8
  req: isolateObjectProperty(context.req, 'transactionID')
8
9
  };
9
10
  const result = await refreshOperation(options);
@@ -15,6 +16,7 @@ export function refresh(collection) {
15
16
  context.headers['Set-Cookie'] = cookie;
16
17
  if (collection.config.auth.removeTokenFromResponses) {
17
18
  delete result.refreshedToken;
19
+ delete result.refreshToken;
18
20
  }
19
21
  return result;
20
22
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/resolvers/auth/refresh.ts"],"sourcesContent":["import type { Collection } from 'payload'\n\nimport { generatePayloadCookie, isolateObjectProperty, refreshOperation } from 'payload'\n\nimport type { Context } from '../types.js'\n\nexport function refresh(collection: Collection): any {\n async function resolver(_, __, context: Context) {\n const options = {\n collection,\n depth: 0,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await refreshOperation(options)\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: context.req.payload.config.cookiePrefix,\n token: result.refreshedToken,\n })\n context.headers['Set-Cookie'] = cookie\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.refreshedToken\n }\n\n return result\n }\n\n return resolver\n}\n"],"names":["generatePayloadCookie","isolateObjectProperty","refreshOperation","refresh","collection","resolver","_","__","context","options","depth","req","result","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","token","refreshedToken","headers","removeTokenFromResponses"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,qBAAqB,EAAEC,gBAAgB,QAAQ,UAAS;AAIxF,OAAO,SAASC,QAAQC,UAAsB;IAC5C,eAAeC,SAASC,CAAC,EAAEC,EAAE,EAAEC,OAAgB;QAC7C,MAAMC,UAAU;YACdL;YACAM,OAAO;YACPC,KAAKV,sBAAsBO,QAAQG,GAAG,EAAE;QAC1C;QAEA,MAAMC,SAAS,MAAMV,iBAAiBO;QACtC,MAAMI,SAASb,sBAAsB;YACnCc,sBAAsBV,WAAWW,MAAM,CAACC,IAAI;YAC5CC,cAAcT,QAAQG,GAAG,CAACO,OAAO,CAACH,MAAM,CAACE,YAAY;YACrDE,OAAOP,OAAOQ,cAAc;QAC9B;QACAZ,QAAQa,OAAO,CAAC,aAAa,GAAGR;QAEhC,IAAIT,WAAWW,MAAM,CAACC,IAAI,CAACM,wBAAwB,EAAE;YACnD,OAAOV,OAAOQ,cAAc;QAC9B;QAEA,OAAOR;IACT;IAEA,OAAOP;AACT"}
1
+ {"version":3,"sources":["../../../src/resolvers/auth/refresh.ts"],"sourcesContent":["import type { Collection } from 'payload'\n\nimport { generatePayloadCookie, isolateObjectProperty, refreshOperation } from 'payload'\n\nimport type { Context } from '../types.js'\n\nexport function refresh(collection: Collection): any {\n async function resolver(_, args, context: Context) {\n const options = {\n collection,\n depth: 0,\n refreshToken: args.refreshToken,\n req: isolateObjectProperty(context.req, 'transactionID'),\n }\n\n const result = await refreshOperation(options)\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: context.req.payload.config.cookiePrefix,\n token: result.refreshedToken,\n })\n context.headers['Set-Cookie'] = cookie\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.refreshedToken\n delete result.refreshToken\n }\n\n return result\n }\n\n return resolver\n}\n"],"names":["generatePayloadCookie","isolateObjectProperty","refreshOperation","refresh","collection","resolver","_","args","context","options","depth","refreshToken","req","result","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","token","refreshedToken","headers","removeTokenFromResponses"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,qBAAqB,EAAEC,gBAAgB,QAAQ,UAAS;AAIxF,OAAO,SAASC,QAAQC,UAAsB;IAC5C,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAgB;QAC/C,MAAMC,UAAU;YACdL;YACAM,OAAO;YACPC,cAAcJ,KAAKI,YAAY;YAC/BC,KAAKX,sBAAsBO,QAAQI,GAAG,EAAE;QAC1C;QAEA,MAAMC,SAAS,MAAMX,iBAAiBO;QACtC,MAAMK,SAASd,sBAAsB;YACnCe,sBAAsBX,WAAWY,MAAM,CAACC,IAAI;YAC5CC,cAAcV,QAAQI,GAAG,CAACO,OAAO,CAACH,MAAM,CAACE,YAAY;YACrDE,OAAOP,OAAOQ,cAAc;QAC9B;QACAb,QAAQc,OAAO,CAAC,aAAa,GAAGR;QAEhC,IAAIV,WAAWY,MAAM,CAACC,IAAI,CAACM,wBAAwB,EAAE;YACnD,OAAOV,OAAOQ,cAAc;YAC5B,OAAOR,OAAOF,YAAY;QAC5B;QAEA,OAAOE;IACT;IAEA,OAAOR;AACT"}
@@ -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;AA2ChB,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,CA2jB3F"}
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;AA2ChB,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,CAokB3F"}
@@ -540,11 +540,21 @@ export function initCollections({ config, graphqlResult }) {
540
540
  refreshedToken: {
541
541
  type: GraphQLString
542
542
  },
543
+ ...collectionConfig.auth.refreshTokens ? {
544
+ refreshToken: {
545
+ type: GraphQLString
546
+ }
547
+ } : {},
543
548
  user: {
544
549
  type: collection.graphQL.JWT
545
550
  }
546
551
  }
547
552
  }),
553
+ args: collectionConfig.auth.refreshTokens ? {
554
+ refreshToken: {
555
+ type: GraphQLString
556
+ }
557
+ } : undefined,
548
558
  resolve: refresh(collection)
549
559
  };
550
560
  graphqlResult.Mutation.fields[`logout${singularName}`] = {
@@ -583,6 +593,11 @@ export function initCollections({ config, graphqlResult }) {
583
593
  exp: {
584
594
  type: GraphQLInt
585
595
  },
596
+ ...collectionConfig.auth.refreshTokens ? {
597
+ refreshToken: {
598
+ type: GraphQLString
599
+ }
600
+ } : {},
586
601
  token: {
587
602
  type: GraphQLString
588
603
  },
@@ -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 { renameFileResolver } from '../resolvers/collections/renameFile.js'\nimport { restoreVersionResolver } from '../resolvers/collections/restoreVersion.js'\nimport { updateResolver } from '../resolvers/collections/update.js'\nimport { validateResolver } from '../resolvers/collections/validate.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 = {}, 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 if (collectionConfig.auth) {\n baseFields._strategy = { type: GraphQLString }\n }\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n collection.graphQL.type = buildObjectType({\n name: singularName,\n baseFields,\n collectionSlug: collectionConfig.slug,\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 let mutationCreateInputFields = mutationInputFields\n\n if (\n config.db.allowIDOnCreate &&\n !collectionConfig.flattenedFields.some((field) => field.name === 'id')\n ) {\n mutationCreateInputFields = [\n ...mutationCreateInputFields,\n {\n name: 'id',\n type: config.db.defaultIDType,\n } as Field,\n ]\n }\n\n const createMutationInputType = buildMutationInputType({\n name: singularName,\n config,\n fields: mutationCreateInputFields,\n graphqlResult,\n parentIsLocalized: false,\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 parentIsLocalized: false,\n parentName: `${singularName}Update`,\n })\n if (updateMutationInputType) {\n collection.graphQL.updateMutationInputType = new GraphQLNonNull(updateMutationInputType)\n }\n\n const validationMutationInputType = buildMutationInputType({\n name: `${singularName}Validation`,\n config,\n fields: mutationCreateInputFields,\n forceNullable: true,\n graphqlResult,\n parentIsLocalized: false,\n parentName: `${singularName}Validation`,\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 select: { type: GraphQLBoolean },\n trash: { type: GraphQLBoolean },\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 select: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n trash: { type: GraphQLBoolean },\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 trash: { 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 trash: { type: GraphQLBoolean },\n },\n resolve: updateResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`validate${singularName}`] = {\n type: graphqlResult.types.validationResultType,\n args: {\n id: { type: idType },\n ...(validationMutationInputType ? { data: { type: validationMutationInputType } } : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: validateResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`delete${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n trash: { type: GraphQLBoolean },\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: ({ t }) => t('general:createdAt'),\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: ({ t }) => t('general:updatedAt'),\n },\n ]\n\n collection.graphQL.versionType = buildObjectType({\n name: `${singularName}Version`,\n collectionSlug: collectionConfig.slug,\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 trash: { type: GraphQLBoolean },\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 select: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n trash: { type: GraphQLBoolean },\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 (mutationsEnabled && collectionConfig.upload) {\n graphqlResult.Mutation.fields[`renameFile${formatName(singularName)}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n draft: { type: GraphQLBoolean },\n filename: { type: new GraphQLNonNull(GraphQLString) },\n },\n resolve: renameFileResolver(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 name: '_strategy',\n type: 'text',\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 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 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 args: {\n allSessions: { type: GraphQLBoolean },\n },\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 ...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","renameFileResolver","restoreVersionResolver","updateResolver","validateResolver","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","auth","_strategy","forceNullableObjectType","Boolean","drafts","collectionSlug","forceNullable","parentName","paginatedType","whereInputType","mutationInputFields","disableLocalStrategy","optionalPassword","label","required","mutationCreateInputFields","allowIDOnCreate","flattenedFields","some","createMutationInputType","parentIsLocalized","mutationInputType","updateMutationInputType","filter","validationMutationInputType","queriesEnabled","disableQueries","mutationsEnabled","disableMutations","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","select","trash","resolve","where","limit","page","pagination","sort","totalDocs","entity","scope","typeSuffix","Mutation","data","autosave","validationResultType","disableDuplicate","versionIDType","versionCollectionFields","t","versionType","upload","filename","authFields","loginWithUsername","allowEmailLogin","requireEmail","JWT","saveToJWT","exp","token","user","refreshedToken","allSessions","authArgs","canLoginWithEmail","canLoginWithUsername","maxLoginAttempts","password"],"mappings":"AAQA,SACEA,cAAc,EACdC,UAAU,EACV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BAC9De,MAAM,IAAIjE,kBAAkB;4BAC1B0D,MAAM5B,WAAW,GAAGc,KAAK,aAAa,CAAC;4BACvCG,QAAQ;gCACNwF,OAAO;oCAAEtE,MAAMhE;gCAAc;gCAC7BuI,MAAM;oCAAEvE,MAAMpB,WAAWG,OAAO,CAACiB,IAAI;gCAAC;4BACxC;wBACF;wBACAgC,MAAM;4BACJ8C,UAAU;gCAAE9E,MAAMhE;4BAAc;4BAChCsI,OAAO;gCAAEtE,MAAMhE;4BAAc;wBAC/B;wBACA0G,SAAS7F,cAAc+B;oBACzB;oBAEAN,cAAc8E,QAAQ,CAACtE,MAAM,CAAC,CAAC,WAAW,EAAEG,cAAc,CAAC,GAAG;wBAC5De,MAAMpE;wBACNoG,MAAM;4BACJsC,OAAO;gCAAEtE,MAAMhE;4BAAc;wBAC/B;wBACA0G,SAAS3F,YAAY6B;oBACvB;gBACF;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 { renameFileResolver } from '../resolvers/collections/renameFile.js'\nimport { restoreVersionResolver } from '../resolvers/collections/restoreVersion.js'\nimport { updateResolver } from '../resolvers/collections/update.js'\nimport { validateResolver } from '../resolvers/collections/validate.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 = {}, 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 if (collectionConfig.auth) {\n baseFields._strategy = { type: GraphQLString }\n }\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n collection.graphQL.type = buildObjectType({\n name: singularName,\n baseFields,\n collectionSlug: collectionConfig.slug,\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 let mutationCreateInputFields = mutationInputFields\n\n if (\n config.db.allowIDOnCreate &&\n !collectionConfig.flattenedFields.some((field) => field.name === 'id')\n ) {\n mutationCreateInputFields = [\n ...mutationCreateInputFields,\n {\n name: 'id',\n type: config.db.defaultIDType,\n } as Field,\n ]\n }\n\n const createMutationInputType = buildMutationInputType({\n name: singularName,\n config,\n fields: mutationCreateInputFields,\n graphqlResult,\n parentIsLocalized: false,\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 parentIsLocalized: false,\n parentName: `${singularName}Update`,\n })\n if (updateMutationInputType) {\n collection.graphQL.updateMutationInputType = new GraphQLNonNull(updateMutationInputType)\n }\n\n const validationMutationInputType = buildMutationInputType({\n name: `${singularName}Validation`,\n config,\n fields: mutationCreateInputFields,\n forceNullable: true,\n graphqlResult,\n parentIsLocalized: false,\n parentName: `${singularName}Validation`,\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 select: { type: GraphQLBoolean },\n trash: { type: GraphQLBoolean },\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 select: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n trash: { type: GraphQLBoolean },\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 trash: { 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 trash: { type: GraphQLBoolean },\n },\n resolve: updateResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`validate${singularName}`] = {\n type: graphqlResult.types.validationResultType,\n args: {\n id: { type: idType },\n ...(validationMutationInputType ? { data: { type: validationMutationInputType } } : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: validateResolver(collection),\n }\n\n graphqlResult.Mutation.fields[`delete${singularName}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n trash: { type: GraphQLBoolean },\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: ({ t }) => t('general:createdAt'),\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: ({ t }) => t('general:updatedAt'),\n },\n ]\n\n collection.graphQL.versionType = buildObjectType({\n name: `${singularName}Version`,\n collectionSlug: collectionConfig.slug,\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 trash: { type: GraphQLBoolean },\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 select: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n trash: { type: GraphQLBoolean },\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 (mutationsEnabled && collectionConfig.upload) {\n graphqlResult.Mutation.fields[`renameFile${formatName(singularName)}`] = {\n type: collection.graphQL.type,\n args: {\n id: { type: new GraphQLNonNull(idType) },\n draft: { type: GraphQLBoolean },\n filename: { type: new GraphQLNonNull(GraphQLString) },\n },\n resolve: renameFileResolver(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 name: '_strategy',\n type: 'text',\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 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 ...(collectionConfig.auth.refreshTokens\n ? { refreshToken: { type: GraphQLString } }\n : {}),\n user: {\n type: collection.graphQL.JWT,\n },\n },\n }),\n args: collectionConfig.auth.refreshTokens\n ? { refreshToken: { type: GraphQLString } }\n : undefined,\n resolve: refresh(collection),\n }\n\n graphqlResult.Mutation.fields[`logout${singularName}`] = {\n type: GraphQLString,\n args: {\n allSessions: { type: GraphQLBoolean },\n },\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 ...(collectionConfig.auth.refreshTokens\n ? { refreshToken: { type: GraphQLString } }\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 ...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","renameFileResolver","restoreVersionResolver","updateResolver","validateResolver","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","auth","_strategy","forceNullableObjectType","Boolean","drafts","collectionSlug","forceNullable","parentName","paginatedType","whereInputType","mutationInputFields","disableLocalStrategy","optionalPassword","label","required","mutationCreateInputFields","allowIDOnCreate","flattenedFields","some","createMutationInputType","parentIsLocalized","mutationInputType","updateMutationInputType","filter","validationMutationInputType","queriesEnabled","disableQueries","mutationsEnabled","disableMutations","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","select","trash","resolve","where","limit","page","pagination","sort","totalDocs","entity","scope","typeSuffix","Mutation","data","autosave","validationResultType","disableDuplicate","versionIDType","versionCollectionFields","t","versionType","upload","filename","authFields","loginWithUsername","allowEmailLogin","requireEmail","JWT","saveToJWT","exp","token","user","refreshedToken","refreshTokens","refreshToken","undefined","allSessions","authArgs","canLoginWithEmail","canLoginWithUsername","maxLoginA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wBACF;wBACAgC,MAAM;4BACJ,GAAG6C,QAAQ;4BACXI,UAAU;gCAAEjF,MAAMhE;4BAAc;wBAClC;wBACA0G,SAASjG,MAAMmC;oBACjB;oBAEAN,cAAc8E,QAAQ,CAACtE,MAAM,CAAC,CAAC,cAAc,EAAEG,cAAc,CAAC,GAAG;wBAC/De,MAAM,IAAIlE,eAAeF;wBACzBoG,MAAM;4BACJ,GAAG6C,QAAQ;wBACb;wBACAnC,SAASnG,eAAeqC;oBAC1B;oBAEAN,cAAc8E,QAAQ,CAACtE,MAAM,CAAC,CAAC,aAAa,EAAEG,cAAc,CAAC,GAAG;wBAC9De,MAAM,IAAIjE,kBAAkB;4BAC1B0D,MAAM5B,WAAW,GAAGc,KAAK,aAAa,CAAC;4BACvCG,QAAQ;gCACNwF,OAAO;oCAAEtE,MAAMhE;gCAAc;gCAC7BuI,MAAM;oCAAEvE,MAAMpB,WAAWG,OAAO,CAACiB,IAAI;gCAAC;4BACxC;wBACF;wBACAgC,MAAM;4BACJiD,UAAU;gCAAEjF,MAAMhE;4BAAc;4BAChCsI,OAAO;gCAAEtE,MAAMhE;4BAAc;wBAC/B;wBACA0G,SAAS7F,cAAc+B;oBACzB;oBAEAN,cAAc8E,QAAQ,CAACtE,MAAM,CAAC,CAAC,WAAW,EAAEG,cAAc,CAAC,GAAG;wBAC5De,MAAMpE;wBACNoG,MAAM;4BACJsC,OAAO;gCAAEtE,MAAMhE;4BAAc;wBAC/B;wBACA0G,SAAS3F,YAAY6B;oBACvB;gBACF;YACF;QACF;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/graphql",
3
- "version": "4.0.0-beta.6",
3
+ "version": "4.0.0-beta.7",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "license": "MIT",
6
6
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
@@ -52,11 +52,11 @@
52
52
  "devDependencies": {
53
53
  "@types/pluralize": "^0.0.33",
54
54
  "graphql-http": "1.22.4",
55
- "payload": "4.0.0-beta.6"
55
+ "payload": "4.0.0-beta.7"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "graphql": "^16.8.1",
59
- "payload": "4.0.0-beta.6"
59
+ "payload": "4.0.0-beta.7"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "pnpm build:types && pnpm build:swc",