@strapi/plugin-graphql 0.0.0-experimental.6340da17068c3bed7fb006e7bcc554c71129e282 → 0.0.0-experimental.63624e21eb5b0713345a0cf2f68f1c40eab427bc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/package.json.js +1 -2
- package/dist/admin/package.json.js.map +1 -1
- package/dist/admin/package.json.mjs +1 -2
- package/dist/admin/package.json.mjs.map +1 -1
- package/dist/admin/src/index.d.ts +2 -1
- package/dist/admin/translations/ko.json.js +10 -0
- package/dist/admin/translations/ko.json.js.map +1 -0
- package/dist/admin/translations/ko.json.mjs +8 -0
- package/dist/admin/translations/ko.json.mjs.map +1 -0
- package/dist/server/bootstrap.js +35 -10
- package/dist/server/bootstrap.js.map +1 -1
- package/dist/server/bootstrap.mjs +33 -9
- package/dist/server/bootstrap.mjs.map +1 -1
- package/dist/server/format-graphql-error.js +34 -8
- package/dist/server/format-graphql-error.js.map +1 -1
- package/dist/server/format-graphql-error.mjs +34 -8
- package/dist/server/format-graphql-error.mjs.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/services/builders/dynamic-zones.js +3 -3
- package/dist/server/services/builders/dynamic-zones.js.map +1 -1
- package/dist/server/services/builders/dynamic-zones.mjs +3 -3
- package/dist/server/services/builders/dynamic-zones.mjs.map +1 -1
- package/dist/server/services/builders/entity.js +4 -4
- package/dist/server/services/builders/entity.js.map +1 -1
- package/dist/server/services/builders/entity.mjs +2 -2
- package/dist/server/services/builders/entity.mjs.map +1 -1
- package/dist/server/services/builders/enums.js +2 -2
- package/dist/server/services/builders/enums.js.map +1 -1
- package/dist/server/services/builders/enums.mjs +2 -2
- package/dist/server/services/builders/enums.mjs.map +1 -1
- package/dist/server/services/builders/filters/content-type.js +1 -0
- package/dist/server/services/builders/filters/content-type.js.map +1 -1
- package/dist/server/services/builders/filters/content-type.mjs +1 -0
- package/dist/server/services/builders/filters/content-type.mjs.map +1 -1
- package/dist/server/services/builders/filters/operators/eq.js.map +1 -1
- package/dist/server/services/builders/filters/operators/eq.mjs.map +1 -1
- package/dist/server/services/builders/filters/operators/index.js +3 -3
- package/dist/server/services/builders/filters/operators/index.js.map +1 -1
- package/dist/server/services/builders/filters/operators/index.mjs +3 -3
- package/dist/server/services/builders/filters/operators/index.mjs.map +1 -1
- package/dist/server/services/builders/filters/operators/not.js +1 -0
- package/dist/server/services/builders/filters/operators/not.js.map +1 -1
- package/dist/server/services/builders/filters/operators/not.mjs +1 -0
- package/dist/server/services/builders/filters/operators/not.mjs.map +1 -1
- package/dist/server/services/builders/generic-morph.js +1 -2
- package/dist/server/services/builders/generic-morph.js.map +1 -1
- package/dist/server/services/builders/generic-morph.mjs +1 -2
- package/dist/server/services/builders/generic-morph.mjs.map +1 -1
- package/dist/server/services/builders/index.js +2 -4
- package/dist/server/services/builders/index.js.map +1 -1
- package/dist/server/services/builders/index.mjs +2 -4
- package/dist/server/services/builders/index.mjs.map +1 -1
- package/dist/server/services/builders/input.js +1 -2
- package/dist/server/services/builders/input.js.map +1 -1
- package/dist/server/services/builders/input.mjs +1 -2
- package/dist/server/services/builders/input.mjs.map +1 -1
- package/dist/server/services/builders/queries/collection-type.js.map +1 -1
- package/dist/server/services/builders/queries/collection-type.mjs.map +1 -1
- package/dist/server/services/builders/queries/single-type.js.map +1 -1
- package/dist/server/services/builders/queries/single-type.mjs.map +1 -1
- package/dist/server/services/builders/relation-response-collection.js +3 -3
- package/dist/server/services/builders/relation-response-collection.js.map +1 -1
- package/dist/server/services/builders/relation-response-collection.mjs +3 -3
- package/dist/server/services/builders/relation-response-collection.mjs.map +1 -1
- package/dist/server/services/builders/resolvers/association.js +4 -3
- package/dist/server/services/builders/resolvers/association.js.map +1 -1
- package/dist/server/services/builders/resolvers/association.mjs +4 -3
- package/dist/server/services/builders/resolvers/association.mjs.map +1 -1
- package/dist/server/services/builders/resolvers/component.js +1 -0
- package/dist/server/services/builders/resolvers/component.js.map +1 -1
- package/dist/server/services/builders/resolvers/component.mjs +1 -0
- package/dist/server/services/builders/resolvers/component.mjs.map +1 -1
- package/dist/server/services/builders/resolvers/query.js +3 -3
- package/dist/server/services/builders/resolvers/query.js.map +1 -1
- package/dist/server/services/builders/resolvers/query.mjs +3 -3
- package/dist/server/services/builders/resolvers/query.mjs.map +1 -1
- package/dist/server/services/builders/response-collection.js +4 -4
- package/dist/server/services/builders/response-collection.js.map +1 -1
- package/dist/server/services/builders/response-collection.mjs +3 -3
- package/dist/server/services/builders/response-collection.mjs.map +1 -1
- package/dist/server/services/builders/response.js +1 -2
- package/dist/server/services/builders/response.js.map +1 -1
- package/dist/server/services/builders/response.mjs +1 -2
- package/dist/server/services/builders/response.mjs.map +1 -1
- package/dist/server/services/builders/type.js +4 -4
- package/dist/server/services/builders/type.js.map +1 -1
- package/dist/server/services/builders/type.mjs +3 -3
- package/dist/server/services/builders/type.mjs.map +1 -1
- package/dist/server/services/builders/utils.js +7 -6
- package/dist/server/services/builders/utils.js.map +1 -1
- package/dist/server/services/builders/utils.mjs +7 -6
- package/dist/server/services/builders/utils.mjs.map +1 -1
- package/dist/server/services/constants.js +3 -3
- package/dist/server/services/constants.js.map +1 -1
- package/dist/server/services/constants.mjs +3 -3
- package/dist/server/services/constants.mjs.map +1 -1
- package/dist/server/services/content-api/index.js +12 -10
- package/dist/server/services/content-api/index.js.map +1 -1
- package/dist/server/services/content-api/index.mjs +12 -10
- package/dist/server/services/content-api/index.mjs.map +1 -1
- package/dist/server/services/content-api/policy.js +2 -3
- package/dist/server/services/content-api/policy.js.map +1 -1
- package/dist/server/services/content-api/policy.mjs +2 -3
- package/dist/server/services/content-api/policy.mjs.map +1 -1
- package/dist/server/services/content-api/register-functions/internals.js +1 -3
- package/dist/server/services/content-api/register-functions/internals.js.map +1 -1
- package/dist/server/services/content-api/register-functions/internals.mjs +1 -3
- package/dist/server/services/content-api/register-functions/internals.mjs.map +1 -1
- package/dist/server/services/content-api/wrap-resolvers.js +13 -13
- package/dist/server/services/content-api/wrap-resolvers.js.map +1 -1
- package/dist/server/services/content-api/wrap-resolvers.mjs +13 -13
- package/dist/server/services/content-api/wrap-resolvers.mjs.map +1 -1
- package/dist/server/services/extension/extension.js +3 -3
- package/dist/server/services/extension/extension.js.map +1 -1
- package/dist/server/services/extension/extension.mjs +3 -3
- package/dist/server/services/extension/extension.mjs.map +1 -1
- package/dist/server/services/extension/shadow-crud-manager.js +3 -3
- package/dist/server/services/extension/shadow-crud-manager.js.map +1 -1
- package/dist/server/services/extension/shadow-crud-manager.mjs +3 -3
- package/dist/server/services/extension/shadow-crud-manager.mjs.map +1 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +2 -2
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/services/internals/helpers/get-enabled-scalars.js +2 -2
- package/dist/server/services/internals/helpers/get-enabled-scalars.js.map +1 -1
- package/dist/server/services/internals/helpers/get-enabled-scalars.mjs +1 -1
- package/dist/server/services/internals/helpers/get-enabled-scalars.mjs.map +1 -1
- package/dist/server/services/internals/types/error.js +1 -2
- package/dist/server/services/internals/types/error.js.map +1 -1
- package/dist/server/services/internals/types/error.mjs +1 -2
- package/dist/server/services/internals/types/error.mjs.map +1 -1
- package/dist/server/services/internals/types/filters.js +3 -0
- package/dist/server/services/internals/types/filters.js.map +1 -1
- package/dist/server/services/internals/types/filters.mjs +3 -0
- package/dist/server/services/internals/types/filters.mjs.map +1 -1
- package/dist/server/services/type-registry.js +1 -2
- package/dist/server/services/type-registry.js.map +1 -1
- package/dist/server/services/type-registry.mjs +1 -2
- package/dist/server/services/type-registry.mjs.map +1 -1
- package/dist/server/services/utils/attributes.js +7 -6
- package/dist/server/services/utils/attributes.js.map +1 -1
- package/dist/server/services/utils/attributes.mjs +7 -6
- package/dist/server/services/utils/attributes.mjs.map +1 -1
- package/dist/server/services/utils/mappers/entity-to-response-entity.js +2 -2
- package/dist/server/services/utils/mappers/entity-to-response-entity.js.map +1 -1
- package/dist/server/services/utils/mappers/entity-to-response-entity.mjs +2 -2
- package/dist/server/services/utils/mappers/entity-to-response-entity.mjs.map +1 -1
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js +11 -10
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js.map +1 -1
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs +10 -9
- package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs.map +1 -1
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js +4 -3
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js.map +1 -1
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs +4 -3
- package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs.map +1 -1
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js +3 -3
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js.map +1 -1
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs +2 -2
- package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs.map +1 -1
- package/dist/server/services/utils/naming.js +13 -10
- package/dist/server/services/utils/naming.js.map +1 -1
- package/dist/server/services/utils/naming.mjs +9 -6
- package/dist/server/services/utils/naming.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/format-graphql-error.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +170 -54
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/dynamic-zones.d.ts +1 -1
- package/dist/server/src/services/builders/filters/content-type.d.ts.map +1 -1
- package/dist/server/src/services/builders/filters/index.d.ts +1 -1
- package/dist/server/src/services/builders/filters/operators/index.d.ts +112 -5
- package/dist/server/src/services/builders/filters/operators/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/filters/operators/not.d.ts.map +1 -1
- package/dist/server/src/services/builders/generic-morph.d.ts.map +1 -1
- package/dist/server/src/services/builders/index.d.ts +120 -11
- package/dist/server/src/services/builders/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/input.d.ts.map +1 -1
- package/dist/server/src/services/builders/mutations/index.d.ts +2 -2
- package/dist/server/src/services/builders/queries/collection-type.d.ts.map +1 -1
- package/dist/server/src/services/builders/queries/index.d.ts +2 -2
- package/dist/server/src/services/builders/resolvers/association.d.ts.map +1 -1
- package/dist/server/src/services/builders/resolvers/component.d.ts.map +1 -1
- package/dist/server/src/services/builders/resolvers/index.d.ts +7 -7
- package/dist/server/src/services/builders/resolvers/index.d.ts.map +1 -1
- package/dist/server/src/services/builders/resolvers/query.d.ts +3 -3
- package/dist/server/src/services/builders/response.d.ts.map +1 -1
- package/dist/server/src/services/builders/utils.d.ts +4 -2
- package/dist/server/src/services/builders/utils.d.ts.map +1 -1
- package/dist/server/src/services/constants.d.ts +4 -67
- package/dist/server/src/services/constants.d.ts.map +1 -1
- package/dist/server/src/services/content-api/index.d.ts.map +1 -1
- package/dist/server/src/services/content-api/policy.d.ts.map +1 -1
- package/dist/server/src/services/extension/shadow-crud-manager.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +170 -54
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/internals/types/error.d.ts.map +1 -1
- package/dist/server/src/services/internals/types/filters.d.ts.map +1 -1
- package/dist/server/src/services/type-registry.d.ts.map +1 -1
- package/dist/server/src/services/utils/attributes.d.ts.map +1 -1
- package/dist/server/src/services/utils/index.d.ts +46 -40
- package/dist/server/src/services/utils/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/mappers/entity-to-response-entity.d.ts +14 -7
- package/dist/server/src/services/utils/mappers/entity-to-response-entity.d.ts.map +1 -1
- package/dist/server/src/services/utils/mappers/graphql-filters-to-strapi-query.d.ts.map +1 -1
- package/dist/server/src/services/utils/mappers/index.d.ts +19 -13
- package/dist/server/src/services/utils/mappers/index.d.ts.map +1 -1
- package/dist/server/src/types/index.d.ts +64 -0
- package/dist/server/src/types/index.d.ts.map +1 -0
- package/dist/server/src/types/services.d.ts +97 -0
- package/dist/server/src/types/services.d.ts.map +1 -0
- package/package.json +32 -18
package/dist/admin/index.js
CHANGED
|
@@ -13,6 +13,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
13
13
|
case './translations/en.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/en.json.js')); });
|
|
14
14
|
case './translations/es.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/es.json.js')); });
|
|
15
15
|
case './translations/fr.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/fr.json.js')); });
|
|
16
|
+
case './translations/ko.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/ko.json.js')); });
|
|
16
17
|
case './translations/pl.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/pl.json.js')); });
|
|
17
18
|
case './translations/ru.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/ru.json.js')); });
|
|
18
19
|
case './translations/sk.json': return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./translations/sk.json.js')); });
|
|
@@ -31,7 +32,6 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
31
32
|
const name = _package.default.strapi.name;
|
|
32
33
|
// eslint-disable-next-line import/no-default-export
|
|
33
34
|
var index = {
|
|
34
|
-
// TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
|
|
35
35
|
register (app) {
|
|
36
36
|
app.registerPlugin({
|
|
37
37
|
id: pluginId.pluginId,
|
package/dist/admin/index.js.map
CHANGED
|
@@ -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\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n
|
|
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;;;;"}
|
package/dist/admin/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
9
9
|
case './translations/en.json': return import('./translations/en.json.mjs');
|
|
10
10
|
case './translations/es.json': return import('./translations/es.json.mjs');
|
|
11
11
|
case './translations/fr.json': return import('./translations/fr.json.mjs');
|
|
12
|
+
case './translations/ko.json': return import('./translations/ko.json.mjs');
|
|
12
13
|
case './translations/pl.json': return import('./translations/pl.json.mjs');
|
|
13
14
|
case './translations/ru.json': return import('./translations/ru.json.mjs');
|
|
14
15
|
case './translations/sk.json': return import('./translations/sk.json.mjs');
|
|
@@ -27,7 +28,6 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
27
28
|
const name = pluginPkg.strapi.name;
|
|
28
29
|
// eslint-disable-next-line import/no-default-export
|
|
29
30
|
var index = {
|
|
30
|
-
// TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
|
|
31
31
|
register (app) {
|
|
32
32
|
app.registerPlugin({
|
|
33
33
|
id: pluginId,
|
package/dist/admin/index.mjs.map
CHANGED
|
@@ -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\nconst name = pluginPkg.strapi.name;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ko = {
|
|
4
|
+
"plugin.description.long": "기본 API 메서드를 포함한 GraphQL 엔드포인트를 추가합니다.",
|
|
5
|
+
"plugin.description.short": "기본 API 메서드를 포함한 GraphQL 엔드포인트를 추가합니다.",
|
|
6
|
+
"plugin.name": "GraphQL"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
module.exports = ko;
|
|
10
|
+
//# sourceMappingURL=ko.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ko.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ko.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/server/bootstrap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var lodash = require('lodash');
|
|
4
4
|
var server = require('@apollo/server');
|
|
5
5
|
var _default = require('@apollo/server/plugin/landingPage/default');
|
|
6
6
|
var koa = require('@as-integrations/koa');
|
|
@@ -15,11 +15,19 @@ var depthLimit__default = /*#__PURE__*/_interopDefault(depthLimit);
|
|
|
15
15
|
var bodyParser__default = /*#__PURE__*/_interopDefault(bodyParser);
|
|
16
16
|
var cors__default = /*#__PURE__*/_interopDefault(cors);
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const getOperationLimitsWarning = ({ depthLimit: configuredDepthLimit, maxLimit })=>{
|
|
19
|
+
const unboundedOrInvalidKeys = [];
|
|
20
|
+
if (typeof configuredDepthLimit !== 'number' || !Number.isFinite(configuredDepthLimit) || configuredDepthLimit <= 0) {
|
|
21
|
+
unboundedOrInvalidKeys.push('depthLimit');
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
if (typeof maxLimit !== 'number' || !Number.isFinite(maxLimit) || maxLimit <= 0) {
|
|
24
|
+
unboundedOrInvalidKeys.push('maxLimit');
|
|
25
|
+
}
|
|
26
|
+
if (unboundedOrInvalidKeys.length === 0) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
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.`;
|
|
30
|
+
};
|
|
23
31
|
const determineLandingPage = (strapi)=>{
|
|
24
32
|
const { config } = strapi.plugin('graphql');
|
|
25
33
|
const utils = strapi.plugin('graphql').service('utils');
|
|
@@ -74,7 +82,7 @@ const determineLandingPage = (strapi)=>{
|
|
|
74
82
|
return isProduction ? prodLanding() : localLanding();
|
|
75
83
|
}
|
|
76
84
|
// if user provided a landing page function, return that
|
|
77
|
-
if (
|
|
85
|
+
if (typeof configLandingPage === 'function') {
|
|
78
86
|
return userLanding(configLandingPage);
|
|
79
87
|
}
|
|
80
88
|
// If no other setting could be found, default to production settings
|
|
@@ -84,12 +92,21 @@ const determineLandingPage = (strapi)=>{
|
|
|
84
92
|
async function bootstrap({ strapi }) {
|
|
85
93
|
// Generate the GraphQL schema for the content API
|
|
86
94
|
const schema = strapi.plugin('graphql').service('content-api').buildSchema();
|
|
87
|
-
if (
|
|
95
|
+
if (lodash.isEmpty(schema)) {
|
|
88
96
|
strapi.log.warn('The GraphQL schema has not been generated because it is empty');
|
|
89
97
|
return;
|
|
90
98
|
}
|
|
91
99
|
const { config } = strapi.plugin('graphql');
|
|
92
100
|
const path = config('endpoint');
|
|
101
|
+
const configuredDepthLimit = config('depthLimit');
|
|
102
|
+
const maxLimit = config('maxLimit');
|
|
103
|
+
const operationLimitsWarning = getOperationLimitsWarning({
|
|
104
|
+
depthLimit: configuredDepthLimit,
|
|
105
|
+
maxLimit
|
|
106
|
+
});
|
|
107
|
+
if (operationLimitsWarning) {
|
|
108
|
+
strapi.log.warn(operationLimitsWarning);
|
|
109
|
+
}
|
|
93
110
|
const landingPage = determineLandingPage(strapi);
|
|
94
111
|
/**
|
|
95
112
|
* We need the arguments passed to the root query to be available in the association resolver
|
|
@@ -125,8 +142,10 @@ async function bootstrap({ strapi }) {
|
|
|
125
142
|
// Schema
|
|
126
143
|
schema,
|
|
127
144
|
// Validation
|
|
145
|
+
// Keep v5 compatibility: depthLimit is passed through unchanged, so an unset or invalid value
|
|
146
|
+
// does not become an enforced finite limit during an upgrade.
|
|
128
147
|
validationRules: [
|
|
129
|
-
depthLimit__default.default(
|
|
148
|
+
depthLimit__default.default(configuredDepthLimit)
|
|
130
149
|
],
|
|
131
150
|
// Errors
|
|
132
151
|
formatError: formatGraphqlError.formatGraphqlError,
|
|
@@ -142,7 +161,12 @@ async function bootstrap({ strapi }) {
|
|
|
142
161
|
],
|
|
143
162
|
cache: 'bounded'
|
|
144
163
|
};
|
|
145
|
-
const serverConfig =
|
|
164
|
+
const serverConfig = lodash.mergeWith({}, defaultServerConfig, config('apolloServer'), (a, b)=>{
|
|
165
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
166
|
+
return a.concat(b);
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
});
|
|
146
170
|
// Create a new Apollo server
|
|
147
171
|
const server$1 = new server.ApolloServer(serverConfig);
|
|
148
172
|
try {
|
|
@@ -165,7 +189,7 @@ async function bootstrap({ strapi }) {
|
|
|
165
189
|
handler.push(cors__default.default(serverConfig.cors));
|
|
166
190
|
}
|
|
167
191
|
// add koa bodyparser middleware
|
|
168
|
-
if (
|
|
192
|
+
if (lodash.isObject(serverConfig.bodyParserConfig)) {
|
|
169
193
|
handler.push(bodyParser__default.default(serverConfig.bodyParserConfig));
|
|
170
194
|
} else if (serverConfig.bodyParserConfig) {
|
|
171
195
|
handler.push(bodyParser__default.default());
|
|
@@ -218,4 +242,5 @@ async function bootstrap({ strapi }) {
|
|
|
218
242
|
|
|
219
243
|
exports.bootstrap = bootstrap;
|
|
220
244
|
exports.determineLandingPage = determineLandingPage;
|
|
245
|
+
exports.getOperationLimitsWarning = getOperationLimitsWarning;
|
|
221
246
|
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { isEmpty, mergeWith, isArray, isObject, isFunction } from 'lodash/fp';\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\nconst merge = mergeWith((a, b) => {\n if (isArray(a) && isArray(b)) {\n return a.concat(b);\n }\n});\n\ntype StrapiGraphQLContext = BaseContext & {\n rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;\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('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 (isFunction(configLandingPage)) {\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\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 validationRules: [depthLimit(config('depthLimit') 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 = merge(\n defaultServerConfig,\n config('apolloServer')\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":["merge","mergeWith","a","b","isArray","concat","determineLandingPage","strapi","config","plugin","utils","service","configLandingPage","isProduction","process","env","NODE_ENV","localLanding","log","debug","playground","setEnabled","ApolloServerPluginLandingPageLocalDefault","prodLanding","ApolloServerPluginLandingPageProductionDefault","userLanding","userFunction","result","playgroundAlways","undefined","warn","isFunction","bootstrap","schema","buildSchema","isEmpty","path","landingPage","pluginAddRootQueryArgs","requestDidStart","executionDidStart","willResolveField","source","args","contextValue","info","operation","rootQueryArgsByPath","Map","set","key","_originField","fieldName","defaultServerConfig","validationRules","depthLimit","formatError","formatGraphqlError","cors","uploads","bodyParserConfig","status400ForVariableCoercionErrors","plugins","cache","serverConfig","server","ApolloServer","start","error","Error","message","handler","push","isObject","bodyParser","ctx","next","state","route","type","isPlaygroundRequest","request","method","url","isEnabled","header","accept","includes","auth","authenticate","koaMiddleware","context","koaContext","routes","destroy","stop"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAMA,KAAAA,GAAQC,YAAAA,CAAU,CAACC,CAAAA,EAAGC,CAAAA,GAAAA;IAC1B,IAAIC,UAAAA,CAAQF,CAAAA,CAAAA,IAA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, 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;IAE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AEhEyB,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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEmpty, mergeWith, isObject } from 'lodash';
|
|
2
2
|
import { ApolloServer } from '@apollo/server';
|
|
3
3
|
import { ApolloServerPluginLandingPageLocalDefault, ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default';
|
|
4
4
|
import { koaMiddleware } from '@as-integrations/koa';
|
|
@@ -7,11 +7,19 @@ import bodyParser from 'koa-bodyparser';
|
|
|
7
7
|
import cors from '@koa/cors';
|
|
8
8
|
import { formatGraphqlError } from './format-graphql-error.mjs';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const getOperationLimitsWarning = ({ depthLimit: configuredDepthLimit, maxLimit })=>{
|
|
11
|
+
const unboundedOrInvalidKeys = [];
|
|
12
|
+
if (typeof configuredDepthLimit !== 'number' || !Number.isFinite(configuredDepthLimit) || configuredDepthLimit <= 0) {
|
|
13
|
+
unboundedOrInvalidKeys.push('depthLimit');
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
if (typeof maxLimit !== 'number' || !Number.isFinite(maxLimit) || maxLimit <= 0) {
|
|
16
|
+
unboundedOrInvalidKeys.push('maxLimit');
|
|
17
|
+
}
|
|
18
|
+
if (unboundedOrInvalidKeys.length === 0) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
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.`;
|
|
22
|
+
};
|
|
15
23
|
const determineLandingPage = (strapi)=>{
|
|
16
24
|
const { config } = strapi.plugin('graphql');
|
|
17
25
|
const utils = strapi.plugin('graphql').service('utils');
|
|
@@ -66,7 +74,7 @@ const determineLandingPage = (strapi)=>{
|
|
|
66
74
|
return isProduction ? prodLanding() : localLanding();
|
|
67
75
|
}
|
|
68
76
|
// if user provided a landing page function, return that
|
|
69
|
-
if (
|
|
77
|
+
if (typeof configLandingPage === 'function') {
|
|
70
78
|
return userLanding(configLandingPage);
|
|
71
79
|
}
|
|
72
80
|
// If no other setting could be found, default to production settings
|
|
@@ -82,6 +90,15 @@ async function bootstrap({ strapi }) {
|
|
|
82
90
|
}
|
|
83
91
|
const { config } = strapi.plugin('graphql');
|
|
84
92
|
const path = config('endpoint');
|
|
93
|
+
const configuredDepthLimit = config('depthLimit');
|
|
94
|
+
const maxLimit = config('maxLimit');
|
|
95
|
+
const operationLimitsWarning = getOperationLimitsWarning({
|
|
96
|
+
depthLimit: configuredDepthLimit,
|
|
97
|
+
maxLimit
|
|
98
|
+
});
|
|
99
|
+
if (operationLimitsWarning) {
|
|
100
|
+
strapi.log.warn(operationLimitsWarning);
|
|
101
|
+
}
|
|
85
102
|
const landingPage = determineLandingPage(strapi);
|
|
86
103
|
/**
|
|
87
104
|
* We need the arguments passed to the root query to be available in the association resolver
|
|
@@ -117,8 +134,10 @@ async function bootstrap({ strapi }) {
|
|
|
117
134
|
// Schema
|
|
118
135
|
schema,
|
|
119
136
|
// Validation
|
|
137
|
+
// Keep v5 compatibility: depthLimit is passed through unchanged, so an unset or invalid value
|
|
138
|
+
// does not become an enforced finite limit during an upgrade.
|
|
120
139
|
validationRules: [
|
|
121
|
-
depthLimit(
|
|
140
|
+
depthLimit(configuredDepthLimit)
|
|
122
141
|
],
|
|
123
142
|
// Errors
|
|
124
143
|
formatError: formatGraphqlError,
|
|
@@ -134,7 +153,12 @@ async function bootstrap({ strapi }) {
|
|
|
134
153
|
],
|
|
135
154
|
cache: 'bounded'
|
|
136
155
|
};
|
|
137
|
-
const serverConfig =
|
|
156
|
+
const serverConfig = mergeWith({}, defaultServerConfig, config('apolloServer'), (a, b)=>{
|
|
157
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
158
|
+
return a.concat(b);
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
});
|
|
138
162
|
// Create a new Apollo server
|
|
139
163
|
const server = new ApolloServer(serverConfig);
|
|
140
164
|
try {
|
|
@@ -208,5 +232,5 @@ async function bootstrap({ strapi }) {
|
|
|
208
232
|
};
|
|
209
233
|
}
|
|
210
234
|
|
|
211
|
-
export { bootstrap, determineLandingPage };
|
|
235
|
+
export { bootstrap, determineLandingPage, getOperationLimitsWarning };
|
|
212
236
|
//# sourceMappingURL=bootstrap.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.mjs","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { isEmpty, mergeWith, isArray, isObject, isFunction } from 'lodash/fp';\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\nconst merge = mergeWith((a, b) => {\n if (isArray(a) && isArray(b)) {\n return a.concat(b);\n }\n});\n\ntype StrapiGraphQLContext = BaseContext & {\n rootQueryArgsByPath?: Map<string | number, Record<string, unknown>>;\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('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 (isFunction(configLandingPage)) {\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\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 validationRules: [depthLimit(config('depthLimit') 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 = merge(\n defaultServerConfig,\n config('apolloServer')\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":["merge","mergeWith","a","b","isArray","concat","determineLandingPage","strapi","config","plugin","utils","service","configLandingPage","isProduction","process","env","NODE_ENV","localLanding","log","debug","playground","setEnabled","ApolloServerPluginLandingPageLocalDefault","prodLanding","ApolloServerPluginLandingPageProductionDefault","userLanding","userFunction","result","playgroundAlways","undefined","warn","isFunction","bootstrap","schema","buildSchema","isEmpty","path","landingPage","pluginAddRootQueryArgs","requestDidStart","executionDidStart","willResolveField","source","args","contextValue","info","operation","rootQueryArgsByPath","Map","set","key","_originField","fieldName","defaultServerConfig","validationRules","depthLimit","formatError","formatGraphqlError","cors","uploads","bodyParserConfig","status400ForVariableCoercionErrors","plugins","cache","serverConfig","server","ApolloServer","start","error","Error","message","handler","push","isObject","bodyParser","ctx","next","state","route","type","isPlaygroundRequest","request","method","url","isEnabled","header","accept","includes","auth","authenticate","koaMiddleware","context","koaContext","routes","destroy","stop"],"mappings":";;;;;;;;;AAiBA,MAAMA,KAAAA,GAAQC,SAAAA,CAAU,CAACC,CAAAA,EAAGC,CAAAA,GAAAA;IAC1B,IAAIC,OAAAA,CAAQF,CAAAA,CAAAA,IAAME,OAAAA,CAAQD,CAAAA,CAAAA,EAAI;QAC5B,OAAOD,CAAAA,CAAEG,MAAM,CAACF,CAAAA,CAAAA;AAClB,IAAA;AACF,CAAA,CAAA;AAMO,MAAMG,uBAAuB,CAClCC,MAAAA,GAAAA;AAEA,IAAA,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA;AACjC,IAAA,MAAMC,QAAQH,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWE,OAAO,CAAC,OAAA,CAAA;AAE/C;;;;;;;SAQA,MAAMC,oBAAoBJ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P,mBAAAA,EAAqB;YACvB,OAAOJ,IAAAA,EAAAA;AACT,QAAA;AAEA,QAAA,OAAOrE,MAAAA,CAAOiF,IAAI,CAACC,YAAY,CAACd,GAAAA,EAAKC,IAAAA,CAAAA;AACvC,IAAA,CAAA,CAAA;;IAGAL,OAAAA,CAAQC,IAAI,CACVkB,aAAAA,CAA0DzB,MAAAA,EAAQ;;AAEhE0B,QAAAA,OAAAA,EAAS,OAAO,EAAEhB,GAAG,EAAE,IAAM;AAC3BE,gBAAAA,KAAAA,EAAOF,IAAIE,KAAK;gBAChBe,UAAAA,EAAYjB;aACd;AACF,KAAA,CAAA,CAAA;;IAIFpE,MAAAA,CAAO0D,MAAM,CAAC4B,MAAM,CAAC;AACnB,QAAA;YACEX,MAAAA,EAAQ,KAAA;AACR9C,YAAAA,IAAAA;AACAmC,YAAAA,OAAAA;YACA/D,MAAAA,EAAQ;gBACNgF,IAAAA,EAAM;AACR;AACF;AACD,KAAA,CAAA;;;;AAKDjF,IAAAA,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWqF,OAAO,GAAG,UAAA;AACjC,QAAA,MAAM7B,OAAO8B,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 { 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,EAAEC,MAAM,EAAE,GAAGD,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA;AACjC,IAAA,MAAMC,QAAQH,MAAAA,CAAOE,MAAM,CAAC,SAAA,CAAA,CAAWE,OAAO,CAAC,OAA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AAA,CAAA,CAAWwF,OAAO,GAAG,UAAA;AACjC,QAAA,MAAM5B,OAAO6B,IAAI,EAAA;AACnB,IAAA,CAAA;AACF;;;;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var lodash = require('lodash');
|
|
4
4
|
var utils = require('@strapi/utils');
|
|
5
5
|
var errors = require('@apollo/server/errors');
|
|
6
6
|
var graphql = require('graphql');
|
|
7
7
|
|
|
8
8
|
const { HttpError, ForbiddenError, UnauthorizedError, ApplicationError, ValidationError } = utils.errors;
|
|
9
|
-
const formatToCode = (name)=>`STRAPI_${
|
|
9
|
+
const formatToCode = (name)=>`STRAPI_${lodash.snakeCase(name).toUpperCase()}`;
|
|
10
10
|
const formatErrorToExtension = (error)=>({
|
|
11
|
-
error:
|
|
11
|
+
error: lodash.pick(error, [
|
|
12
12
|
'name',
|
|
13
13
|
'message',
|
|
14
14
|
'details'
|
|
15
|
-
])
|
|
15
|
+
])
|
|
16
16
|
});
|
|
17
17
|
function createFormattedError(formattedError, message, code, originalError) {
|
|
18
18
|
const options = {
|
|
@@ -31,8 +31,10 @@ function createFormattedError(formattedError, message, code, originalError) {
|
|
|
31
31
|
* Intercepts specific Strapi error types to send custom error response codes in the GraphQL response
|
|
32
32
|
*/ function formatGraphqlError(formattedError, error) {
|
|
33
33
|
const originalError = errors.unwrapResolverError(error);
|
|
34
|
-
//
|
|
35
|
-
|
|
34
|
+
// Nothing to inspect, so keep Apollo's own formatted error. This must not be an emptiness check:
|
|
35
|
+
// an Error only has non-enumerable fields (message, stack), so lodash isEmpty reports it as
|
|
36
|
+
// empty and a bare Error from a resolver would reach the client with its message
|
|
37
|
+
if (originalError === null || originalError === undefined) {
|
|
36
38
|
return formattedError;
|
|
37
39
|
}
|
|
38
40
|
const { message = '', name = 'UNKNOWN' } = originalError;
|
|
@@ -52,8 +54,32 @@ function createFormattedError(formattedError, message, code, originalError) {
|
|
|
52
54
|
// else if originalError doesn't appear to be from Strapi or GraphQL..
|
|
53
55
|
// Log the error
|
|
54
56
|
strapi.log.error(originalError);
|
|
55
|
-
// Create a generic 500 to send so we don't risk leaking any data
|
|
56
|
-
|
|
57
|
+
// Create a generic 500 to send so we don't risk leaking any data. The error that went to the log
|
|
58
|
+
// is not passed on: its name, message and details can hold SQL with bound values, hostnames and
|
|
59
|
+
// driver reasons. The extension carries the same error shape as the REST 500 body.
|
|
60
|
+
// path and locations stay: they name the field and the place in the query, and clients use them
|
|
61
|
+
// to attach the error. A fresh GraphQLError does not copy locations (the constructor only
|
|
62
|
+
// derives them from source positions), and spreading formattedError would also copy
|
|
63
|
+
// extensions.stacktrace in development.
|
|
64
|
+
const sanitized = createFormattedError({
|
|
65
|
+
message: 'Internal Server Error',
|
|
66
|
+
path: formattedError.path
|
|
67
|
+
}, 'Internal Server Error', 'INTERNAL_SERVER_ERROR', {
|
|
68
|
+
name: 'InternalServerError',
|
|
69
|
+
message: 'Internal Server Error'
|
|
70
|
+
});
|
|
71
|
+
// The GraphQLError type marks locations readonly. The constructor still creates a writable,
|
|
72
|
+
// enumerable field, and it will not copy locations off a formatted error, so set the field
|
|
73
|
+
// directly. Clients read it from toJSON().
|
|
74
|
+
if (formattedError.locations != null) {
|
|
75
|
+
Object.defineProperty(sanitized, 'locations', {
|
|
76
|
+
value: formattedError.locations,
|
|
77
|
+
enumerable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
configurable: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return sanitized;
|
|
57
83
|
}
|
|
58
84
|
|
|
59
85
|
exports.formatGraphqlError = formatGraphqlError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-graphql-error.js","sources":["../../server/src/format-graphql-error.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"format-graphql-error.js","sources":["../../server/src/format-graphql-error.ts"],"sourcesContent":["import { snakeCase, pick } from 'lodash';\nimport { errors } from '@strapi/utils';\nimport { unwrapResolverError } from '@apollo/server/errors';\nimport { GraphQLError, type GraphQLFormattedError } from 'graphql';\n\nconst { HttpError, ForbiddenError, UnauthorizedError, ApplicationError, ValidationError } = errors;\n\nconst formatToCode = (name: string) => `STRAPI_${snakeCase(name).toUpperCase()}`;\nconst formatErrorToExtension = (error: any) => ({\n error: pick(error, ['name', 'message', 'details']),\n});\n\nfunction createFormattedError(\n formattedError: GraphQLFormattedError,\n message: string,\n code: string,\n originalError: unknown\n) {\n const options = {\n ...formattedError,\n extensions: {\n ...formattedError.extensions,\n ...formatErrorToExtension(originalError),\n code,\n },\n };\n\n return new GraphQLError(message, options);\n}\n\n/**\n * The handler for Apollo Server v4's formatError config option\n *\n * Intercepts specific Strapi error types to send custom error response codes in the GraphQL response\n */\nexport function formatGraphqlError(formattedError: GraphQLFormattedError, error: unknown) {\n const originalError = unwrapResolverError(error);\n\n // Nothing to inspect, so keep Apollo's own formatted error. This must not be an emptiness check:\n // an Error only has non-enumerable fields (message, stack), so lodash isEmpty reports it as\n // empty and a bare Error from a resolver would reach the client with its message\n if (originalError === null || originalError === undefined) {\n return formattedError;\n }\n\n const { message = '', name = 'UNKNOWN' } = originalError as Error;\n\n if (originalError instanceof ForbiddenError || originalError instanceof UnauthorizedError) {\n return createFormattedError(formattedError, message, 'FORBIDDEN', originalError);\n }\n\n if (originalError instanceof ValidationError) {\n return createFormattedError(formattedError, message, 'BAD_USER_INPUT', originalError);\n }\n\n if (originalError instanceof ApplicationError || originalError instanceof HttpError) {\n const errorName = formatToCode(name);\n return createFormattedError(formattedError, message, errorName, originalError);\n }\n\n if (originalError instanceof GraphQLError) {\n return formattedError;\n }\n\n // else if originalError doesn't appear to be from Strapi or GraphQL..\n\n // Log the error\n strapi.log.error(originalError);\n\n // Create a generic 500 to send so we don't risk leaking any data. The error that went to the log\n // is not passed on: its name, message and details can hold SQL with bound values, hostnames and\n // driver reasons. The extension carries the same error shape as the REST 500 body.\n // path and locations stay: they name the field and the place in the query, and clients use them\n // to attach the error. A fresh GraphQLError does not copy locations (the constructor only\n // derives them from source positions), and spreading formattedError would also copy\n // extensions.stacktrace in development.\n const sanitized = createFormattedError(\n { message: 'Internal Server Error', path: formattedError.path },\n 'Internal Server Error',\n 'INTERNAL_SERVER_ERROR',\n { name: 'InternalServerError', message: 'Internal Server Error' }\n );\n // The GraphQLError type marks locations readonly. The constructor still creates a writable,\n // enumerable field, and it will not copy locations off a formatted error, so set the field\n // directly. Clients read it from toJSON().\n if (formattedError.locations != null) {\n Object.defineProperty(sanitized, 'locations', {\n value: formattedError.locations,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n return sanitized;\n}\n"],"names":["HttpError","ForbiddenError","UnauthorizedError","ApplicationError","ValidationError","errors","formatToCode","name","snakeCase","toUpperCase","formatErrorToExtension","error","pick","createFormattedError","formattedError","message","code","originalError","options","extensions","GraphQLError","formatGraphqlError","unwrapResolverError","undefined","errorName","strapi","log","sanitized","path","locations","Object","defineProperty","value","enumerable","writable","configurable"],"mappings":";;;;;;;AAKA,MAAM,EAAEA,SAAS,EAAEC,cAAc,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,eAAe,EAAE,GAAGC,YAAAA;AAE5F,MAAMC,YAAAA,GAAe,CAACC,IAAAA,GAAiB,CAAC,OAAO,EAAEC,gBAAAA,CAAUD,IAAAA,CAAAA,CAAME,WAAW,EAAA,CAAA,CAAI;AAChF,MAAMC,sBAAAA,GAAyB,CAACC,KAAAA,IAAgB;AAC9CA,QAAAA,KAAAA,EAAOC,YAAKD,KAAAA,EAAO;AAAC,YAAA,MAAA;AAAQ,YAAA,SAAA;AAAW,YAAA;AAAU,SAAA;KACnD,CAAA;AAEA,SAASE,qBACPC,cAAqC,EACrCC,OAAe,EACfC,IAAY,EACZC,aAAsB,EAAA;AAEtB,IAAA,MAAMC,OAAAA,GAAU;AACd,QAAA,GAAGJ,cAAc;QACjBK,UAAAA,EAAY;AACV,YAAA,GAAGL,eAAeK,UAAU;AAC5B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