@strapi/plugin-graphql 5.46.0 → 5.46.1

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.
@@ -47,8 +47,11 @@ var associationResolvers = (({ strapi })=>{
47
47
  rootPath = rootPath.prev;
48
48
  }
49
49
  const rootQueryArgs = rootPath ? context.rootQueryArgsByPath?.get(rootPath.key) : undefined;
50
- // Only inherit status from built-in queries to avoid conflicts with custom resolvers
51
- const inheritedStatus = rootQueryArgs?.status && rootQueryArgs?._originField && isBuiltInQueryField(rootQueryArgs._originField) ? rootQueryArgs.status : null;
50
+ const shouldInheritRootQueryStatus = rootQueryArgs?._originField && isBuiltInQueryField(rootQueryArgs._originField);
51
+ // Only inherit status from built-in queries to avoid conflicts with custom resolvers.
52
+ // Built-in root queries default to published results; draft/preview queries pass `status`.
53
+ // Nested relations should match that parent query.
54
+ const inheritedStatus = shouldInheritRootQueryStatus ? rootQueryArgs.status || 'published' : null;
52
55
  const statusToApply = args.status || inheritedStatus;
53
56
  const defaultFilters = isTargetDraftAndPublishContentType && statusToApply ? {
54
57
  where: {
@@ -1 +1 @@
1
- {"version":3,"file":"association.js","sources":["../../../../../server/src/services/builders/resolvers/association.ts"],"sourcesContent":["import { get, merge } from 'lodash/fp';\nimport { async, contentTypes, errors } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\n\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { service: getGraphQLService } = strapi.plugin('graphql');\n\n const { isMorphRelation, isMedia } = getGraphQLService('utils').attributes;\n const { transformArgs } = getGraphQLService('builders').utils;\n const { toEntityResponse, toEntityResponseCollection } = getGraphQLService('format').returnTypes;\n\n return {\n buildAssociationResolver({\n contentTypeUID,\n attributeName,\n }: {\n contentTypeUID: Internal.UID.ContentType;\n attributeName: string;\n }) {\n const contentType = strapi.getModel(contentTypeUID);\n const attribute: any = contentType.attributes[attributeName];\n\n if (!attribute) {\n throw new ApplicationError(\n `Failed to build an association resolver for ${contentTypeUID}::${attributeName}`\n );\n }\n\n const isMediaAttribute = isMedia(attribute);\n const isMorphAttribute = isMorphRelation(attribute);\n\n const targetUID = isMediaAttribute ? 'plugin::upload.file' : attribute.target;\n const isToMany = isMediaAttribute ? attribute.multiple : attribute.relation.endsWith('Many');\n\n const targetContentType = strapi.getModel(targetUID);\n\n return async (parent: any, args: any, context: any, info: any) => {\n const { auth } = context.state;\n\n const transformedArgs = transformArgs(args, {\n contentType: targetContentType,\n usePagination: true,\n });\n\n await strapi.contentAPI.validate.query(transformedArgs, targetContentType, {\n auth,\n });\n\n const sanitizedQuery = await strapi.contentAPI.sanitize.query(\n transformedArgs,\n targetContentType,\n {\n auth,\n }\n );\n const transformedQuery = strapi.get('query-params').transform(targetUID, sanitizedQuery);\n\n const isTargetDraftAndPublishContentType =\n contentTypes.hasDraftAndPublish(targetContentType);\n\n // Helper to check if a field is from built-in queries (not custom resolvers)\n // Use the precomputed lookup populated by the content-api service at schema build time.\n const isBuiltInQueryField = (fieldName: string) => {\n const graphqlService = strapi.plugin('graphql').service('content-api');\n return graphqlService.isBuiltInQueryField(fieldName);\n };\n\n // Walk back to the root of info.path so we pick up the args of *our* query branch\n let rootPath = info?.path;\n while (rootPath?.prev) {\n rootPath = rootPath.prev;\n }\n const rootQueryArgs = rootPath ? context.rootQueryArgsByPath?.get(rootPath.key) : undefined;\n\n // Only inherit status from built-in queries to avoid conflicts with custom resolvers\n const inheritedStatus =\n rootQueryArgs?.status &&\n rootQueryArgs?._originField &&\n isBuiltInQueryField(rootQueryArgs._originField)\n ? rootQueryArgs.status\n : null;\n\n const statusToApply = args.status || inheritedStatus;\n\n const defaultFilters =\n isTargetDraftAndPublishContentType && statusToApply\n ? {\n where: {\n publishedAt: statusToApply === 'published' ? { $notNull: true } : { $null: true },\n },\n }\n : {};\n\n // Inherit hasPublishedVersion from root query (same pattern as status)\n const inheritedHasPublishedVersion =\n rootQueryArgs?.hasPublishedVersion !== undefined &&\n rootQueryArgs?._originField &&\n isBuiltInQueryField(rootQueryArgs._originField)\n ? rootQueryArgs.hasPublishedVersion\n : undefined;\n\n // Build hasPublishedVersion condition for this relation's model\n let hasPublishedVersionFilters: Record<string, any> = {};\n if (isTargetDraftAndPublishContentType && inheritedHasPublishedVersion !== undefined) {\n const meta = strapi.db.metadata.get(targetUID);\n const tableName = meta.tableName;\n const documentIdAttr = meta.attributes.documentId;\n const publishedAtAttr = meta.attributes.publishedAt;\n const documentIdColumn =\n ('columnName' in documentIdAttr && documentIdAttr.columnName) || 'document_id';\n const publishedAtColumn =\n ('columnName' in publishedAtAttr && publishedAtAttr.columnName) || 'published_at';\n\n const knex = strapi.db.connection;\n const subquery = knex(tableName)\n .distinct(documentIdColumn)\n .whereNotNull(publishedAtColumn);\n\n hasPublishedVersionFilters = {\n where: {\n documentId: inheritedHasPublishedVersion ? { $in: subquery } : { $notIn: subquery },\n },\n };\n }\n\n const dbQuery = merge(merge(defaultFilters, hasPublishedVersionFilters), transformedQuery);\n\n // Sign media URLs if upload plugin is available and using private provider\n const data = await (async () => {\n const rawData = await strapi.db\n .query(contentTypeUID)\n .load(parent, attributeName, dbQuery);\n if (isMediaAttribute && strapi.plugin('upload')) {\n const { signFileUrls } = strapi.plugin('upload').service('file');\n\n if (Array.isArray(rawData)) {\n return async.map(rawData, (item: any) => signFileUrls(item));\n }\n\n if (rawData) {\n return signFileUrls(rawData);\n }\n }\n\n return rawData;\n })();\n\n const sanitizeInfo = {\n args: sanitizedQuery,\n resourceUID: targetUID,\n };\n\n // If this a polymorphic association, it sanitizes & returns the raw data\n // Note: The value needs to be wrapped in a fake object that represents its parent\n // so that the sanitize util can work properly.\n if (isMorphAttribute) {\n // Helpers used for the data cleanup\n const wrapData = (dataToWrap: any) => ({ [attributeName]: dataToWrap });\n const sanitizeData = (dataToSanitize: any) => {\n return strapi.contentAPI.sanitize.output(dataToSanitize, contentType, { auth });\n };\n const unwrapData = get(attributeName);\n\n // Sanitizer definition\n const sanitizeMorphAttribute = async.pipe(wrapData, sanitizeData, unwrapData);\n\n return sanitizeMorphAttribute(data);\n }\n\n // If this is a to-many relation, it returns an object that\n // matches what the entity-response-collection's resolvers expect\n if (isToMany) {\n return toEntityResponseCollection(data, sanitizeInfo);\n }\n\n // Else, it returns an object that matches\n // what the entity-response's resolvers expect\n return toEntityResponse(data, sanitizeInfo);\n };\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","service","getGraphQLService","plugin","isMorphRelation","isMedia","attributes","transformArgs","utils","toEntityResponse","toEntityResponseCollection","returnTypes","buildAssociationResolver","contentTypeUID","attributeName","contentType","getModel","attribute","isMediaAttribute","isMorphAttribute","targetUID","target","isToMany","multiple","relation","endsWith","targetContentType","parent","args","context","info","auth","state","transformedArgs","usePagination","contentAPI","validate","query","sanitizedQuery","sanitize","transformedQuery","get","transform","isTargetDraftAndPublishContentType","contentTypes","hasDraftAndPublish","isBuiltInQueryField","fieldName","graphqlService","rootPath","path","prev","rootQueryArgs","rootQueryArgsByPath","key","undefined","inheritedStatus","status","_originField","statusToApply","defaultFilters","where","publishedAt","$notNull","$null","inheritedHasPublishedVersion","hasPublishedVersion","hasPublishedVersionFilters","meta","db","metadata","tableName","documentIdAttr","documentId","publishedAtAttr","documentIdColumn","columnName","publishedAtColumn","knex","connection","subquery","distinct","whereNotNull","$in","$notIn","dbQuery","merge","data","rawData","load","signFileUrls","Array","isArray","async","map","item","sanitizeInfo","resourceUID","wrapData","dataToWrap","sanitizeData","dataToSanitize","output","unwrapData","sanitizeMorphAttribute","pipe"],"mappings":";;;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,2BAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAAAA,EAASC,iBAAiB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;IAErD,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAAGH,iB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eAAe,CAACC,cAAAA,GAAAA;wBACpB,OAAOrG,MAAAA,CAAOmC,UAAU,CAACI,QAAQ,CAAC+D,MAAM,CAACD,gBAAgBtF,WAAAA,EAAa;AAAEgB,4BAAAA;AAAK,yBAAA,CAAA;AAC/E,oBAAA,CAAA;AACA,oBAAA,MAAMwE,aAAa9D,MAAAA,CAAI3B,aAAAA,CAAAA;;AAGvB,oBAAA,MAAM0F,sBAAAA,GAAyBX,WAAAA,CAAMY,IAAI,CAACP,UAAUE,YAAAA,EAAcG,UAAAA,CAAAA;AAElE,oBAAA,OAAOC,sBAAAA,CAAuBjB,IAAAA,CAAAA;AAChC,gBAAA;;;AAIA,gBAAA,IAAIjE,QAAAA,EAAU;AACZ,oBAAA,OAAOZ,2BAA2B6E,IAAAA,EAAMS,YAAAA,CAAAA;AAC1C,gBAAA;;;AAIA,gBAAA,OAAOvF,iBAAiB8E,IAAAA,EAAMS,YAAAA,CAAAA;AAChC,YAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"association.js","sources":["../../../../../server/src/services/builders/resolvers/association.ts"],"sourcesContent":["import { get, merge } from 'lodash/fp';\nimport { async, contentTypes, errors } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\n\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { service: getGraphQLService } = strapi.plugin('graphql');\n\n const { isMorphRelation, isMedia } = getGraphQLService('utils').attributes;\n const { transformArgs } = getGraphQLService('builders').utils;\n const { toEntityResponse, toEntityResponseCollection } = getGraphQLService('format').returnTypes;\n\n return {\n buildAssociationResolver({\n contentTypeUID,\n attributeName,\n }: {\n contentTypeUID: Internal.UID.ContentType;\n attributeName: string;\n }) {\n const contentType = strapi.getModel(contentTypeUID);\n const attribute: any = contentType.attributes[attributeName];\n\n if (!attribute) {\n throw new ApplicationError(\n `Failed to build an association resolver for ${contentTypeUID}::${attributeName}`\n );\n }\n\n const isMediaAttribute = isMedia(attribute);\n const isMorphAttribute = isMorphRelation(attribute);\n\n const targetUID = isMediaAttribute ? 'plugin::upload.file' : attribute.target;\n const isToMany = isMediaAttribute ? attribute.multiple : attribute.relation.endsWith('Many');\n\n const targetContentType = strapi.getModel(targetUID);\n\n return async (parent: any, args: any, context: any, info: any) => {\n const { auth } = context.state;\n\n const transformedArgs = transformArgs(args, {\n contentType: targetContentType,\n usePagination: true,\n });\n\n await strapi.contentAPI.validate.query(transformedArgs, targetContentType, {\n auth,\n });\n\n const sanitizedQuery = await strapi.contentAPI.sanitize.query(\n transformedArgs,\n targetContentType,\n {\n auth,\n }\n );\n const transformedQuery = strapi.get('query-params').transform(targetUID, sanitizedQuery);\n\n const isTargetDraftAndPublishContentType =\n contentTypes.hasDraftAndPublish(targetContentType);\n\n // Helper to check if a field is from built-in queries (not custom resolvers)\n // Use the precomputed lookup populated by the content-api service at schema build time.\n const isBuiltInQueryField = (fieldName: string) => {\n const graphqlService = strapi.plugin('graphql').service('content-api');\n return graphqlService.isBuiltInQueryField(fieldName);\n };\n\n // Walk back to the root of info.path so we pick up the args of *our* query branch\n let rootPath = info?.path;\n while (rootPath?.prev) {\n rootPath = rootPath.prev;\n }\n const rootQueryArgs = rootPath ? context.rootQueryArgsByPath?.get(rootPath.key) : undefined;\n\n const shouldInheritRootQueryStatus =\n rootQueryArgs?._originField && isBuiltInQueryField(rootQueryArgs._originField);\n\n // Only inherit status from built-in queries to avoid conflicts with custom resolvers.\n // Built-in root queries default to published results; draft/preview queries pass `status`.\n // Nested relations should match that parent query.\n const inheritedStatus = shouldInheritRootQueryStatus\n ? rootQueryArgs.status || 'published'\n : null;\n\n const statusToApply = args.status || inheritedStatus;\n\n const defaultFilters =\n isTargetDraftAndPublishContentType && statusToApply\n ? {\n where: {\n publishedAt: statusToApply === 'published' ? { $notNull: true } : { $null: true },\n },\n }\n : {};\n\n // Inherit hasPublishedVersion from root query (same pattern as status)\n const inheritedHasPublishedVersion =\n rootQueryArgs?.hasPublishedVersion !== undefined &&\n rootQueryArgs?._originField &&\n isBuiltInQueryField(rootQueryArgs._originField)\n ? rootQueryArgs.hasPublishedVersion\n : undefined;\n\n // Build hasPublishedVersion condition for this relation's model\n let hasPublishedVersionFilters: Record<string, any> = {};\n if (isTargetDraftAndPublishContentType && inheritedHasPublishedVersion !== undefined) {\n const meta = strapi.db.metadata.get(targetUID);\n const tableName = meta.tableName;\n const documentIdAttr = meta.attributes.documentId;\n const publishedAtAttr = meta.attributes.publishedAt;\n const documentIdColumn =\n ('columnName' in documentIdAttr && documentIdAttr.columnName) || 'document_id';\n const publishedAtColumn =\n ('columnName' in publishedAtAttr && publishedAtAttr.columnName) || 'published_at';\n\n const knex = strapi.db.connection;\n const subquery = knex(tableName)\n .distinct(documentIdColumn)\n .whereNotNull(publishedAtColumn);\n\n hasPublishedVersionFilters = {\n where: {\n documentId: inheritedHasPublishedVersion ? { $in: subquery } : { $notIn: subquery },\n },\n };\n }\n\n const dbQuery = merge(merge(defaultFilters, hasPublishedVersionFilters), transformedQuery);\n\n // Sign media URLs if upload plugin is available and using private provider\n const data = await (async () => {\n const rawData = await strapi.db\n .query(contentTypeUID)\n .load(parent, attributeName, dbQuery);\n if (isMediaAttribute && strapi.plugin('upload')) {\n const { signFileUrls } = strapi.plugin('upload').service('file');\n\n if (Array.isArray(rawData)) {\n return async.map(rawData, (item: any) => signFileUrls(item));\n }\n\n if (rawData) {\n return signFileUrls(rawData);\n }\n }\n\n return rawData;\n })();\n\n const sanitizeInfo = {\n args: sanitizedQuery,\n resourceUID: targetUID,\n };\n\n // If this a polymorphic association, it sanitizes & returns the raw data\n // Note: The value needs to be wrapped in a fake object that represents its parent\n // so that the sanitize util can work properly.\n if (isMorphAttribute) {\n // Helpers used for the data cleanup\n const wrapData = (dataToWrap: any) => ({ [attributeName]: dataToWrap });\n const sanitizeData = (dataToSanitize: any) => {\n return strapi.contentAPI.sanitize.output(dataToSanitize, contentType, { auth });\n };\n const unwrapData = get(attributeName);\n\n // Sanitizer definition\n const sanitizeMorphAttribute = async.pipe(wrapData, sanitizeData, unwrapData);\n\n return sanitizeMorphAttribute(data);\n }\n\n // If this is a to-many relation, it returns an object that\n // matches what the entity-response-collection's resolvers expect\n if (isToMany) {\n return toEntityResponseCollection(data, sanitizeInfo);\n }\n\n // Else, it returns an object that matches\n // what the entity-response's resolvers expect\n return toEntityResponse(data, sanitizeInfo);\n };\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","service","getGraphQLService","plugin","isMorphRelation","isMedia","attributes","transformArgs","utils","toEntityResponse","toEntityResponseCollection","returnTypes","buildAssociationResolver","contentTypeUID","attributeName","contentType","getModel","attribute","isMediaAttribute","isMorphAttribute","targetUID","target","isToMany","multiple","relation","endsWith","targetContentType","parent","args","context","info","auth","state","transformedArgs","usePagination","contentAPI","validate","query","sanitizedQuery","sanitize","transformedQuery","get","transform","isTargetDraftAndPublishContentType","contentTypes","hasDraftAndPublish","isBuiltInQueryField","fieldName","graphqlService","rootPath","path","prev","rootQueryArgs","rootQueryArgsByPath","key","undefined","shouldInheritRootQueryStatus","_originField","inheritedStatus","status","statusToApply","defaultFilters","where","publishedAt","$notNull","$null","inheritedHasPublishedVersion","hasPublishedVersion","hasPublishedVersionFilters","meta","db","metadata","tableName","documentIdAttr","documentId","publishedAtAttr","documentIdColumn","columnName","publishedAtColumn","knex","connection","subquery","distinct","whereNotNull","$in","$notIn","dbQuery","merge","data","rawData","load","signFileUrls","Array","isArray","async","map","item","sanitizeInfo","resourceUID","wrapData","dataToWrap","sanitizeData","dataToSanitize","output","unwrapData","sanitizeMorphAttribute","pipe"],"mappings":";;;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,2BAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAAAA,EAASC,iBAAiB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;IAErD,MAAM,EAAEC,eAA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;AAAE,4BAAA,CAACtF,gBAAgBsF;yBAAW,CAAA;AACrE,oBAAA,MAAMC,eAAe,CAACC,cAAAA,GAAAA;wBACpB,OAAOtG,MAAAA,CAAOmC,UAAU,CAACI,QAAQ,CAACgE,MAAM,CAACD,gBAAgBvF,WAAAA,EAAa;AAAEgB,4BAAAA;AAAK,yBAAA,CAAA;AAC/E,oBAAA,CAAA;AACA,oBAAA,MAAMyE,aAAa/D,MAAAA,CAAI3B,aAAAA,CAAAA;;AAGvB,oBAAA,MAAM2F,sBAAAA,GAAyBX,WAAAA,CAAMY,IAAI,CAACP,UAAUE,YAAAA,EAAcG,UAAAA,CAAAA;AAElE,oBAAA,OAAOC,sBAAAA,CAAuBjB,IAAAA,CAAAA;AAChC,gBAAA;;;AAIA,gBAAA,IAAIlE,QAAAA,EAAU;AACZ,oBAAA,OAAOZ,2BAA2B8E,IAAAA,EAAMS,YAAAA,CAAAA;AAC1C,gBAAA;;;AAIA,gBAAA,OAAOxF,iBAAiB+E,IAAAA,EAAMS,YAAAA,CAAAA;AAChC,YAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -45,8 +45,11 @@ var associationResolvers = (({ strapi })=>{
45
45
  rootPath = rootPath.prev;
46
46
  }
47
47
  const rootQueryArgs = rootPath ? context.rootQueryArgsByPath?.get(rootPath.key) : undefined;
48
- // Only inherit status from built-in queries to avoid conflicts with custom resolvers
49
- const inheritedStatus = rootQueryArgs?.status && rootQueryArgs?._originField && isBuiltInQueryField(rootQueryArgs._originField) ? rootQueryArgs.status : null;
48
+ const shouldInheritRootQueryStatus = rootQueryArgs?._originField && isBuiltInQueryField(rootQueryArgs._originField);
49
+ // Only inherit status from built-in queries to avoid conflicts with custom resolvers.
50
+ // Built-in root queries default to published results; draft/preview queries pass `status`.
51
+ // Nested relations should match that parent query.
52
+ const inheritedStatus = shouldInheritRootQueryStatus ? rootQueryArgs.status || 'published' : null;
50
53
  const statusToApply = args.status || inheritedStatus;
51
54
  const defaultFilters = isTargetDraftAndPublishContentType && statusToApply ? {
52
55
  where: {
@@ -1 +1 @@
1
- {"version":3,"file":"association.mjs","sources":["../../../../../server/src/services/builders/resolvers/association.ts"],"sourcesContent":["import { get, merge } from 'lodash/fp';\nimport { async, contentTypes, errors } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\n\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { service: getGraphQLService } = strapi.plugin('graphql');\n\n const { isMorphRelation, isMedia } = getGraphQLService('utils').attributes;\n const { transformArgs } = getGraphQLService('builders').utils;\n const { toEntityResponse, toEntityResponseCollection } = getGraphQLService('format').returnTypes;\n\n return {\n buildAssociationResolver({\n contentTypeUID,\n attributeName,\n }: {\n contentTypeUID: Internal.UID.ContentType;\n attributeName: string;\n }) {\n const contentType = strapi.getModel(contentTypeUID);\n const attribute: any = contentType.attributes[attributeName];\n\n if (!attribute) {\n throw new ApplicationError(\n `Failed to build an association resolver for ${contentTypeUID}::${attributeName}`\n );\n }\n\n const isMediaAttribute = isMedia(attribute);\n const isMorphAttribute = isMorphRelation(attribute);\n\n const targetUID = isMediaAttribute ? 'plugin::upload.file' : attribute.target;\n const isToMany = isMediaAttribute ? attribute.multiple : attribute.relation.endsWith('Many');\n\n const targetContentType = strapi.getModel(targetUID);\n\n return async (parent: any, args: any, context: any, info: any) => {\n const { auth } = context.state;\n\n const transformedArgs = transformArgs(args, {\n contentType: targetContentType,\n usePagination: true,\n });\n\n await strapi.contentAPI.validate.query(transformedArgs, targetContentType, {\n auth,\n });\n\n const sanitizedQuery = await strapi.contentAPI.sanitize.query(\n transformedArgs,\n targetContentType,\n {\n auth,\n }\n );\n const transformedQuery = strapi.get('query-params').transform(targetUID, sanitizedQuery);\n\n const isTargetDraftAndPublishContentType =\n contentTypes.hasDraftAndPublish(targetContentType);\n\n // Helper to check if a field is from built-in queries (not custom resolvers)\n // Use the precomputed lookup populated by the content-api service at schema build time.\n const isBuiltInQueryField = (fieldName: string) => {\n const graphqlService = strapi.plugin('graphql').service('content-api');\n return graphqlService.isBuiltInQueryField(fieldName);\n };\n\n // Walk back to the root of info.path so we pick up the args of *our* query branch\n let rootPath = info?.path;\n while (rootPath?.prev) {\n rootPath = rootPath.prev;\n }\n const rootQueryArgs = rootPath ? context.rootQueryArgsByPath?.get(rootPath.key) : undefined;\n\n // Only inherit status from built-in queries to avoid conflicts with custom resolvers\n const inheritedStatus =\n rootQueryArgs?.status &&\n rootQueryArgs?._originField &&\n isBuiltInQueryField(rootQueryArgs._originField)\n ? rootQueryArgs.status\n : null;\n\n const statusToApply = args.status || inheritedStatus;\n\n const defaultFilters =\n isTargetDraftAndPublishContentType && statusToApply\n ? {\n where: {\n publishedAt: statusToApply === 'published' ? { $notNull: true } : { $null: true },\n },\n }\n : {};\n\n // Inherit hasPublishedVersion from root query (same pattern as status)\n const inheritedHasPublishedVersion =\n rootQueryArgs?.hasPublishedVersion !== undefined &&\n rootQueryArgs?._originField &&\n isBuiltInQueryField(rootQueryArgs._originField)\n ? rootQueryArgs.hasPublishedVersion\n : undefined;\n\n // Build hasPublishedVersion condition for this relation's model\n let hasPublishedVersionFilters: Record<string, any> = {};\n if (isTargetDraftAndPublishContentType && inheritedHasPublishedVersion !== undefined) {\n const meta = strapi.db.metadata.get(targetUID);\n const tableName = meta.tableName;\n const documentIdAttr = meta.attributes.documentId;\n const publishedAtAttr = meta.attributes.publishedAt;\n const documentIdColumn =\n ('columnName' in documentIdAttr && documentIdAttr.columnName) || 'document_id';\n const publishedAtColumn =\n ('columnName' in publishedAtAttr && publishedAtAttr.columnName) || 'published_at';\n\n const knex = strapi.db.connection;\n const subquery = knex(tableName)\n .distinct(documentIdColumn)\n .whereNotNull(publishedAtColumn);\n\n hasPublishedVersionFilters = {\n where: {\n documentId: inheritedHasPublishedVersion ? { $in: subquery } : { $notIn: subquery },\n },\n };\n }\n\n const dbQuery = merge(merge(defaultFilters, hasPublishedVersionFilters), transformedQuery);\n\n // Sign media URLs if upload plugin is available and using private provider\n const data = await (async () => {\n const rawData = await strapi.db\n .query(contentTypeUID)\n .load(parent, attributeName, dbQuery);\n if (isMediaAttribute && strapi.plugin('upload')) {\n const { signFileUrls } = strapi.plugin('upload').service('file');\n\n if (Array.isArray(rawData)) {\n return async.map(rawData, (item: any) => signFileUrls(item));\n }\n\n if (rawData) {\n return signFileUrls(rawData);\n }\n }\n\n return rawData;\n })();\n\n const sanitizeInfo = {\n args: sanitizedQuery,\n resourceUID: targetUID,\n };\n\n // If this a polymorphic association, it sanitizes & returns the raw data\n // Note: The value needs to be wrapped in a fake object that represents its parent\n // so that the sanitize util can work properly.\n if (isMorphAttribute) {\n // Helpers used for the data cleanup\n const wrapData = (dataToWrap: any) => ({ [attributeName]: dataToWrap });\n const sanitizeData = (dataToSanitize: any) => {\n return strapi.contentAPI.sanitize.output(dataToSanitize, contentType, { auth });\n };\n const unwrapData = get(attributeName);\n\n // Sanitizer definition\n const sanitizeMorphAttribute = async.pipe(wrapData, sanitizeData, unwrapData);\n\n return sanitizeMorphAttribute(data);\n }\n\n // If this is a to-many relation, it returns an object that\n // matches what the entity-response-collection's resolvers expect\n if (isToMany) {\n return toEntityResponseCollection(data, sanitizeInfo);\n }\n\n // Else, it returns an object that matches\n // what the entity-response's resolvers expect\n return toEntityResponse(data, sanitizeInfo);\n };\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","service","getGraphQLService","plugin","isMorphRelation","isMedia","attributes","transformArgs","utils","toEntityResponse","toEntityResponseCollection","returnTypes","buildAssociationResolver","contentTypeUID","attributeName","contentType","getModel","attribute","isMediaAttribute","isMorphAttribute","targetUID","target","isToMany","multiple","relation","endsWith","targetContentType","parent","args","context","info","auth","state","transformedArgs","usePagination","contentAPI","validate","query","sanitizedQuery","sanitize","transformedQuery","get","transform","isTargetDraftAndPublishContentType","contentTypes","hasDraftAndPublish","isBuiltInQueryField","fieldName","graphqlService","rootPath","path","prev","rootQueryArgs","rootQueryArgsByPath","key","undefined","inheritedStatus","status","_originField","statusToApply","defaultFilters","where","publishedAt","$notNull","$null","inheritedHasPublishedVersion","hasPublishedVersion","hasPublishedVersionFilters","meta","db","metadata","tableName","documentIdAttr","documentId","publishedAtAttr","documentIdColumn","columnName","publishedAtColumn","knex","connection","subquery","distinct","whereNotNull","$in","$notIn","dbQuery","merge","data","rawData","load","signFileUrls","Array","isArray","async","map","item","sanitizeInfo","resourceUID","wrapData","dataToWrap","sanitizeData","dataToSanitize","output","unwrapData","sanitizeMorphAttribute","pipe"],"mappings":";;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,2BAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAAAA,EAASC,iBAAiB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;IAErD,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAAGH,iBAAAA,CAAkB,SAASI,UAAU;AAC1E,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAGL,iBAAAA,CAAkB,YAAYM,KAAK;IAC7D,MAAM,EAAEC,gBAAgB,EAAEC,0BAA0B,EAAE,GAAGR,iBAAAA,CAAkB,UAAUS,WAAW;IAEhG,OAAO;AACLC,QAAAA,wBAAAA,CAAAA,CAAyB,EACvBC,cAAc,EACdC,aAAa,EAId,EAAA;YACC,MAAMC,WAAAA,GAAcf,MAAAA,CAAOgB,QAAQ,CAACH,cAAAA,CAAAA;AACpC,YAAA,MAAMI,SAAAA,GAAiBF,WAAAA,CAAYT,UAAU,CAACQ,aAAAA,CAAc;AAE5D,YAAA,IAAI,CAACG,SAAAA,EAAW;gBACd,MAAM,IAAInB,iBACR,CAAC,4CAA4C,EAAEe,cAAAA,CAAe,EAAE,EAAEC,aAAAA,CAAAA,CAAe,CAAA;AAErF,YAAA;AAEA,YAAA,MAAMI,mBAAmBb,OAAAA,CAAQY,SAAAA,CAAAA;AACjC,YAAA,MAA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
+ {"version":3,"file":"association.mjs","sources":["../../../../../server/src/services/builders/resolvers/association.ts"],"sourcesContent":["import { get, merge } from 'lodash/fp';\nimport { async, contentTypes, errors } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\n\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { service: getGraphQLService } = strapi.plugin('graphql');\n\n const { isMorphRelation, isMedia } = getGraphQLService('utils').attributes;\n const { transformArgs } = getGraphQLService('builders').utils;\n const { toEntityResponse, toEntityResponseCollection } = getGraphQLService('format').returnTypes;\n\n return {\n buildAssociationResolver({\n contentTypeUID,\n attributeName,\n }: {\n contentTypeUID: Internal.UID.ContentType;\n attributeName: string;\n }) {\n const contentType = strapi.getModel(contentTypeUID);\n const attribute: any = contentType.attributes[attributeName];\n\n if (!attribute) {\n throw new ApplicationError(\n `Failed to build an association resolver for ${contentTypeUID}::${attributeName}`\n );\n }\n\n const isMediaAttribute = isMedia(attribute);\n const isMorphAttribute = isMorphRelation(attribute);\n\n const targetUID = isMediaAttribute ? 'plugin::upload.file' : attribute.target;\n const isToMany = isMediaAttribute ? attribute.multiple : attribute.relation.endsWith('Many');\n\n const targetContentType = strapi.getModel(targetUID);\n\n return async (parent: any, args: any, context: any, info: any) => {\n const { auth } = context.state;\n\n const transformedArgs = transformArgs(args, {\n contentType: targetContentType,\n usePagination: true,\n });\n\n await strapi.contentAPI.validate.query(transformedArgs, targetContentType, {\n auth,\n });\n\n const sanitizedQuery = await strapi.contentAPI.sanitize.query(\n transformedArgs,\n targetContentType,\n {\n auth,\n }\n );\n const transformedQuery = strapi.get('query-params').transform(targetUID, sanitizedQuery);\n\n const isTargetDraftAndPublishContentType =\n contentTypes.hasDraftAndPublish(targetContentType);\n\n // Helper to check if a field is from built-in queries (not custom resolvers)\n // Use the precomputed lookup populated by the content-api service at schema build time.\n const isBuiltInQueryField = (fieldName: string) => {\n const graphqlService = strapi.plugin('graphql').service('content-api');\n return graphqlService.isBuiltInQueryField(fieldName);\n };\n\n // Walk back to the root of info.path so we pick up the args of *our* query branch\n let rootPath = info?.path;\n while (rootPath?.prev) {\n rootPath = rootPath.prev;\n }\n const rootQueryArgs = rootPath ? context.rootQueryArgsByPath?.get(rootPath.key) : undefined;\n\n const shouldInheritRootQueryStatus =\n rootQueryArgs?._originField && isBuiltInQueryField(rootQueryArgs._originField);\n\n // Only inherit status from built-in queries to avoid conflicts with custom resolvers.\n // Built-in root queries default to published results; draft/preview queries pass `status`.\n // Nested relations should match that parent query.\n const inheritedStatus = shouldInheritRootQueryStatus\n ? rootQueryArgs.status || 'published'\n : null;\n\n const statusToApply = args.status || inheritedStatus;\n\n const defaultFilters =\n isTargetDraftAndPublishContentType && statusToApply\n ? {\n where: {\n publishedAt: statusToApply === 'published' ? { $notNull: true } : { $null: true },\n },\n }\n : {};\n\n // Inherit hasPublishedVersion from root query (same pattern as status)\n const inheritedHasPublishedVersion =\n rootQueryArgs?.hasPublishedVersion !== undefined &&\n rootQueryArgs?._originField &&\n isBuiltInQueryField(rootQueryArgs._originField)\n ? rootQueryArgs.hasPublishedVersion\n : undefined;\n\n // Build hasPublishedVersion condition for this relation's model\n let hasPublishedVersionFilters: Record<string, any> = {};\n if (isTargetDraftAndPublishContentType && inheritedHasPublishedVersion !== undefined) {\n const meta = strapi.db.metadata.get(targetUID);\n const tableName = meta.tableName;\n const documentIdAttr = meta.attributes.documentId;\n const publishedAtAttr = meta.attributes.publishedAt;\n const documentIdColumn =\n ('columnName' in documentIdAttr && documentIdAttr.columnName) || 'document_id';\n const publishedAtColumn =\n ('columnName' in publishedAtAttr && publishedAtAttr.columnName) || 'published_at';\n\n const knex = strapi.db.connection;\n const subquery = knex(tableName)\n .distinct(documentIdColumn)\n .whereNotNull(publishedAtColumn);\n\n hasPublishedVersionFilters = {\n where: {\n documentId: inheritedHasPublishedVersion ? { $in: subquery } : { $notIn: subquery },\n },\n };\n }\n\n const dbQuery = merge(merge(defaultFilters, hasPublishedVersionFilters), transformedQuery);\n\n // Sign media URLs if upload plugin is available and using private provider\n const data = await (async () => {\n const rawData = await strapi.db\n .query(contentTypeUID)\n .load(parent, attributeName, dbQuery);\n if (isMediaAttribute && strapi.plugin('upload')) {\n const { signFileUrls } = strapi.plugin('upload').service('file');\n\n if (Array.isArray(rawData)) {\n return async.map(rawData, (item: any) => signFileUrls(item));\n }\n\n if (rawData) {\n return signFileUrls(rawData);\n }\n }\n\n return rawData;\n })();\n\n const sanitizeInfo = {\n args: sanitizedQuery,\n resourceUID: targetUID,\n };\n\n // If this a polymorphic association, it sanitizes & returns the raw data\n // Note: The value needs to be wrapped in a fake object that represents its parent\n // so that the sanitize util can work properly.\n if (isMorphAttribute) {\n // Helpers used for the data cleanup\n const wrapData = (dataToWrap: any) => ({ [attributeName]: dataToWrap });\n const sanitizeData = (dataToSanitize: any) => {\n return strapi.contentAPI.sanitize.output(dataToSanitize, contentType, { auth });\n };\n const unwrapData = get(attributeName);\n\n // Sanitizer definition\n const sanitizeMorphAttribute = async.pipe(wrapData, sanitizeData, unwrapData);\n\n return sanitizeMorphAttribute(data);\n }\n\n // If this is a to-many relation, it returns an object that\n // matches what the entity-response-collection's resolvers expect\n if (isToMany) {\n return toEntityResponseCollection(data, sanitizeInfo);\n }\n\n // Else, it returns an object that matches\n // what the entity-response's resolvers expect\n return toEntityResponse(data, sanitizeInfo);\n };\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","service","getGraphQLService","plugin","isMorphRelation","isMedia","attributes","transformArgs","utils","toEntityResponse","toEntityResponseCollection","returnTypes","buildAssociationResolver","contentTypeUID","attributeName","contentType","getModel","attribute","isMediaAttribute","isMorphAttribute","targetUID","target","isToMany","multiple","relation","endsWith","targetContentType","parent","args","context","info","auth","state","transformedArgs","usePagination","contentAPI","validate","query","sanitizedQuery","sanitize","transformedQuery","get","transform","isTargetDraftAndPublishContentType","contentTypes","hasDraftAndPublish","isBuiltInQueryField","fieldName","graphqlService","rootPath","path","prev","rootQueryArgs","rootQueryArgsByPath","key","undefined","shouldInheritRootQueryStatus","_originField","inheritedStatus","status","statusToApply","defaultFilters","where","publishedAt","$notNull","$null","inheritedHasPublishedVersion","hasPublishedVersion","hasPublishedVersionFilters","meta","db","metadata","tableName","documentIdAttr","documentId","publishedAtAttr","documentIdColumn","columnName","publishedAtColumn","knex","connection","subquery","distinct","whereNotNull","$in","$notIn","dbQuery","merge","data","rawData","load","signFileUrls","Array","isArray","async","map","item","sanitizeInfo","resourceUID","wrapData","dataToWrap","sanitizeData","dataToSanitize","output","unwrapData","sanitizeMorphAttribute","pipe"],"mappings":";;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,2BAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAAAA,EAASC,iBAAiB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;IAErD,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAAGH,iBAAAA,CAAkB,SAASI,UAAU;AAC1E,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAGL,iBAAAA,CAAkB,YAAYM,KAAK;IAC7D,MAAM,EAAEC,gBAAgB,EAAEC,0BAA0B,EAAE,GAAGR,iBAAAA,CAAkB,UAAUS,WAAW;IAEhG,OAAO;AACLC,QAAAA,wBAAAA,CAAAA,CAAyB,EACvBC,cAAc,EACdC,aAAa,EAId,EAAA;YACC,MAAMC,WAAAA,GAAcf,MAAAA,CAAOgB,QAAQ,CAACH,cAAAA,CAAAA;AACpC,YAAA,MAAMI,SAAAA,GAAiBF,WAAAA,CAAYT,UAAU,CAACQ,aAAAA,CAAc;AAE5D,YAAA,IAAI,CAACG,SAAAA,EAAW;gBACd,MAAM,IAAInB,iBACR,CAAC,4CAA4C,EAAEe,cAAAA,CAAe,EAAE,EAAEC,aAAAA,CAAAA,CAAe,CAAA;AAErF,YAAA;AAEA,YAAA,MAAMI,mBAAmBb,OAAAA,CAAQY,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AAA;AAChC,YAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"association.d.ts","sourceRoot":"","sources":["../../../../../../server/src/services/builders/resolvers/association.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;qCAIf,OAAO;iEAW5B;QACD,cAAc,EAAE,SAAS,GAAG,CAAC,WAAW,CAAC;QACzC,aAAa,EAAE,MAAM,CAAC;KACvB,YAkBuB,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG;;AAhCnE,wBAiLE"}
1
+ {"version":3,"file":"association.d.ts","sourceRoot":"","sources":["../../../../../../server/src/services/builders/resolvers/association.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;qCAIf,OAAO;iEAW5B;QACD,cAAc,EAAE,SAAS,GAAG,CAAC,WAAW,CAAC;QACzC,aAAa,EAAE,MAAM,CAAC;KACvB,YAkBuB,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG;;AAhCnE,wBAmLE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "5.46.0",
3
+ "version": "5.46.1",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -65,7 +65,7 @@
65
65
  "@koa/cors": "5.0.0",
66
66
  "@strapi/design-system": "2.2.0",
67
67
  "@strapi/icons": "2.2.0",
68
- "@strapi/utils": "5.46.0",
68
+ "@strapi/utils": "5.46.1",
69
69
  "graphql": "^16.8.1",
70
70
  "graphql-depth-limit": "^1.1.0",
71
71
  "graphql-playground-middleware-koa": "^1.6.21",
@@ -77,19 +77,19 @@
77
77
  "pluralize": "8.0.0"
78
78
  },
79
79
  "devDependencies": {
80
- "@strapi/strapi": "5.46.0",
81
- "@strapi/types": "5.46.0",
80
+ "@strapi/strapi": "5.46.1",
81
+ "@strapi/types": "5.46.1",
82
82
  "@types/graphql-depth-limit": "1.1.5",
83
83
  "@types/koa-bodyparser": "4.3.12",
84
84
  "@types/koa__cors": "5.0.0",
85
85
  "cross-env": "^7.0.3",
86
- "eslint-config-custom": "5.46.0",
86
+ "eslint-config-custom": "5.46.1",
87
87
  "koa": "2.16.4",
88
88
  "react": "18.3.1",
89
89
  "react-dom": "18.3.1",
90
90
  "react-router-dom": "6.30.3",
91
- "styled-components": "6.1.8",
92
- "tsconfig": "5.46.0",
91
+ "styled-components": "6.4.1",
92
+ "tsconfig": "5.46.1",
93
93
  "typescript": "5.4.5"
94
94
  },
95
95
  "peerDependencies": {