@payloadcms/graphql 4.0.0-internal.cc18726 → 4.0.0-internal.cd47d20
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/resolvers/collections/find.js +1 -1
- package/dist/resolvers/collections/find.js.map +1 -1
- package/dist/resolvers/collections/findByID.js +1 -1
- package/dist/resolvers/collections/findByID.js.map +1 -1
- package/dist/resolvers/collections/findVersionByID.js +1 -1
- package/dist/resolvers/collections/findVersionByID.js.map +1 -1
- package/dist/resolvers/collections/findVersions.js +1 -1
- package/dist/resolvers/collections/findVersions.js.map +1 -1
- package/dist/resolvers/globals/findOne.js +1 -1
- package/dist/resolvers/globals/findOne.js.map +1 -1
- package/dist/resolvers/globals/findVersionByID.js +1 -1
- package/dist/resolvers/globals/findVersionByID.js.map +1 -1
- package/dist/resolvers/globals/findVersions.js +1 -1
- package/dist/resolvers/globals/findVersions.js.map +1 -1
- package/dist/schema/fieldToSchemaMap.js +3 -3
- package/dist/schema/fieldToSchemaMap.js.map +1 -1
- package/dist/utilities/select.d.ts +4 -3
- package/dist/utilities/select.d.ts.map +1 -1
- package/dist/utilities/select.js +83 -45
- package/dist/utilities/select.js.map +1 -1
- package/package.json +3 -3
- package/dist/utilities/formatName.spec.js +0 -57
- package/dist/utilities/formatName.spec.js.map +0 -1
- package/dist/utilities/formatUtcOffset.spec.js +0 -142
- package/dist/utilities/formatUtcOffset.spec.js.map +0 -1
|
@@ -7,7 +7,7 @@ export function findResolver(collection) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollectionMany(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollectionMany(info, context) : undefined;
|
|
11
11
|
req.locale = args.locale || req.locale;
|
|
12
12
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
13
13
|
req.query = req.query || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/collections/find.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, PaginatedDocs, Where } from 'payload'\n\nimport { findOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollectionMany } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n data: Record<string, unknown>\n draft: boolean\n fallbackLocale?: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n select?: boolean\n sort?: string\n trash?: boolean\n where?: Where\n },\n context: Context,\n info: GraphQLResolveInfo,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<PaginatedDocs<any>>\n\nexport function findResolver(collection: Collection): Resolver {\n return async function resolver(_, args, context, info) {\n const req = (context.req = isolateObjectProperty(context.req, [\n 'locale',\n 'fallbackLocale',\n 'transactionID',\n ]))\n const select = (context.select = args.select ? buildSelectForCollectionMany(info) : undefined)\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const draft: boolean =\n (args.draft ?? req.query?.draft === 'false')\n ? false\n : req.query?.draft === 'true'\n ? true\n : undefined\n if (typeof draft === 'boolean') {\n req.query.draft = String(draft)\n }\n\n const { sort } = args\n\n const options = {\n collection,\n depth: 0,\n draft: args.draft,\n limit: args.limit,\n page: args.page,\n pagination: args.pagination,\n req,\n select,\n sort: sort && typeof sort === 'string' ? sort.split(',') : undefined,\n trash: args.trash,\n where: args.where,\n }\n\n const result = await findOperation(options)\n return result\n }\n}\n"],"names":["findOperation","isolateObjectProperty","buildSelectForCollectionMany","findResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","draft","String","sort","options","depth","limit","page","pagination","split","trash","where","result"],"mappings":"AAGA,SAASA,aAAa,EAAEC,qBAAqB,QAAQ,UAAS;AAI9D,SAASC,4BAA4B,QAAQ,4BAA2B;AAsBxE,OAAO,SAASC,aAAaC,UAAsB;IACjD,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAOF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAC5D;YACA;YACA;SACD;QACD,MAAMC,SAAUH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,6BAA6BO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/collections/find.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, PaginatedDocs, Where } from 'payload'\n\nimport { findOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollectionMany } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n data: Record<string, unknown>\n draft: boolean\n fallbackLocale?: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n select?: boolean\n sort?: string\n trash?: boolean\n where?: Where\n },\n context: Context,\n info: GraphQLResolveInfo,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<PaginatedDocs<any>>\n\nexport function findResolver(collection: Collection): Resolver {\n return async function resolver(_, args, context, info) {\n const req = (context.req = isolateObjectProperty(context.req, [\n 'locale',\n 'fallbackLocale',\n 'transactionID',\n ]))\n const select = (context.select = args.select ? buildSelectForCollectionMany(info, context) : undefined)\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const draft: boolean =\n (args.draft ?? req.query?.draft === 'false')\n ? false\n : req.query?.draft === 'true'\n ? true\n : undefined\n if (typeof draft === 'boolean') {\n req.query.draft = String(draft)\n }\n\n const { sort } = args\n\n const options = {\n collection,\n depth: 0,\n draft: args.draft,\n limit: args.limit,\n page: args.page,\n pagination: args.pagination,\n req,\n select,\n sort: sort && typeof sort === 'string' ? sort.split(',') : undefined,\n trash: args.trash,\n where: args.where,\n }\n\n const result = await findOperation(options)\n return result\n }\n}\n"],"names":["findOperation","isolateObjectProperty","buildSelectForCollectionMany","findResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","draft","String","sort","options","depth","limit","page","pagination","split","trash","where","result"],"mappings":"AAGA,SAASA,aAAa,EAAEC,qBAAqB,QAAQ,UAAS;AAI9D,SAASC,4BAA4B,QAAQ,4BAA2B;AAsBxE,OAAO,SAASC,aAAaC,UAAsB;IACjD,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAOF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAC5D;YACA;YACA;SACD;QACD,MAAMC,SAAUH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,6BAA6BO,MAAMD,WAAWI;QAE7FF,IAAIG,MAAM,GAAGN,KAAKM,MAAM,IAAIH,IAAIG,MAAM;QACtCH,IAAII,cAAc,GAAGP,KAAKO,cAAc,IAAIJ,IAAII,cAAc;QAC9DJ,IAAIK,KAAK,GAAGL,IAAIK,KAAK,IAAI,CAAC;QAE1B,MAAMC,QACJ,AAACT,KAAKS,KAAK,IAAIN,IAAIK,KAAK,EAAEC,UAAU,UAChC,QACAN,IAAIK,KAAK,EAAEC,UAAU,SACnB,OACAJ;QACR,IAAI,OAAOI,UAAU,WAAW;YAC9BN,IAAIK,KAAK,CAACC,KAAK,GAAGC,OAAOD;QAC3B;QAEA,MAAM,EAAEE,IAAI,EAAE,GAAGX;QAEjB,MAAMY,UAAU;YACdf;YACAgB,OAAO;YACPJ,OAAOT,KAAKS,KAAK;YACjBK,OAAOd,KAAKc,KAAK;YACjBC,MAAMf,KAAKe,IAAI;YACfC,YAAYhB,KAAKgB,UAAU;YAC3Bb;YACAC;YACAO,MAAMA,QAAQ,OAAOA,SAAS,WAAWA,KAAKM,KAAK,CAAC,OAAOZ;YAC3Da,OAAOlB,KAAKkB,KAAK;YACjBC,OAAOnB,KAAKmB,KAAK;QACnB;QAEA,MAAMC,SAAS,MAAM3B,cAAcmB;QACnC,OAAOQ;IACT;AACF"}
|
|
@@ -7,7 +7,7 @@ export function findByIDResolver(collection) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollection(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined;
|
|
11
11
|
req.locale = args.locale || req.locale;
|
|
12
12
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
13
13
|
req.query = req.query || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/collections/findByID.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, CollectionSlug, DataFromCollectionSlug } from 'payload'\n\nimport { findByIDOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver<TData> = (\n _: unknown,\n args: {\n draft: boolean\n fallbackLocale?: string\n id: string\n locale?: string\n select?: boolean\n trash?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<TData>\n\nexport function findByIDResolver<TSlug extends CollectionSlug>(\n collection: Collection,\n): Resolver<DataFromCollectionSlug<TSlug>> {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info) : undefined\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const draft: boolean =\n (args.draft ?? req.query?.draft === 'false')\n ? false\n : req.query?.draft === 'true'\n ? true\n : undefined\n if (typeof draft === 'boolean') {\n req.query.draft = String(draft)\n }\n\n const options = {\n id: args.id,\n collection,\n depth: 0,\n draft: args.draft,\n req,\n select,\n trash: args.trash,\n }\n\n const result = await findByIDOperation(options)\n return result\n }\n}\n"],"names":["findByIDOperation","isolateObjectProperty","buildSelectForCollection","findByIDResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","draft","String","options","id","depth","trash","result"],"mappings":"AAGA,SAASA,iBAAiB,EAAEC,qBAAqB,QAAQ,UAAS;AAIlE,SAASC,wBAAwB,QAAQ,4BAA2B;AAgBpE,OAAO,SAASC,iBACdC,UAAsB;IAEtB,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/collections/findByID.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, CollectionSlug, DataFromCollectionSlug } from 'payload'\n\nimport { findByIDOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver<TData> = (\n _: unknown,\n args: {\n draft: boolean\n fallbackLocale?: string\n id: string\n locale?: string\n select?: boolean\n trash?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<TData>\n\nexport function findByIDResolver<TSlug extends CollectionSlug>(\n collection: Collection,\n): Resolver<DataFromCollectionSlug<TSlug>> {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const draft: boolean =\n (args.draft ?? req.query?.draft === 'false')\n ? false\n : req.query?.draft === 'true'\n ? true\n : undefined\n if (typeof draft === 'boolean') {\n req.query.draft = String(draft)\n }\n\n const options = {\n id: args.id,\n collection,\n depth: 0,\n draft: args.draft,\n req,\n select,\n trash: args.trash,\n }\n\n const result = await findByIDOperation(options)\n return result\n }\n}\n"],"names":["findByIDOperation","isolateObjectProperty","buildSelectForCollection","findByIDResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","draft","String","options","id","depth","trash","result"],"mappings":"AAGA,SAASA,iBAAiB,EAAEC,qBAAqB,QAAQ,UAAS;AAIlE,SAASC,wBAAwB,QAAQ,4BAA2B;AAgBpE,OAAO,SAASC,iBACdC,UAAsB;IAEtB,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,MAAMD,WAAWI;QAExFF,IAAIG,MAAM,GAAGN,KAAKM,MAAM,IAAIH,IAAIG,MAAM;QACtCH,IAAII,cAAc,GAAGP,KAAKO,cAAc,IAAIJ,IAAII,cAAc;QAC9DJ,IAAIK,KAAK,GAAGL,IAAIK,KAAK,IAAI,CAAC;QAE1B,MAAMC,QACJ,AAACT,KAAKS,KAAK,IAAIN,IAAIK,KAAK,EAAEC,UAAU,UAChC,QACAN,IAAIK,KAAK,EAAEC,UAAU,SACnB,OACAJ;QACR,IAAI,OAAOI,UAAU,WAAW;YAC9BN,IAAIK,KAAK,CAACC,KAAK,GAAGC,OAAOD;QAC3B;QAEA,MAAME,UAAU;YACdC,IAAIZ,KAAKY,EAAE;YACXf;YACAgB,OAAO;YACPJ,OAAOT,KAAKS,KAAK;YACjBN;YACAC;YACAU,OAAOd,KAAKc,KAAK;QACnB;QAEA,MAAMC,SAAS,MAAMtB,kBAAkBkB;QACvC,OAAOI;IACT;AACF"}
|
|
@@ -7,7 +7,7 @@ export function findVersionByIDResolver(collection) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollection(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined;
|
|
11
11
|
req.locale = args.locale || req.locale;
|
|
12
12
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
13
13
|
req.query = req.query || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/collections/findVersionByID.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, TypeWithID, TypeWithVersion } from 'payload'\n\nimport { findVersionByIDOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver<T extends TypeWithID = any> = (\n _: unknown,\n args: {\n fallbackLocale?: string\n id: number | string\n locale?: string\n select?: boolean\n trash?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<TypeWithVersion<T>>\n\nexport function findVersionByIDResolver(collection: Collection): Resolver {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info) : undefined\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const options = {\n id: args.id,\n collection,\n depth: 0,\n req,\n select,\n trash: args.trash,\n }\n\n const result = await findVersionByIDOperation(options)\n return result\n }\n}\n"],"names":["findVersionByIDOperation","isolateObjectProperty","buildSelectForCollection","findVersionByIDResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","options","id","depth","trash","result"],"mappings":"AAGA,SAASA,wBAAwB,EAAEC,qBAAqB,QAAQ,UAAS;AAIzE,SAASC,wBAAwB,QAAQ,4BAA2B;AAepE,OAAO,SAASC,wBAAwBC,UAAsB;IAC5D,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/collections/findVersionByID.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, TypeWithID, TypeWithVersion } from 'payload'\n\nimport { findVersionByIDOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver<T extends TypeWithID = any> = (\n _: unknown,\n args: {\n fallbackLocale?: string\n id: number | string\n locale?: string\n select?: boolean\n trash?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<TypeWithVersion<T>>\n\nexport function findVersionByIDResolver(collection: Collection): Resolver {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const options = {\n id: args.id,\n collection,\n depth: 0,\n req,\n select,\n trash: args.trash,\n }\n\n const result = await findVersionByIDOperation(options)\n return result\n }\n}\n"],"names":["findVersionByIDOperation","isolateObjectProperty","buildSelectForCollection","findVersionByIDResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","options","id","depth","trash","result"],"mappings":"AAGA,SAASA,wBAAwB,EAAEC,qBAAqB,QAAQ,UAAS;AAIzE,SAASC,wBAAwB,QAAQ,4BAA2B;AAepE,OAAO,SAASC,wBAAwBC,UAAsB;IAC5D,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,MAAMD,WAAWI;QAExFF,IAAIG,MAAM,GAAGN,KAAKM,MAAM,IAAIH,IAAIG,MAAM;QACtCH,IAAII,cAAc,GAAGP,KAAKO,cAAc,IAAIJ,IAAII,cAAc;QAC9DJ,IAAIK,KAAK,GAAGL,IAAIK,KAAK,IAAI,CAAC;QAE1B,MAAMC,UAAU;YACdC,IAAIV,KAAKU,EAAE;YACXb;YACAc,OAAO;YACPR;YACAC;YACAQ,OAAOZ,KAAKY,KAAK;QACnB;QAEA,MAAMC,SAAS,MAAMpB,yBAAyBgB;QAC9C,OAAOI;IACT;AACF"}
|
|
@@ -7,7 +7,7 @@ export function findVersionsResolver(collection) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollectionMany(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollectionMany(info, context) : undefined;
|
|
11
11
|
req.locale = args.locale || req.locale;
|
|
12
12
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
13
13
|
req.query = req.query || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/collections/findVersions.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, PaginatedDocs, Where } from 'payload'\n\nimport { findVersionsOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollectionMany } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n fallbackLocale?: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n select?: boolean\n sort?: string\n trash?: boolean\n where: Where\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<PaginatedDocs<any>>\n\nexport function findVersionsResolver(collection: Collection): Resolver {\n return async function resolver(_, args, context, info) {\n const req = (context.req = isolateObjectProperty(context.req, [\n 'locale',\n 'fallbackLocale',\n 'transactionID',\n ]))\n const select = (context.select = args.select ? buildSelectForCollectionMany(info) : undefined)\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const draft: boolean =\n (args.draft ?? req.query?.draft === 'false')\n ? false\n : req.query?.draft === 'true'\n ? true\n : undefined\n if (typeof draft === 'boolean') {\n req.query.draft = String(draft)\n }\n\n const { sort } = args\n\n const options = {\n collection,\n depth: 0,\n limit: args.limit,\n page: args.page,\n pagination: args.pagination,\n req,\n select,\n sort: sort && typeof sort === 'string' ? sort.split(',') : undefined,\n trash: args.trash,\n where: args.where,\n }\n\n const result = await findVersionsOperation(options)\n return result\n }\n}\n"],"names":["findVersionsOperation","isolateObjectProperty","buildSelectForCollectionMany","findVersionsResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","draft","String","sort","options","depth","limit","page","pagination","split","trash","where","result"],"mappings":"AAGA,SAASA,qBAAqB,EAAEC,qBAAqB,QAAQ,UAAS;AAItE,SAASC,4BAA4B,QAAQ,4BAA2B;AAoBxE,OAAO,SAASC,qBAAqBC,UAAsB;IACzD,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAOF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAC5D;YACA;YACA;SACD;QACD,MAAMC,SAAUH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,6BAA6BO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/collections/findVersions.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Collection, PaginatedDocs, Where } from 'payload'\n\nimport { findVersionsOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollectionMany } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n fallbackLocale?: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n select?: boolean\n sort?: string\n trash?: boolean\n where: Where\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<PaginatedDocs<any>>\n\nexport function findVersionsResolver(collection: Collection): Resolver {\n return async function resolver(_, args, context, info) {\n const req = (context.req = isolateObjectProperty(context.req, [\n 'locale',\n 'fallbackLocale',\n 'transactionID',\n ]))\n const select = (context.select = args.select ? buildSelectForCollectionMany(info, context) : undefined)\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const draft: boolean =\n (args.draft ?? req.query?.draft === 'false')\n ? false\n : req.query?.draft === 'true'\n ? true\n : undefined\n if (typeof draft === 'boolean') {\n req.query.draft = String(draft)\n }\n\n const { sort } = args\n\n const options = {\n collection,\n depth: 0,\n limit: args.limit,\n page: args.page,\n pagination: args.pagination,\n req,\n select,\n sort: sort && typeof sort === 'string' ? sort.split(',') : undefined,\n trash: args.trash,\n where: args.where,\n }\n\n const result = await findVersionsOperation(options)\n return result\n }\n}\n"],"names":["findVersionsOperation","isolateObjectProperty","buildSelectForCollectionMany","findVersionsResolver","collection","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","draft","String","sort","options","depth","limit","page","pagination","split","trash","where","result"],"mappings":"AAGA,SAASA,qBAAqB,EAAEC,qBAAqB,QAAQ,UAAS;AAItE,SAASC,4BAA4B,QAAQ,4BAA2B;AAoBxE,OAAO,SAASC,qBAAqBC,UAAsB;IACzD,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAOF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAC5D;YACA;YACA;SACD;QACD,MAAMC,SAAUH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,6BAA6BO,MAAMD,WAAWI;QAE7FF,IAAIG,MAAM,GAAGN,KAAKM,MAAM,IAAIH,IAAIG,MAAM;QACtCH,IAAII,cAAc,GAAGP,KAAKO,cAAc,IAAIJ,IAAII,cAAc;QAC9DJ,IAAIK,KAAK,GAAGL,IAAIK,KAAK,IAAI,CAAC;QAE1B,MAAMC,QACJ,AAACT,KAAKS,KAAK,IAAIN,IAAIK,KAAK,EAAEC,UAAU,UAChC,QACAN,IAAIK,KAAK,EAAEC,UAAU,SACnB,OACAJ;QACR,IAAI,OAAOI,UAAU,WAAW;YAC9BN,IAAIK,KAAK,CAACC,KAAK,GAAGC,OAAOD;QAC3B;QAEA,MAAM,EAAEE,IAAI,EAAE,GAAGX;QAEjB,MAAMY,UAAU;YACdf;YACAgB,OAAO;YACPC,OAAOd,KAAKc,KAAK;YACjBC,MAAMf,KAAKe,IAAI;YACfC,YAAYhB,KAAKgB,UAAU;YAC3Bb;YACAC;YACAO,MAAMA,QAAQ,OAAOA,SAAS,WAAWA,KAAKM,KAAK,CAAC,OAAOZ;YAC3Da,OAAOlB,KAAKkB,KAAK;YACjBC,OAAOnB,KAAKmB,KAAK;QACnB;QAEA,MAAMC,SAAS,MAAM3B,sBAAsBmB;QAC3C,OAAOQ;IACT;AACF"}
|
|
@@ -7,7 +7,7 @@ export function findOne(globalConfig) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollection(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined;
|
|
11
11
|
const { slug } = globalConfig;
|
|
12
12
|
req.locale = args.locale || req.locale;
|
|
13
13
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/globals/findOne.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Document, SanitizedGlobalConfig } from 'payload'\n\nimport { findOneOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n fallbackLocale?: string\n id: number | string\n locale?: string\n select?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo\n) => Promise<Document>\n\nexport function findOne(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info) : undefined\n const { slug } = globalConfig\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const options = {\n slug,\n depth: 0,\n draft: args.draft,\n globalConfig,\n req,\n select,\n }\n\n const result = await findOneOperation(options)\n return result\n }\n}\n"],"names":["findOneOperation","isolateObjectProperty","buildSelectForCollection","findOne","globalConfig","resolver","_","args","context","info","req","select","undefined","slug","locale","fallbackLocale","query","options","depth","draft","result"],"mappings":"AAGA,SAASA,gBAAgB,EAAEC,qBAAqB,QAAQ,UAAS;AAIjE,SAASC,wBAAwB,QAAQ,4BAA2B;AAepE,OAAO,SAASC,QAAQC,YAAmC;IACzD,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/globals/findOne.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Document, SanitizedGlobalConfig } from 'payload'\n\nimport { findOneOperation, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n fallbackLocale?: string\n id: number | string\n locale?: string\n select?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo\n) => Promise<Document>\n\nexport function findOne(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined\n const { slug } = globalConfig\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const options = {\n slug,\n depth: 0,\n draft: args.draft,\n globalConfig,\n req,\n select,\n }\n\n const result = await findOneOperation(options)\n return result\n }\n}\n"],"names":["findOneOperation","isolateObjectProperty","buildSelectForCollection","findOne","globalConfig","resolver","_","args","context","info","req","select","undefined","slug","locale","fallbackLocale","query","options","depth","draft","result"],"mappings":"AAGA,SAASA,gBAAgB,EAAEC,qBAAqB,QAAQ,UAAS;AAIjE,SAASC,wBAAwB,QAAQ,4BAA2B;AAepE,OAAO,SAASC,QAAQC,YAAmC;IACzD,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,MAAMD,WAAWI;QACxF,MAAM,EAAEC,IAAI,EAAE,GAAGT;QAEjBM,IAAII,MAAM,GAAGP,KAAKO,MAAM,IAAIJ,IAAII,MAAM;QACtCJ,IAAIK,cAAc,GAAGR,KAAKQ,cAAc,IAAIL,IAAIK,cAAc;QAC9DL,IAAIM,KAAK,GAAGN,IAAIM,KAAK,IAAI,CAAC;QAE1B,MAAMC,UAAU;YACdJ;YACAK,OAAO;YACPC,OAAOZ,KAAKY,KAAK;YACjBf;YACAM;YACAC;QACF;QAEA,MAAMS,SAAS,MAAMpB,iBAAiBiB;QACtC,OAAOG;IACT;AACF"}
|
|
@@ -7,7 +7,7 @@ export function findVersionByID(globalConfig) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollection(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined;
|
|
11
11
|
req.locale = args.locale || req.locale;
|
|
12
12
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
13
13
|
req.query = req.query || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/globals/findVersionByID.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Document, SanitizedGlobalConfig } from 'payload'\n\nimport { findVersionByIDOperationGlobal, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n fallbackLocale?: string\n id: number | string\n locale?: string\n select?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo\n) => Promise<Document>\n\nexport function findVersionByID(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info) : undefined\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const options = {\n id: args.id,\n depth: 0,\n draft: args.draft,\n globalConfig,\n req,\n select,\n }\n\n const result = await findVersionByIDOperationGlobal(options)\n return result\n }\n}\n"],"names":["findVersionByIDOperationGlobal","isolateObjectProperty","buildSelectForCollection","findVersionByID","globalConfig","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","options","id","depth","draft","result"],"mappings":"AAGA,SAASA,8BAA8B,EAAEC,qBAAqB,QAAQ,UAAS;AAI/E,SAASC,wBAAwB,QAAQ,4BAA2B;AAepE,OAAO,SAASC,gBAAgBC,YAAmC;IACjE,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/globals/findVersionByID.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Document, SanitizedGlobalConfig } from 'payload'\n\nimport { findVersionByIDOperationGlobal, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollection } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n draft?: boolean\n fallbackLocale?: string\n id: number | string\n locale?: string\n select?: boolean\n },\n context: Context,\n info: GraphQLResolveInfo\n) => Promise<Document>\n\nexport function findVersionByID(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context, info) {\n const req = context.req = isolateObjectProperty(context.req, ['locale', 'fallbackLocale', 'transactionID'])\n const select = context.select = args.select ? buildSelectForCollection(info, context) : undefined\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const options = {\n id: args.id,\n depth: 0,\n draft: args.draft,\n globalConfig,\n req,\n select,\n }\n\n const result = await findVersionByIDOperationGlobal(options)\n return result\n }\n}\n"],"names":["findVersionByIDOperationGlobal","isolateObjectProperty","buildSelectForCollection","findVersionByID","globalConfig","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","options","id","depth","draft","result"],"mappings":"AAGA,SAASA,8BAA8B,EAAEC,qBAAqB,QAAQ,UAAS;AAI/E,SAASC,wBAAwB,QAAQ,4BAA2B;AAepE,OAAO,SAASC,gBAAgBC,YAAmC;IACjE,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAMF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAAC;YAAU;YAAkB;SAAgB;QAC1G,MAAMC,SAASH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,yBAAyBO,MAAMD,WAAWI;QAExFF,IAAIG,MAAM,GAAGN,KAAKM,MAAM,IAAIH,IAAIG,MAAM;QACtCH,IAAII,cAAc,GAAGP,KAAKO,cAAc,IAAIJ,IAAII,cAAc;QAC9DJ,IAAIK,KAAK,GAAGL,IAAIK,KAAK,IAAI,CAAC;QAE1B,MAAMC,UAAU;YACdC,IAAIV,KAAKU,EAAE;YACXC,OAAO;YACPC,OAAOZ,KAAKY,KAAK;YACjBf;YACAM;YACAC;QACF;QAEA,MAAMS,SAAS,MAAMpB,+BAA+BgB;QACpD,OAAOI;IACT;AACF"}
|
|
@@ -7,7 +7,7 @@ export function findVersions(globalConfig) {
|
|
|
7
7
|
'fallbackLocale',
|
|
8
8
|
'transactionID'
|
|
9
9
|
]);
|
|
10
|
-
const select = context.select = args.select ? buildSelectForCollectionMany(info) : undefined;
|
|
10
|
+
const select = context.select = args.select ? buildSelectForCollectionMany(info, context) : undefined;
|
|
11
11
|
req.locale = args.locale || req.locale;
|
|
12
12
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
13
13
|
req.query = req.query || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/resolvers/globals/findVersions.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Document, SanitizedGlobalConfig, Where } from 'payload'\n\nimport { findVersionsOperationGlobal, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollectionMany } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n fallbackLocale?: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n select?: boolean\n sort?: string\n where: Where\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<Document>\n\nexport function findVersions(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context, info) {\n const req = (context.req = isolateObjectProperty(context.req, [\n 'locale',\n 'fallbackLocale',\n 'transactionID',\n ]))\n const select = (context.select = args.select ? buildSelectForCollectionMany(info) : undefined)\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const { sort } = args\n\n const options = {\n depth: 0,\n globalConfig,\n limit: args.limit,\n page: args.page,\n pagination: args.pagination,\n req,\n select,\n sort: sort && typeof sort === 'string' ? sort.split(',') : undefined,\n where: args.where,\n }\n\n const result = await findVersionsOperationGlobal(options)\n return result\n }\n}\n"],"names":["findVersionsOperationGlobal","isolateObjectProperty","buildSelectForCollectionMany","findVersions","globalConfig","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","sort","options","depth","limit","page","pagination","split","where","result"],"mappings":"AAGA,SAASA,2BAA2B,EAAEC,qBAAqB,QAAQ,UAAS;AAI5E,SAASC,4BAA4B,QAAQ,4BAA2B;AAkBxE,OAAO,SAASC,aAAaC,YAAmC;IAC9D,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAOF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAC5D;YACA;YACA;SACD;QACD,MAAMC,SAAUH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,6BAA6BO,
|
|
1
|
+
{"version":3,"sources":["../../../src/resolvers/globals/findVersions.ts"],"sourcesContent":["import type { GraphQLResolveInfo } from 'graphql'\nimport type { Document, SanitizedGlobalConfig, Where } from 'payload'\n\nimport { findVersionsOperationGlobal, isolateObjectProperty } from 'payload'\n\nimport type { Context } from '../types.js'\n\nimport { buildSelectForCollectionMany } from '../../utilities/select.js'\n\nexport type Resolver = (\n _: unknown,\n args: {\n fallbackLocale?: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n select?: boolean\n sort?: string\n where: Where\n },\n context: Context,\n info: GraphQLResolveInfo,\n) => Promise<Document>\n\nexport function findVersions(globalConfig: SanitizedGlobalConfig): Resolver {\n return async function resolver(_, args, context, info) {\n const req = (context.req = isolateObjectProperty(context.req, [\n 'locale',\n 'fallbackLocale',\n 'transactionID',\n ]))\n const select = (context.select = args.select ? buildSelectForCollectionMany(info, context) : undefined)\n\n req.locale = args.locale || req.locale\n req.fallbackLocale = args.fallbackLocale || req.fallbackLocale\n req.query = req.query || {}\n\n const { sort } = args\n\n const options = {\n depth: 0,\n globalConfig,\n limit: args.limit,\n page: args.page,\n pagination: args.pagination,\n req,\n select,\n sort: sort && typeof sort === 'string' ? sort.split(',') : undefined,\n where: args.where,\n }\n\n const result = await findVersionsOperationGlobal(options)\n return result\n }\n}\n"],"names":["findVersionsOperationGlobal","isolateObjectProperty","buildSelectForCollectionMany","findVersions","globalConfig","resolver","_","args","context","info","req","select","undefined","locale","fallbackLocale","query","sort","options","depth","limit","page","pagination","split","where","result"],"mappings":"AAGA,SAASA,2BAA2B,EAAEC,qBAAqB,QAAQ,UAAS;AAI5E,SAASC,4BAA4B,QAAQ,4BAA2B;AAkBxE,OAAO,SAASC,aAAaC,YAAmC;IAC9D,OAAO,eAAeC,SAASC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI;QACnD,MAAMC,MAAOF,QAAQE,GAAG,GAAGT,sBAAsBO,QAAQE,GAAG,EAAE;YAC5D;YACA;YACA;SACD;QACD,MAAMC,SAAUH,QAAQG,MAAM,GAAGJ,KAAKI,MAAM,GAAGT,6BAA6BO,MAAMD,WAAWI;QAE7FF,IAAIG,MAAM,GAAGN,KAAKM,MAAM,IAAIH,IAAIG,MAAM;QACtCH,IAAII,cAAc,GAAGP,KAAKO,cAAc,IAAIJ,IAAII,cAAc;QAC9DJ,IAAIK,KAAK,GAAGL,IAAIK,KAAK,IAAI,CAAC;QAE1B,MAAM,EAAEC,IAAI,EAAE,GAAGT;QAEjB,MAAMU,UAAU;YACdC,OAAO;YACPd;YACAe,OAAOZ,KAAKY,KAAK;YACjBC,MAAMb,KAAKa,IAAI;YACfC,YAAYd,KAAKc,UAAU;YAC3BX;YACAC;YACAK,MAAMA,QAAQ,OAAOA,SAAS,WAAWA,KAAKM,KAAK,CAAC,OAAOV;YAC3DW,OAAOhB,KAAKgB,KAAK;QACnB;QAEA,MAAMC,SAAS,MAAMxB,4BAA4BiB;QACjD,OAAOO;IACT;AACF"}
|
|
@@ -298,7 +298,7 @@ export const fieldToSchemaMap = {
|
|
|
298
298
|
const { count = false, limit, page, sort, where } = args;
|
|
299
299
|
const { req } = context;
|
|
300
300
|
const draft = Boolean(args.draft ?? context.req.query?.draft);
|
|
301
|
-
const select = resolveSelect(info, context.select);
|
|
301
|
+
const select = resolveSelect(info, context.select, context);
|
|
302
302
|
const targetField = field.targetField;
|
|
303
303
|
const fullWhere = combineQueries(where, Array.isArray(targetField.relationTo) ? {
|
|
304
304
|
[field.on]: {
|
|
@@ -493,7 +493,7 @@ export const fieldToSchemaMap = {
|
|
|
493
493
|
const fallbackLocale = args.fallbackLocale || context.req.fallbackLocale;
|
|
494
494
|
let relatedCollectionSlug = field.relationTo;
|
|
495
495
|
const draft = Boolean(args.draft ?? context.req.query?.draft);
|
|
496
|
-
const select = resolveSelect(info, context.select);
|
|
496
|
+
const select = resolveSelect(info, context.select, context);
|
|
497
497
|
if (hasManyValues) {
|
|
498
498
|
const results = [];
|
|
499
499
|
const resultPromises = [];
|
|
@@ -838,7 +838,7 @@ export const fieldToSchemaMap = {
|
|
|
838
838
|
const fallbackLocale = args.fallbackLocale || context.req.fallbackLocale;
|
|
839
839
|
let relatedCollectionSlug = field.relationTo;
|
|
840
840
|
const draft = Boolean(args.draft ?? context.req.query?.draft);
|
|
841
|
-
const select = resolveSelect(info, context.select);
|
|
841
|
+
const select = resolveSelect(info, context.select, context);
|
|
842
842
|
if (hasManyValues) {
|
|
843
843
|
const results = [];
|
|
844
844
|
const resultPromises = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/fieldToSchemaMap.ts"],"sourcesContent":["import type { GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLOutputType } from 'graphql'\nimport type {\n ArrayField,\n BlocksField,\n CheckboxField,\n CodeField,\n CollapsibleField,\n DateField,\n EmailField,\n Field,\n FlattenedJoinField,\n GraphQLInfo,\n GroupField,\n JoinField,\n JSONField,\n NumberField,\n PointField,\n RadioField,\n RelationshipField,\n RichTextAdapter,\n RichTextField,\n RowField,\n SanitizedConfig,\n SelectField,\n SlugField,\n TabsField,\n TextareaField,\n TextField,\n UploadField,\n} from 'payload'\n\nimport {\n GraphQLBoolean,\n GraphQLEnumType,\n GraphQLFloat,\n GraphQLInt,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLString,\n GraphQLUnionType,\n} from 'graphql'\nimport { DateTimeResolver, EmailAddressResolver } from 'graphql-scalars'\nimport { combineQueries, createDataloaderCacheKey, MissingEditorProp, toWords } from 'payload'\nimport { fieldAffectsData, tabHasName } from 'payload/shared'\n\nimport type { Context } from '../resolvers/types.js'\n\nimport { GraphQLJSON } from '../packages/graphql-type-json/index.js'\nimport { combineParentName } from '../utilities/combineParentName.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { formatOptions } from '../utilities/formatOptions.js'\nimport { resolveSelect } from '../utilities/select.js'\nimport { buildObjectType, type ObjectTypeConfig } from './buildObjectType.js'\nimport { isFieldNullable } from './isFieldNullable.js'\nimport { withNullableType } from './withNullableType.js'\n\nfunction formattedNameResolver({\n field,\n ...rest\n}: { field: Field } & GraphQLFieldConfig<any, Context, any>): GraphQLFieldConfig<\n any,\n Context,\n any\n> {\n if ('name' in field) {\n if (formatName(field.name) !== field.name) {\n return {\n ...rest,\n extensions: { ...rest.extensions, field },\n resolve: (parent) => parent[field.name],\n }\n }\n }\n return rest\n}\n\ntype SharedArgs = {\n collectionSlug?: string\n config: SanitizedConfig\n forceNullable?: boolean\n graphqlResult: GraphQLInfo\n newlyCreatedBlockType: GraphQLObjectType\n objectTypeConfig: ObjectTypeConfig\n parentIsLocalized?: boolean\n parentName: string\n}\n\ntype GenericFieldToSchemaMap = (args: { field: Field } & SharedArgs) => ObjectTypeConfig\n\ntype FieldToSchemaMap = {\n array: (args: { field: ArrayField } & SharedArgs) => ObjectTypeConfig\n blocks: (args: { field: BlocksField } & SharedArgs) => ObjectTypeConfig\n checkbox: (args: { field: CheckboxField } & SharedArgs) => ObjectTypeConfig\n code: (args: { field: CodeField } & SharedArgs) => ObjectTypeConfig\n collapsible: (args: { field: CollapsibleField } & SharedArgs) => ObjectTypeConfig\n date: (args: { field: DateField } & SharedArgs) => ObjectTypeConfig\n email: (args: { field: EmailField } & SharedArgs) => ObjectTypeConfig\n group: (args: { field: GroupField } & SharedArgs) => ObjectTypeConfig\n join: (args: { field: JoinField } & SharedArgs) => ObjectTypeConfig\n json: (args: { field: JSONField } & SharedArgs) => ObjectTypeConfig\n number: (args: { field: NumberField } & SharedArgs) => ObjectTypeConfig\n point: (args: { field: PointField } & SharedArgs) => ObjectTypeConfig\n radio: (args: { field: RadioField } & SharedArgs) => ObjectTypeConfig\n relationship: (args: { field: RelationshipField } & SharedArgs) => ObjectTypeConfig\n richText: (args: { field: RichTextField } & SharedArgs) => ObjectTypeConfig\n row: (args: { field: RowField } & SharedArgs) => ObjectTypeConfig\n select: (args: { field: SelectField } & SharedArgs) => ObjectTypeConfig\n slug: (args: { field: SlugField } & SharedArgs) => ObjectTypeConfig\n tabs: (args: { field: TabsField } & SharedArgs) => ObjectTypeConfig\n text: (args: { field: TextField } & SharedArgs) => ObjectTypeConfig\n textarea: (args: { field: TextareaField } & SharedArgs) => ObjectTypeConfig\n upload: (args: { field: UploadField } & SharedArgs) => ObjectTypeConfig\n}\n\nexport const fieldToSchemaMap: FieldToSchemaMap = {\n slug: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n array: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const interfaceName =\n field?.interfaceName || combineParentName(parentName, toWords(field.name, true))\n\n if (!graphqlResult.types.arrayTypes[interfaceName]) {\n const objectType = buildObjectType({\n name: interfaceName,\n config,\n fields: field.fields,\n forceNullable: isFieldNullable({ field, forceNullable, parentIsLocalized }),\n graphqlResult,\n parentIsLocalized: field.localized || parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n graphqlResult.types.arrayTypes[interfaceName] = objectType\n }\n }\n\n if (!graphqlResult.types.arrayTypes[interfaceName]) {\n return objectTypeConfig\n }\n\n const arrayType = new GraphQLList(\n new GraphQLNonNull(graphqlResult.types.arrayTypes[interfaceName]),\n )\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({ type: arrayType, field, parentIsLocalized }) as GraphQLOutputType,\n field,\n }),\n }\n },\n blocks: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const blockTypes: GraphQLObjectType<any, any>[] = field.blocks.reduce((acc, _block) => {\n const blockSlug = typeof _block === 'string' ? _block : _block.slug\n if (!graphqlResult.types.blockTypes[blockSlug]) {\n // TODO: iterate over blocks mapped to block slug in v4, or pass through payload.blocks\n const block =\n typeof _block === 'string' ? config.blocks.find((b) => b.slug === _block) : _block\n\n const interfaceName =\n block?.interfaceName || block?.graphQL?.singularName || toWords(block.slug, true)\n\n const objectType = buildObjectType({\n name: interfaceName,\n config,\n fields: [\n ...block.fields,\n {\n name: 'blockType',\n type: 'text',\n },\n ],\n forceNullable,\n graphqlResult,\n parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n // Store block slug in extensions for use in select building\n objectType.extensions = {\n ...objectType.extensions,\n blockSlug: block.slug,\n }\n graphqlResult.types.blockTypes[block.slug] = objectType\n }\n }\n\n if (graphqlResult.types.blockTypes[blockSlug]) {\n acc.push(graphqlResult.types.blockTypes[blockSlug])\n }\n\n return acc\n }, [])\n\n if (blockTypes.length === 0) {\n return objectTypeConfig\n }\n\n const fullName = combineParentName(parentName, toWords(field.name, true))\n\n const type = new GraphQLList(\n new GraphQLNonNull(\n new GraphQLUnionType({\n name: fullName,\n resolveType: (data) => graphqlResult.types.blockTypes[data.blockType].name,\n types: blockTypes,\n }),\n ),\n ) as GraphQLOutputType\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({ type, field, parentIsLocalized }) as GraphQLOutputType,\n field,\n }),\n }\n },\n checkbox: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLBoolean,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n code: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n collapsible: ({\n collectionSlug,\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) =>\n field.fields.reduce((objectTypeConfigWithCollapsibleFields, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n collectionSlug,\n config,\n field: subField,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig: objectTypeConfigWithCollapsibleFields,\n parentIsLocalized,\n parentName,\n })\n }\n return objectTypeConfigWithCollapsibleFields\n }, objectTypeConfig),\n date: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: DateTimeResolver,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n email: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: EmailAddressResolver,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n group: ({\n collectionSlug,\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n if (fieldAffectsData(field)) {\n const interfaceName =\n field?.interfaceName || combineParentName(parentName, toWords(field.name, true))\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n const objectType = buildObjectType({\n name: interfaceName,\n config,\n fields: field.fields,\n forceNullable: isFieldNullable({ field, forceNullable, parentIsLocalized }),\n graphqlResult,\n parentIsLocalized: field.localized || parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n graphqlResult.types.groupTypes[interfaceName] = objectType\n }\n }\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n return objectTypeConfig\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: {\n type: graphqlResult.types.groupTypes[interfaceName],\n extensions: { field },\n resolve: (parent, args, context) => {\n return {\n ...parent[field.name],\n _id: parent._id ?? parent.id,\n }\n },\n } satisfies GraphQLFieldConfig<any, Context, any>,\n }\n } else {\n return field.fields.reduce((objectTypeConfigWithCollapsibleFields, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n collectionSlug,\n config,\n field: subField,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig: objectTypeConfigWithCollapsibleFields,\n parentIsLocalized,\n parentName,\n })\n }\n return objectTypeConfigWithCollapsibleFields\n }, objectTypeConfig)\n }\n },\n join: ({ collectionSlug, field, graphqlResult, objectTypeConfig, parentName }) => {\n const joinName = combineParentName(parentName, toWords(field.name, true))\n\n const joinType: GraphQLFieldConfig<any, Context, any> = {\n type: new GraphQLObjectType({\n name: joinName,\n fields: {\n docs: {\n type: new GraphQLNonNull(\n Array.isArray(field.collection)\n ? GraphQLJSON\n : new GraphQLList(\n new GraphQLNonNull(graphqlResult.collections[field.collection].graphQL.type),\n ),\n ),\n },\n hasNextPage: { type: new GraphQLNonNull(GraphQLBoolean) },\n totalDocs: { type: GraphQLInt },\n },\n }),\n args: {\n count: { type: GraphQLBoolean },\n limit: {\n type: GraphQLInt,\n },\n page: {\n type: GraphQLInt,\n },\n sort: {\n type: GraphQLString,\n },\n where: {\n type: Array.isArray(field.collection)\n ? GraphQLJSON\n : graphqlResult.collections[field.collection].graphQL.whereInputType,\n },\n },\n extensions: {\n complexity: typeof field?.graphQL?.complexity === 'number' ? field.graphQL.complexity : 10,\n field,\n },\n async resolve(parent, args, context, info) {\n const { collection } = field\n const { count = false, limit, page, sort, where } = args\n const { req } = context\n\n const draft = Boolean(args.draft ?? context.req.query?.draft)\n const select = resolveSelect(info, context.select)\n\n const targetField = (field as FlattenedJoinField).targetField\n\n const fullWhere = combineQueries(\n where,\n Array.isArray(targetField.relationTo)\n ? {\n [field.on]: {\n equals: {\n relationTo: collectionSlug,\n value: parent._id ?? parent.id,\n },\n },\n }\n : {\n [field.on]: { equals: parent._id ?? parent.id },\n },\n )\n\n if (Array.isArray(collection)) {\n throw new Error('GraphQL with array of join.field.collection is not implemented')\n }\n\n if (count && limit === 0) {\n return await req.payload.count({\n collection,\n overrideAccess: false,\n req,\n where: fullWhere,\n })\n }\n\n const { docs, totalDocs } = await req.payload.find({\n collection,\n depth: 0,\n draft,\n fallbackLocale: req.fallbackLocale,\n // Fetch one extra document to determine if there are more documents beyond the requested limit (used for hasNextPage calculation).\n limit: typeof limit === 'number' && limit > 0 ? limit + 1 : 0,\n locale: req.locale,\n overrideAccess: false,\n page,\n pagination: count ? true : false,\n req,\n select,\n sort,\n where: fullWhere,\n })\n\n let shouldSlice = false\n\n if (typeof limit === 'number' && limit !== 0 && limit < docs.length) {\n shouldSlice = true\n }\n\n return {\n docs: shouldSlice ? docs.slice(0, -1) : docs,\n hasNextPage: limit === 0 ? false : limit < docs.length,\n ...(count ? { totalDocs } : {}),\n }\n },\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: joinType,\n }\n },\n json: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLJSON,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n number: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => {\n const type = field?.name === 'id' ? GraphQLInt : GraphQLFloat\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: field?.hasMany === true ? new GraphQLList(new GraphQLNonNull(type)) : type,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }\n },\n point: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: new GraphQLList(new GraphQLNonNull(GraphQLFloat)),\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n radio: ({ field, forceNullable, objectTypeConfig, parentIsLocalized, parentName }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: new GraphQLEnumType({\n name: combineParentName(parentName, field.name),\n values: formatOptions(field),\n }),\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n relationship: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const { relationTo } = field\n const isRelatedToManyCollections = Array.isArray(relationTo)\n const hasManyValues = field.hasMany\n const relationshipName = combineParentName(parentName, toWords(field.name, true))\n\n let type: GraphQLOutputType\n let relationToType = null\n\n const graphQLCollections = config.collections.filter(\n (collectionConfig) => collectionConfig.graphQL !== false,\n )\n\n if (Array.isArray(relationTo)) {\n relationToType = new GraphQLEnumType({\n name: `${relationshipName}_RelationTo`,\n values: relationTo\n .filter((relation) =>\n graphQLCollections.some((collection) => collection.slug === relation),\n )\n .reduce(\n (relations, relation) => ({\n ...relations,\n [formatName(relation)]: {\n value: relation,\n },\n }),\n {},\n ),\n })\n\n // Only pass collections that are GraphQL enabled\n const types = relationTo\n .filter((relation) => graphQLCollections.some((collection) => collection.slug === relation))\n .map((relation) => graphqlResult.collections[relation]?.graphQL.type)\n\n type = new GraphQLObjectType({\n name: `${relationshipName}_Relationship`,\n fields: {\n relationTo: {\n type: relationToType,\n },\n value: {\n type: new GraphQLUnionType({\n name: relationshipName,\n resolveType(data) {\n return graphqlResult.collections[data.collection].graphQL.type.name\n },\n types,\n }) as GraphQLOutputType,\n },\n },\n }) as GraphQLOutputType\n } else {\n ;({ type } = graphqlResult.collections[relationTo].graphQL)\n }\n\n // If the relationshipType is undefined at this point,\n // it can be assumed that this blockType can have a relationship\n // to itself. Therefore, we set the relationshipType equal to the blockType\n // that is currently being created.\n\n type = type || newlyCreatedBlockType\n\n const relationshipArgs: {\n draft: GraphQLArgumentConfig\n fallbackLocale: GraphQLArgumentConfig\n limit: GraphQLArgumentConfig\n locale: GraphQLArgumentConfig\n page: GraphQLArgumentConfig\n where: GraphQLArgumentConfig\n } = {} as any\n\n const relationsUseDrafts = (Array.isArray(relationTo) ? relationTo : [relationTo])\n .filter((relation) => graphQLCollections.some((collection) => collection.slug === relation))\n .some((relation) => graphqlResult.collections[relation].config.versions?.drafts)\n\n if (relationsUseDrafts) {\n relationshipArgs.draft = {\n type: GraphQLBoolean,\n }\n }\n\n if (config.localization) {\n relationshipArgs.locale = {\n type: graphqlResult.types.localeInputType,\n }\n\n relationshipArgs.fallbackLocale = {\n type: graphqlResult.types.fallbackLocaleInputType,\n }\n }\n\n const relationship: GraphQLFieldConfig<any, Context, any> = {\n type: withNullableType({\n type: hasManyValues ? new GraphQLList(new GraphQLNonNull(type)) : type,\n field,\n // can be null if the related doc is deleted even if the field is required, unless hasMany\n forceNullable: !field.hasMany,\n parentIsLocalized,\n }) as GraphQLOutputType,\n args: relationshipArgs,\n extensions: {\n complexity: typeof field?.graphQL?.complexity === 'number' ? field.graphQL.complexity : 10,\n field,\n },\n async resolve(parent, args, context, info) {\n const value = parent[field.name]\n const locale = args.locale || context.req.locale\n const fallbackLocale = args.fallbackLocale || context.req.fallbackLocale\n let relatedCollectionSlug = field.relationTo\n const draft = Boolean(args.draft ?? context.req.query?.draft)\n const select = resolveSelect(info, context.select)\n\n if (hasManyValues) {\n const results = []\n const resultPromises = []\n\n const createPopulationPromise = async (relatedDoc, i) => {\n let id = relatedDoc\n let collectionSlug = field.relationTo\n const isValidGraphQLCollection = isRelatedToManyCollections\n ? graphQLCollections.some((collection) => collectionSlug.includes(collection.slug))\n : graphQLCollections.some((collection) => collectionSlug === collection.slug)\n\n if (isValidGraphQLCollection) {\n if (isRelatedToManyCollections) {\n collectionSlug = relatedDoc.relationTo\n id = relatedDoc.value\n }\n\n const result = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: collectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (result) {\n if (isRelatedToManyCollections) {\n results.push({\n relationTo: collectionSlug,\n value: {\n ...result,\n collection: collectionSlug,\n },\n })\n } else {\n results.push(result)\n }\n }\n }\n }\n\n if (value) {\n value.forEach((relatedDoc, i) => {\n resultPromises.push(createPopulationPromise(relatedDoc, i))\n })\n }\n\n await Promise.all(resultPromises)\n return results\n }\n\n let id = value\n if (isRelatedToManyCollections && value) {\n id = value.value\n relatedCollectionSlug = value.relationTo\n }\n\n if (id) {\n if (graphQLCollections.some((collection) => collection.slug === relatedCollectionSlug)) {\n const relatedDocument = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: relatedCollectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (relatedDocument) {\n if (isRelatedToManyCollections) {\n return {\n relationTo: relatedCollectionSlug,\n value: {\n ...relatedDocument,\n collection: relatedCollectionSlug,\n },\n }\n }\n\n return relatedDocument\n }\n }\n\n return null\n }\n\n return null\n },\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: relationship,\n }\n },\n richText: ({ config, field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: {\n type: withNullableType({\n type: GraphQLJSON,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n args: {\n depth: {\n type: GraphQLInt,\n },\n },\n extensions: {\n field,\n },\n async resolve(parent, args, context: Context) {\n let depth = config.defaultDepth\n if (typeof args.depth !== 'undefined') {\n depth = args.depth\n }\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n // RichText fields have their own depth argument in GraphQL.\n // This is why the populationPromise (which populates richtext fields like uploads and relationships)\n // is run here again, with the provided depth.\n // In the graphql find.ts resolver, the depth is then hard-coded to 0.\n // Effectively, this means that the populationPromise for GraphQL is only run here, and not in the find.ts resolver / normal population promise.\n if (editor?.graphQLPopulationPromises) {\n const fieldPromises = []\n const populationPromises = []\n const populateDepth =\n field?.maxDepth !== undefined && field?.maxDepth < depth ? field?.maxDepth : depth\n\n editor?.graphQLPopulationPromises({\n context,\n depth: populateDepth,\n draft: args.draft,\n field,\n fieldPromises,\n findMany: false,\n flattenLocales: false,\n overrideAccess: false,\n parentIsLocalized,\n populationPromises,\n req: context.req,\n showHiddenFields: false,\n siblingDoc: parent,\n })\n await Promise.all(fieldPromises)\n await Promise.all(populationPromises)\n }\n\n return parent[field.name]\n },\n },\n }),\n row: ({ field, objectTypeConfig, ...rest }) =>\n field.fields.reduce((objectTypeConfigWithRowFields, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n field: subField,\n objectTypeConfig: objectTypeConfigWithRowFields,\n ...rest,\n })\n }\n return objectTypeConfigWithRowFields\n }, objectTypeConfig),\n select: ({ field, forceNullable, objectTypeConfig, parentIsLocalized, parentName }) => {\n const fullName = combineParentName(parentName, field.name)\n\n let type: GraphQLOutputType = new GraphQLEnumType({\n name: fullName,\n values: formatOptions(field),\n })\n\n type = field.hasMany ? new GraphQLList(new GraphQLNonNull(type)) : type\n type = withNullableType({ type, field, forceNullable, parentIsLocalized }) as GraphQLOutputType\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({ type, field }),\n }\n },\n tabs: ({\n collectionSlug,\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) =>\n field.tabs.reduce((tabSchema, tab) => {\n if (tabHasName(tab)) {\n const interfaceName =\n tab?.interfaceName || combineParentName(parentName, toWords(tab.name, true))\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n const objectType = buildObjectType({\n name: interfaceName,\n collectionSlug,\n config,\n fields: tab.fields,\n forceNullable,\n graphqlResult,\n parentIsLocalized: tab.localized || parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n graphqlResult.types.groupTypes[interfaceName] = objectType\n }\n }\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n return tabSchema\n }\n\n return {\n ...tabSchema,\n [tab.name]: {\n type: graphqlResult.types.groupTypes[interfaceName],\n resolve(parent, args, context: Context) {\n return {\n ...parent[tab.name],\n _id: parent._id ?? parent.id,\n }\n },\n },\n }\n }\n\n return {\n ...tabSchema,\n ...tab.fields.reduce((subFieldSchema, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n collectionSlug,\n config,\n field: subField,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig: subFieldSchema,\n parentIsLocalized,\n parentName,\n })\n }\n return subFieldSchema\n }, tabSchema),\n }\n }, objectTypeConfig),\n text: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type:\n field.hasMany === true\n ? new GraphQLList(new GraphQLNonNull(GraphQLString))\n : GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n textarea: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n upload: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const { relationTo } = field\n const isRelatedToManyCollections = Array.isArray(relationTo)\n const hasManyValues = field.hasMany\n const relationshipName = combineParentName(parentName, toWords(field.name, true))\n\n let type\n let relationToType = null\n\n const graphQLCollections = config.collections.filter(\n (collectionConfig) => collectionConfig.graphQL !== false,\n )\n\n if (Array.isArray(relationTo)) {\n relationToType = new GraphQLEnumType({\n name: `${relationshipName}_RelationTo`,\n values: relationTo.reduce(\n (relations, relation) => ({\n ...relations,\n [formatName(relation)]: {\n value: relation,\n },\n }),\n {},\n ),\n })\n\n const types = relationTo.map((relation) => graphqlResult.collections[relation].graphQL.type)\n\n type = new GraphQLObjectType({\n name: `${relationshipName}_Relationship`,\n fields: {\n relationTo: {\n type: relationToType,\n },\n value: {\n type: new GraphQLUnionType({\n name: relationshipName,\n resolveType(data) {\n return graphqlResult.collections[data.collection].graphQL.type.name\n },\n types,\n }),\n },\n },\n })\n } else {\n ;({ type } = graphqlResult.collections[relationTo].graphQL)\n }\n\n // If the relationshipType is undefined at this point,\n // it can be assumed that this blockType can have a relationship\n // to itself. Therefore, we set the relationshipType equal to the blockType\n // that is currently being created.\n\n type = type || newlyCreatedBlockType\n\n const relationshipArgs: {\n draft?: GraphQLArgumentConfig\n fallbackLocale?: GraphQLArgumentConfig\n limit?: GraphQLArgumentConfig\n locale?: GraphQLArgumentConfig\n page?: GraphQLArgumentConfig\n where?: GraphQLArgumentConfig\n } = {} as any\n\n const relationsUseDrafts = (Array.isArray(relationTo) ? relationTo : [relationTo]).some(\n (relation) => graphqlResult.collections[relation].config.versions?.drafts,\n )\n\n if (relationsUseDrafts) {\n relationshipArgs.draft = {\n type: GraphQLBoolean,\n }\n }\n\n if (config.localization) {\n relationshipArgs.locale = {\n type: graphqlResult.types.localeInputType,\n }\n\n relationshipArgs.fallbackLocale = {\n type: graphqlResult.types.fallbackLocaleInputType,\n }\n }\n\n const relationship: GraphQLFieldConfig<any, Context, any> = {\n type: withNullableType({\n type: hasManyValues ? new GraphQLList(new GraphQLNonNull(type)) : type,\n field,\n // can be null if the related doc is deleted even if the field is required, unless hasMany\n forceNullable: !field.hasMany,\n parentIsLocalized,\n }) as GraphQLOutputType,\n args: relationshipArgs,\n extensions: {\n complexity: typeof field?.graphQL?.complexity === 'number' ? field.graphQL.complexity : 10,\n field,\n },\n async resolve(parent, args, context, info) {\n const value = parent[field.name]\n const locale = args.locale || context.req.locale\n const fallbackLocale = args.fallbackLocale || context.req.fallbackLocale\n let relatedCollectionSlug = field.relationTo\n const draft = Boolean(args.draft ?? context.req.query?.draft)\n const select = resolveSelect(info, context.select)\n\n if (hasManyValues) {\n const results = []\n const resultPromises = []\n\n const createPopulationPromise = async (relatedDoc, i) => {\n let id = relatedDoc\n let collectionSlug = field.relationTo\n const isValidGraphQLCollection = isRelatedToManyCollections\n ? graphQLCollections.some((collection) => collectionSlug.includes(collection.slug))\n : graphQLCollections.some((collection) => collectionSlug === collection.slug)\n\n if (isValidGraphQLCollection) {\n if (isRelatedToManyCollections) {\n collectionSlug = relatedDoc.relationTo\n id = relatedDoc.value\n }\n\n const result = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: collectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (result) {\n if (isRelatedToManyCollections) {\n results.push({\n relationTo: collectionSlug,\n value: {\n ...result,\n collection: collectionSlug,\n },\n })\n } else {\n results.push(result)\n }\n }\n }\n }\n\n if (value) {\n value.forEach((relatedDoc, i) => {\n resultPromises.push(createPopulationPromise(relatedDoc, i))\n })\n }\n\n await Promise.all(resultPromises)\n return results\n }\n\n let id = value\n if (isRelatedToManyCollections && value) {\n id = value.value\n relatedCollectionSlug = value.relationTo\n }\n\n if (id) {\n if (graphQLCollections.some((collection) => collection.slug === relatedCollectionSlug)) {\n const relatedDocument = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: relatedCollectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (relatedDocument) {\n if (isRelatedToManyCollections) {\n return {\n relationTo: relatedCollectionSlug,\n value: {\n ...relatedDocument,\n collection: relatedCollectionSlug,\n },\n }\n }\n\n return relatedDocument\n }\n }\n\n return null\n }\n\n return null\n },\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: relationship,\n }\n },\n}\n"],"names":["GraphQLBoolean","GraphQLEnumType","GraphQLFloat","GraphQLInt","GraphQLList","GraphQLNonNull","GraphQLObjectType","GraphQLString","GraphQLUnionType","DateTimeResolver","EmailAddressResolver","combineQueries","createDataloaderCacheKey","MissingEditorProp","toWords","fieldAffectsData","tabHasName","GraphQLJSON","combineParentName","formatName","formatOptions","resolveSelect","buildObjectType","isFieldNullable","withNullableType","formattedNameResolver","field","rest","name","extensions","resolve","parent","fieldToSchemaMap","slug","forceNullable","objectTypeConfig","parentIsLocalized","type","array","config","graphqlResult","parentName","interfaceName","types","arrayTypes","objectType","fields","localized","Object","keys","getFields","length","arrayType","blocks","blockTypes","reduce","acc","_block","blockSlug","block","find","b","graphQL","singularName","push","fullName","resolveType","data","blockType","checkbox","code","collapsible","collectionSlug","newlyCreatedBlockType","objectTypeConfigWithCollapsibleFields","subField","addSubField","date","email","group","groupTypes","args","context","_id","id","join","joinName","joinType","docs","Array","isArray","collection","collections","hasNextPage","totalDocs","count","limit","page","sort","where","whereInputType","complexity","info","req","draft","Boolean","query","select","targetField","fullWhere","relationTo","on","equals","value","Error","payload","overrideAccess","depth","fallbackLocale","locale","pagination","shouldSlice","slice","json","number","hasMany","point","radio","values","relationship","isRelatedToManyCollections","hasManyValues","relationshipName","relationToType","graphQLCollections","filter","collectionConfig","relation","some","relations","map","relationshipArgs","relationsUseDrafts","versions","drafts","localization","localeInputType","fallbackLocaleInputType","relatedCollectionSlug","results","resultPromises","createPopulationPromise","relatedDoc","i","isValidGraphQLCollection","includes","result","payloadDataLoader","load","currentDepth","docID","showHiddenFields","transactionID","forEach","Promise","all","relatedDocument","richText","defaultDepth","editor","graphQLPopulationPromises","fieldPromises","populationPromises","populateDepth","maxDepth","undefined","findMany","flattenLocales","siblingDoc","row","objectTypeConfigWithRowFields","tabs","tabSchema","tab","subFieldSchema","text","textarea","upload"],"mappings":"AA+BA,SACEA,cAAc,EACdC,eAAe,EACfC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,QACX,UAAS;AAChB,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,kBAAiB;AACxE,SAASC,cAAc,EAAEC,wBAAwB,EAAEC,iBAAiB,EAAEC,OAAO,QAAQ,UAAS;AAC9F,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,iBAAgB;AAI7D,SAASC,WAAW,QAAQ,yCAAwC;AACpE,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,UAAU,QAAQ,6BAA4B;AACvD,SAASC,aAAa,QAAQ,gCAA+B;AAC7D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,eAAe,QAA+B,uBAAsB;AAC7E,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,gBAAgB,QAAQ,wBAAuB;AAExD,SAASC,sBAAsB,EAC7BC,KAAK,EACL,GAAGC,MACsD;IAKzD,IAAI,UAAUD,OAAO;QACnB,IAAIP,WAAWO,MAAME,IAAI,MAAMF,MAAME,IAAI,EAAE;YACzC,OAAO;gBACL,GA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B;4BACvB4D,gBAAgB4E;4BAChBW,cAAc;4BACd1C,OAAO;4BACP2C,OAAO5E;4BACPoB;4BACAc;4BACAC;4BACAH,gBAAgB;4BAChBT;4BACAsD,kBAAkB;4BAClBC,eAAehF,QAAQqB,GAAG,CAAC2D,aAAa;wBAC1C;wBAGF,IAAII,iBAAiB;4BACnB,IAAIpC,4BAA4B;gCAC9B,OAAO;oCACLpB,YAAYsC;oCACZnC,OAAO;wCACL,GAAGqD,eAAe;wCAClB3E,YAAYyD;oCACd;gCACF;4BACF;4BAEA,OAAOkB;wBACT;oBACF;oBAEA,OAAO;gBACT;gBAEA,OAAO;YACT;QACF;QAEA,OAAO;YACL,GAAGnI,gBAAgB;YACnB,CAAChB,WAAWO,MAAME,IAAI,EAAE,EAAEqG;QAC5B;IACF;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/fieldToSchemaMap.ts"],"sourcesContent":["import type { GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLOutputType } from 'graphql'\nimport type {\n ArrayField,\n BlocksField,\n CheckboxField,\n CodeField,\n CollapsibleField,\n DateField,\n EmailField,\n Field,\n FlattenedJoinField,\n GraphQLInfo,\n GroupField,\n JoinField,\n JSONField,\n NumberField,\n PointField,\n RadioField,\n RelationshipField,\n RichTextAdapter,\n RichTextField,\n RowField,\n SanitizedConfig,\n SelectField,\n SlugField,\n TabsField,\n TextareaField,\n TextField,\n UploadField,\n} from 'payload'\n\nimport {\n GraphQLBoolean,\n GraphQLEnumType,\n GraphQLFloat,\n GraphQLInt,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLString,\n GraphQLUnionType,\n} from 'graphql'\nimport { DateTimeResolver, EmailAddressResolver } from 'graphql-scalars'\nimport { combineQueries, createDataloaderCacheKey, MissingEditorProp, toWords } from 'payload'\nimport { fieldAffectsData, tabHasName } from 'payload/shared'\n\nimport type { Context } from '../resolvers/types.js'\n\nimport { GraphQLJSON } from '../packages/graphql-type-json/index.js'\nimport { combineParentName } from '../utilities/combineParentName.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { formatOptions } from '../utilities/formatOptions.js'\nimport { resolveSelect } from '../utilities/select.js'\nimport { buildObjectType, type ObjectTypeConfig } from './buildObjectType.js'\nimport { isFieldNullable } from './isFieldNullable.js'\nimport { withNullableType } from './withNullableType.js'\n\nfunction formattedNameResolver({\n field,\n ...rest\n}: { field: Field } & GraphQLFieldConfig<any, Context, any>): GraphQLFieldConfig<\n any,\n Context,\n any\n> {\n if ('name' in field) {\n if (formatName(field.name) !== field.name) {\n return {\n ...rest,\n extensions: { ...rest.extensions, field },\n resolve: (parent) => parent[field.name],\n }\n }\n }\n return rest\n}\n\ntype SharedArgs = {\n collectionSlug?: string\n config: SanitizedConfig\n forceNullable?: boolean\n graphqlResult: GraphQLInfo\n newlyCreatedBlockType: GraphQLObjectType\n objectTypeConfig: ObjectTypeConfig\n parentIsLocalized?: boolean\n parentName: string\n}\n\ntype GenericFieldToSchemaMap = (args: { field: Field } & SharedArgs) => ObjectTypeConfig\n\ntype FieldToSchemaMap = {\n array: (args: { field: ArrayField } & SharedArgs) => ObjectTypeConfig\n blocks: (args: { field: BlocksField } & SharedArgs) => ObjectTypeConfig\n checkbox: (args: { field: CheckboxField } & SharedArgs) => ObjectTypeConfig\n code: (args: { field: CodeField } & SharedArgs) => ObjectTypeConfig\n collapsible: (args: { field: CollapsibleField } & SharedArgs) => ObjectTypeConfig\n date: (args: { field: DateField } & SharedArgs) => ObjectTypeConfig\n email: (args: { field: EmailField } & SharedArgs) => ObjectTypeConfig\n group: (args: { field: GroupField } & SharedArgs) => ObjectTypeConfig\n join: (args: { field: JoinField } & SharedArgs) => ObjectTypeConfig\n json: (args: { field: JSONField } & SharedArgs) => ObjectTypeConfig\n number: (args: { field: NumberField } & SharedArgs) => ObjectTypeConfig\n point: (args: { field: PointField } & SharedArgs) => ObjectTypeConfig\n radio: (args: { field: RadioField } & SharedArgs) => ObjectTypeConfig\n relationship: (args: { field: RelationshipField } & SharedArgs) => ObjectTypeConfig\n richText: (args: { field: RichTextField } & SharedArgs) => ObjectTypeConfig\n row: (args: { field: RowField } & SharedArgs) => ObjectTypeConfig\n select: (args: { field: SelectField } & SharedArgs) => ObjectTypeConfig\n slug: (args: { field: SlugField } & SharedArgs) => ObjectTypeConfig\n tabs: (args: { field: TabsField } & SharedArgs) => ObjectTypeConfig\n text: (args: { field: TextField } & SharedArgs) => ObjectTypeConfig\n textarea: (args: { field: TextareaField } & SharedArgs) => ObjectTypeConfig\n upload: (args: { field: UploadField } & SharedArgs) => ObjectTypeConfig\n}\n\nexport const fieldToSchemaMap: FieldToSchemaMap = {\n slug: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n array: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const interfaceName =\n field?.interfaceName || combineParentName(parentName, toWords(field.name, true))\n\n if (!graphqlResult.types.arrayTypes[interfaceName]) {\n const objectType = buildObjectType({\n name: interfaceName,\n config,\n fields: field.fields,\n forceNullable: isFieldNullable({ field, forceNullable, parentIsLocalized }),\n graphqlResult,\n parentIsLocalized: field.localized || parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n graphqlResult.types.arrayTypes[interfaceName] = objectType\n }\n }\n\n if (!graphqlResult.types.arrayTypes[interfaceName]) {\n return objectTypeConfig\n }\n\n const arrayType = new GraphQLList(\n new GraphQLNonNull(graphqlResult.types.arrayTypes[interfaceName]),\n )\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({ type: arrayType, field, parentIsLocalized }) as GraphQLOutputType,\n field,\n }),\n }\n },\n blocks: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const blockTypes: GraphQLObjectType<any, any>[] = field.blocks.reduce((acc, _block) => {\n const blockSlug = typeof _block === 'string' ? _block : _block.slug\n if (!graphqlResult.types.blockTypes[blockSlug]) {\n // TODO: iterate over blocks mapped to block slug in v4, or pass through payload.blocks\n const block =\n typeof _block === 'string' ? config.blocks.find((b) => b.slug === _block) : _block\n\n const interfaceName =\n block?.interfaceName || block?.graphQL?.singularName || toWords(block.slug, true)\n\n const objectType = buildObjectType({\n name: interfaceName,\n config,\n fields: [\n ...block.fields,\n {\n name: 'blockType',\n type: 'text',\n },\n ],\n forceNullable,\n graphqlResult,\n parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n // Store block slug in extensions for use in select building\n objectType.extensions = {\n ...objectType.extensions,\n blockSlug: block.slug,\n }\n graphqlResult.types.blockTypes[block.slug] = objectType\n }\n }\n\n if (graphqlResult.types.blockTypes[blockSlug]) {\n acc.push(graphqlResult.types.blockTypes[blockSlug])\n }\n\n return acc\n }, [])\n\n if (blockTypes.length === 0) {\n return objectTypeConfig\n }\n\n const fullName = combineParentName(parentName, toWords(field.name, true))\n\n const type = new GraphQLList(\n new GraphQLNonNull(\n new GraphQLUnionType({\n name: fullName,\n resolveType: (data) => graphqlResult.types.blockTypes[data.blockType].name,\n types: blockTypes,\n }),\n ),\n ) as GraphQLOutputType\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({ type, field, parentIsLocalized }) as GraphQLOutputType,\n field,\n }),\n }\n },\n checkbox: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLBoolean,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n code: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n collapsible: ({\n collectionSlug,\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) =>\n field.fields.reduce((objectTypeConfigWithCollapsibleFields, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n collectionSlug,\n config,\n field: subField,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig: objectTypeConfigWithCollapsibleFields,\n parentIsLocalized,\n parentName,\n })\n }\n return objectTypeConfigWithCollapsibleFields\n }, objectTypeConfig),\n date: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: DateTimeResolver,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n email: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: EmailAddressResolver,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n group: ({\n collectionSlug,\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n if (fieldAffectsData(field)) {\n const interfaceName =\n field?.interfaceName || combineParentName(parentName, toWords(field.name, true))\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n const objectType = buildObjectType({\n name: interfaceName,\n config,\n fields: field.fields,\n forceNullable: isFieldNullable({ field, forceNullable, parentIsLocalized }),\n graphqlResult,\n parentIsLocalized: field.localized || parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n graphqlResult.types.groupTypes[interfaceName] = objectType\n }\n }\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n return objectTypeConfig\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: {\n type: graphqlResult.types.groupTypes[interfaceName],\n extensions: { field },\n resolve: (parent, args, context) => {\n return {\n ...parent[field.name],\n _id: parent._id ?? parent.id,\n }\n },\n } satisfies GraphQLFieldConfig<any, Context, any>,\n }\n } else {\n return field.fields.reduce((objectTypeConfigWithCollapsibleFields, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n collectionSlug,\n config,\n field: subField,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig: objectTypeConfigWithCollapsibleFields,\n parentIsLocalized,\n parentName,\n })\n }\n return objectTypeConfigWithCollapsibleFields\n }, objectTypeConfig)\n }\n },\n join: ({ collectionSlug, field, graphqlResult, objectTypeConfig, parentName }) => {\n const joinName = combineParentName(parentName, toWords(field.name, true))\n\n const joinType: GraphQLFieldConfig<any, Context, any> = {\n type: new GraphQLObjectType({\n name: joinName,\n fields: {\n docs: {\n type: new GraphQLNonNull(\n Array.isArray(field.collection)\n ? GraphQLJSON\n : new GraphQLList(\n new GraphQLNonNull(graphqlResult.collections[field.collection].graphQL.type),\n ),\n ),\n },\n hasNextPage: { type: new GraphQLNonNull(GraphQLBoolean) },\n totalDocs: { type: GraphQLInt },\n },\n }),\n args: {\n count: { type: GraphQLBoolean },\n limit: {\n type: GraphQLInt,\n },\n page: {\n type: GraphQLInt,\n },\n sort: {\n type: GraphQLString,\n },\n where: {\n type: Array.isArray(field.collection)\n ? GraphQLJSON\n : graphqlResult.collections[field.collection].graphQL.whereInputType,\n },\n },\n extensions: {\n complexity: typeof field?.graphQL?.complexity === 'number' ? field.graphQL.complexity : 10,\n field,\n },\n async resolve(parent, args, context, info) {\n const { collection } = field\n const { count = false, limit, page, sort, where } = args\n const { req } = context\n\n const draft = Boolean(args.draft ?? context.req.query?.draft)\n const select = resolveSelect(info, context.select, context)\n\n const targetField = (field as FlattenedJoinField).targetField\n\n const fullWhere = combineQueries(\n where,\n Array.isArray(targetField.relationTo)\n ? {\n [field.on]: {\n equals: {\n relationTo: collectionSlug,\n value: parent._id ?? parent.id,\n },\n },\n }\n : {\n [field.on]: { equals: parent._id ?? parent.id },\n },\n )\n\n if (Array.isArray(collection)) {\n throw new Error('GraphQL with array of join.field.collection is not implemented')\n }\n\n if (count && limit === 0) {\n return await req.payload.count({\n collection,\n overrideAccess: false,\n req,\n where: fullWhere,\n })\n }\n\n const { docs, totalDocs } = await req.payload.find({\n collection,\n depth: 0,\n draft,\n fallbackLocale: req.fallbackLocale,\n // Fetch one extra document to determine if there are more documents beyond the requested limit (used for hasNextPage calculation).\n limit: typeof limit === 'number' && limit > 0 ? limit + 1 : 0,\n locale: req.locale,\n overrideAccess: false,\n page,\n pagination: count ? true : false,\n req,\n select,\n sort,\n where: fullWhere,\n })\n\n let shouldSlice = false\n\n if (typeof limit === 'number' && limit !== 0 && limit < docs.length) {\n shouldSlice = true\n }\n\n return {\n docs: shouldSlice ? docs.slice(0, -1) : docs,\n hasNextPage: limit === 0 ? false : limit < docs.length,\n ...(count ? { totalDocs } : {}),\n }\n },\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: joinType,\n }\n },\n json: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLJSON,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n number: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => {\n const type = field?.name === 'id' ? GraphQLInt : GraphQLFloat\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: field?.hasMany === true ? new GraphQLList(new GraphQLNonNull(type)) : type,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }\n },\n point: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: new GraphQLList(new GraphQLNonNull(GraphQLFloat)),\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n radio: ({ field, forceNullable, objectTypeConfig, parentIsLocalized, parentName }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: new GraphQLEnumType({\n name: combineParentName(parentName, field.name),\n values: formatOptions(field),\n }),\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n relationship: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const { relationTo } = field\n const isRelatedToManyCollections = Array.isArray(relationTo)\n const hasManyValues = field.hasMany\n const relationshipName = combineParentName(parentName, toWords(field.name, true))\n\n let type: GraphQLOutputType\n let relationToType = null\n\n const graphQLCollections = config.collections.filter(\n (collectionConfig) => collectionConfig.graphQL !== false,\n )\n\n if (Array.isArray(relationTo)) {\n relationToType = new GraphQLEnumType({\n name: `${relationshipName}_RelationTo`,\n values: relationTo\n .filter((relation) =>\n graphQLCollections.some((collection) => collection.slug === relation),\n )\n .reduce(\n (relations, relation) => ({\n ...relations,\n [formatName(relation)]: {\n value: relation,\n },\n }),\n {},\n ),\n })\n\n // Only pass collections that are GraphQL enabled\n const types = relationTo\n .filter((relation) => graphQLCollections.some((collection) => collection.slug === relation))\n .map((relation) => graphqlResult.collections[relation]?.graphQL.type)\n\n type = new GraphQLObjectType({\n name: `${relationshipName}_Relationship`,\n fields: {\n relationTo: {\n type: relationToType,\n },\n value: {\n type: new GraphQLUnionType({\n name: relationshipName,\n resolveType(data) {\n return graphqlResult.collections[data.collection].graphQL.type.name\n },\n types,\n }) as GraphQLOutputType,\n },\n },\n }) as GraphQLOutputType\n } else {\n ;({ type } = graphqlResult.collections[relationTo].graphQL)\n }\n\n // If the relationshipType is undefined at this point,\n // it can be assumed that this blockType can have a relationship\n // to itself. Therefore, we set the relationshipType equal to the blockType\n // that is currently being created.\n\n type = type || newlyCreatedBlockType\n\n const relationshipArgs: {\n draft: GraphQLArgumentConfig\n fallbackLocale: GraphQLArgumentConfig\n limit: GraphQLArgumentConfig\n locale: GraphQLArgumentConfig\n page: GraphQLArgumentConfig\n where: GraphQLArgumentConfig\n } = {} as any\n\n const relationsUseDrafts = (Array.isArray(relationTo) ? relationTo : [relationTo])\n .filter((relation) => graphQLCollections.some((collection) => collection.slug === relation))\n .some((relation) => graphqlResult.collections[relation].config.versions?.drafts)\n\n if (relationsUseDrafts) {\n relationshipArgs.draft = {\n type: GraphQLBoolean,\n }\n }\n\n if (config.localization) {\n relationshipArgs.locale = {\n type: graphqlResult.types.localeInputType,\n }\n\n relationshipArgs.fallbackLocale = {\n type: graphqlResult.types.fallbackLocaleInputType,\n }\n }\n\n const relationship: GraphQLFieldConfig<any, Context, any> = {\n type: withNullableType({\n type: hasManyValues ? new GraphQLList(new GraphQLNonNull(type)) : type,\n field,\n // can be null if the related doc is deleted even if the field is required, unless hasMany\n forceNullable: !field.hasMany,\n parentIsLocalized,\n }) as GraphQLOutputType,\n args: relationshipArgs,\n extensions: {\n complexity: typeof field?.graphQL?.complexity === 'number' ? field.graphQL.complexity : 10,\n field,\n },\n async resolve(parent, args, context, info) {\n const value = parent[field.name]\n const locale = args.locale || context.req.locale\n const fallbackLocale = args.fallbackLocale || context.req.fallbackLocale\n let relatedCollectionSlug = field.relationTo\n const draft = Boolean(args.draft ?? context.req.query?.draft)\n const select = resolveSelect(info, context.select, context)\n\n if (hasManyValues) {\n const results = []\n const resultPromises = []\n\n const createPopulationPromise = async (relatedDoc, i) => {\n let id = relatedDoc\n let collectionSlug = field.relationTo\n const isValidGraphQLCollection = isRelatedToManyCollections\n ? graphQLCollections.some((collection) => collectionSlug.includes(collection.slug))\n : graphQLCollections.some((collection) => collectionSlug === collection.slug)\n\n if (isValidGraphQLCollection) {\n if (isRelatedToManyCollections) {\n collectionSlug = relatedDoc.relationTo\n id = relatedDoc.value\n }\n\n const result = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: collectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (result) {\n if (isRelatedToManyCollections) {\n results.push({\n relationTo: collectionSlug,\n value: {\n ...result,\n collection: collectionSlug,\n },\n })\n } else {\n results.push(result)\n }\n }\n }\n }\n\n if (value) {\n value.forEach((relatedDoc, i) => {\n resultPromises.push(createPopulationPromise(relatedDoc, i))\n })\n }\n\n await Promise.all(resultPromises)\n return results\n }\n\n let id = value\n if (isRelatedToManyCollections && value) {\n id = value.value\n relatedCollectionSlug = value.relationTo\n }\n\n if (id) {\n if (graphQLCollections.some((collection) => collection.slug === relatedCollectionSlug)) {\n const relatedDocument = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: relatedCollectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (relatedDocument) {\n if (isRelatedToManyCollections) {\n return {\n relationTo: relatedCollectionSlug,\n value: {\n ...relatedDocument,\n collection: relatedCollectionSlug,\n },\n }\n }\n\n return relatedDocument\n }\n }\n\n return null\n }\n\n return null\n },\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: relationship,\n }\n },\n richText: ({ config, field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: {\n type: withNullableType({\n type: GraphQLJSON,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n args: {\n depth: {\n type: GraphQLInt,\n },\n },\n extensions: {\n field,\n },\n async resolve(parent, args, context: Context) {\n let depth = config.defaultDepth\n if (typeof args.depth !== 'undefined') {\n depth = args.depth\n }\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n // RichText fields have their own depth argument in GraphQL.\n // This is why the populationPromise (which populates richtext fields like uploads and relationships)\n // is run here again, with the provided depth.\n // In the graphql find.ts resolver, the depth is then hard-coded to 0.\n // Effectively, this means that the populationPromise for GraphQL is only run here, and not in the find.ts resolver / normal population promise.\n if (editor?.graphQLPopulationPromises) {\n const fieldPromises = []\n const populationPromises = []\n const populateDepth =\n field?.maxDepth !== undefined && field?.maxDepth < depth ? field?.maxDepth : depth\n\n editor?.graphQLPopulationPromises({\n context,\n depth: populateDepth,\n draft: args.draft,\n field,\n fieldPromises,\n findMany: false,\n flattenLocales: false,\n overrideAccess: false,\n parentIsLocalized,\n populationPromises,\n req: context.req,\n showHiddenFields: false,\n siblingDoc: parent,\n })\n await Promise.all(fieldPromises)\n await Promise.all(populationPromises)\n }\n\n return parent[field.name]\n },\n },\n }),\n row: ({ field, objectTypeConfig, ...rest }) =>\n field.fields.reduce((objectTypeConfigWithRowFields, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n field: subField,\n objectTypeConfig: objectTypeConfigWithRowFields,\n ...rest,\n })\n }\n return objectTypeConfigWithRowFields\n }, objectTypeConfig),\n select: ({ field, forceNullable, objectTypeConfig, parentIsLocalized, parentName }) => {\n const fullName = combineParentName(parentName, field.name)\n\n let type: GraphQLOutputType = new GraphQLEnumType({\n name: fullName,\n values: formatOptions(field),\n })\n\n type = field.hasMany ? new GraphQLList(new GraphQLNonNull(type)) : type\n type = withNullableType({ type, field, forceNullable, parentIsLocalized }) as GraphQLOutputType\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({ type, field }),\n }\n },\n tabs: ({\n collectionSlug,\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) =>\n field.tabs.reduce((tabSchema, tab) => {\n if (tabHasName(tab)) {\n const interfaceName =\n tab?.interfaceName || combineParentName(parentName, toWords(tab.name, true))\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n const objectType = buildObjectType({\n name: interfaceName,\n collectionSlug,\n config,\n fields: tab.fields,\n forceNullable,\n graphqlResult,\n parentIsLocalized: tab.localized || parentIsLocalized,\n parentName: interfaceName,\n })\n\n if (Object.keys(objectType.getFields()).length) {\n graphqlResult.types.groupTypes[interfaceName] = objectType\n }\n }\n\n if (!graphqlResult.types.groupTypes[interfaceName]) {\n return tabSchema\n }\n\n return {\n ...tabSchema,\n [tab.name]: {\n type: graphqlResult.types.groupTypes[interfaceName],\n resolve(parent, args, context: Context) {\n return {\n ...parent[tab.name],\n _id: parent._id ?? parent.id,\n }\n },\n },\n }\n }\n\n return {\n ...tabSchema,\n ...tab.fields.reduce((subFieldSchema, subField) => {\n const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]\n if (addSubField) {\n return addSubField({\n collectionSlug,\n config,\n field: subField,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig: subFieldSchema,\n parentIsLocalized,\n parentName,\n })\n }\n return subFieldSchema\n }, tabSchema),\n }\n }, objectTypeConfig),\n text: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type:\n field.hasMany === true\n ? new GraphQLList(new GraphQLNonNull(GraphQLString))\n : GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n textarea: ({ field, forceNullable, objectTypeConfig, parentIsLocalized }) => ({\n ...objectTypeConfig,\n [formatName(field.name)]: formattedNameResolver({\n type: withNullableType({\n type: GraphQLString,\n field,\n forceNullable,\n parentIsLocalized,\n }) as GraphQLOutputType,\n field,\n }),\n }),\n upload: ({\n config,\n field,\n forceNullable,\n graphqlResult,\n newlyCreatedBlockType,\n objectTypeConfig,\n parentIsLocalized,\n parentName,\n }) => {\n const { relationTo } = field\n const isRelatedToManyCollections = Array.isArray(relationTo)\n const hasManyValues = field.hasMany\n const relationshipName = combineParentName(parentName, toWords(field.name, true))\n\n let type\n let relationToType = null\n\n const graphQLCollections = config.collections.filter(\n (collectionConfig) => collectionConfig.graphQL !== false,\n )\n\n if (Array.isArray(relationTo)) {\n relationToType = new GraphQLEnumType({\n name: `${relationshipName}_RelationTo`,\n values: relationTo.reduce(\n (relations, relation) => ({\n ...relations,\n [formatName(relation)]: {\n value: relation,\n },\n }),\n {},\n ),\n })\n\n const types = relationTo.map((relation) => graphqlResult.collections[relation].graphQL.type)\n\n type = new GraphQLObjectType({\n name: `${relationshipName}_Relationship`,\n fields: {\n relationTo: {\n type: relationToType,\n },\n value: {\n type: new GraphQLUnionType({\n name: relationshipName,\n resolveType(data) {\n return graphqlResult.collections[data.collection].graphQL.type.name\n },\n types,\n }),\n },\n },\n })\n } else {\n ;({ type } = graphqlResult.collections[relationTo].graphQL)\n }\n\n // If the relationshipType is undefined at this point,\n // it can be assumed that this blockType can have a relationship\n // to itself. Therefore, we set the relationshipType equal to the blockType\n // that is currently being created.\n\n type = type || newlyCreatedBlockType\n\n const relationshipArgs: {\n draft?: GraphQLArgumentConfig\n fallbackLocale?: GraphQLArgumentConfig\n limit?: GraphQLArgumentConfig\n locale?: GraphQLArgumentConfig\n page?: GraphQLArgumentConfig\n where?: GraphQLArgumentConfig\n } = {} as any\n\n const relationsUseDrafts = (Array.isArray(relationTo) ? relationTo : [relationTo]).some(\n (relation) => graphqlResult.collections[relation].config.versions?.drafts,\n )\n\n if (relationsUseDrafts) {\n relationshipArgs.draft = {\n type: GraphQLBoolean,\n }\n }\n\n if (config.localization) {\n relationshipArgs.locale = {\n type: graphqlResult.types.localeInputType,\n }\n\n relationshipArgs.fallbackLocale = {\n type: graphqlResult.types.fallbackLocaleInputType,\n }\n }\n\n const relationship: GraphQLFieldConfig<any, Context, any> = {\n type: withNullableType({\n type: hasManyValues ? new GraphQLList(new GraphQLNonNull(type)) : type,\n field,\n // can be null if the related doc is deleted even if the field is required, unless hasMany\n forceNullable: !field.hasMany,\n parentIsLocalized,\n }) as GraphQLOutputType,\n args: relationshipArgs,\n extensions: {\n complexity: typeof field?.graphQL?.complexity === 'number' ? field.graphQL.complexity : 10,\n field,\n },\n async resolve(parent, args, context, info) {\n const value = parent[field.name]\n const locale = args.locale || context.req.locale\n const fallbackLocale = args.fallbackLocale || context.req.fallbackLocale\n let relatedCollectionSlug = field.relationTo\n const draft = Boolean(args.draft ?? context.req.query?.draft)\n const select = resolveSelect(info, context.select, context)\n\n if (hasManyValues) {\n const results = []\n const resultPromises = []\n\n const createPopulationPromise = async (relatedDoc, i) => {\n let id = relatedDoc\n let collectionSlug = field.relationTo\n const isValidGraphQLCollection = isRelatedToManyCollections\n ? graphQLCollections.some((collection) => collectionSlug.includes(collection.slug))\n : graphQLCollections.some((collection) => collectionSlug === collection.slug)\n\n if (isValidGraphQLCollection) {\n if (isRelatedToManyCollections) {\n collectionSlug = relatedDoc.relationTo\n id = relatedDoc.value\n }\n\n const result = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: collectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (result) {\n if (isRelatedToManyCollections) {\n results.push({\n relationTo: collectionSlug,\n value: {\n ...result,\n collection: collectionSlug,\n },\n })\n } else {\n results.push(result)\n }\n }\n }\n }\n\n if (value) {\n value.forEach((relatedDoc, i) => {\n resultPromises.push(createPopulationPromise(relatedDoc, i))\n })\n }\n\n await Promise.all(resultPromises)\n return results\n }\n\n let id = value\n if (isRelatedToManyCollections && value) {\n id = value.value\n relatedCollectionSlug = value.relationTo\n }\n\n if (id) {\n if (graphQLCollections.some((collection) => collection.slug === relatedCollectionSlug)) {\n const relatedDocument = await context.req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: relatedCollectionSlug as string,\n currentDepth: 0,\n depth: 0,\n docID: id,\n draft,\n fallbackLocale,\n locale,\n overrideAccess: false,\n select,\n showHiddenFields: false,\n transactionID: context.req.transactionID,\n }),\n )\n\n if (relatedDocument) {\n if (isRelatedToManyCollections) {\n return {\n relationTo: relatedCollectionSlug,\n value: {\n ...relatedDocument,\n collection: relatedCollectionSlug,\n },\n }\n }\n\n return relatedDocument\n }\n }\n\n return null\n }\n\n return null\n },\n }\n\n return {\n ...objectTypeConfig,\n [formatName(field.name)]: relationship,\n }\n },\n}\n"],"names":["GraphQLBoolean","GraphQLEnumType","GraphQLFloat","GraphQLInt","GraphQLList","GraphQLNonNull","GraphQLObjectType","GraphQLString","GraphQLUnionType","DateTimeResolver","EmailAddressResolver","combineQueries","createDataloaderCacheKey","MissingEditorProp","toWords","fieldAffectsData","tabHasName","GraphQLJSON","combineParentName","formatName","formatOptions","resolveSelect","buildObjectType","isFieldNullable","withNullableType","formattedNameResolver","field","rest","name","extensions","resolve","parent","fieldToSchemaMap","slug","forceNullable","objectTypeConfig","parentIsLocalized","type","array","config","graphqlResult","parentName","interfaceName","types","arrayTypes","objectType","fields","localized","Object","keys","getFields","length","arrayType","blocks","blockTypes","reduce","acc","_block","blockSlug","block","find","b","graphQL","singularName","push","fullName","resolveType","data","blockType","checkbox","code","collapsible","collectionSlug","newlyCreatedBlockType","objectTypeConfigWithCollapsibleFields","subField","addSubField","date","email","group","groupTypes","args","context","_id","id","join","joinName","joinType","docs","Array","isArray","collection","collections","hasNextPage","totalDocs","count","limit","page","sort","where","whereInputType","complexity","info","req","draft","Boolean","query","select","targetField","fullWhere","relationTo","on","equals","value","Error","payload","overrideAccess","depth","fallbackLocale","locale","pagination","shouldSlice","slice","json","number","hasMany","point","radio","values","relationship","isRelatedToManyCollections","hasManyValues","relationshipName","relationToType","graphQLCollections","filter","collectionConfig","relation","some","relations","map","relationshipArgs","relationsUseDrafts","versions","drafts","localization","localeInputType","fallbackLocaleInputType","relatedCollectionSlug","results","resultPromises","createPopulationPromise","relatedDoc","i","isValidGraphQLCollection","includes","result","payloadDataLoader","load","currentDepth","docID","showHiddenFields","transactionID","forEach","Promise","all","relatedDocument","richText","defaultDepth","editor","graphQLPopulationPromises","fieldPromises","populationPromises","populateDepth","maxDepth","undefined","findMany","flattenLocales","siblingDoc","row","objectTypeConfigWithRowFields","tabs","tabSchema","tab","subFieldSchema","text","textarea","upload"],"mappings":"AA+BA,SACEA,cAAc,EACdC,eAAe,EACfC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,QACX,UAAS;AAChB,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,kBAAiB;AACxE,SAASC,cAAc,EAAEC,wBAAwB,EAAEC,iBAAiB,EAAEC,OAAO,QAAQ,UAAS;AAC9F,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,iBAAgB;AAI7D,SAASC,WAAW,QAAQ,yCAAwC;AACpE,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,UAAU,QAAQ,6BAA4B;AACvD,SAASC,aAAa,QAAQ,gCAA+B;AAC7D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,eAAe,QAA+B,uBAAsB;AAC7E,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,gBAAgB,QAAQ,wBAAuB;AAExD,SAASC,sBAAsB,EAC7BC,KAAK,EACL,GAAGC,MACsD;IAKzD,IAAI,UAAUD,OAA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AAKmH,wBAAwB;wBACtF,MAAMkB,kBAAkB,MAAMpF,QAAQqB,GAAG,CAACsD,iBAAiB,CAACC,IAAI,CAC9DlJ,yBAAyB;4BACvB4D,gBAAgB4E;4BAChBW,cAAc;4BACd1C,OAAO;4BACP2C,OAAO5E;4BACPoB;4BACAc;4BACAC;4BACAH,gBAAgB;4BAChBT;4BACAsD,kBAAkB;4BAClBC,eAAehF,QAAQqB,GAAG,CAAC2D,aAAa;wBAC1C;wBAGF,IAAII,iBAAiB;4BACnB,IAAIpC,4BAA4B;gCAC9B,OAAO;oCACLpB,YAAYsC;oCACZnC,OAAO;wCACL,GAAGqD,eAAe;wCAClB3E,YAAYyD;oCACd;gCACF;4BACF;4BAEA,OAAOkB;wBACT;oBACF;oBAEA,OAAO;gBACT;gBAEA,OAAO;YACT;QACF;QAEA,OAAO;YACL,GAAGnI,gBAAgB;YACnB,CAAChB,WAAWO,MAAME,IAAI,EAAE,EAAEqG;QAC5B;IACF;AACF,EAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
2
2
|
import type { TypedCollectionSelect } from 'payload';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
3
|
+
import type { Context } from '../resolvers/types.js';
|
|
4
|
+
export declare function buildSelectForCollection(info: GraphQLResolveInfo, context?: Context): SelectType;
|
|
5
|
+
export declare function buildSelectForCollectionMany(info: GraphQLResolveInfo, context?: Context): SelectType;
|
|
6
|
+
export declare function resolveSelect(info: GraphQLResolveInfo, select: SelectType, context?: Context): SelectType;
|
|
6
7
|
type SelectType = TypedCollectionSelect['any'];
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/utilities/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,kBAAkB,EAAoB,MAAM,SAAS,CAAA;AACtF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/utilities/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,kBAAkB,EAAoB,MAAM,SAAS,CAAA;AACtF,OAAO,KAAK,EAKV,qBAAqB,EAEtB,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AASpD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,CAMhG;AACD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,UAAU,CAMZ;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,OAAO,GAChB,UAAU,CA0BZ;AA+JD,KAAK,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAA"}
|
package/dist/utilities/select.js
CHANGED
|
@@ -1,52 +1,47 @@
|
|
|
1
1
|
import { getNamedType, isInterfaceType, isObjectType, isUnionType, Kind } from 'graphql';
|
|
2
|
-
|
|
2
|
+
const selectRootPathsByContext = new WeakMap();
|
|
3
|
+
export function buildSelectForCollection(info, context) {
|
|
4
|
+
if (context) {
|
|
5
|
+
registerSelectRootPath(context, info);
|
|
6
|
+
}
|
|
3
7
|
return buildSelect(info);
|
|
4
8
|
}
|
|
5
|
-
export function buildSelectForCollectionMany(info) {
|
|
6
|
-
|
|
9
|
+
export function buildSelectForCollectionMany(info, context) {
|
|
10
|
+
if (context) {
|
|
11
|
+
registerSelectRootPath(context, info);
|
|
12
|
+
}
|
|
13
|
+
return buildSelect(info)?.docs;
|
|
7
14
|
}
|
|
8
|
-
export function resolveSelect(info, select) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const pathKey = path.key;
|
|
13
|
-
const pathType = info.schema.getType(path.typename);
|
|
14
|
-
if (pathType) {
|
|
15
|
-
const field = pathType?.getFields()?.[pathKey]?.extensions?.field;
|
|
16
|
-
if (field?.type === 'join') {
|
|
17
|
-
path = path.prev;
|
|
18
|
-
traversePath.unshift('docs');
|
|
19
|
-
}
|
|
20
|
-
if (field?.type === 'relationship' && Array.isArray(field.relationTo)) {
|
|
21
|
-
path = path.prev;
|
|
22
|
-
traversePath.unshift('value');
|
|
23
|
-
}
|
|
24
|
-
if (field) {
|
|
25
|
-
traversePath.unshift(field.name);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (path.prev) {
|
|
29
|
-
traverseTree(path.prev);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
traverseTree(info.path);
|
|
33
|
-
traversePath.forEach((key)=>{
|
|
34
|
-
select = select?.[key];
|
|
35
|
-
});
|
|
15
|
+
export function resolveSelect(info, select, context) {
|
|
16
|
+
const isSelectEnabled = context ? hasSelectRootPath(context, info) : typeof select !== 'undefined';
|
|
17
|
+
if (!isSelectEnabled) {
|
|
18
|
+
return undefined;
|
|
36
19
|
}
|
|
37
|
-
|
|
20
|
+
const field = info.parentType.getFields()[info.fieldName]?.extensions?.field;
|
|
21
|
+
const fieldSelect = buildSelect(info);
|
|
22
|
+
if (field?.type === 'join') {
|
|
23
|
+
return fieldSelect?.docs;
|
|
24
|
+
}
|
|
25
|
+
if ((field?.type === 'relationship' || field?.type === 'upload') && Array.isArray(field.relationTo)) {
|
|
26
|
+
return fieldSelect?.value;
|
|
27
|
+
}
|
|
28
|
+
return fieldSelect;
|
|
38
29
|
}
|
|
39
30
|
function buildSelect(info) {
|
|
40
31
|
const returnType = getNamedType(info.returnType);
|
|
41
|
-
const selectionSet = info.fieldNodes[0].selectionSet;
|
|
42
32
|
if (!returnType) {
|
|
43
33
|
return;
|
|
44
34
|
}
|
|
45
|
-
return
|
|
35
|
+
return info.fieldNodes.reduce((fieldTree, fieldNode)=>{
|
|
36
|
+
if (!fieldNode.selectionSet) {
|
|
37
|
+
return fieldTree;
|
|
38
|
+
}
|
|
39
|
+
return mergeSelectTrees(fieldTree, buildSelectTree(info, fieldNode.selectionSet, returnType));
|
|
40
|
+
}, {});
|
|
46
41
|
}
|
|
47
42
|
function buildSelectTree(info, selectionSet, type) {
|
|
48
43
|
const fieldMap = type.getFields?.();
|
|
49
|
-
|
|
44
|
+
let fieldTree = {};
|
|
50
45
|
for (const selection of selectionSet.selections){
|
|
51
46
|
switch(selection.kind){
|
|
52
47
|
case Kind.FIELD:
|
|
@@ -64,11 +59,15 @@ function buildSelectTree(info, selectionSet, type) {
|
|
|
64
59
|
if (selection.selectionSet) {
|
|
65
60
|
const type = getNamedType(fieldSchema.type);
|
|
66
61
|
if (isObjectType(type) || isInterfaceType(type) || isUnionType(type)) {
|
|
67
|
-
fieldTree
|
|
62
|
+
fieldTree = mergeSelectTrees(fieldTree, {
|
|
63
|
+
[fieldNameOriginal]: buildSelectTree(info, selection.selectionSet, type)
|
|
64
|
+
});
|
|
68
65
|
continue;
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
fieldTree
|
|
68
|
+
fieldTree = mergeSelectTrees(fieldTree, {
|
|
69
|
+
[fieldNameOriginal]: true
|
|
70
|
+
});
|
|
72
71
|
break;
|
|
73
72
|
}
|
|
74
73
|
case Kind.FRAGMENT_SPREAD:
|
|
@@ -77,7 +76,7 @@ function buildSelectTree(info, selectionSet, type) {
|
|
|
77
76
|
const fragment = info.fragments[fragmentName];
|
|
78
77
|
const fragmentType = fragment && info.schema.getType(fragment.typeCondition.name.value);
|
|
79
78
|
if (fragmentType) {
|
|
80
|
-
|
|
79
|
+
fieldTree = mergeSelectTrees(fieldTree, buildFragmentSelectTree(info, fragment.selectionSet, fragmentType, type));
|
|
81
80
|
}
|
|
82
81
|
break;
|
|
83
82
|
}
|
|
@@ -85,13 +84,7 @@ function buildSelectTree(info, selectionSet, type) {
|
|
|
85
84
|
{
|
|
86
85
|
const fragmentType = selection.typeCondition ? info.schema.getType(selection.typeCondition.name.value) : type;
|
|
87
86
|
if (fragmentType) {
|
|
88
|
-
|
|
89
|
-
const blockSlug = fragmentType.extensions?.blockSlug;
|
|
90
|
-
if (blockSlug && isUnionType(type)) {
|
|
91
|
-
fieldTree[blockSlug] = buildSelectTree(info, selection.selectionSet, fragmentType);
|
|
92
|
-
} else {
|
|
93
|
-
Object.assign(fieldTree, buildSelectTree(info, selection.selectionSet, fragmentType));
|
|
94
|
-
}
|
|
87
|
+
fieldTree = mergeSelectTrees(fieldTree, buildFragmentSelectTree(info, selection.selectionSet, fragmentType, type));
|
|
95
88
|
}
|
|
96
89
|
break;
|
|
97
90
|
}
|
|
@@ -99,5 +92,50 @@ function buildSelectTree(info, selectionSet, type) {
|
|
|
99
92
|
}
|
|
100
93
|
return fieldTree;
|
|
101
94
|
}
|
|
95
|
+
function buildFragmentSelectTree(info, selectionSet, fragmentType, parentType) {
|
|
96
|
+
const fragmentSelectTree = buildSelectTree(info, selectionSet, fragmentType);
|
|
97
|
+
const blockSlug = fragmentType.extensions?.blockSlug;
|
|
98
|
+
if (blockSlug && isUnionType(parentType)) {
|
|
99
|
+
return {
|
|
100
|
+
[blockSlug]: fragmentSelectTree
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return fragmentSelectTree;
|
|
104
|
+
}
|
|
105
|
+
function getRootPathKey(path) {
|
|
106
|
+
while(path.prev){
|
|
107
|
+
path = path.prev;
|
|
108
|
+
}
|
|
109
|
+
return path.key;
|
|
110
|
+
}
|
|
111
|
+
function hasSelectRootPath(context, info) {
|
|
112
|
+
return Boolean(selectRootPathsByContext.get(context)?.get(info.operation)?.has(getRootPathKey(info.path)));
|
|
113
|
+
}
|
|
114
|
+
function isSelectTree(value) {
|
|
115
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
116
|
+
}
|
|
117
|
+
function mergeSelectTrees(firstTree, secondTree) {
|
|
118
|
+
const mergedTree = {
|
|
119
|
+
...firstTree
|
|
120
|
+
};
|
|
121
|
+
for (const [fieldName, fieldSelect] of Object.entries(secondTree)){
|
|
122
|
+
const existingFieldSelect = mergedTree[fieldName];
|
|
123
|
+
mergedTree[fieldName] = isSelectTree(existingFieldSelect) && isSelectTree(fieldSelect) ? mergeSelectTrees(existingFieldSelect, fieldSelect) : fieldSelect;
|
|
124
|
+
}
|
|
125
|
+
return mergedTree;
|
|
126
|
+
}
|
|
127
|
+
function registerSelectRootPath(context, info) {
|
|
128
|
+
let selectRootPathsByOperation = selectRootPathsByContext.get(context);
|
|
129
|
+
if (!selectRootPathsByOperation) {
|
|
130
|
+
selectRootPathsByOperation = new WeakMap();
|
|
131
|
+
selectRootPathsByContext.set(context, selectRootPathsByOperation);
|
|
132
|
+
}
|
|
133
|
+
let selectRootPaths = selectRootPathsByOperation.get(info.operation);
|
|
134
|
+
if (!selectRootPaths) {
|
|
135
|
+
selectRootPaths = new Set();
|
|
136
|
+
selectRootPathsByOperation.set(info.operation, selectRootPaths);
|
|
137
|
+
}
|
|
138
|
+
selectRootPaths.add(getRootPathKey(info.path));
|
|
139
|
+
}
|
|
102
140
|
|
|
103
141
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/select.ts"],"sourcesContent":["import type { GraphQLObjectType, GraphQLResolveInfo, SelectionSetNode } from 'graphql'\nimport type { FieldBase, JoinField, RelationshipField, TypedCollectionSelect } from 'payload'\n\nimport { getNamedType, isInterfaceType, isObjectType, isUnionType, Kind } from 'graphql'\n\nexport function buildSelectForCollection(info: GraphQLResolveInfo): SelectType {\n return buildSelect(info)\n}\nexport function buildSelectForCollectionMany(info: GraphQLResolveInfo): SelectType {\n return buildSelect(info).docs as SelectType\n}\n\nexport function resolveSelect(info: GraphQLResolveInfo, select: SelectType): SelectType {\n if (select) {\n const traversePath: string[] = []\n const traverseTree = (path: GraphQLResolveInfo['path']) => {\n const pathKey = path.key\n const pathType = info.schema.getType(path.typename) as GraphQLObjectType\n\n if (pathType) {\n const field = pathType?.getFields()?.[pathKey]?.extensions?.field as\n | JoinField\n | RelationshipField\n\n if (field?.type === 'join') {\n path = path.prev\n traversePath.unshift('docs')\n }\n if (field?.type === 'relationship' && Array.isArray(field.relationTo)) {\n path = path.prev\n traversePath.unshift('value')\n }\n if (field) {\n traversePath.unshift(field.name)\n }\n }\n\n if (path.prev) {\n traverseTree(path.prev)\n }\n }\n\n traverseTree(info.path)\n traversePath.forEach((key) => {\n select = select?.[key] as SelectType\n })\n }\n\n return select\n}\n\nfunction buildSelect(info: GraphQLResolveInfo) {\n const returnType = getNamedType(info.returnType) as GraphQLObjectType\n const selectionSet = info.fieldNodes[0].selectionSet\n\n if (!returnType) {\n return\n }\n\n return buildSelectTree(info, selectionSet, returnType)\n}\nfunction buildSelectTree(\n info: GraphQLResolveInfo,\n selectionSet: SelectionSetNode,\n type: GraphQLObjectType,\n): SelectType {\n const fieldMap = type.getFields?.()\n const fieldTree: SelectType = {}\n\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n const fieldName = selection.name.value\n const fieldSchema = fieldMap?.[fieldName]\n\n const field = fieldSchema?.extensions?.field as FieldBase\n const fieldNameOriginal = field?.name || fieldName\n\n if (fieldName === '__typename') {\n continue\n }\n if (fieldSchema == undefined) {\n continue\n }\n\n if (selection.selectionSet) {\n const type = getNamedType(fieldSchema.type) as GraphQLObjectType\n\n if (isObjectType(type) || isInterfaceType(type) || isUnionType(type)) {\n fieldTree[fieldNameOriginal] = buildSelectTree(info, selection.selectionSet, type)\n continue\n }\n }\n\n fieldTree[fieldNameOriginal] = true\n break\n }\n\n case Kind.FRAGMENT_SPREAD: {\n const fragmentName = selection.name.value\n const fragment = info.fragments[fragmentName]\n const fragmentType =\n fragment && (info.schema.getType(fragment.typeCondition.name.value) as GraphQLObjectType)\n\n if (fragmentType) {\n Object.assign(fieldTree, buildSelectTree(info, fragment.selectionSet, fragmentType))\n }\n break\n }\n\n case Kind.INLINE_FRAGMENT: {\n const fragmentType = selection.typeCondition\n ? (info.schema.getType(selection.typeCondition.name.value) as GraphQLObjectType)\n : type\n\n if (fragmentType) {\n // Block types in unions need selections nested under their slug\n const blockSlug = fragmentType.extensions?.blockSlug as string | undefined\n\n if (blockSlug && isUnionType(type)) {\n fieldTree[blockSlug] = buildSelectTree(info, selection.selectionSet, fragmentType)\n } else {\n Object.assign(fieldTree, buildSelectTree(info, selection.selectionSet, fragmentType))\n }\n }\n break\n }\n }\n }\n\n return fieldTree\n}\n\ntype SelectType = TypedCollectionSelect['any']\n"],"names":["getNamedType","isInterfaceType","isObjectType","isUnionType","Kind","buildSelectForCollection","info","buildSelect","buildSelectForCollectionMany","docs","resolveSelect","select","traversePath","traverseTree","path","pathKey","key","pathType","schema","getType","typename","field","getFields","extensions","type","prev","unshift","Array","isArray","relationTo","name","forEach","returnType","selectionSet","fieldNodes","buildSelectTree","fieldMap","fieldTree","selection","selections","kind","FIELD","fieldName","value","fieldSchema","fieldNameOriginal","undefined","FRAGMENT_SPREAD","fragmentName","fragment","fragments","fragmentType","typeCondition","Object","assign","INLINE_FRAGMENT","blockSlug"],"mappings":"AAGA,SAASA,YAAY,EAAEC,eAAe,EAAEC,YAAY,EAAEC,WAAW,EAAEC,IAAI,QAAQ,UAAS;AAExF,OAAO,SAASC,yBAAyBC,IAAwB;IAC/D,OAAOC,YAAYD;AACrB;AACA,OAAO,SAASE,6BAA6BF,IAAwB;IACnE,OAAOC,YAAYD,MAAMG,IAAI;AAC/B;AAEA,OAAO,SAASC,cAAcJ,IAAwB,EAAEK,MAAkB;IACxE,IAAIA,QAAQ;QACV,MAAMC,eAAyB,EAAE;QACjC,MAAMC,eAAe,CAACC;YACpB,MAAMC,UAAUD,KAAKE,GAAG;YACxB,MAAMC,WAAWX,KAAKY,MAAM,CAACC,OAAO,CAACL,KAAKM,QAAQ;YAElD,IAAIH,UAAU;gBACZ,MAAMI,QAAQJ,UAAUK,a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BACF;oBAEA,IAAIR,UAAUL,YAAY,EAAE;wBAC1B,MAAMT,OAAOxB,aAAa4C,YAAYpB,IAAI;wBAE1C,IAAItB,aAAasB,SAASvB,gBAAgBuB,SAASrB,YAAYqB,OAAO;4BACpEa,SAAS,CAACQ,kBAAkB,GAAGV,gBAAgB7B,MAAMgC,UAAUL,YAAY,EAAET;4BAC7E;wBACF;oBACF;oBAEAa,SAAS,CAACQ,kBAAkB,GAAG;oBAC/B;gBACF;YAEA,KAAKzC,KAAK2C,eAAe;gBAAE;oBACzB,MAAMC,eAAeV,UAAUR,IAAI,CAACa,KAAK;oBACzC,MAAMM,WAAW3C,KAAK4C,SAAS,CAACF,aAAa;oBAC7C,MAAMG,eACJF,YAAa3C,KAAKY,MAAM,CAACC,OAAO,CAAC8B,SAASG,aAAa,CAACtB,IAAI,CAACa,KAAK;oBAEpE,IAAIQ,cAAc;wBAChBE,OAAOC,MAAM,CAACjB,WAAWF,gBAAgB7B,MAAM2C,SAAShB,YAAY,EAAEkB;oBACxE;oBACA;gBACF;YAEA,KAAK/C,KAAKmD,eAAe;gBAAE;oBACzB,MAAMJ,eAAeb,UAAUc,aAAa,GACvC9C,KAAKY,MAAM,CAACC,OAAO,CAACmB,UAAUc,aAAa,CAACtB,IAAI,CAACa,KAAK,IACvDnB;oBAEJ,IAAI2B,cAAc;wBAChB,gEAAgE;wBAChE,MAAMK,YAAYL,aAAa5B,UAAU,EAAEiC;wBAE3C,IAAIA,aAAarD,YAAYqB,OAAO;4BAClCa,SAAS,CAACmB,UAAU,GAAGrB,gBAAgB7B,MAAMgC,UAAUL,YAAY,EAAEkB;wBACvE,OAAO;4BACLE,OAAOC,MAAM,CAACjB,WAAWF,gBAAgB7B,MAAMgC,UAAUL,YAAY,EAAEkB;wBACzE;oBACF;oBACA;gBACF;QACF;IACF;IAEA,OAAOd;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/select.ts"],"sourcesContent":["import type { GraphQLObjectType, GraphQLResolveInfo, SelectionSetNode } from 'graphql'\nimport type {\n FieldBase,\n JoinField,\n RelationshipField,\n SelectIncludeType,\n TypedCollectionSelect,\n UploadField,\n} from 'payload'\n\nimport { getNamedType, isInterfaceType, isObjectType, isUnionType, Kind } from 'graphql'\n\nimport type { Context } from '../resolvers/types.js'\n\ntype SelectRootPathsByOperation = WeakMap<\n GraphQLResolveInfo['operation'],\n Set<GraphQLResolveInfo['path']['key']>\n>\n\nconst selectRootPathsByContext = new WeakMap<Context, SelectRootPathsByOperation>()\n\nexport function buildSelectForCollection(info: GraphQLResolveInfo, context?: Context): SelectType {\n if (context) {\n registerSelectRootPath(context, info)\n }\n\n return buildSelect(info)\n}\nexport function buildSelectForCollectionMany(\n info: GraphQLResolveInfo,\n context?: Context,\n): SelectType {\n if (context) {\n registerSelectRootPath(context, info)\n }\n\n return buildSelect(info)?.docs as SelectType\n}\n\nexport function resolveSelect(\n info: GraphQLResolveInfo,\n select: SelectType,\n context?: Context,\n): SelectType {\n const isSelectEnabled = context ? hasSelectRootPath(context, info) : typeof select !== 'undefined'\n\n if (!isSelectEnabled) {\n return undefined\n }\n\n const field = info.parentType.getFields()[info.fieldName]?.extensions?.field as\n | JoinField\n | RelationshipField\n | undefined\n | UploadField\n const fieldSelect = buildSelect(info)\n\n if (field?.type === 'join') {\n return fieldSelect?.docs as SelectType\n }\n\n if (\n (field?.type === 'relationship' || field?.type === 'upload') &&\n Array.isArray(field.relationTo)\n ) {\n return fieldSelect?.value as SelectType\n }\n\n return fieldSelect\n}\n\nfunction buildSelect(info: GraphQLResolveInfo) {\n const returnType = getNamedType(info.returnType) as GraphQLObjectType\n\n if (!returnType) {\n return\n }\n\n return info.fieldNodes.reduce<SelectTree>((fieldTree, fieldNode) => {\n if (!fieldNode.selectionSet) {\n return fieldTree\n }\n\n return mergeSelectTrees(fieldTree, buildSelectTree(info, fieldNode.selectionSet, returnType))\n }, {})\n}\n\nfunction buildSelectTree(\n info: GraphQLResolveInfo,\n selectionSet: SelectionSetNode,\n type: GraphQLObjectType,\n): SelectTree {\n const fieldMap = type.getFields?.()\n let fieldTree: SelectTree = {}\n\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n const fieldName = selection.name.value\n const fieldSchema = fieldMap?.[fieldName]\n\n const field = fieldSchema?.extensions?.field as FieldBase\n const fieldNameOriginal = field?.name || fieldName\n\n if (fieldName === '__typename') {\n continue\n }\n if (fieldSchema == undefined) {\n continue\n }\n\n if (selection.selectionSet) {\n const type = getNamedType(fieldSchema.type) as GraphQLObjectType\n\n if (isObjectType(type) || isInterfaceType(type) || isUnionType(type)) {\n fieldTree = mergeSelectTrees(fieldTree, {\n [fieldNameOriginal]: buildSelectTree(info, selection.selectionSet, type),\n })\n continue\n }\n }\n\n fieldTree = mergeSelectTrees(fieldTree, { [fieldNameOriginal]: true })\n break\n }\n\n case Kind.FRAGMENT_SPREAD: {\n const fragmentName = selection.name.value\n const fragment = info.fragments[fragmentName]\n const fragmentType =\n fragment && (info.schema.getType(fragment.typeCondition.name.value) as GraphQLObjectType)\n\n if (fragmentType) {\n fieldTree = mergeSelectTrees(\n fieldTree,\n buildFragmentSelectTree(info, fragment.selectionSet, fragmentType, type),\n )\n }\n break\n }\n\n case Kind.INLINE_FRAGMENT: {\n const fragmentType = selection.typeCondition\n ? (info.schema.getType(selection.typeCondition.name.value) as GraphQLObjectType)\n : type\n\n if (fragmentType) {\n fieldTree = mergeSelectTrees(\n fieldTree,\n buildFragmentSelectTree(info, selection.selectionSet, fragmentType, type),\n )\n }\n break\n }\n }\n }\n\n return fieldTree\n}\n\nfunction buildFragmentSelectTree(\n info: GraphQLResolveInfo,\n selectionSet: SelectionSetNode,\n fragmentType: GraphQLObjectType,\n parentType: GraphQLObjectType,\n): SelectTree {\n const fragmentSelectTree = buildSelectTree(info, selectionSet, fragmentType)\n const blockSlug = fragmentType.extensions?.blockSlug as string | undefined\n\n if (blockSlug && isUnionType(parentType)) {\n return { [blockSlug]: fragmentSelectTree }\n }\n\n return fragmentSelectTree\n}\n\nfunction getRootPathKey(path: GraphQLResolveInfo['path']): GraphQLResolveInfo['path']['key'] {\n while (path.prev) {\n path = path.prev\n }\n\n return path.key\n}\n\nfunction hasSelectRootPath(context: Context, info: GraphQLResolveInfo): boolean {\n return Boolean(\n selectRootPathsByContext.get(context)?.get(info.operation)?.has(getRootPathKey(info.path)),\n )\n}\n\nfunction isSelectTree(value: unknown): value is SelectTree {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction mergeSelectTrees(firstTree: SelectTree, secondTree: SelectTree): SelectTree {\n const mergedTree = { ...firstTree }\n\n for (const [fieldName, fieldSelect] of Object.entries(secondTree)) {\n const existingFieldSelect = mergedTree[fieldName]\n\n mergedTree[fieldName] =\n isSelectTree(existingFieldSelect) && isSelectTree(fieldSelect)\n ? mergeSelectTrees(existingFieldSelect, fieldSelect)\n : fieldSelect\n }\n\n return mergedTree\n}\n\nfunction registerSelectRootPath(context: Context, info: GraphQLResolveInfo): void {\n let selectRootPathsByOperation = selectRootPathsByContext.get(context)\n\n if (!selectRootPathsByOperation) {\n selectRootPathsByOperation = new WeakMap()\n selectRootPathsByContext.set(context, selectRootPathsByOperation)\n }\n\n let selectRootPaths = selectRootPathsByOperation.get(info.operation)\n\n if (!selectRootPaths) {\n selectRootPaths = new Set()\n selectRootPathsByOperation.set(info.operation, selectRootPaths)\n }\n\n selectRootPaths.add(getRootPathKey(info.path))\n}\n\ntype SelectTree = SelectIncludeType\ntype SelectType = TypedCollectionSelect['any']\n"],"names":["getNamedType","isInterfaceType","isObjectType","isUnionType","Kind","selectRootPathsByContext","WeakMap","buildSelectForCollection","info","context","registerSelectRootPath","buildSelect","buildSelectForCollectionMany","docs","resolveSelect","select","isSelectEnabled","hasSelectRootPath","undefined","field","parentType","getFields","fieldName","extensions","fieldSelect","type","Array","isArray","relationTo","value","returnType","fieldNodes","reduce","fieldTree","fieldNode","selectionSet","mergeSelectTrees","buildSelectTree","fieldMap","selection","selections","kind","FIELD","name","fieldSchema","fieldNameOriginal","FRAGMENT_SPREAD","fragmentName","fragment","fragments","fragmentType","schema","getType","typeCondition","buildFragmentSelectTree","INLINE_FRAGMENT","fragmentSelectTree","blockSlug","getRootPathKey","path","prev","key","Boolean","get","operation","has","isSelectTree","firstTree","secondTree","mergedTree","Object","entries","existingFieldSelect","selectRootPathsByOperation","set","selectRootPaths","Set","add"],"mappings":"AAUA,SAASA,YAAY,EAAEC,eAAe,EAAEC,YAAY,EAAEC,WAAW,EAAEC,IAAI,QAAQ,UAAS;AASxF,MAAMC,2BAA2B,IAAIC;AAErC,OAAO,SAASC,yBAAyBC,IAAwB,EAAEC,OAAiB;IAClF,IAAIA,SAAS;QACXC,uBAAuBD,SAASD;IAClC;IAEA,OAAOG,YAAYH;AACrB;AACA,OAAO,SAASI,6BACdJ,IAAwB,EACxBC,OAAiB;IAEjB,IAAIA,SAAS;QACXC,uBAAuBD,SAASD;IAClC;IAEA,OAAOG,YAAYH,OAAOK;AAC5B;AAEA,OAAO,SAASC,cACdN,IAAwB,EACxBO,MAAkB,EAClBN,OAAiB;IAEjB,MAAMO,kBAAkBP,UAAUQ,kBAAkBR,SAASD,QAAQ,OAAOO,WAAW;IAEvF,IAAI,CAACC,iBAAiB;QACpB,OAAOE;IACT;IAEA,MAAMC,QAAQX,KAAKY,UAAU,CAACC,SAAS,EAAE,CAACb,KAAKc,SAAS,CAAC,EAAEC,YAAYJ;IAKvE,MAAMK,cAAcb,YAAYH;IAEhC,IAAIW,OAAOM,SAAS,QAAQ;QAC1B,OAAOD,aAAaX;IACtB;IAEA,IACE,AAACM,CAAAA,OAAOM,SAAS,kBAAkBN,OAAOM,SAAS,QAAO,KAC1DC,MAAMC,OAAO,CAACR,MAAMS,UAAU,GAC9B;QACA,OAAOJ,aAAaK;IACtB;IAEA,OAAOL;AACT;AAEA,SAASb,YAAYH,IAAwB;IAC3C,MAAMsB,aAAa9B,aAAaQ,KAAKsB,UAAU;IAE/C,IAAI,CAACA,YA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QAAE,GAAGF,SAAS;IAAC;IAElC,KAAK,MAAM,CAAC7C,WAAWE,YAAY,IAAI8C,OAAOC,OAAO,CAACH,YAAa;QACjE,MAAMI,sBAAsBH,UAAU,CAAC/C,UAAU;QAEjD+C,UAAU,CAAC/C,UAAU,GACnB4C,aAAaM,wBAAwBN,aAAa1C,eAC9CY,iBAAiBoC,qBAAqBhD,eACtCA;IACR;IAEA,OAAO6C;AACT;AAEA,SAAS3D,uBAAuBD,OAAgB,EAAED,IAAwB;IACxE,IAAIiE,6BAA6BpE,yBAAyB0D,GAAG,CAACtD;IAE9D,IAAI,CAACgE,4BAA4B;QAC/BA,6BAA6B,IAAInE;QACjCD,yBAAyBqE,GAAG,CAACjE,SAASgE;IACxC;IAEA,IAAIE,kBAAkBF,2BAA2BV,GAAG,CAACvD,KAAKwD,SAAS;IAEnE,IAAI,CAACW,iBAAiB;QACpBA,kBAAkB,IAAIC;QACtBH,2BAA2BC,GAAG,CAAClE,KAAKwD,SAAS,EAAEW;IACjD;IAEAA,gBAAgBE,GAAG,CAACnB,eAAelD,KAAKmD,IAAI;AAC9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/graphql",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.cd47d20",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@types/pluralize": "^0.0.33",
|
|
54
54
|
"graphql-http": "1.22.4",
|
|
55
55
|
"@payloadcms/eslint-config": "3.28.0",
|
|
56
|
-
"payload": "4.0.0-internal.
|
|
56
|
+
"payload": "4.0.0-internal.cd47d20"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"graphql": "^16.8.1",
|
|
60
|
-
"payload": "4.0.0-internal.
|
|
60
|
+
"payload": "4.0.0-internal.cd47d20"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "pnpm build:types && pnpm build:swc",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { formatName } from './formatName';
|
|
3
|
-
describe('formatName', ()=>{
|
|
4
|
-
it.each`
|
|
5
|
-
char | expected
|
|
6
|
-
${'á'} | ${'a'}
|
|
7
|
-
${'è'} | ${'e'}
|
|
8
|
-
${'í'} | ${'i'}
|
|
9
|
-
${'ó'} | ${'o'}
|
|
10
|
-
${'ú'} | ${'u'}
|
|
11
|
-
${'ñ'} | ${'n'}
|
|
12
|
-
${'ü'} | ${'u'}
|
|
13
|
-
`('should convert accented character: $char', ({ char, expected })=>{
|
|
14
|
-
expect(formatName(char)).toEqual(expected);
|
|
15
|
-
});
|
|
16
|
-
describe('UTC offset handling', ()=>{
|
|
17
|
-
it.each`
|
|
18
|
-
offset | expected
|
|
19
|
-
${'+00:00'} | ${'_TZOFFSET_PLUS_00_00'}
|
|
20
|
-
${'+05:30'} | ${'_TZOFFSET_PLUS_05_30'}
|
|
21
|
-
${'+05:45'} | ${'_TZOFFSET_PLUS_05_45'}
|
|
22
|
-
${'+08:00'} | ${'_TZOFFSET_PLUS_08_00'}
|
|
23
|
-
${'+12:00'} | ${'_TZOFFSET_PLUS_12_00'}
|
|
24
|
-
${'+14:00'} | ${'_TZOFFSET_PLUS_14_00'}
|
|
25
|
-
${'-00:00'} | ${'_TZOFFSET_MINUS_00_00'}
|
|
26
|
-
${'-03:30'} | ${'_TZOFFSET_MINUS_03_30'}
|
|
27
|
-
${'-05:00'} | ${'_TZOFFSET_MINUS_05_00'}
|
|
28
|
-
${'-08:00'} | ${'_TZOFFSET_MINUS_08_00'}
|
|
29
|
-
${'-12:00'} | ${'_TZOFFSET_MINUS_12_00'}
|
|
30
|
-
`('should convert UTC offset $offset to $expected', ({ offset, expected })=>{
|
|
31
|
-
expect(formatName(offset)).toEqual(expected);
|
|
32
|
-
});
|
|
33
|
-
it('should not collide between positive and negative offsets', ()=>{
|
|
34
|
-
const plusFive = formatName('+05:00');
|
|
35
|
-
const minusFive = formatName('-05:00');
|
|
36
|
-
expect(plusFive).not.toEqual(minusFive);
|
|
37
|
-
expect(plusFive).toEqual('_TZOFFSET_PLUS_05_00');
|
|
38
|
-
expect(minusFive).toEqual('_TZOFFSET_MINUS_05_00');
|
|
39
|
-
});
|
|
40
|
-
it('should not treat IANA timezone names as offsets', ()=>{
|
|
41
|
-
// These should use standard formatting, not UTC offset formatting
|
|
42
|
-
expect(formatName('America/New_York')).toEqual('America_New_York');
|
|
43
|
-
expect(formatName('Europe/London')).toEqual('Europe_London');
|
|
44
|
-
expect(formatName('Asia/Tokyo')).toEqual('Asia_Tokyo');
|
|
45
|
-
});
|
|
46
|
-
it('should not treat partial offset patterns as offsets', ()=>{
|
|
47
|
-
// These don't match the strict ±HH:mm pattern, so they use standard formatting
|
|
48
|
-
expect(formatName('+5')).toEqual('_5');
|
|
49
|
-
expect(formatName('+05')).toEqual('_05');
|
|
50
|
-
expect(formatName('+0530')).toEqual('_0530');
|
|
51
|
-
// 05:30 without sign is not a UTC offset, starts with number so gets _ prefix
|
|
52
|
-
expect(formatName('05:30')).toEqual('_05:30');
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=formatName.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/formatName.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { formatName } from './formatName'\n\ndescribe('formatName', () => {\n it.each`\n char | expected\n ${'á'} | ${'a'}\n ${'è'} | ${'e'}\n ${'í'} | ${'i'}\n ${'ó'} | ${'o'}\n ${'ú'} | ${'u'}\n ${'ñ'} | ${'n'}\n ${'ü'} | ${'u'}\n `('should convert accented character: $char', ({ char, expected }) => {\n expect(formatName(char)).toEqual(expected)\n })\n\n describe('UTC offset handling', () => {\n it.each`\n offset | expected\n ${'+00:00'} | ${'_TZOFFSET_PLUS_00_00'}\n ${'+05:30'} | ${'_TZOFFSET_PLUS_05_30'}\n ${'+05:45'} | ${'_TZOFFSET_PLUS_05_45'}\n ${'+08:00'} | ${'_TZOFFSET_PLUS_08_00'}\n ${'+12:00'} | ${'_TZOFFSET_PLUS_12_00'}\n ${'+14:00'} | ${'_TZOFFSET_PLUS_14_00'}\n ${'-00:00'} | ${'_TZOFFSET_MINUS_00_00'}\n ${'-03:30'} | ${'_TZOFFSET_MINUS_03_30'}\n ${'-05:00'} | ${'_TZOFFSET_MINUS_05_00'}\n ${'-08:00'} | ${'_TZOFFSET_MINUS_08_00'}\n ${'-12:00'} | ${'_TZOFFSET_MINUS_12_00'}\n `('should convert UTC offset $offset to $expected', ({ offset, expected }) => {\n expect(formatName(offset)).toEqual(expected)\n })\n\n it('should not collide between positive and negative offsets', () => {\n const plusFive = formatName('+05:00')\n const minusFive = formatName('-05:00')\n expect(plusFive).not.toEqual(minusFive)\n expect(plusFive).toEqual('_TZOFFSET_PLUS_05_00')\n expect(minusFive).toEqual('_TZOFFSET_MINUS_05_00')\n })\n\n it('should not treat IANA timezone names as offsets', () => {\n // These should use standard formatting, not UTC offset formatting\n expect(formatName('America/New_York')).toEqual('America_New_York')\n expect(formatName('Europe/London')).toEqual('Europe_London')\n expect(formatName('Asia/Tokyo')).toEqual('Asia_Tokyo')\n })\n\n it('should not treat partial offset patterns as offsets', () => {\n // These don't match the strict ±HH:mm pattern, so they use standard formatting\n expect(formatName('+5')).toEqual('_5')\n expect(formatName('+05')).toEqual('_05')\n expect(formatName('+0530')).toEqual('_0530')\n // 05:30 without sign is not a UTC offset, starts with number so gets _ prefix\n expect(formatName('05:30')).toEqual('_05:30')\n })\n })\n})\n"],"names":["describe","it","expect","formatName","each","char","expected","toEqual","offset","plusFive","minusFive","not"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAA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AAC;QAC5B;QAEAN,GAAG,mDAAmD;YACpD,kEAAkE;YAClEC,OAAOC,WAAW,qBAAqBI,OAAO,CAAC;YAC/CL,OAAOC,WAAW,kBAAkBI,OAAO,CAAC;YAC5CL,OAAOC,WAAW,eAAeI,OAAO,CAAC;QAC3C;QAEAN,GAAG,uDAAuD;YACxD,+EAA+E;YAC/EC,OAAOC,WAAW,OAAOI,OAAO,CAAC;YACjCL,OAAOC,WAAW,QAAQI,OAAO,CAAC;YAClCL,OAAOC,WAAW,UAAUI,OAAO,CAAC;YACpC,8EAA8E;YAC9EL,OAAOC,WAAW,UAAUI,OAAO,CAAC;QACtC;IACF;AACF"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { formatUtcOffset } from './formatUtcOffset.js';
|
|
3
|
-
describe('formatUtcOffset', ()=>{
|
|
4
|
-
describe('valid UTC offsets', ()=>{
|
|
5
|
-
it.each([
|
|
6
|
-
[
|
|
7
|
-
'+00:00',
|
|
8
|
-
'_TZOFFSET_PLUS_00_00'
|
|
9
|
-
],
|
|
10
|
-
[
|
|
11
|
-
'+05:30',
|
|
12
|
-
'_TZOFFSET_PLUS_05_30'
|
|
13
|
-
],
|
|
14
|
-
[
|
|
15
|
-
'+05:45',
|
|
16
|
-
'_TZOFFSET_PLUS_05_45'
|
|
17
|
-
],
|
|
18
|
-
[
|
|
19
|
-
'+08:00',
|
|
20
|
-
'_TZOFFSET_PLUS_08_00'
|
|
21
|
-
],
|
|
22
|
-
[
|
|
23
|
-
'+09:30',
|
|
24
|
-
'_TZOFFSET_PLUS_09_30'
|
|
25
|
-
],
|
|
26
|
-
[
|
|
27
|
-
'+12:00',
|
|
28
|
-
'_TZOFFSET_PLUS_12_00'
|
|
29
|
-
],
|
|
30
|
-
[
|
|
31
|
-
'+14:00',
|
|
32
|
-
'_TZOFFSET_PLUS_14_00'
|
|
33
|
-
]
|
|
34
|
-
])('should convert positive offset %s to %s', (offset, expected)=>{
|
|
35
|
-
expect(formatUtcOffset(offset)).toEqual(expected);
|
|
36
|
-
});
|
|
37
|
-
it.each([
|
|
38
|
-
[
|
|
39
|
-
'-00:00',
|
|
40
|
-
'_TZOFFSET_MINUS_00_00'
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
'-03:30',
|
|
44
|
-
'_TZOFFSET_MINUS_03_30'
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
'-05:00',
|
|
48
|
-
'_TZOFFSET_MINUS_05_00'
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
'-08:00',
|
|
52
|
-
'_TZOFFSET_MINUS_08_00'
|
|
53
|
-
],
|
|
54
|
-
[
|
|
55
|
-
'-09:30',
|
|
56
|
-
'_TZOFFSET_MINUS_09_30'
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
'-12:00',
|
|
60
|
-
'_TZOFFSET_MINUS_12_00'
|
|
61
|
-
]
|
|
62
|
-
])('should convert negative offset %s to %s', (offset, expected)=>{
|
|
63
|
-
expect(formatUtcOffset(offset)).toEqual(expected);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
describe('non-offset values', ()=>{
|
|
67
|
-
it.each([
|
|
68
|
-
'UTC',
|
|
69
|
-
'America/New_York',
|
|
70
|
-
'Europe/London',
|
|
71
|
-
'Asia/Tokyo',
|
|
72
|
-
'Pacific/Auckland'
|
|
73
|
-
])('should return null for IANA timezone: %s', (timezone)=>{
|
|
74
|
-
expect(formatUtcOffset(timezone)).toBeNull();
|
|
75
|
-
});
|
|
76
|
-
it.each([
|
|
77
|
-
'+5',
|
|
78
|
-
'-8',
|
|
79
|
-
'+05',
|
|
80
|
-
'-08',
|
|
81
|
-
'+0530',
|
|
82
|
-
'-0800',
|
|
83
|
-
'05:30',
|
|
84
|
-
'0530',
|
|
85
|
-
'invalid',
|
|
86
|
-
''
|
|
87
|
-
])('should return null for non-standard format: %s', (value)=>{
|
|
88
|
-
expect(formatUtcOffset(value)).toBeNull();
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
describe('uniqueness', ()=>{
|
|
92
|
-
it('should produce unique names for positive and negative offsets', ()=>{
|
|
93
|
-
const testCases = [
|
|
94
|
-
[
|
|
95
|
-
'+05:00',
|
|
96
|
-
'-05:00'
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
'+08:00',
|
|
100
|
-
'-08:00'
|
|
101
|
-
],
|
|
102
|
-
[
|
|
103
|
-
'+00:00',
|
|
104
|
-
'-00:00'
|
|
105
|
-
],
|
|
106
|
-
[
|
|
107
|
-
'+12:00',
|
|
108
|
-
'-12:00'
|
|
109
|
-
]
|
|
110
|
-
];
|
|
111
|
-
for (const [positive, negative] of testCases){
|
|
112
|
-
const positiveName = formatUtcOffset(positive);
|
|
113
|
-
const negativeName = formatUtcOffset(negative);
|
|
114
|
-
expect(positiveName).not.toEqual(negativeName);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
it('should produce unique names for different hour offsets', ()=>{
|
|
118
|
-
const offsets = [
|
|
119
|
-
'+05:00',
|
|
120
|
-
'+06:00',
|
|
121
|
-
'+07:00',
|
|
122
|
-
'+08:00'
|
|
123
|
-
];
|
|
124
|
-
const names = offsets.map(formatUtcOffset);
|
|
125
|
-
const uniqueNames = new Set(names);
|
|
126
|
-
expect(uniqueNames.size).toEqual(offsets.length);
|
|
127
|
-
});
|
|
128
|
-
it('should produce unique names for different minute offsets', ()=>{
|
|
129
|
-
const offsets = [
|
|
130
|
-
'+05:00',
|
|
131
|
-
'+05:15',
|
|
132
|
-
'+05:30',
|
|
133
|
-
'+05:45'
|
|
134
|
-
];
|
|
135
|
-
const names = offsets.map(formatUtcOffset);
|
|
136
|
-
const uniqueNames = new Set(names);
|
|
137
|
-
expect(uniqueNames.size).toEqual(offsets.length);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
//# sourceMappingURL=formatUtcOffset.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/formatUtcOffset.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { formatUtcOffset } from './formatUtcOffset.js'\n\ndescribe('formatUtcOffset', () => {\n describe('valid UTC offsets', () => {\n it.each([\n ['+00:00', '_TZOFFSET_PLUS_00_00'],\n ['+05:30', '_TZOFFSET_PLUS_05_30'],\n ['+05:45', '_TZOFFSET_PLUS_05_45'],\n ['+08:00', '_TZOFFSET_PLUS_08_00'],\n ['+09:30', '_TZOFFSET_PLUS_09_30'],\n ['+12:00', '_TZOFFSET_PLUS_12_00'],\n ['+14:00', '_TZOFFSET_PLUS_14_00'],\n ])('should convert positive offset %s to %s', (offset, expected) => {\n expect(formatUtcOffset(offset)).toEqual(expected)\n })\n\n it.each([\n ['-00:00', '_TZOFFSET_MINUS_00_00'],\n ['-03:30', '_TZOFFSET_MINUS_03_30'],\n ['-05:00', '_TZOFFSET_MINUS_05_00'],\n ['-08:00', '_TZOFFSET_MINUS_08_00'],\n ['-09:30', '_TZOFFSET_MINUS_09_30'],\n ['-12:00', '_TZOFFSET_MINUS_12_00'],\n ])('should convert negative offset %s to %s', (offset, expected) => {\n expect(formatUtcOffset(offset)).toEqual(expected)\n })\n })\n\n describe('non-offset values', () => {\n it.each(['UTC', 'America/New_York', 'Europe/London', 'Asia/Tokyo', 'Pacific/Auckland'])(\n 'should return null for IANA timezone: %s',\n (timezone) => {\n expect(formatUtcOffset(timezone)).toBeNull()\n },\n )\n\n it.each(['+5', '-8', '+05', '-08', '+0530', '-0800', '05:30', '0530', 'invalid', ''])(\n 'should return null for non-standard format: %s',\n (value) => {\n expect(formatUtcOffset(value)).toBeNull()\n },\n )\n })\n\n describe('uniqueness', () => {\n it('should produce unique names for positive and negative offsets', () => {\n const testCases = [\n ['+05:00', '-05:00'],\n ['+08:00', '-08:00'],\n ['+00:00', '-00:00'],\n ['+12:00', '-12:00'],\n ]\n\n for (const [positive, negative] of testCases) {\n const positiveName = formatUtcOffset(positive)\n const negativeName = formatUtcOffset(negative)\n expect(positiveName).not.toEqual(negativeName)\n }\n })\n\n it('should produce unique names for different hour offsets', () => {\n const offsets = ['+05:00', '+06:00', '+07:00', '+08:00']\n const names = offsets.map(formatUtcOffset)\n const uniqueNames = new Set(names)\n expect(uniqueNames.size).toEqual(offsets.length)\n })\n\n it('should produce unique names for different minute offsets', () => {\n const offsets = ['+05:00', '+05:15', '+05:30', '+05:45']\n const names = offsets.map(formatUtcOffset)\n const uniqueNames = new Set(names)\n expect(uniqueNames.size).toEqual(offsets.length)\n })\n })\n})\n"],"names":["describe","expect","it","formatUtcOffset","each","offset","expected","toEqual","timezone","toBeNull","value","testCases","positive","negative","positiveName","negativeName","not","offsets","names","map","uniqueNames","Set","size","length"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,eAAe,QAAQ,uBAAsB;AAEtDH,SAAS,mBAAmB;IAC1BA,SAAS,qBAAqB;QAC5BE,GAAGE,IAAI,CAAC;YACN;gBAAC;gBAAU;aAAuB;YAClC;gBAAC;gBAAU;aAAuB;YAClC;gBAAC;gBAAU;aAAuB;YAClC;gBAAC;gBAAU;aAAuB;YAClC;gBAAC;gBAAU;aAAuB;YAClC;gBAAC;gBAAU;aAAuB;YAClC;gBAAC;gBAAU;aAAuB;SACnC,EAAE,2CAA2C,CAACC,QAAQC;YACrDL,OAAOE,gBAAgBE,SAASE,OAAO,CAACD;QAC1C;QAEAJ,GAAGE,IAAI,CAAC;YACN;gBAAC;gBAAU;aAAwB;YACnC;gBAAC;gBAAU;aAAwB;YACnC;gBAAC;gBAAU;aAAwB;YACnC;gBAAC;gBAAU;aAAwB;YACnC;gBAAC;gBAAU;aAAwB;YACnC;gBAAC;gBAAU;aAAwB;SACpC,EAAE,2CAA2C,CAACC,QAAQC;YACrDL,OAAOE,gBAAgBE,SAASE,OAAO,CAACD;QAC1C;I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