@strapi/plugin-graphql 5.62.0 → 5.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,12 +8,14 @@ function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: nu
8
8
 
9
9
  function __variableDynamicImportRuntime0__(path) {
10
10
  switch (path) {
11
+ case './translations/ar.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/ar.json.js')); });
11
12
  case './translations/cs.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/cs.json.js')); });
12
13
  case './translations/da.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/da.json.js')); });
13
14
  case './translations/en.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/en.json.js')); });
14
15
  case './translations/es.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/es.json.js')); });
15
16
  case './translations/fr.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/fr.json.js')); });
16
17
  case './translations/ko.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/ko.json.js')); });
18
+ case './translations/nl.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/nl.json.js')); });
17
19
  case './translations/pl.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/pl.json.js')); });
18
20
  case './translations/ru.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/ru.json.js')); });
19
21
  case './translations/sk.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/sk.json.js')); });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import pluginPkg from '../../package.json';\n\nimport { pluginId } from './pluginId';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\nimport type { StrapiApp } from '@strapi/admin/strapi-admin';\n\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: StrapiApp) {\n app.registerPlugin({\n id: pluginId,\n name,\n });\n },\n bootstrap() {},\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["name","pluginPkg","strapi","register","app","registerPlugin","id","pluginId","bootstrap","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,IAAAA,GAAOC,gBAAAA,CAAUC,MAAM,CAACF,IAAI;AAElC;AACA,YAAe;AACbG,IAAAA,QAAAA,CAAAA,CAASC,GAAc,EAAA;AACrBA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjBC,EAAAA,EAAIC,iBAAAA;AACJP,YAAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA;IACAQ,SAAAA,CAAAA,GAAAA,CAAa,CAAA;IACb,MAAMC,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAAA,CAAQC,GAAG,CACrCH,OAAAA,CAAQI,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAAA,CAAO,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,kDAAyBD,IAAAA,EAAMX,iBAAAA,CAAAA;AACrCQ,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA;AACJ,QAAA,CAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB,IAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import pluginPkg from '../../package.json';\n\nimport { pluginId } from './pluginId';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\nimport type { StrapiApp } from '@strapi/admin/strapi-admin';\n\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: StrapiApp) {\n app.registerPlugin({\n id: pluginId,\n name,\n });\n },\n bootstrap() {},\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["name","pluginPkg","strapi","register","app","registerPlugin","id","pluginId","bootstrap","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,IAAAA,GAAOC,gBAAAA,CAAUC,MAAM,CAACF,IAAI;AAElC;AACA,YAAe;AACbG,IAAAA,QAAAA,CAAAA,CAASC,GAAc,EAAA;AACrBA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjBC,EAAAA,EAAIC,iBAAAA;AACJP,YAAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA;IACAQ,SAAAA,CAAAA,GAAAA,CAAa,CAAA;IACb,MAAMC,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAAA,CAAQC,GAAG,CACrCH,OAAAA,CAAQI,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAAA,CAAO,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,kDAAyBD,IAAAA,EAAMX,iBAAAA,CAAAA;AACrCQ,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA;AACJ,QAAA,CAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB,IAAA;AACF,CAAA;;;;"}
@@ -4,12 +4,14 @@ import { prefixPluginTranslations } from './utils/prefixPluginTranslations.mjs';
4
4
 
5
5
  function __variableDynamicImportRuntime0__(path) {
6
6
  switch (path) {
7
+ case './translations/ar.json': return import('./translations/ar.json.mjs');
7
8
  case './translations/cs.json': return import('./translations/cs.json.mjs');
8
9
  case './translations/da.json': return import('./translations/da.json.mjs');
9
10
  case './translations/en.json': return import('./translations/en.json.mjs');
10
11
  case './translations/es.json': return import('./translations/es.json.mjs');
11
12
  case './translations/fr.json': return import('./translations/fr.json.mjs');
12
13
  case './translations/ko.json': return import('./translations/ko.json.mjs');
14
+ case './translations/nl.json': return import('./translations/nl.json.mjs');
13
15
  case './translations/pl.json': return import('./translations/pl.json.mjs');
14
16
  case './translations/ru.json': return import('./translations/ru.json.mjs');
15
17
  case './translations/sk.json': return import('./translations/sk.json.mjs');
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import pluginPkg from '../../package.json';\n\nimport { pluginId } from './pluginId';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\nimport type { StrapiApp } from '@strapi/admin/strapi-admin';\n\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: StrapiApp) {\n app.registerPlugin({\n id: pluginId,\n name,\n });\n },\n bootstrap() {},\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["name","pluginPkg","strapi","register","app","registerPlugin","id","pluginId","bootstrap","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,IAAAA,GAAOC,SAAAA,CAAUC,MAAM,CAACF,IAAI;AAElC;AACA,YAAe;AACbG,IAAAA,QAAAA,CAAAA,CAASC,GAAc,EAAA;AACrBA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjBC,EAAAA,EAAIC,QAAAA;AACJP,YAAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA;IACAQ,SAAAA,CAAAA,GAAAA,CAAa,CAAA;IACb,MAAMC,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAAA,CAAQC,GAAG,CACrCH,OAAAA,CAAQI,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAAA,CAAO,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAAA,EAAMX,QAAAA,CAAAA;AACrCQ,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA;AACJ,QAAA,CAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB,IAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import pluginPkg from '../../package.json';\n\nimport { pluginId } from './pluginId';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\nimport type { StrapiApp } from '@strapi/admin/strapi-admin';\n\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: StrapiApp) {\n app.registerPlugin({\n id: pluginId,\n name,\n });\n },\n bootstrap() {},\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["name","pluginPkg","strapi","register","app","registerPlugin","id","pluginId","bootstrap","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,IAAAA,GAAOC,SAAAA,CAAUC,MAAM,CAACF,IAAI;AAElC;AACA,YAAe;AACbG,IAAAA,QAAAA,CAAAA,CAASC,GAAc,EAAA;AACrBA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjBC,EAAAA,EAAIC,QAAAA;AACJP,YAAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA;IACAQ,SAAAA,CAAAA,GAAAA,CAAa,CAAA;IACb,MAAMC,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAAA,CAAQC,GAAG,CACrCH,OAAAA,CAAQI,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAAA,CAAO,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAAA,EAAMX,QAAAA,CAAAA;AACrCQ,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,YAAA,CAAA,CAAA;AACJ,QAAA,CAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB,IAAA;AACF,CAAA;;;;"}
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var ar = {
4
+ "plugin.description.long": "يضيف نقطة نهاية GraphQL مع أساليب واجهة برمجة التطبيقات (API) الافتراضية.",
5
+ "plugin.description.short": "يضيف نقطة نهاية GraphQL مع أساليب واجهة برمجة التطبيقات (API) الافتراضية.",
6
+ "plugin.name": "GraphQL"
7
+ };
8
+
9
+ module.exports = ar;
10
+ //# sourceMappingURL=ar.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ar.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ var ar = {
2
+ "plugin.description.long": "يضيف نقطة نهاية GraphQL مع أساليب واجهة برمجة التطبيقات (API) الافتراضية.",
3
+ "plugin.description.short": "يضيف نقطة نهاية GraphQL مع أساليب واجهة برمجة التطبيقات (API) الافتراضية.",
4
+ "plugin.name": "GraphQL"
5
+ };
6
+
7
+ export { ar as default };
8
+ //# sourceMappingURL=ar.json.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ar.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var nl = {
4
+ "plugin.description.long": "Voegt een GraphQL-endpoint met standaard API-methoden toe.",
5
+ "plugin.description.short": "Voegt een GraphQL-endpoint met standaard API-methoden toe.",
6
+ "plugin.name": "GraphQL"
7
+ };
8
+
9
+ module.exports = nl;
10
+ //# sourceMappingURL=nl.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nl.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ var nl = {
2
+ "plugin.description.long": "Voegt een GraphQL-endpoint met standaard API-methoden toe.",
3
+ "plugin.description.short": "Voegt een GraphQL-endpoint met standaard API-methoden toe.",
4
+ "plugin.name": "GraphQL"
5
+ };
6
+
7
+ export { nl as default };
8
+ //# sourceMappingURL=nl.json.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nl.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var graphql = require('graphql');
4
+
5
+ // Checked by tag rather than `instanceof` so a schema built by another copy of `graphql` works too.
6
+ const isObjectType = (type)=>Object.prototype.toString.call(type) === '[object GraphQLObjectType]';
7
+ const isClientDisconnected = (contextValue)=>{
8
+ const res = contextValue?.koaContext?.res;
9
+ return Boolean(res?.destroyed && !res.writableEnded);
10
+ };
11
+ /**
12
+ * Wraps every field that has its own resolver so it throws before running when the HTTP peer of
13
+ * the request has disconnected. This stops the remaining nested query fields and serial mutation
14
+ * fields from running for a response nobody will receive.
15
+ *
16
+ * The check lives in the resolver, not in an Apollo `willResolveField` hook. Apollo wraps the
17
+ * resolvers of the schema it receives, so every plugin's `willResolveField` still runs and
18
+ * its `didResolveField` still receives the error. A throwing hook would skip both for the
19
+ * plugins around it.
20
+ *
21
+ * Fields without a resolver use the default resolver, which only reads a property of its parent,
22
+ * so they are left as they are. The schema is changed in place.
23
+ *
24
+ * graphql 16 has no way to cancel an execution, so this wrapper does it by hand. graphql 17 adds an
25
+ * `abortSignal` option to `execute` that stops new fields, later root mutations included, the same
26
+ * way. Replace this wrapper with that option once the plugin moves to graphql 17.
27
+ */ const abortFieldsOnClientDisconnect = (schema)=>{
28
+ Object.values(schema.getTypeMap()).forEach((type)=>{
29
+ if (type.name.startsWith('__') || !isObjectType(type)) {
30
+ return;
31
+ }
32
+ Object.values(type.getFields()).forEach((field)=>{
33
+ const { resolve } = field;
34
+ if (!resolve) {
35
+ return;
36
+ }
37
+ const wrapped = (source, args, contextValue, info)=>{
38
+ if (isClientDisconnected(contextValue)) {
39
+ // A GraphQLError passes through formatGraphqlError untouched. Any other error is treated as
40
+ // a server error and logged once per skipped field, which floods the log on large lists.
41
+ throw new graphql.GraphQLError('GraphQL request was aborted because the client disconnected', {
42
+ extensions: {
43
+ code: 'CLIENT_DISCONNECTED'
44
+ }
45
+ });
46
+ }
47
+ return resolve(source, args, contextValue, info);
48
+ };
49
+ field.resolve = wrapped;
50
+ });
51
+ });
52
+ return schema;
53
+ };
54
+
55
+ exports.abortFieldsOnClientDisconnect = abortFieldsOnClientDisconnect;
56
+ //# sourceMappingURL=abort-disconnected-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-disconnected-request.js","sources":["../../server/src/abort-disconnected-request.ts"],"sourcesContent":["import { GraphQLError } from 'graphql';\nimport type {\n GraphQLFieldResolver,\n GraphQLNamedType,\n GraphQLObjectType,\n GraphQLSchema,\n} from 'graphql';\n\ntype ResponseState = { destroyed: boolean; writableEnded: boolean };\n\n// Checked by tag rather than `instanceof` so a schema built by another copy of `graphql` works too.\nconst isObjectType = (type: GraphQLNamedType): type is GraphQLObjectType =>\n Object.prototype.toString.call(type) === '[object GraphQLObjectType]';\n\nconst isClientDisconnected = (contextValue: unknown): boolean => {\n const res = (contextValue as { koaContext?: { res?: ResponseState } } | undefined)?.koaContext\n ?.res;\n\n return Boolean(res?.destroyed && !res.writableEnded);\n};\n\n/**\n * Wraps every field that has its own resolver so it throws before running when the HTTP peer of\n * the request has disconnected. This stops the remaining nested query fields and serial mutation\n * fields from running for a response nobody will receive.\n *\n * The check lives in the resolver, not in an Apollo `willResolveField` hook. Apollo wraps the\n * resolvers of the schema it receives, so every plugin's `willResolveField` still runs and\n * its `didResolveField` still receives the error. A throwing hook would skip both for the\n * plugins around it.\n *\n * Fields without a resolver use the default resolver, which only reads a property of its parent,\n * so they are left as they are. The schema is changed in place.\n *\n * graphql 16 has no way to cancel an execution, so this wrapper does it by hand. graphql 17 adds an\n * `abortSignal` option to `execute` that stops new fields, later root mutations included, the same\n * way. Replace this wrapper with that option once the plugin moves to graphql 17.\n */\nexport const abortFieldsOnClientDisconnect = (schema: GraphQLSchema) => {\n Object.values(schema.getTypeMap()).forEach((type) => {\n if (type.name.startsWith('__') || !isObjectType(type)) {\n return;\n }\n\n Object.values(type.getFields()).forEach((field) => {\n const { resolve } = field;\n\n if (!resolve) {\n return;\n }\n\n const wrapped: GraphQLFieldResolver<unknown, unknown> = (\n source,\n args,\n contextValue,\n info\n ) => {\n if (isClientDisconnected(contextValue)) {\n // A GraphQLError passes through formatGraphqlError untouched. Any other error is treated as\n // a server error and logged once per skipped field, which floods the log on large lists.\n throw new GraphQLError('GraphQL request was aborted because the client disconnected', {\n extensions: { code: 'CLIENT_DISCONNECTED' },\n });\n }\n\n return resolve(source, args, contextValue, info);\n };\n\n field.resolve = wrapped;\n });\n });\n\n return schema;\n};\n"],"names":["isObjectType","type","Object","prototype","toString","call","isClientDisconnected","contextValue","res","koaContext","Boolean","destroyed","writableEnded","abortFieldsOnClientDisconnect","schema","values","getTypeMap","forEach","name","startsWith","getFields","field","resolve","wrapped","source","args","info","GraphQLError","extensions","code"],"mappings":";;;;AAUA;AACA,MAAMA,YAAAA,GAAe,CAACC,IAAAA,GACpBC,MAAAA,CAAOC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,IAAAA,CAAAA,KAAU,4BAAA;AAE3C,MAAMK,uBAAuB,CAACC,YAAAA,GAAAA;IAC5B,MAAMC,GAAAA,GAAOD,cAAuEE,UAAAA,EAChFD,GAAAA;AAEJ,IAAA,OAAOE,OAAAA,CAAQF,GAAAA,EAAKG,SAAAA,IAAa,CAACH,IAAII,aAAa,CAAA;AACrD,CAAA;AAEA;;;;;;;;;;;;;;;;IAiBO,MAAMC,6BAAAA,GAAgC,CAACC,MAAAA,GAAAA;AAC5CZ,IAAAA,MAAAA,CAAOa,MAAM,CAACD,MAAAA,CAAOE,UAAU,EAAA,CAAA,CAAIC,OAAO,CAAC,CAAChB,IAAAA,GAAAA;QAC1C,IAAIA,IAAAA,CAAKiB,IAAI,CAACC,UAAU,CAAC,IAAA,CAAA,IAAS,CAACnB,aAAaC,IAAAA,CAAAA,EAAO;AACrD,YAAA;AACF,QAAA;AAEAC,QAAAA,MAAAA,CAAOa,MAAM,CAACd,IAAAA,CAAKmB,SAAS,EAAA,CAAA,CAAIH,OAAO,CAAC,CAACI,KAAAA,GAAAA;YACvC,MAAM,EAAEC,OAAO,EAAE,GAAGD,KAAAA;AAEpB,YAAA,IAAI,CAACC,OAAAA,EAAS;AACZ,gBAAA;AACF,YAAA;AAEA,YAAA,MAAMC,OAAAA,GAAkD,CACtDC,MAAAA,EACAC,IAAAA,EACAlB,YAAAA,EACAmB,IAAAA,GAAAA;AAEA,gBAAA,IAAIpB,qBAAqBC,YAAAA,CAAAA,EAAe;;;oBAGtC,MAAM,IAAIoB,qBAAa,6DAAA,EAA+D;wBACpFC,UAAAA,EAAY;4BAAEC,IAAAA,EAAM;AAAsB;AAC5C,qBAAA,CAAA;AACF,gBAAA;gBAEA,OAAOP,OAAAA,CAAQE,MAAAA,EAAQC,IAAAA,EAAMlB,YAAAA,EAAcmB,IAAAA,CAAAA;AAC7C,YAAA,CAAA;AAEAL,YAAAA,KAAAA,CAAMC,OAAO,GAAGC,OAAAA;AAClB,QAAA,CAAA,CAAA;AACF,IAAA,CAAA,CAAA;IAEA,OAAOT,MAAAA;AACT;;;;"}
@@ -0,0 +1,54 @@
1
+ import { GraphQLError } from 'graphql';
2
+
3
+ // Checked by tag rather than `instanceof` so a schema built by another copy of `graphql` works too.
4
+ const isObjectType = (type)=>Object.prototype.toString.call(type) === '[object GraphQLObjectType]';
5
+ const isClientDisconnected = (contextValue)=>{
6
+ const res = contextValue?.koaContext?.res;
7
+ return Boolean(res?.destroyed && !res.writableEnded);
8
+ };
9
+ /**
10
+ * Wraps every field that has its own resolver so it throws before running when the HTTP peer of
11
+ * the request has disconnected. This stops the remaining nested query fields and serial mutation
12
+ * fields from running for a response nobody will receive.
13
+ *
14
+ * The check lives in the resolver, not in an Apollo `willResolveField` hook. Apollo wraps the
15
+ * resolvers of the schema it receives, so every plugin's `willResolveField` still runs and
16
+ * its `didResolveField` still receives the error. A throwing hook would skip both for the
17
+ * plugins around it.
18
+ *
19
+ * Fields without a resolver use the default resolver, which only reads a property of its parent,
20
+ * so they are left as they are. The schema is changed in place.
21
+ *
22
+ * graphql 16 has no way to cancel an execution, so this wrapper does it by hand. graphql 17 adds an
23
+ * `abortSignal` option to `execute` that stops new fields, later root mutations included, the same
24
+ * way. Replace this wrapper with that option once the plugin moves to graphql 17.
25
+ */ const abortFieldsOnClientDisconnect = (schema)=>{
26
+ Object.values(schema.getTypeMap()).forEach((type)=>{
27
+ if (type.name.startsWith('__') || !isObjectType(type)) {
28
+ return;
29
+ }
30
+ Object.values(type.getFields()).forEach((field)=>{
31
+ const { resolve } = field;
32
+ if (!resolve) {
33
+ return;
34
+ }
35
+ const wrapped = (source, args, contextValue, info)=>{
36
+ if (isClientDisconnected(contextValue)) {
37
+ // A GraphQLError passes through formatGraphqlError untouched. Any other error is treated as
38
+ // a server error and logged once per skipped field, which floods the log on large lists.
39
+ throw new GraphQLError('GraphQL request was aborted because the client disconnected', {
40
+ extensions: {
41
+ code: 'CLIENT_DISCONNECTED'
42
+ }
43
+ });
44
+ }
45
+ return resolve(source, args, contextValue, info);
46
+ };
47
+ field.resolve = wrapped;
48
+ });
49
+ });
50
+ return schema;
51
+ };
52
+
53
+ export { abortFieldsOnClientDisconnect };
54
+ //# sourceMappingURL=abort-disconnected-request.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-disconnected-request.mjs","sources":["../../server/src/abort-disconnected-request.ts"],"sourcesContent":["import { GraphQLError } from 'graphql';\nimport type {\n GraphQLFieldResolver,\n GraphQLNamedType,\n GraphQLObjectType,\n GraphQLSchema,\n} from 'graphql';\n\ntype ResponseState = { destroyed: boolean; writableEnded: boolean };\n\n// Checked by tag rather than `instanceof` so a schema built by another copy of `graphql` works too.\nconst isObjectType = (type: GraphQLNamedType): type is GraphQLObjectType =>\n Object.prototype.toString.call(type) === '[object GraphQLObjectType]';\n\nconst isClientDisconnected = (contextValue: unknown): boolean => {\n const res = (contextValue as { koaContext?: { res?: ResponseState } } | undefined)?.koaContext\n ?.res;\n\n return Boolean(res?.destroyed && !res.writableEnded);\n};\n\n/**\n * Wraps every field that has its own resolver so it throws before running when the HTTP peer of\n * the request has disconnected. This stops the remaining nested query fields and serial mutation\n * fields from running for a response nobody will receive.\n *\n * The check lives in the resolver, not in an Apollo `willResolveField` hook. Apollo wraps the\n * resolvers of the schema it receives, so every plugin's `willResolveField` still runs and\n * its `didResolveField` still receives the error. A throwing hook would skip both for the\n * plugins around it.\n *\n * Fields without a resolver use the default resolver, which only reads a property of its parent,\n * so they are left as they are. The schema is changed in place.\n *\n * graphql 16 has no way to cancel an execution, so this wrapper does it by hand. graphql 17 adds an\n * `abortSignal` option to `execute` that stops new fields, later root mutations included, the same\n * way. Replace this wrapper with that option once the plugin moves to graphql 17.\n */\nexport const abortFieldsOnClientDisconnect = (schema: GraphQLSchema) => {\n Object.values(schema.getTypeMap()).forEach((type) => {\n if (type.name.startsWith('__') || !isObjectType(type)) {\n return;\n }\n\n Object.values(type.getFields()).forEach((field) => {\n const { resolve } = field;\n\n if (!resolve) {\n return;\n }\n\n const wrapped: GraphQLFieldResolver<unknown, unknown> = (\n source,\n args,\n contextValue,\n info\n ) => {\n if (isClientDisconnected(contextValue)) {\n // A GraphQLError passes through formatGraphqlError untouched. Any other error is treated as\n // a server error and logged once per skipped field, which floods the log on large lists.\n throw new GraphQLError('GraphQL request was aborted because the client disconnected', {\n extensions: { code: 'CLIENT_DISCONNECTED' },\n });\n }\n\n return resolve(source, args, contextValue, info);\n };\n\n field.resolve = wrapped;\n });\n });\n\n return schema;\n};\n"],"names":["isObjectType","type","Object","prototype","toString","call","isClientDisconnected","contextValue","res","koaContext","Boolean","destroyed","writableEnded","abortFieldsOnClientDisconnect","schema","values","getTypeMap","forEach","name","startsWith","getFields","field","resolve","wrapped","source","args","info","GraphQLError","extensions","code"],"mappings":";;AAUA;AACA,MAAMA,YAAAA,GAAe,CAACC,IAAAA,GACpBC,MAAAA,CAAOC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,IAAAA,CAAAA,KAAU,4BAAA;AAE3C,MAAMK,uBAAuB,CAACC,YAAAA,GAAAA;IAC5B,MAAMC,GAAAA,GAAOD,cAAuEE,UAAAA,EAChFD,GAAAA;AAEJ,IAAA,OAAOE,OAAAA,CAAQF,GAAAA,EAAKG,SAAAA,IAAa,CAACH,IAAII,aAAa,CAAA;AACrD,CAAA;AAEA;;;;;;;;;;;;;;;;IAiBO,MAAMC,6BAAAA,GAAgC,CAACC,MAAAA,GAAAA;AAC5CZ,IAAAA,MAAAA,CAAOa,MAAM,CAACD,MAAAA,CAAOE,UAAU,EAAA,CAAA,CAAIC,OAAO,CAAC,CAAChB,IAAAA,GAAAA;QAC1C,IAAIA,IAAAA,CAAKiB,IAAI,CAACC,UAAU,CAAC,IAAA,CAAA,IAAS,CAACnB,aAAaC,IAAAA,CAAAA,EAAO;AACrD,YAAA;AACF,QAAA;AAEAC,QAAAA,MAAAA,CAAOa,MAAM,CAACd,IAAAA,CAAKmB,SAAS,EAAA,CAAA,CAAIH,OAAO,CAAC,CAACI,KAAAA,GAAAA;YACvC,MAAM,EAAEC,OAAO,EAAE,GAAGD,KAAAA;AAEpB,YAAA,IAAI,CAACC,OAAAA,EAAS;AACZ,gBAAA;AACF,YAAA;AAEA,YAAA,MAAMC,OAAAA,GAAkD,CACtDC,MAAAA,EACAC,IAAAA,EACAlB,YAAAA,EACAmB,IAAAA,GAAAA;AAEA,gBAAA,IAAIpB,qBAAqBC,YAAAA,CAAAA,EAAe;;;oBAGtC,MAAM,IAAIoB,aAAa,6DAAA,EAA+D;wBACpFC,UAAAA,EAAY;4BAAEC,IAAAA,EAAM;AAAsB;AAC5C,qBAAA,CAAA;AACF,gBAAA;gBAEA,OAAOP,OAAAA,CAAQE,MAAAA,EAAQC,IAAAA,EAAMlB,YAAAA,EAAcmB,IAAAA,CAAAA;AAC7C,YAAA,CAAA;AAEAL,YAAAA,KAAAA,CAAMC,OAAO,GAAGC,OAAAA;AAClB,QAAA,CAAA,CAAA;AACF,IAAA,CAAA,CAAA;IAEA,OAAOT,MAAAA;AACT;;;;"}
@@ -7,6 +7,7 @@ var koa = require('@as-integrations/koa');
7
7
  var depthLimit = require('graphql-depth-limit');
8
8
  var bodyParser = require('koa-bodyparser');
9
9
  var cors = require('@koa/cors');
10
+ var abortDisconnectedRequest = require('./abort-disconnected-request.js');
10
11
  var formatGraphqlError = require('./format-graphql-error.js');
11
12
 
12
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -167,6 +168,9 @@ async function bootstrap({ strapi }) {
167
168
  }
168
169
  return undefined;
169
170
  });
171
+ if (serverConfig.schema) {
172
+ abortDisconnectedRequest.abortFieldsOnClientDisconnect(serverConfig.schema);
173
+ }
170
174
  // Create a new Apollo server
171
175
  const server$1 = new server.ApolloServer(serverConfig);
172
176
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { mergeWith, isEmpty, isObject } from 'lodash';\nimport { ApolloServer, type ApolloServerPlugin, type ApolloServerOptions } from '@apollo/server';\nimport {\n ApolloServerPluginLandingPageLocalDefault,\n ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\nimport { koaMiddleware } from '@as-integrations/koa';\nimport depthLimit from 'graphql-depth-limit';\nimport bodyParser from 'koa-bodyparser';\nimport cors from '@koa/cors';\n\nimport type { Core } from '@strapi/types';\nimport type { Options } from '@koa/cors';\nimport type { BaseContext, DefaultContextExtends, DefaultStateExtends } from 'koa';\n\nimport { formatGraphqlError } from './format-graphql-error';\n\ntype StrapiGraphQLContext = BaseContext & {\n rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;\n};\n\ntype OperationLimitConfig = {\n depthLimit?: unknown;\n maxLimit?: unknown;\n};\n\nexport const getOperationLimitsWarning = ({\n depthLimit: configuredDepthLimit,\n maxLimit,\n}: OperationLimitConfig): string | undefined => {\n const unboundedOrInvalidKeys: string[] = [];\n\n if (\n typeof configuredDepthLimit !== 'number' ||\n !Number.isFinite(configuredDepthLimit) ||\n configuredDepthLimit <= 0\n ) {\n unboundedOrInvalidKeys.push('depthLimit');\n }\n\n if (typeof maxLimit !== 'number' || !Number.isFinite(maxLimit) || maxLimit <= 0) {\n unboundedOrInvalidKeys.push('maxLimit');\n }\n\n if (unboundedOrInvalidKeys.length === 0) {\n return undefined;\n }\n\n return `Built-in GraphQL operation limits are unbounded or invalid for: ${unboundedOrInvalidKeys.join(', ')}. Configure these limits (for example: defaultLimit: 25, maxLimit: 100, depthLimit: 10). Custom Apollo validation rules may independently enforce limits. See https://docs.strapi.io/cms/configurations/plugins.`;\n};\n\nexport const determineLandingPage = (\n strapi: Core.Strapi\n): ApolloServerPlugin<StrapiGraphQLContext> => {\n const { config } = strapi.plugin('graphql');\n const utils = strapi.plugin('graphql').service('utils');\n\n /**\n * configLanding page may be one of the following:\n *\n * - true: always use \"playground\" even in production\n * - false: never show \"playground\" even in non-production\n * - undefined: default Apollo behavior (hide playground on production)\n * - a function that returns an Apollo plugin that implements renderLandingPage\n ** */\n const configLandingPage = config<\n boolean | ((strapi?: Core.Strapi) => ApolloServerPlugin | boolean)\n >('landingPage');\n\n const isProduction = process.env.NODE_ENV === 'production';\n\n const localLanding = () => {\n strapi.log.debug('Apollo landing page: local');\n utils.playground.setEnabled(true);\n return ApolloServerPluginLandingPageLocalDefault();\n };\n\n const prodLanding = () => {\n strapi.log.debug('Apollo landing page: production');\n utils.playground.setEnabled(false);\n return ApolloServerPluginLandingPageProductionDefault();\n };\n\n const userLanding = (userFunction: (strapi?: Core.Strapi) => ApolloServerPlugin | boolean) => {\n strapi.log.debug('Apollo landing page: from user-defined function...');\n const result = userFunction(strapi);\n if (result === true) {\n return localLanding();\n }\n if (result === false) {\n return prodLanding();\n }\n strapi.log.debug('Apollo landing page: user-defined');\n return result;\n };\n\n // DEPRECATED, remove in Strapi v6\n const playgroundAlways = config('playgroundAlways');\n if (playgroundAlways !== undefined) {\n strapi.log.warn(\n 'The graphql config playgroundAlways is deprecated. This will be removed in Strapi 6. Please use landingPage instead. '\n );\n }\n if (playgroundAlways === false) {\n strapi.log.warn(\n 'graphql config playgroundAlways:false has no effect, please use landingPage:false to disable Graphql Playground in all environments'\n );\n }\n\n if (playgroundAlways || configLandingPage === true) {\n return localLanding();\n }\n\n // if landing page has been disabled, use production\n if (configLandingPage === false) {\n return prodLanding();\n }\n\n // If user did not define any settings, use our defaults\n if (configLandingPage === undefined) {\n return isProduction ? prodLanding() : localLanding();\n }\n\n // if user provided a landing page function, return that\n if (typeof configLandingPage === 'function') {\n return userLanding(configLandingPage);\n }\n\n // If no other setting could be found, default to production settings\n strapi.log.warn(\n 'Your Graphql landing page has been disabled because there is a problem with your Graphql settings'\n );\n return prodLanding();\n};\n\nexport async function bootstrap({ strapi }: { strapi: Core.Strapi }) {\n // Generate the GraphQL schema for the content API\n const schema = strapi.plugin('graphql').service('content-api').buildSchema();\n\n if (isEmpty(schema)) {\n strapi.log.warn('The GraphQL schema has not been generated because it is empty');\n\n return;\n }\n\n const { config } = strapi.plugin('graphql');\n\n const path: string = config('endpoint');\n const configuredDepthLimit = config('depthLimit');\n const maxLimit = config('maxLimit');\n const operationLimitsWarning = getOperationLimitsWarning({\n depthLimit: configuredDepthLimit,\n maxLimit,\n });\n\n if (operationLimitsWarning) {\n strapi.log.warn(operationLimitsWarning);\n }\n\n const landingPage = determineLandingPage(strapi);\n /**\n * We need the arguments passed to the root query to be available in the association resolver\n * so we can forward those arguments along to any relations.\n *\n * In order to do that we are currently storing the arguments in context.\n * There is likely a better solution, but for now this is the simplest fix we could find.\n *\n * @see https://github.com/strapi/strapi/issues/23524\n */\n const pluginAddRootQueryArgs: ApolloServerPlugin<StrapiGraphQLContext> = {\n async requestDidStart() {\n return {\n async executionDidStart() {\n return {\n willResolveField({ source, args, contextValue, info }) {\n if (!source && info.operation.operation === 'query') {\n // Key args per root field (alias)\n if (!contextValue.rootQueryArgsByPath) {\n contextValue.rootQueryArgsByPath = new Map();\n }\n contextValue.rootQueryArgsByPath.set(info.path.key, {\n ...args,\n _originField: info.fieldName,\n });\n }\n },\n };\n },\n };\n },\n };\n\n type CustomOptions = {\n cors?: boolean | Options;\n uploads: boolean;\n bodyParserConfig: boolean;\n };\n\n const defaultServerConfig: ApolloServerOptions<StrapiGraphQLContext> & CustomOptions = {\n // Schema\n schema,\n\n // Validation\n // Keep v5 compatibility: depthLimit is passed through unchanged, so an unset or invalid value\n // does not become an enforced finite limit during an upgrade.\n validationRules: [depthLimit(configuredDepthLimit as number) as any],\n\n // Errors\n formatError: formatGraphqlError,\n\n // Misc\n cors: undefined,\n uploads: false,\n bodyParserConfig: true,\n // send 400 http status instead of 200 for input validation errors\n status400ForVariableCoercionErrors: true,\n plugins: [landingPage, pluginAddRootQueryArgs],\n\n cache: 'bounded' as const,\n };\n\n const serverConfig = mergeWith(\n {},\n defaultServerConfig,\n config('apolloServer'),\n (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.concat(b);\n }\n return undefined;\n }\n ) as ApolloServerOptions<StrapiGraphQLContext> & CustomOptions;\n\n // Create a new Apollo server\n const server = new ApolloServer(serverConfig);\n\n try {\n // server.start() must be called before using server.applyMiddleware()\n await server.start();\n } catch (error) {\n if (error instanceof Error) {\n strapi.log.error('Failed to start the Apollo server', error.message);\n }\n\n throw error;\n }\n\n // Create the route handlers for Strapi\n const handler: Core.MiddlewareHandler[] = [];\n\n // add cors middleware\n if (serverConfig.cors === false) {\n // Explicitly disabled - don't add middleware\n } else if (serverConfig.cors === undefined || serverConfig.cors === true) {\n // enable with defaults (backwards compatible)\n handler.push(cors());\n } else {\n // Custom options object\n handler.push(cors(serverConfig.cors));\n }\n\n // add koa bodyparser middleware\n if (isObject(serverConfig.bodyParserConfig)) {\n handler.push(bodyParser(serverConfig.bodyParserConfig));\n } else if (serverConfig.bodyParserConfig) {\n handler.push(bodyParser());\n } else {\n strapi.log.debug('Body parser has been disabled for Apollo server');\n }\n\n // add the Strapi auth middleware\n handler.push((ctx, next) => {\n ctx.state.route = {\n info: {\n // Indicate it's a content API route\n type: 'content-api',\n },\n };\n\n const isPlaygroundRequest =\n ctx.request.method === 'GET' &&\n ctx.request.url === path && // Matches the GraphQL endpoint\n strapi.plugin('graphql').service('utils').playground.isEnabled() && // Only allow if the Playground is enabled\n ctx.request.header.accept?.includes('text/html'); // Specific to Playground UI loading\n\n // Skip authentication for the GraphQL Playground UI\n if (isPlaygroundRequest) {\n return next();\n }\n\n return strapi.auth.authenticate(ctx, next);\n });\n\n // add the graphql server for koa\n handler.push(\n koaMiddleware<DefaultStateExtends, DefaultContextExtends>(server, {\n // Initialize loaders for this request.\n context: async ({ ctx }) => ({\n state: ctx.state,\n koaContext: ctx,\n }),\n })\n );\n\n // now that handlers are set up, add the graphql route to our apollo server\n strapi.server.routes([\n {\n method: 'ALL',\n path,\n handler,\n config: {\n auth: false,\n },\n },\n ]);\n\n // Register destroy behavior\n // We're doing it here instead of exposing a destroy method to the strapi-server.js\n // file since we need to have access to the ApolloServer instance\n strapi.plugin('graphql').destroy = async () => {\n await server.stop();\n };\n}\n"],"names":["getOperationLimitsWarning","depthLimit","configuredDepthLimit","maxLimit","unboundedOrInvalidKeys","Number","isFinite","push","length","undefined","join","determineLandingPage","strapi","config","plugin","utils","service","configLandingPage","isProduction","process","env","NODE_ENV","localLanding","log","debug","playground","setEnabled","ApolloServerPluginLandingPageLocalDefault","prodLanding","ApolloServerPluginLandingPageProductionDefault","userLanding","userFunction","result","playgroundAlways","warn","bootstrap","schema","buildSchema","isEmpty","path","operationLimitsWarning","landingPage","pluginAddRootQueryArgs","requestDidStart","executionDidStart","willResolveField","source","args","contextValue","info","operation","rootQueryArgsByPath","Map","set","key","_originField","fieldName","defaultServerConfig","validationRules","formatError","formatGraphqlError","cors","uploads","bodyParserConfig","status400ForVariableCoercionErrors","plugins","cache","serverConfig","mergeWith","a","b","Array","isArray","concat","server","ApolloServer","start","error","Error","message","handler","isObject","bodyParser","ctx","next","state","route","type","isPlaygroundRequest","request","method","url","isEnabled","header","accept","includes","auth","authenticate","koaMiddleware","context","koaContext","routes","destroy","stop"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,MAAMA,4BAA4B,CAAC,EACxCC,YAAYC,oBAAoB,EAChCC,QAAQ,EACa,GAAA;AACrB,IAAA,MAAMC,yBAAmC,EAAE;IAE3C,IACE,OAAOF,yBAAyB,QAAA,IAChC,CAACG,OAAOC,QAAQ,CAACJ,oBAAAA,CAAAA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AAM,EAAEC,QAAAA,CAAS;;AAGtC,QAAA,IAAIP,mBAAAA,EAAqB;YACvB,OAAOJ,IAAAA,EAAAA;AACT,QAAA;AAEA,QAAA,OAAOxE,MAAAA,CAAOoF,IAAI,CAACC,YAAY,CAACd,GAAAA,EAAKC,IAAAA,CAAAA;AACvC,IAAA,CAAA,CAAA;;IAGAJ,OAAAA,CAAQzE,IAAI,CACV2F,iBAAAA,CAA0DxB,QAAAA,EAAQ;;AAEhEyB,QAAAA,OAAAA,EAAS,OAAO,EAAEhB,GAAG,EAAE,IAAM;AAC3BE,gBAAAA,KAAAA,EAAOF,IAAIE,KAAK;gBAChBe,UAAAA,EAAYjB;aACd;AACF,KAAA,CAAA,CAAA;;IAIFvE,MAAAA,CAAO8D,MAAM,CAAC2B,MAAM,CAAC;AACnB,QAAA;YACEX,MAAAA,EAAQ,KAAA;AACRnD,YAAAA,IAAAA;AACAyC,YAAAA,OAAAA;YACAnE,MAAAA,EAAQ;gBACNmF,IAAAA,EAAM;AACR;AACF;AACD,KAAA,CAAA;;;;AAKDpF,IAAAA,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWwF,OAAO,GAAG,UAAA;AACjC,QAAA,MAAM5B,SAAO6B,IAAI,EAAA;AACnB,IAAA,CAAA;AACF;;;;;;"}
1
+ {"version":3,"file":"bootstrap.js","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { mergeWith, isEmpty, isObject } from 'lodash';\nimport { ApolloServer, type ApolloServerPlugin, type ApolloServerOptions } from '@apollo/server';\nimport {\n ApolloServerPluginLandingPageLocalDefault,\n ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\nimport { koaMiddleware } from '@as-integrations/koa';\nimport depthLimit from 'graphql-depth-limit';\nimport bodyParser from 'koa-bodyparser';\nimport cors from '@koa/cors';\n\nimport type { Core } from '@strapi/types';\nimport type { Options } from '@koa/cors';\nimport type { BaseContext, DefaultContextExtends, DefaultStateExtends } from 'koa';\n\nimport { abortFieldsOnClientDisconnect } from './abort-disconnected-request';\nimport { formatGraphqlError } from './format-graphql-error';\n\ntype StrapiGraphQLContext = BaseContext & {\n koaContext: Parameters<Core.MiddlewareHandler>[0];\n rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;\n};\n\ntype OperationLimitConfig = {\n depthLimit?: unknown;\n maxLimit?: unknown;\n};\n\nexport const getOperationLimitsWarning = ({\n depthLimit: configuredDepthLimit,\n maxLimit,\n}: OperationLimitConfig): string | undefined => {\n const unboundedOrInvalidKeys: string[] = [];\n\n if (\n typeof configuredDepthLimit !== 'number' ||\n !Number.isFinite(configuredDepthLimit) ||\n configuredDepthLimit <= 0\n ) {\n unboundedOrInvalidKeys.push('depthLimit');\n }\n\n if (typeof maxLimit !== 'number' || !Number.isFinite(maxLimit) || maxLimit <= 0) {\n unboundedOrInvalidKeys.push('maxLimit');\n }\n\n if (unboundedOrInvalidKeys.length === 0) {\n return undefined;\n }\n\n return `Built-in GraphQL operation limits are unbounded or invalid for: ${unboundedOrInvalidKeys.join(', ')}. Configure these limits (for example: defaultLimit: 25, maxLimit: 100, depthLimit: 10). Custom Apollo validation rules may independently enforce limits. See https://docs.strapi.io/cms/configurations/plugins.`;\n};\n\nexport const determineLandingPage = (\n strapi: Core.Strapi\n): ApolloServerPlugin<StrapiGraphQLContext> => {\n const { config } = strapi.plugin('graphql');\n const utils = strapi.plugin('graphql').service('utils');\n\n /**\n * configLanding page may be one of the following:\n *\n * - true: always use \"playground\" even in production\n * - false: never show \"playground\" even in non-production\n * - undefined: default Apollo behavior (hide playground on production)\n * - a function that returns an Apollo plugin that implements renderLandingPage\n ** */\n const configLandingPage = config<\n boolean | ((strapi?: Core.Strapi) => ApolloServerPlugin | boolean)\n >('landingPage');\n\n const isProduction = process.env.NODE_ENV === 'production';\n\n const localLanding = () => {\n strapi.log.debug('Apollo landing page: local');\n utils.playground.setEnabled(true);\n return ApolloServerPluginLandingPageLocalDefault();\n };\n\n const prodLanding = () => {\n strapi.log.debug('Apollo landing page: production');\n utils.playground.setEnabled(false);\n return ApolloServerPluginLandingPageProductionDefault();\n };\n\n const userLanding = (userFunction: (strapi?: Core.Strapi) => ApolloServerPlugin | boolean) => {\n strapi.log.debug('Apollo landing page: from user-defined function...');\n const result = userFunction(strapi);\n if (result === true) {\n return localLanding();\n }\n if (result === false) {\n return prodLanding();\n }\n strapi.log.debug('Apollo landing page: user-defined');\n return result;\n };\n\n // DEPRECATED, remove in Strapi v6\n const playgroundAlways = config('playgroundAlways');\n if (playgroundAlways !== undefined) {\n strapi.log.warn(\n 'The graphql config playgroundAlways is deprecated. This will be removed in Strapi 6. Please use landingPage instead. '\n );\n }\n if (playgroundAlways === false) {\n strapi.log.warn(\n 'graphql config playgroundAlways:false has no effect, please use landingPage:false to disable Graphql Playground in all environments'\n );\n }\n\n if (playgroundAlways || configLandingPage === true) {\n return localLanding();\n }\n\n // if landing page has been disabled, use production\n if (configLandingPage === false) {\n return prodLanding();\n }\n\n // If user did not define any settings, use our defaults\n if (configLandingPage === undefined) {\n return isProduction ? prodLanding() : localLanding();\n }\n\n // if user provided a landing page function, return that\n if (typeof configLandingPage === 'function') {\n return userLanding(configLandingPage);\n }\n\n // If no other setting could be found, default to production settings\n strapi.log.warn(\n 'Your Graphql landing page has been disabled because there is a problem with your Graphql settings'\n );\n return prodLanding();\n};\n\nexport async function bootstrap({ strapi }: { strapi: Core.Strapi }) {\n // Generate the GraphQL schema for the content API\n const schema = strapi.plugin('graphql').service('content-api').buildSchema();\n\n if (isEmpty(schema)) {\n strapi.log.warn('The GraphQL schema has not been generated because it is empty');\n\n return;\n }\n\n const { config } = strapi.plugin('graphql');\n\n const path: string = config('endpoint');\n const configuredDepthLimit = config('depthLimit');\n const maxLimit = config('maxLimit');\n const operationLimitsWarning = getOperationLimitsWarning({\n depthLimit: configuredDepthLimit,\n maxLimit,\n });\n\n if (operationLimitsWarning) {\n strapi.log.warn(operationLimitsWarning);\n }\n\n const landingPage = determineLandingPage(strapi);\n /**\n * We need the arguments passed to the root query to be available in the association resolver\n * so we can forward those arguments along to any relations.\n *\n * In order to do that we are currently storing the arguments in context.\n * There is likely a better solution, but for now this is the simplest fix we could find.\n *\n * @see https://github.com/strapi/strapi/issues/23524\n */\n const pluginAddRootQueryArgs: ApolloServerPlugin<StrapiGraphQLContext> = {\n async requestDidStart() {\n return {\n async executionDidStart() {\n return {\n willResolveField({ source, args, contextValue, info }) {\n if (!source && info.operation.operation === 'query') {\n // Key args per root field (alias)\n if (!contextValue.rootQueryArgsByPath) {\n contextValue.rootQueryArgsByPath = new Map();\n }\n contextValue.rootQueryArgsByPath.set(info.path.key, {\n ...args,\n _originField: info.fieldName,\n });\n }\n },\n };\n },\n };\n },\n };\n\n type CustomOptions = {\n cors?: boolean | Options;\n uploads: boolean;\n bodyParserConfig: boolean;\n };\n\n const defaultServerConfig: ApolloServerOptions<StrapiGraphQLContext> & CustomOptions = {\n // Schema\n schema,\n\n // Validation\n // Keep v5 compatibility: depthLimit is passed through unchanged, so an unset or invalid value\n // does not become an enforced finite limit during an upgrade.\n validationRules: [depthLimit(configuredDepthLimit as number) as any],\n\n // Errors\n formatError: formatGraphqlError,\n\n // Misc\n cors: undefined,\n uploads: false,\n bodyParserConfig: true,\n // send 400 http status instead of 200 for input validation errors\n status400ForVariableCoercionErrors: true,\n plugins: [landingPage, pluginAddRootQueryArgs],\n\n cache: 'bounded' as const,\n };\n\n const serverConfig = mergeWith(\n {},\n defaultServerConfig,\n config('apolloServer'),\n (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.concat(b);\n }\n return undefined;\n }\n ) as ApolloServerOptions<StrapiGraphQLContext> & CustomOptions;\n\n if (serverConfig.schema) {\n abortFieldsOnClientDisconnect(serverConfig.schema);\n }\n\n // Create a new Apollo server\n const server = new ApolloServer(serverConfig);\n\n try {\n // server.start() must be called before using server.applyMiddleware()\n await server.start();\n } catch (error) {\n if (error instanceof Error) {\n strapi.log.error('Failed to start the Apollo server', error.message);\n }\n\n throw error;\n }\n\n // Create the route handlers for Strapi\n const handler: Core.MiddlewareHandler[] = [];\n\n // add cors middleware\n if (serverConfig.cors === false) {\n // Explicitly disabled - don't add middleware\n } else if (serverConfig.cors === undefined || serverConfig.cors === true) {\n // enable with defaults (backwards compatible)\n handler.push(cors());\n } else {\n // Custom options object\n handler.push(cors(serverConfig.cors));\n }\n\n // add koa bodyparser middleware\n if (isObject(serverConfig.bodyParserConfig)) {\n handler.push(bodyParser(serverConfig.bodyParserConfig));\n } else if (serverConfig.bodyParserConfig) {\n handler.push(bodyParser());\n } else {\n strapi.log.debug('Body parser has been disabled for Apollo server');\n }\n\n // add the Strapi auth middleware\n handler.push((ctx, next) => {\n ctx.state.route = {\n info: {\n // Indicate it's a content API route\n type: 'content-api',\n },\n };\n\n const isPlaygroundRequest =\n ctx.request.method === 'GET' &&\n ctx.request.url === path && // Matches the GraphQL endpoint\n strapi.plugin('graphql').service('utils').playground.isEnabled() && // Only allow if the Playground is enabled\n ctx.request.header.accept?.includes('text/html'); // Specific to Playground UI loading\n\n // Skip authentication for the GraphQL Playground UI\n if (isPlaygroundRequest) {\n return next();\n }\n\n return strapi.auth.authenticate(ctx, next);\n });\n\n // add the graphql server for koa\n handler.push(\n koaMiddleware<DefaultStateExtends, DefaultContextExtends>(server, {\n // Initialize loaders for this request.\n context: async ({ ctx }) => ({\n state: ctx.state,\n koaContext: ctx,\n }),\n })\n );\n\n // now that handlers are set up, add the graphql route to our apollo server\n strapi.server.routes([\n {\n method: 'ALL',\n path,\n handler,\n config: {\n auth: false,\n },\n },\n ]);\n\n // Register destroy behavior\n // We're doing it here instead of exposing a destroy method to the strapi-server.js\n // file since we need to have access to the ApolloServer instance\n strapi.plugin('graphql').destroy = async () => {\n await server.stop();\n };\n}\n"],"names":["getOperationLimitsWarning","depthLimit","configuredDepthLimit","maxLimit","unboundedOrInvalidKeys","Number","isFinite","push","length","undefined","join","determineLandingPage","strapi","config","plugin","utils","service","configLandingPage","isProduction","process","env","NODE_ENV","localLanding","log","debug","playground","setEnabled","ApolloServerPluginLandingPageLocalDefault","prodLanding","ApolloServerPluginLandingPageProductionDefault","userLanding","userFunction","result","playgroundAlways","warn","bootstrap","schema","buildSchema","isEmpty","path","operationLimitsWarning","landingPage","pluginAddRootQueryArgs","requestDidStart","executionDidStart","willResolveField","source","args","contextValue","info","operation","rootQueryArgsByPath","Map","set","key","_originField","fieldName","defaultServerConfig","validationRules","formatError","formatGraphqlError","cors","uploads","bodyParserConfig","status400ForVariableCoercionErrors","plugins","cache","serverConfig","mergeWith","a","b","Array","isArray","concat","abortFieldsOnClientDisconnect","server","ApolloServer","start","error","Error","message","handler","isObject","bodyParser","ctx","next","state","route","type","isPlaygroundRequest","request","method","url","isEnabled","header","accept","includes","auth","authenticate","koaMiddleware","context","koaContext","routes","destroy","stop"],"mappings":";;;;;;;;;;;;;;;;;;AA4BO,MAAMA,4BAA4B,CAAC,EACxCC,YAAYC,oBAAoB,EAChCC,QAAQ,EACa,GAAA;AACrB,IAAA,MAAMC,yBAAmC,EAAE;IAE3C,IACE,OAAOF,yBAAyB,QAAA,IAChC,CAACG,OAAOC,QAAQ,CAACJ,oBAAAA,CAAAA,IACjBA,oBAAAA,IAAwB,CAAA,EACxB;AACAE,QAAAA,sBAAAA,CAAuBG,IAAI,CAAC,YAAA,CAAA;AAC9B,IAAA;IAEA,IAAI,OAAOJ,aAAa,QAAA,IAAY,CAACE,OAAOC,QAAQ,CAACH,QAAAA,CAAAA,IAAaA,QAAAA,IAAY,CAAA,EAAG;AAC/EC,QAAAA,sBAAAA,CAAuBG,IAAI,CAAC,UAAA,CAAA;AAC9B,IAAA;IAEA,IAAIH,sBAAAA,CAAuBI,MAAM,KAAK,CAAA,EAAG;QACvC,OAAOC,SAAAA;AACT,IAAA;IAEA,OAAO,CAAC,gEAAgE,EAAEL,sBAAAA,CAAuBM,IAAI,CAAC,IAAA,CAAA,CAAM,gNAAgN,CAAC;AAC/T;AAEO,MAAMC,u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A,EAAOF,IAAIE,KAAK;gBAChBe,UAAAA,EAAYjB;aACd;AACF,KAAA,CAAA,CAAA;;IAIFxE,MAAAA,CAAO+D,MAAM,CAAC2B,MAAM,CAAC;AACnB,QAAA;YACEX,MAAAA,EAAQ,KAAA;AACRpD,YAAAA,IAAAA;AACA0C,YAAAA,OAAAA;YACApE,MAAAA,EAAQ;gBACNoF,IAAAA,EAAM;AACR;AACF;AACD,KAAA,CAAA;;;;AAKDrF,IAAAA,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWyF,OAAO,GAAG,UAAA;AACjC,QAAA,MAAM5B,SAAO6B,IAAI,EAAA;AACnB,IAAA,CAAA;AACF;;;;;;"}
@@ -5,6 +5,7 @@ import { koaMiddleware } from '@as-integrations/koa';
5
5
  import depthLimit from 'graphql-depth-limit';
6
6
  import bodyParser from 'koa-bodyparser';
7
7
  import cors from '@koa/cors';
8
+ import { abortFieldsOnClientDisconnect } from './abort-disconnected-request.mjs';
8
9
  import { formatGraphqlError } from './format-graphql-error.mjs';
9
10
 
10
11
  const getOperationLimitsWarning = ({ depthLimit: configuredDepthLimit, maxLimit })=>{
@@ -159,6 +160,9 @@ async function bootstrap({ strapi }) {
159
160
  }
160
161
  return undefined;
161
162
  });
163
+ if (serverConfig.schema) {
164
+ abortFieldsOnClientDisconnect(serverConfig.schema);
165
+ }
162
166
  // Create a new Apollo server
163
167
  const server = new ApolloServer(serverConfig);
164
168
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.mjs","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { mergeWith, isEmpty, isObject } from 'lodash';\nimport { ApolloServer, type ApolloServerPlugin, type ApolloServerOptions } from '@apollo/server';\nimport {\n ApolloServerPluginLandingPageLocalDefault,\n ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\nimport { koaMiddleware } from '@as-integrations/koa';\nimport depthLimit from 'graphql-depth-limit';\nimport bodyParser from 'koa-bodyparser';\nimport cors from '@koa/cors';\n\nimport type { Core } from '@strapi/types';\nimport type { Options } from '@koa/cors';\nimport type { BaseContext, DefaultContextExtends, DefaultStateExtends } from 'koa';\n\nimport { formatGraphqlError } from './format-graphql-error';\n\ntype StrapiGraphQLContext = BaseContext & {\n rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;\n};\n\ntype OperationLimitConfig = {\n depthLimit?: unknown;\n maxLimit?: unknown;\n};\n\nexport const getOperationLimitsWarning = ({\n depthLimit: configuredDepthLimit,\n maxLimit,\n}: OperationLimitConfig): string | undefined => {\n const unboundedOrInvalidKeys: string[] = [];\n\n if (\n typeof configuredDepthLimit !== 'number' ||\n !Number.isFinite(configuredDepthLimit) ||\n configuredDepthLimit <= 0\n ) {\n unboundedOrInvalidKeys.push('depthLimit');\n }\n\n if (typeof maxLimit !== 'number' || !Number.isFinite(maxLimit) || maxLimit <= 0) {\n unboundedOrInvalidKeys.push('maxLimit');\n }\n\n if (unboundedOrInvalidKeys.length === 0) {\n return undefined;\n }\n\n return `Built-in GraphQL operation limits are unbounded or invalid for: ${unboundedOrInvalidKeys.join(', ')}. Configure these limits (for example: defaultLimit: 25, maxLimit: 100, depthLimit: 10). Custom Apollo validation rules may independently enforce limits. See https://docs.strapi.io/cms/configurations/plugins.`;\n};\n\nexport const determineLandingPage = (\n strapi: Core.Strapi\n): ApolloServerPlugin<StrapiGraphQLContext> => {\n const { config } = strapi.plugin('graphql');\n const utils = strapi.plugin('graphql').service('utils');\n\n /**\n * configLanding page may be one of the following:\n *\n * - true: always use \"playground\" even in production\n * - false: never show \"playground\" even in non-production\n * - undefined: default Apollo behavior (hide playground on production)\n * - a function that returns an Apollo plugin that implements renderLandingPage\n ** */\n const configLandingPage = config<\n boolean | ((strapi?: Core.Strapi) => ApolloServerPlugin | boolean)\n >('landingPage');\n\n const isProduction = process.env.NODE_ENV === 'production';\n\n const localLanding = () => {\n strapi.log.debug('Apollo landing page: local');\n utils.playground.setEnabled(true);\n return ApolloServerPluginLandingPageLocalDefault();\n };\n\n const prodLanding = () => {\n strapi.log.debug('Apollo landing page: production');\n utils.playground.setEnabled(false);\n return ApolloServerPluginLandingPageProductionDefault();\n };\n\n const userLanding = (userFunction: (strapi?: Core.Strapi) => ApolloServerPlugin | boolean) => {\n strapi.log.debug('Apollo landing page: from user-defined function...');\n const result = userFunction(strapi);\n if (result === true) {\n return localLanding();\n }\n if (result === false) {\n return prodLanding();\n }\n strapi.log.debug('Apollo landing page: user-defined');\n return result;\n };\n\n // DEPRECATED, remove in Strapi v6\n const playgroundAlways = config('playgroundAlways');\n if (playgroundAlways !== undefined) {\n strapi.log.warn(\n 'The graphql config playgroundAlways is deprecated. This will be removed in Strapi 6. Please use landingPage instead. '\n );\n }\n if (playgroundAlways === false) {\n strapi.log.warn(\n 'graphql config playgroundAlways:false has no effect, please use landingPage:false to disable Graphql Playground in all environments'\n );\n }\n\n if (playgroundAlways || configLandingPage === true) {\n return localLanding();\n }\n\n // if landing page has been disabled, use production\n if (configLandingPage === false) {\n return prodLanding();\n }\n\n // If user did not define any settings, use our defaults\n if (configLandingPage === undefined) {\n return isProduction ? prodLanding() : localLanding();\n }\n\n // if user provided a landing page function, return that\n if (typeof configLandingPage === 'function') {\n return userLanding(configLandingPage);\n }\n\n // If no other setting could be found, default to production settings\n strapi.log.warn(\n 'Your Graphql landing page has been disabled because there is a problem with your Graphql settings'\n );\n return prodLanding();\n};\n\nexport async function bootstrap({ strapi }: { strapi: Core.Strapi }) {\n // Generate the GraphQL schema for the content API\n const schema = strapi.plugin('graphql').service('content-api').buildSchema();\n\n if (isEmpty(schema)) {\n strapi.log.warn('The GraphQL schema has not been generated because it is empty');\n\n return;\n }\n\n const { config } = strapi.plugin('graphql');\n\n const path: string = config('endpoint');\n const configuredDepthLimit = config('depthLimit');\n const maxLimit = config('maxLimit');\n const operationLimitsWarning = getOperationLimitsWarning({\n depthLimit: configuredDepthLimit,\n maxLimit,\n });\n\n if (operationLimitsWarning) {\n strapi.log.warn(operationLimitsWarning);\n }\n\n const landingPage = determineLandingPage(strapi);\n /**\n * We need the arguments passed to the root query to be available in the association resolver\n * so we can forward those arguments along to any relations.\n *\n * In order to do that we are currently storing the arguments in context.\n * There is likely a better solution, but for now this is the simplest fix we could find.\n *\n * @see https://github.com/strapi/strapi/issues/23524\n */\n const pluginAddRootQueryArgs: ApolloServerPlugin<StrapiGraphQLContext> = {\n async requestDidStart() {\n return {\n async executionDidStart() {\n return {\n willResolveField({ source, args, contextValue, info }) {\n if (!source && info.operation.operation === 'query') {\n // Key args per root field (alias)\n if (!contextValue.rootQueryArgsByPath) {\n contextValue.rootQueryArgsByPath = new Map();\n }\n contextValue.rootQueryArgsByPath.set(info.path.key, {\n ...args,\n _originField: info.fieldName,\n });\n }\n },\n };\n },\n };\n },\n };\n\n type CustomOptions = {\n cors?: boolean | Options;\n uploads: boolean;\n bodyParserConfig: boolean;\n };\n\n const defaultServerConfig: ApolloServerOptions<StrapiGraphQLContext> & CustomOptions = {\n // Schema\n schema,\n\n // Validation\n // Keep v5 compatibility: depthLimit is passed through unchanged, so an unset or invalid value\n // does not become an enforced finite limit during an upgrade.\n validationRules: [depthLimit(configuredDepthLimit as number) as any],\n\n // Errors\n formatError: formatGraphqlError,\n\n // Misc\n cors: undefined,\n uploads: false,\n bodyParserConfig: true,\n // send 400 http status instead of 200 for input validation errors\n status400ForVariableCoercionErrors: true,\n plugins: [landingPage, pluginAddRootQueryArgs],\n\n cache: 'bounded' as const,\n };\n\n const serverConfig = mergeWith(\n {},\n defaultServerConfig,\n config('apolloServer'),\n (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.concat(b);\n }\n return undefined;\n }\n ) as ApolloServerOptions<StrapiGraphQLContext> & CustomOptions;\n\n // Create a new Apollo server\n const server = new ApolloServer(serverConfig);\n\n try {\n // server.start() must be called before using server.applyMiddleware()\n await server.start();\n } catch (error) {\n if (error instanceof Error) {\n strapi.log.error('Failed to start the Apollo server', error.message);\n }\n\n throw error;\n }\n\n // Create the route handlers for Strapi\n const handler: Core.MiddlewareHandler[] = [];\n\n // add cors middleware\n if (serverConfig.cors === false) {\n // Explicitly disabled - don't add middleware\n } else if (serverConfig.cors === undefined || serverConfig.cors === true) {\n // enable with defaults (backwards compatible)\n handler.push(cors());\n } else {\n // Custom options object\n handler.push(cors(serverConfig.cors));\n }\n\n // add koa bodyparser middleware\n if (isObject(serverConfig.bodyParserConfig)) {\n handler.push(bodyParser(serverConfig.bodyParserConfig));\n } else if (serverConfig.bodyParserConfig) {\n handler.push(bodyParser());\n } else {\n strapi.log.debug('Body parser has been disabled for Apollo server');\n }\n\n // add the Strapi auth middleware\n handler.push((ctx, next) => {\n ctx.state.route = {\n info: {\n // Indicate it's a content API route\n type: 'content-api',\n },\n };\n\n const isPlaygroundRequest =\n ctx.request.method === 'GET' &&\n ctx.request.url === path && // Matches the GraphQL endpoint\n strapi.plugin('graphql').service('utils').playground.isEnabled() && // Only allow if the Playground is enabled\n ctx.request.header.accept?.includes('text/html'); // Specific to Playground UI loading\n\n // Skip authentication for the GraphQL Playground UI\n if (isPlaygroundRequest) {\n return next();\n }\n\n return strapi.auth.authenticate(ctx, next);\n });\n\n // add the graphql server for koa\n handler.push(\n koaMiddleware<DefaultStateExtends, DefaultContextExtends>(server, {\n // Initialize loaders for this request.\n context: async ({ ctx }) => ({\n state: ctx.state,\n koaContext: ctx,\n }),\n })\n );\n\n // now that handlers are set up, add the graphql route to our apollo server\n strapi.server.routes([\n {\n method: 'ALL',\n path,\n handler,\n config: {\n auth: false,\n },\n },\n ]);\n\n // Register destroy behavior\n // We're doing it here instead of exposing a destroy method to the strapi-server.js\n // file since we need to have access to the ApolloServer instance\n strapi.plugin('graphql').destroy = async () => {\n await server.stop();\n };\n}\n"],"names":["getOperationLimitsWarning","depthLimit","configuredDepthLimit","maxLimit","unboundedOrInvalidKeys","Number","isFinite","push","length","undefined","join","determineLandingPage","strapi","config","plugin","utils","service","configLandingPage","isProduction","process","env","NODE_ENV","localLanding","log","debug","playground","setEnabled","ApolloServerPluginLandingPageLocalDefault","prodLanding","ApolloServerPluginLandingPageProductionDefault","userLanding","userFunction","result","playgroundAlways","warn","bootstrap","schema","buildSchema","isEmpty","path","operationLimitsWarning","landingPage","pluginAddRootQueryArgs","requestDidStart","executionDidStart","willResolveField","source","args","contextValue","info","operation","rootQueryArgsByPath","Map","set","key","_originField","fieldName","defaultServerConfig","validationRules","formatError","formatGraphqlError","cors","uploads","bodyParserConfig","status400ForVariableCoercionErrors","plugins","cache","serverConfig","mergeWith","a","b","Array","isArray","concat","server","ApolloServer","start","error","Error","message","handler","isObject","bodyParser","ctx","next","state","route","type","isPlaygroundRequest","request","method","url","isEnabled","header","accept","includes","auth","authenticate","koaMiddleware","context","koaContext","routes","destroy","stop"],"mappings":";;;;;;;;;AA0BO,MAAMA,4BAA4B,CAAC,EACxCC,YAAYC,oBAAoB,EAChCC,QAAQ,EACa,GAAA;AACrB,IAAA,MAAMC,yBAAmC,EAAE;IAE3C,IACE,OAAOF,yBAAyB,QAAA,IAChC,CAACG,OAAOC,QAAQ,CAACJ,oBAAAA,CAAAA,IACjBA,oBAAAA,IAAwB,CAAA,EACxB;AACAE,QAAAA,sBAAAA,CAAuBG,IAAI,CAAC,YAAA,CAAA;AAC9B,IAAA;IAEA,IAAI,OAAOJ,aAAa,QAAA,IAAY,CAACE,OAAOC,QAAQ,CAACH,QAAAA,CAAAA,IAAaA,QAAAA,IAAY,CAAA,EAAG;AAC/EC,QAAAA,sBAAAA,CAAuBG,IAAI,CAAC,UAAA,CAAA;AAC9B,IAAA;IAEA,IAAIH,sBAAAA,CAAuBI,MAAM,KAAK,CAAA,EAAG;QACvC,OAAOC,SAAAA;AACT,IAAA;IAEA,OAAO,CAAC,gEAAgE,EAAEL,sBAAAA,CAAuBM,IAAI,CAAC,IAAA,CAAA,CAAM,gNAAgN,CAAC;AAC/T;AAEO,MAAMC,uBAAuB,CAClCC,MAAAA,GAAAA;AAEA,IAAA,MAAM,EAAE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A,IAAAA;AACAyC,YAAAA,OAAAA;YACAnE,MAAAA,EAAQ;gBACNmF,IAAAA,EAAM;AACR;AACF;AACD,KAAA,CAAA;;;;AAKDpF,IAAAA,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWwF,OAAO,GAAG,UAAA;AACjC,QAAA,MAAM5B,OAAO6B,IAAI,EAAA;AACnB,IAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"bootstrap.mjs","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { mergeWith, isEmpty, isObject } from 'lodash';\nimport { ApolloServer, type ApolloServerPlugin, type ApolloServerOptions } from '@apollo/server';\nimport {\n ApolloServerPluginLandingPageLocalDefault,\n ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\nimport { koaMiddleware } from '@as-integrations/koa';\nimport depthLimit from 'graphql-depth-limit';\nimport bodyParser from 'koa-bodyparser';\nimport cors from '@koa/cors';\n\nimport type { Core } from '@strapi/types';\nimport type { Options } from '@koa/cors';\nimport type { BaseContext, DefaultContextExtends, DefaultStateExtends } from 'koa';\n\nimport { abortFieldsOnClientDisconnect } from './abort-disconnected-request';\nimport { formatGraphqlError } from './format-graphql-error';\n\ntype StrapiGraphQLContext = BaseContext & {\n koaContext: Parameters<Core.MiddlewareHandler>[0];\n rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;\n};\n\ntype OperationLimitConfig = {\n depthLimit?: unknown;\n maxLimit?: unknown;\n};\n\nexport const getOperationLimitsWarning = ({\n depthLimit: configuredDepthLimit,\n maxLimit,\n}: OperationLimitConfig): string | undefined => {\n const unboundedOrInvalidKeys: string[] = [];\n\n if (\n typeof configuredDepthLimit !== 'number' ||\n !Number.isFinite(configuredDepthLimit) ||\n configuredDepthLimit <= 0\n ) {\n unboundedOrInvalidKeys.push('depthLimit');\n }\n\n if (typeof maxLimit !== 'number' || !Number.isFinite(maxLimit) || maxLimit <= 0) {\n unboundedOrInvalidKeys.push('maxLimit');\n }\n\n if (unboundedOrInvalidKeys.length === 0) {\n return undefined;\n }\n\n return `Built-in GraphQL operation limits are unbounded or invalid for: ${unboundedOrInvalidKeys.join(', ')}. Configure these limits (for example: defaultLimit: 25, maxLimit: 100, depthLimit: 10). Custom Apollo validation rules may independently enforce limits. See https://docs.strapi.io/cms/configurations/plugins.`;\n};\n\nexport const determineLandingPage = (\n strapi: Core.Strapi\n): ApolloServerPlugin<StrapiGraphQLContext> => {\n const { config } = strapi.plugin('graphql');\n const utils = strapi.plugin('graphql').service('utils');\n\n /**\n * configLanding page may be one of the following:\n *\n * - true: always use \"playground\" even in production\n * - false: never show \"playground\" even in non-production\n * - undefined: default Apollo behavior (hide playground on production)\n * - a function that returns an Apollo plugin that implements renderLandingPage\n ** */\n const configLandingPage = config<\n boolean | ((strapi?: Core.Strapi) => ApolloServerPlugin | boolean)\n >('landingPage');\n\n const isProduction = process.env.NODE_ENV === 'production';\n\n const localLanding = () => {\n strapi.log.debug('Apollo landing page: local');\n utils.playground.setEnabled(true);\n return ApolloServerPluginLandingPageLocalDefault();\n };\n\n const prodLanding = () => {\n strapi.log.debug('Apollo landing page: production');\n utils.playground.setEnabled(false);\n return ApolloServerPluginLandingPageProductionDefault();\n };\n\n const userLanding = (userFunction: (strapi?: Core.Strapi) => ApolloServerPlugin | boolean) => {\n strapi.log.debug('Apollo landing page: from user-defined function...');\n const result = userFunction(strapi);\n if (result === true) {\n return localLanding();\n }\n if (result === false) {\n return prodLanding();\n }\n strapi.log.debug('Apollo landing page: user-defined');\n return result;\n };\n\n // DEPRECATED, remove in Strapi v6\n const playgroundAlways = config('playgroundAlways');\n if (playgroundAlways !== undefined) {\n strapi.log.warn(\n 'The graphql config playgroundAlways is deprecated. This will be removed in Strapi 6. Please use landingPage instead. '\n );\n }\n if (playgroundAlways === false) {\n strapi.log.warn(\n 'graphql config playgroundAlways:false has no effect, please use landingPage:false to disable Graphql Playground in all environments'\n );\n }\n\n if (playgroundAlways || configLandingPage === true) {\n return localLanding();\n }\n\n // if landing page has been disabled, use production\n if (configLandingPage === false) {\n return prodLanding();\n }\n\n // If user did not define any settings, use our defaults\n if (configLandingPage === undefined) {\n return isProduction ? prodLanding() : localLanding();\n }\n\n // if user provided a landing page function, return that\n if (typeof configLandingPage === 'function') {\n return userLanding(configLandingPage);\n }\n\n // If no other setting could be found, default to production settings\n strapi.log.warn(\n 'Your Graphql landing page has been disabled because there is a problem with your Graphql settings'\n );\n return prodLanding();\n};\n\nexport async function bootstrap({ strapi }: { strapi: Core.Strapi }) {\n // Generate the GraphQL schema for the content API\n const schema = strapi.plugin('graphql').service('content-api').buildSchema();\n\n if (isEmpty(schema)) {\n strapi.log.warn('The GraphQL schema has not been generated because it is empty');\n\n return;\n }\n\n const { config } = strapi.plugin('graphql');\n\n const path: string = config('endpoint');\n const configuredDepthLimit = config('depthLimit');\n const maxLimit = config('maxLimit');\n const operationLimitsWarning = getOperationLimitsWarning({\n depthLimit: configuredDepthLimit,\n maxLimit,\n });\n\n if (operationLimitsWarning) {\n strapi.log.warn(operationLimitsWarning);\n }\n\n const landingPage = determineLandingPage(strapi);\n /**\n * We need the arguments passed to the root query to be available in the association resolver\n * so we can forward those arguments along to any relations.\n *\n * In order to do that we are currently storing the arguments in context.\n * There is likely a better solution, but for now this is the simplest fix we could find.\n *\n * @see https://github.com/strapi/strapi/issues/23524\n */\n const pluginAddRootQueryArgs: ApolloServerPlugin<StrapiGraphQLContext> = {\n async requestDidStart() {\n return {\n async executionDidStart() {\n return {\n willResolveField({ source, args, contextValue, info }) {\n if (!source && info.operation.operation === 'query') {\n // Key args per root field (alias)\n if (!contextValue.rootQueryArgsByPath) {\n contextValue.rootQueryArgsByPath = new Map();\n }\n contextValue.rootQueryArgsByPath.set(info.path.key, {\n ...args,\n _originField: info.fieldName,\n });\n }\n },\n };\n },\n };\n },\n };\n\n type CustomOptions = {\n cors?: boolean | Options;\n uploads: boolean;\n bodyParserConfig: boolean;\n };\n\n const defaultServerConfig: ApolloServerOptions<StrapiGraphQLContext> & CustomOptions = {\n // Schema\n schema,\n\n // Validation\n // Keep v5 compatibility: depthLimit is passed through unchanged, so an unset or invalid value\n // does not become an enforced finite limit during an upgrade.\n validationRules: [depthLimit(configuredDepthLimit as number) as any],\n\n // Errors\n formatError: formatGraphqlError,\n\n // Misc\n cors: undefined,\n uploads: false,\n bodyParserConfig: true,\n // send 400 http status instead of 200 for input validation errors\n status400ForVariableCoercionErrors: true,\n plugins: [landingPage, pluginAddRootQueryArgs],\n\n cache: 'bounded' as const,\n };\n\n const serverConfig = mergeWith(\n {},\n defaultServerConfig,\n config('apolloServer'),\n (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.concat(b);\n }\n return undefined;\n }\n ) as ApolloServerOptions<StrapiGraphQLContext> & CustomOptions;\n\n if (serverConfig.schema) {\n abortFieldsOnClientDisconnect(serverConfig.schema);\n }\n\n // Create a new Apollo server\n const server = new ApolloServer(serverConfig);\n\n try {\n // server.start() must be called before using server.applyMiddleware()\n await server.start();\n } catch (error) {\n if (error instanceof Error) {\n strapi.log.error('Failed to start the Apollo server', error.message);\n }\n\n throw error;\n }\n\n // Create the route handlers for Strapi\n const handler: Core.MiddlewareHandler[] = [];\n\n // add cors middleware\n if (serverConfig.cors === false) {\n // Explicitly disabled - don't add middleware\n } else if (serverConfig.cors === undefined || serverConfig.cors === true) {\n // enable with defaults (backwards compatible)\n handler.push(cors());\n } else {\n // Custom options object\n handler.push(cors(serverConfig.cors));\n }\n\n // add koa bodyparser middleware\n if (isObject(serverConfig.bodyParserConfig)) {\n handler.push(bodyParser(serverConfig.bodyParserConfig));\n } else if (serverConfig.bodyParserConfig) {\n handler.push(bodyParser());\n } else {\n strapi.log.debug('Body parser has been disabled for Apollo server');\n }\n\n // add the Strapi auth middleware\n handler.push((ctx, next) => {\n ctx.state.route = {\n info: {\n // Indicate it's a content API route\n type: 'content-api',\n },\n };\n\n const isPlaygroundRequest =\n ctx.request.method === 'GET' &&\n ctx.request.url === path && // Matches the GraphQL endpoint\n strapi.plugin('graphql').service('utils').playground.isEnabled() && // Only allow if the Playground is enabled\n ctx.request.header.accept?.includes('text/html'); // Specific to Playground UI loading\n\n // Skip authentication for the GraphQL Playground UI\n if (isPlaygroundRequest) {\n return next();\n }\n\n return strapi.auth.authenticate(ctx, next);\n });\n\n // add the graphql server for koa\n handler.push(\n koaMiddleware<DefaultStateExtends, DefaultContextExtends>(server, {\n // Initialize loaders for this request.\n context: async ({ ctx }) => ({\n state: ctx.state,\n koaContext: ctx,\n }),\n })\n );\n\n // now that handlers are set up, add the graphql route to our apollo server\n strapi.server.routes([\n {\n method: 'ALL',\n path,\n handler,\n config: {\n auth: false,\n },\n },\n ]);\n\n // Register destroy behavior\n // We're doing it here instead of exposing a destroy method to the strapi-server.js\n // file since we need to have access to the ApolloServer instance\n strapi.plugin('graphql').destroy = async () => {\n await server.stop();\n };\n}\n"],"names":["getOperationLimitsWarning","depthLimit","configuredDepthLimit","maxLimit","unboundedOrInvalidKeys","Number","isFinite","push","length","undefined","join","determineLandingPage","strapi","config","plugin","utils","service","configLandingPage","isProduction","process","env","NODE_ENV","localLanding","log","debug","playground","setEnabled","ApolloServerPluginLandingPageLocalDefault","prodLanding","ApolloServerPluginLandingPageProductionDefault","userLanding","userFunction","result","playgroundAlways","warn","bootstrap","schema","buildSchema","isEmpty","path","operationLimitsWarning","landingPage","pluginAddRootQueryArgs","requestDidStart","executionDidStart","willResolveField","source","args","contextValue","info","operation","rootQueryArgsByPath","Map","set","key","_originField","fieldName","defaultServerConfig","validationRules","formatError","formatGraphqlError","cors","uploads","bodyParserConfig","status400ForVariableCoercionErrors","plugins","cache","serverConfig","mergeWith","a","b","Array","isArray","concat","abortFieldsOnClientDisconnect","server","ApolloServer","start","error","Error","message","handler","isObject","bodyParser","ctx","next","state","route","type","isPlaygroundRequest","request","method","url","isEnabled","header","accept","includes","auth","authenticate","koaMiddleware","context","koaContext","routes","destroy","stop"],"mappings":";;;;;;;;;;AA4BO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AAM;AACR;AACF,SAAA;AAEA,QAAA,MAAMC,mBAAAA,GACJL,GAAAA,CAAIM,OAAO,CAACC,MAAM,KAAK,KAAA,IACvBP,GAAAA,CAAIM,OAAO,CAACE,GAAG,KAAKrD;QACpB3B,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWE,OAAO,CAAC,SAASS,UAAU,CAACoE,SAAS,EAAA;QAC9DT,GAAAA,CAAIM,OAAO,CAACI,MAAM,CAACC,MAAM,EAAEC,QAAAA,CAAS;;AAGtC,QAAA,IAAIP,mBAAAA,EAAqB;YACvB,OAAOJ,IAAAA,EAAAA;AACT,QAAA;AAEA,QAAA,OAAOzE,MAAAA,CAAOqF,IAAI,CAACC,YAAY,CAACd,GAAAA,EAAKC,IAAAA,CAAAA;AACvC,IAAA,CAAA,CAAA;;IAGAJ,OAAAA,CAAQ1E,IAAI,CACV4F,aAAAA,CAA0DxB,MAAAA,EAAQ;;AAEhEyB,QAAAA,OAAAA,EAAS,OAAO,EAAEhB,GAAG,EAAE,IAAM;AAC3BE,gBAAAA,KAAAA,EAAOF,IAAIE,KAAK;gBAChBe,UAAAA,EAAYjB;aACd;AACF,KAAA,CAAA,CAAA;;IAIFxE,MAAAA,CAAO+D,MAAM,CAAC2B,MAAM,CAAC;AACnB,QAAA;YACEX,MAAAA,EAAQ,KAAA;AACRpD,YAAAA,IAAAA;AACA0C,YAAAA,OAAAA;YACApE,MAAAA,EAAQ;gBACNoF,IAAAA,EAAM;AACR;AACF;AACD,KAAA,CAAA;;;;AAKDrF,IAAAA,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWyF,OAAO,GAAG,UAAA;AACjC,QAAA,MAAM5B,OAAO6B,IAAI,EAAA;AACnB,IAAA,CAAA;AACF;;;;"}
@@ -0,0 +1,20 @@
1
+ import type { GraphQLSchema } from 'graphql';
2
+ /**
3
+ * Wraps every field that has its own resolver so it throws before running when the HTTP peer of
4
+ * the request has disconnected. This stops the remaining nested query fields and serial mutation
5
+ * fields from running for a response nobody will receive.
6
+ *
7
+ * The check lives in the resolver, not in an Apollo `willResolveField` hook. Apollo wraps the
8
+ * resolvers of the schema it receives, so every plugin's `willResolveField` still runs and
9
+ * its `didResolveField` still receives the error. A throwing hook would skip both for the
10
+ * plugins around it.
11
+ *
12
+ * Fields without a resolver use the default resolver, which only reads a property of its parent,
13
+ * so they are left as they are. The schema is changed in place.
14
+ *
15
+ * graphql 16 has no way to cancel an execution, so this wrapper does it by hand. graphql 17 adds an
16
+ * `abortSignal` option to `execute` that stops new fields, later root mutations included, the same
17
+ * way. Replace this wrapper with that option once the plugin moves to graphql 17.
18
+ */
19
+ export declare const abortFieldsOnClientDisconnect: (schema: GraphQLSchema) => GraphQLSchema;
20
+ //# sourceMappingURL=abort-disconnected-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-disconnected-request.d.ts","sourceRoot":"","sources":["../../../server/src/abort-disconnected-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,aAAa,EACd,MAAM,SAAS,CAAC;AAejB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,aAAa,kBAmClE,CAAC"}
@@ -2,6 +2,7 @@ import { type ApolloServerPlugin } from '@apollo/server';
2
2
  import type { Core } from '@strapi/types';
3
3
  import type { BaseContext } from 'koa';
4
4
  type StrapiGraphQLContext = BaseContext & {
5
+ koaContext: Parameters<Core.MiddlewareHandler>[0];
5
6
  rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;
6
7
  };
7
8
  type OperationLimitConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,kBAAkB,EAA4B,MAAM,gBAAgB,CAAC;AAUjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAA8C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GvC,oBAAoB,KAAG,MAAM,GAAG,SAoBlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,IAAI,CAAC,MAAM,KAClB,kBAAkB,CAAC,oBAAoB,CAgFzC,CAAC;AAEF,wBAAsB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,iBA+LlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "5.62.0",
3
+ "version": "5.64.0",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -63,11 +63,11 @@
63
63
  "@apollo/server": "4.13.0",
64
64
  "@as-integrations/koa": "1.1.1",
65
65
  "@graphql-tools/schema": "10.0.3",
66
- "@graphql-tools/utils": "^12.0.3",
66
+ "@graphql-tools/utils": "^12.0.4",
67
67
  "@koa/cors": "5.0.0",
68
68
  "@strapi/design-system": "2.3.1",
69
69
  "@strapi/icons": "2.3.1",
70
- "@strapi/utils": "5.62.0",
70
+ "@strapi/utils": "5.64.0",
71
71
  "graphql": "^16.8.1",
72
72
  "graphql-depth-limit": "^1.1.0",
73
73
  "graphql-playground-middleware-koa": "^1.6.21",
@@ -79,24 +79,24 @@
79
79
  "pluralize": "8.0.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@strapi/admin": "5.62.0",
83
- "@strapi/strapi": "5.62.0",
84
- "@strapi/types": "5.62.0",
82
+ "@strapi/admin": "5.64.0",
83
+ "@strapi/strapi": "5.64.0",
84
+ "@strapi/types": "5.64.0",
85
85
  "@types/graphql-depth-limit": "1.1.5",
86
86
  "@types/koa-bodyparser": "4.3.12",
87
87
  "@types/koa__cors": "5.0.0",
88
88
  "@types/node": "22.20.0",
89
89
  "cross-env": "^7.0.3",
90
- "eslint-config-custom": "5.62.0",
90
+ "eslint-config-custom": "5.64.0",
91
91
  "koa": "2.16.4",
92
92
  "react": "18.3.1",
93
93
  "react-dom": "18.3.1",
94
94
  "react-router-dom": "6.30.6",
95
95
  "styled-components": "6.4.1",
96
- "tsconfig": "5.62.0",
96
+ "tsconfig": "5.64.0",
97
97
  "typescript": "5.9.3",
98
98
  "vitest": "catalog:",
99
- "vitest-config": "5.62.0"
99
+ "vitest-config": "5.64.0"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@strapi/admin": "^5.0.0",