@strapi/plugin-graphql 5.4.2 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/_chunks/dk-BbJCmDw6.mjs +0 -1
  2. package/dist/_chunks/dk-C9NcSzyg.js +0 -1
  3. package/dist/_chunks/en-BiKpmhCU.js +0 -1
  4. package/dist/_chunks/en-YIQYYlvv.mjs +0 -1
  5. package/dist/_chunks/es-BbsZ5Fh0.mjs +0 -1
  6. package/dist/_chunks/es-DE22V9D4.js +0 -1
  7. package/dist/_chunks/fr-BgqFw7G8.mjs +0 -1
  8. package/dist/_chunks/fr-Ca-HowfR.js +0 -1
  9. package/dist/_chunks/pl-CbET57Jb.mjs +0 -1
  10. package/dist/_chunks/pl-DVnJGR87.js +0 -1
  11. package/dist/_chunks/ru-BFz40YSA.mjs +0 -1
  12. package/dist/_chunks/ru-o4zaP02C.js +0 -1
  13. package/dist/_chunks/sv-9qK4y9fb.js +0 -1
  14. package/dist/_chunks/sv-CNYcKBn2.mjs +0 -1
  15. package/dist/_chunks/tr-H1PrR6RM.mjs +0 -1
  16. package/dist/_chunks/tr-fBBDNMBY.js +0 -1
  17. package/dist/_chunks/zh-BEh3jejH.mjs +0 -1
  18. package/dist/_chunks/zh-CyCKPuL0.js +0 -1
  19. package/dist/_chunks/zh-Hans-Btuz6Y7W.js +0 -1
  20. package/dist/_chunks/zh-Hans-CRQss50D.mjs +0 -1
  21. package/dist/admin/index.js +20 -16
  22. package/dist/admin/index.mjs +20 -16
  23. package/dist/server/index.js +12 -13
  24. package/dist/server/index.mjs +11 -11
  25. package/dist/server/src/bootstrap.d.ts.map +1 -1
  26. package/package.json +10 -11
  27. package/dist/_chunks/dk-BbJCmDw6.mjs.map +0 -1
  28. package/dist/_chunks/dk-C9NcSzyg.js.map +0 -1
  29. package/dist/_chunks/en-BiKpmhCU.js.map +0 -1
  30. package/dist/_chunks/en-YIQYYlvv.mjs.map +0 -1
  31. package/dist/_chunks/es-BbsZ5Fh0.mjs.map +0 -1
  32. package/dist/_chunks/es-DE22V9D4.js.map +0 -1
  33. package/dist/_chunks/fr-BgqFw7G8.mjs.map +0 -1
  34. package/dist/_chunks/fr-Ca-HowfR.js.map +0 -1
  35. package/dist/_chunks/pl-CbET57Jb.mjs.map +0 -1
  36. package/dist/_chunks/pl-DVnJGR87.js.map +0 -1
  37. package/dist/_chunks/ru-BFz40YSA.mjs.map +0 -1
  38. package/dist/_chunks/ru-o4zaP02C.js.map +0 -1
  39. package/dist/_chunks/sv-9qK4y9fb.js.map +0 -1
  40. package/dist/_chunks/sv-CNYcKBn2.mjs.map +0 -1
  41. package/dist/_chunks/tr-H1PrR6RM.mjs.map +0 -1
  42. package/dist/_chunks/tr-fBBDNMBY.js.map +0 -1
  43. package/dist/_chunks/zh-BEh3jejH.mjs.map +0 -1
  44. package/dist/_chunks/zh-CyCKPuL0.js.map +0 -1
  45. package/dist/_chunks/zh-Hans-Btuz6Y7W.js.map +0 -1
  46. package/dist/_chunks/zh-Hans-CRQss50D.mjs.map +0 -1
  47. package/dist/admin/index.js.map +0 -1
  48. package/dist/admin/index.mjs.map +0 -1
  49. package/dist/server/index.js.map +0 -1
  50. package/dist/server/index.mjs.map +0 -1
@@ -6,4 +6,3 @@ const dk = {
6
6
  export {
7
7
  dk as default
8
8
  };
9
- //# sourceMappingURL=dk-BbJCmDw6.mjs.map
@@ -6,4 +6,3 @@ const dk = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = dk;
9
- //# sourceMappingURL=dk-C9NcSzyg.js.map
@@ -6,4 +6,3 @@ const en = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = en;
9
- //# sourceMappingURL=en-BiKpmhCU.js.map
@@ -6,4 +6,3 @@ const en = {
6
6
  export {
7
7
  en as default
8
8
  };
9
- //# sourceMappingURL=en-YIQYYlvv.mjs.map
@@ -6,4 +6,3 @@ const es = {
6
6
  export {
7
7
  es as default
8
8
  };
9
- //# sourceMappingURL=es-BbsZ5Fh0.mjs.map
@@ -6,4 +6,3 @@ const es = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = es;
9
- //# sourceMappingURL=es-DE22V9D4.js.map
@@ -6,4 +6,3 @@ const fr = {
6
6
  export {
7
7
  fr as default
8
8
  };
9
- //# sourceMappingURL=fr-BgqFw7G8.mjs.map
@@ -6,4 +6,3 @@ const fr = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = fr;
9
- //# sourceMappingURL=fr-Ca-HowfR.js.map
@@ -6,4 +6,3 @@ const pl = {
6
6
  export {
7
7
  pl as default
8
8
  };
9
- //# sourceMappingURL=pl-CbET57Jb.mjs.map
@@ -6,4 +6,3 @@ const pl = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = pl;
9
- //# sourceMappingURL=pl-DVnJGR87.js.map
@@ -6,4 +6,3 @@ const ru = {
6
6
  export {
7
7
  ru as default
8
8
  };
9
- //# sourceMappingURL=ru-BFz40YSA.mjs.map
@@ -6,4 +6,3 @@ const ru = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = ru;
9
- //# sourceMappingURL=ru-o4zaP02C.js.map
@@ -6,4 +6,3 @@ const sv = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = sv;
9
- //# sourceMappingURL=sv-9qK4y9fb.js.map
@@ -6,4 +6,3 @@ const sv = {
6
6
  export {
7
7
  sv as default
8
8
  };
9
- //# sourceMappingURL=sv-CNYcKBn2.mjs.map
@@ -6,4 +6,3 @@ const tr = {
6
6
  export {
7
7
  tr as default
8
8
  };
9
- //# sourceMappingURL=tr-H1PrR6RM.mjs.map
@@ -6,4 +6,3 @@ const tr = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = tr;
9
- //# sourceMappingURL=tr-fBBDNMBY.js.map
@@ -6,4 +6,3 @@ const zh = {
6
6
  export {
7
7
  zh as default
8
8
  };
9
- //# sourceMappingURL=zh-BEh3jejH.mjs.map
@@ -6,4 +6,3 @@ const zh = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = zh;
9
- //# sourceMappingURL=zh-CyCKPuL0.js.map
@@ -6,4 +6,3 @@ const zhHans = {
6
6
  "plugin.name": "GraphQL"
7
7
  };
8
8
  exports.default = zhHans;
9
- //# sourceMappingURL=zh-Hans-Btuz6Y7W.js.map
@@ -6,4 +6,3 @@ const zhHans = {
6
6
  export {
7
7
  zhHans as default
8
8
  };
9
- //# sourceMappingURL=zh-Hans-CRQss50D.mjs.map
@@ -1,15 +1,22 @@
1
1
  "use strict";
2
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
2
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
3
3
  const v = glob[path];
4
4
  if (v) {
5
5
  return typeof v === "function" ? v() : Promise.resolve(v);
6
6
  }
7
7
  return new Promise((_, reject) => {
8
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
8
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
9
+ reject.bind(
10
+ null,
11
+ new Error(
12
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
13
+ )
14
+ )
15
+ );
9
16
  });
10
17
  };
11
18
  const name$1 = "@strapi/plugin-graphql";
12
- const version = "5.4.1";
19
+ const version = "5.5.0";
13
20
  const description = "Adds GraphQL endpoint with default API methods.";
14
21
  const repository = {
15
22
  type: "git",
@@ -62,9 +69,9 @@ const dependencies = {
62
69
  "@graphql-tools/schema": "10.0.3",
63
70
  "@graphql-tools/utils": "^10.1.3",
64
71
  "@koa/cors": "5.0.0",
65
- "@strapi/design-system": "2.0.0-rc.13",
66
- "@strapi/icons": "2.0.0-rc.13",
67
- "@strapi/utils": "5.4.1",
72
+ "@strapi/design-system": "2.0.0-rc.14",
73
+ "@strapi/icons": "2.0.0-rc.14",
74
+ "@strapi/utils": "workspace:*",
68
75
  graphql: "^16.8.1",
69
76
  "graphql-depth-limit": "^1.1.0",
70
77
  "graphql-playground-middleware-koa": "^1.6.21",
@@ -76,20 +83,20 @@ const dependencies = {
76
83
  pluralize: "8.0.0"
77
84
  };
78
85
  const devDependencies = {
79
- "@strapi/sdk-plugin": "^5.0.0",
80
- "@strapi/strapi": "5.4.1",
81
- "@strapi/types": "5.4.1",
86
+ "@strapi/sdk-plugin": "^5.2.0",
87
+ "@strapi/strapi": "workspace:*",
88
+ "@strapi/types": "workspace:*",
82
89
  "@types/graphql-depth-limit": "1.1.5",
83
90
  "@types/koa-bodyparser": "4.3.12",
84
91
  "@types/koa__cors": "5.0.0",
85
92
  "cross-env": "^7.0.3",
86
- "eslint-config-custom": "5.4.1",
93
+ "eslint-config-custom": "workspace:*",
87
94
  koa: "2.15.2",
88
95
  react: "18.3.1",
89
96
  "react-dom": "18.3.1",
90
97
  "react-router-dom": "6.22.3",
91
98
  "styled-components": "6.1.8",
92
- tsconfig: "5.4.1",
99
+ tsconfig: "workspace:*",
93
100
  typescript: "5.3.2"
94
101
  };
95
102
  const peerDependencies = {
@@ -109,7 +116,6 @@ const strapi = {
109
116
  description: "Adds GraphQL endpoint with default API methods.",
110
117
  kind: "plugin"
111
118
  };
112
- const gitHead = "7d785703f52464577d077c4618cbe68b44f8a9cd";
113
119
  const pluginPkg = {
114
120
  name: name$1,
115
121
  version,
@@ -125,8 +131,7 @@ const pluginPkg = {
125
131
  devDependencies,
126
132
  peerDependencies,
127
133
  engines,
128
- strapi,
129
- gitHead
134
+ strapi
130
135
  };
131
136
  const pluginId = "graphql";
132
137
  const prefixPluginTranslations = (trad, pluginId2) => {
@@ -149,7 +154,7 @@ const index = {
149
154
  async registerTrads({ locales }) {
150
155
  const importedTrads = await Promise.all(
151
156
  locales.map((locale) => {
152
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/dk.json": () => Promise.resolve().then(() => require("../_chunks/dk-C9NcSzyg.js")), "./translations/en.json": () => Promise.resolve().then(() => require("../_chunks/en-BiKpmhCU.js")), "./translations/es.json": () => Promise.resolve().then(() => require("../_chunks/es-DE22V9D4.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("../_chunks/fr-Ca-HowfR.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("../_chunks/pl-DVnJGR87.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("../_chunks/ru-o4zaP02C.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("../_chunks/sv-9qK4y9fb.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("../_chunks/tr-fBBDNMBY.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("../_chunks/zh-Hans-Btuz6Y7W.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("../_chunks/zh-CyCKPuL0.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
157
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/dk.json": () => Promise.resolve().then(() => require("../_chunks/dk-C9NcSzyg.js")), "./translations/en.json": () => Promise.resolve().then(() => require("../_chunks/en-BiKpmhCU.js")), "./translations/es.json": () => Promise.resolve().then(() => require("../_chunks/es-DE22V9D4.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("../_chunks/fr-Ca-HowfR.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("../_chunks/pl-DVnJGR87.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("../_chunks/ru-o4zaP02C.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("../_chunks/sv-9qK4y9fb.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("../_chunks/tr-fBBDNMBY.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("../_chunks/zh-Hans-Btuz6Y7W.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("../_chunks/zh-CyCKPuL0.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
153
158
  return {
154
159
  data: prefixPluginTranslations(data, pluginId),
155
160
  locale
@@ -166,4 +171,3 @@ const index = {
166
171
  }
167
172
  };
168
173
  module.exports = index;
169
- //# sourceMappingURL=index.js.map
@@ -1,14 +1,21 @@
1
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
1
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
2
2
  const v = glob[path];
3
3
  if (v) {
4
4
  return typeof v === "function" ? v() : Promise.resolve(v);
5
5
  }
6
6
  return new Promise((_, reject) => {
7
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
7
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
8
+ reject.bind(
9
+ null,
10
+ new Error(
11
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
12
+ )
13
+ )
14
+ );
8
15
  });
9
16
  };
10
17
  const name$1 = "@strapi/plugin-graphql";
11
- const version = "5.4.1";
18
+ const version = "5.5.0";
12
19
  const description = "Adds GraphQL endpoint with default API methods.";
13
20
  const repository = {
14
21
  type: "git",
@@ -61,9 +68,9 @@ const dependencies = {
61
68
  "@graphql-tools/schema": "10.0.3",
62
69
  "@graphql-tools/utils": "^10.1.3",
63
70
  "@koa/cors": "5.0.0",
64
- "@strapi/design-system": "2.0.0-rc.13",
65
- "@strapi/icons": "2.0.0-rc.13",
66
- "@strapi/utils": "5.4.1",
71
+ "@strapi/design-system": "2.0.0-rc.14",
72
+ "@strapi/icons": "2.0.0-rc.14",
73
+ "@strapi/utils": "workspace:*",
67
74
  graphql: "^16.8.1",
68
75
  "graphql-depth-limit": "^1.1.0",
69
76
  "graphql-playground-middleware-koa": "^1.6.21",
@@ -75,20 +82,20 @@ const dependencies = {
75
82
  pluralize: "8.0.0"
76
83
  };
77
84
  const devDependencies = {
78
- "@strapi/sdk-plugin": "^5.0.0",
79
- "@strapi/strapi": "5.4.1",
80
- "@strapi/types": "5.4.1",
85
+ "@strapi/sdk-plugin": "^5.2.0",
86
+ "@strapi/strapi": "workspace:*",
87
+ "@strapi/types": "workspace:*",
81
88
  "@types/graphql-depth-limit": "1.1.5",
82
89
  "@types/koa-bodyparser": "4.3.12",
83
90
  "@types/koa__cors": "5.0.0",
84
91
  "cross-env": "^7.0.3",
85
- "eslint-config-custom": "5.4.1",
92
+ "eslint-config-custom": "workspace:*",
86
93
  koa: "2.15.2",
87
94
  react: "18.3.1",
88
95
  "react-dom": "18.3.1",
89
96
  "react-router-dom": "6.22.3",
90
97
  "styled-components": "6.1.8",
91
- tsconfig: "5.4.1",
98
+ tsconfig: "workspace:*",
92
99
  typescript: "5.3.2"
93
100
  };
94
101
  const peerDependencies = {
@@ -108,7 +115,6 @@ const strapi = {
108
115
  description: "Adds GraphQL endpoint with default API methods.",
109
116
  kind: "plugin"
110
117
  };
111
- const gitHead = "7d785703f52464577d077c4618cbe68b44f8a9cd";
112
118
  const pluginPkg = {
113
119
  name: name$1,
114
120
  version,
@@ -124,8 +130,7 @@ const pluginPkg = {
124
130
  devDependencies,
125
131
  peerDependencies,
126
132
  engines,
127
- strapi,
128
- gitHead
133
+ strapi
129
134
  };
130
135
  const pluginId = "graphql";
131
136
  const prefixPluginTranslations = (trad, pluginId2) => {
@@ -148,7 +153,7 @@ const index = {
148
153
  async registerTrads({ locales }) {
149
154
  const importedTrads = await Promise.all(
150
155
  locales.map((locale) => {
151
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/dk.json": () => import("../_chunks/dk-BbJCmDw6.mjs"), "./translations/en.json": () => import("../_chunks/en-YIQYYlvv.mjs"), "./translations/es.json": () => import("../_chunks/es-BbsZ5Fh0.mjs"), "./translations/fr.json": () => import("../_chunks/fr-BgqFw7G8.mjs"), "./translations/pl.json": () => import("../_chunks/pl-CbET57Jb.mjs"), "./translations/ru.json": () => import("../_chunks/ru-BFz40YSA.mjs"), "./translations/sv.json": () => import("../_chunks/sv-CNYcKBn2.mjs"), "./translations/tr.json": () => import("../_chunks/tr-H1PrR6RM.mjs"), "./translations/zh-Hans.json": () => import("../_chunks/zh-Hans-CRQss50D.mjs"), "./translations/zh.json": () => import("../_chunks/zh-BEh3jejH.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
156
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/dk.json": () => import("../_chunks/dk-BbJCmDw6.mjs"), "./translations/en.json": () => import("../_chunks/en-YIQYYlvv.mjs"), "./translations/es.json": () => import("../_chunks/es-BbsZ5Fh0.mjs"), "./translations/fr.json": () => import("../_chunks/fr-BgqFw7G8.mjs"), "./translations/pl.json": () => import("../_chunks/pl-CbET57Jb.mjs"), "./translations/ru.json": () => import("../_chunks/ru-BFz40YSA.mjs"), "./translations/sv.json": () => import("../_chunks/sv-CNYcKBn2.mjs"), "./translations/tr.json": () => import("../_chunks/tr-H1PrR6RM.mjs"), "./translations/zh-Hans.json": () => import("../_chunks/zh-Hans-CRQss50D.mjs"), "./translations/zh.json": () => import("../_chunks/zh-BEh3jejH.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
152
157
  return {
153
158
  data: prefixPluginTranslations(data, pluginId),
154
159
  locale
@@ -167,4 +172,3 @@ const index = {
167
172
  export {
168
173
  index as default
169
174
  };
170
- //# sourceMappingURL=index.mjs.map
@@ -15,8 +15,7 @@ const pluralize = require("pluralize");
15
15
  const graphqlScalars = require("graphql-scalars");
16
16
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
17
17
  function _interopNamespace(e) {
18
- if (e && e.__esModule)
19
- return e;
18
+ if (e && e.__esModule) return e;
20
19
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
21
20
  if (e) {
22
21
  for (const k in e) {
@@ -159,6 +158,12 @@ async function bootstrap({ strapi: strapi2 }) {
159
158
  type: "content-api"
160
159
  }
161
160
  };
161
+ const isPlaygroundRequest = ctx.request.method === "GET" && ctx.request.url === path && // Matches the GraphQL endpoint
162
+ playgroundEnabled && // Only allow if the Playground is enabled
163
+ ctx.request.header.accept?.includes("text/html");
164
+ if (isPlaygroundRequest) {
165
+ return next();
166
+ }
162
167
  return strapi2.auth.authenticate(ctx, next);
163
168
  });
164
169
  handler.push(
@@ -2242,10 +2247,8 @@ const contentType = ({ strapi: strapi2 }) => {
2242
2247
  const { getFiltersInputTypeName } = utils2.naming;
2243
2248
  const { isMorphRelation } = utils2.attributes;
2244
2249
  const model = "target" in attribute && strapi2.getModel(attribute.target);
2245
- if (!model || isMorphRelation(attribute))
2246
- return;
2247
- if (extension.shadowCRUD(model.uid).isDisabled())
2248
- return;
2250
+ if (!model || isMorphRelation(attribute)) return;
2251
+ if (extension.shadowCRUD(model.uid).isDisabled()) return;
2249
2252
  builder.field(attributeName, { type: getFiltersInputTypeName(model) });
2250
2253
  };
2251
2254
  const addComponentAttribute = (builder, attributeName, attribute) => {
@@ -2253,10 +2256,8 @@ const contentType = ({ strapi: strapi2 }) => {
2253
2256
  const extension = strapi2.plugin("graphql").service("extension");
2254
2257
  const { getFiltersInputTypeName } = utils2.naming;
2255
2258
  const component = strapi2.getModel(attribute.component);
2256
- if (!component)
2257
- return;
2258
- if (extension.shadowCRUD(component.uid).isDisabled())
2259
- return;
2259
+ if (!component) return;
2260
+ if (extension.shadowCRUD(component.uid).isDisabled()) return;
2260
2261
  builder.field(attributeName, { type: getFiltersInputTypeName(component) });
2261
2262
  };
2262
2263
  const buildContentTypeFilters = (contentType2) => {
@@ -2780,8 +2781,7 @@ const utils = ({ strapi: strapi2 }) => {
2780
2781
  const { args: args2 } = getService("internals");
2781
2782
  const { modelType } = contentType2;
2782
2783
  if (modelType === "component") {
2783
- if (!multiple)
2784
- return {};
2784
+ if (!multiple) return {};
2785
2785
  return {
2786
2786
  filters: naming2.getFiltersInputTypeName(contentType2),
2787
2787
  pagination: args2.PaginationArg,
@@ -3111,4 +3111,3 @@ const index = {
3111
3111
  services
3112
3112
  };
3113
3113
  module.exports = index;
3114
- //# sourceMappingURL=index.js.map
@@ -136,6 +136,12 @@ async function bootstrap({ strapi: strapi2 }) {
136
136
  type: "content-api"
137
137
  }
138
138
  };
139
+ const isPlaygroundRequest = ctx.request.method === "GET" && ctx.request.url === path && // Matches the GraphQL endpoint
140
+ playgroundEnabled && // Only allow if the Playground is enabled
141
+ ctx.request.header.accept?.includes("text/html");
142
+ if (isPlaygroundRequest) {
143
+ return next();
144
+ }
139
145
  return strapi2.auth.authenticate(ctx, next);
140
146
  });
141
147
  handler.push(
@@ -2219,10 +2225,8 @@ const contentType = ({ strapi: strapi2 }) => {
2219
2225
  const { getFiltersInputTypeName } = utils2.naming;
2220
2226
  const { isMorphRelation } = utils2.attributes;
2221
2227
  const model = "target" in attribute && strapi2.getModel(attribute.target);
2222
- if (!model || isMorphRelation(attribute))
2223
- return;
2224
- if (extension.shadowCRUD(model.uid).isDisabled())
2225
- return;
2228
+ if (!model || isMorphRelation(attribute)) return;
2229
+ if (extension.shadowCRUD(model.uid).isDisabled()) return;
2226
2230
  builder.field(attributeName, { type: getFiltersInputTypeName(model) });
2227
2231
  };
2228
2232
  const addComponentAttribute = (builder, attributeName, attribute) => {
@@ -2230,10 +2234,8 @@ const contentType = ({ strapi: strapi2 }) => {
2230
2234
  const extension = strapi2.plugin("graphql").service("extension");
2231
2235
  const { getFiltersInputTypeName } = utils2.naming;
2232
2236
  const component = strapi2.getModel(attribute.component);
2233
- if (!component)
2234
- return;
2235
- if (extension.shadowCRUD(component.uid).isDisabled())
2236
- return;
2237
+ if (!component) return;
2238
+ if (extension.shadowCRUD(component.uid).isDisabled()) return;
2237
2239
  builder.field(attributeName, { type: getFiltersInputTypeName(component) });
2238
2240
  };
2239
2241
  const buildContentTypeFilters = (contentType2) => {
@@ -2757,8 +2759,7 @@ const utils = ({ strapi: strapi2 }) => {
2757
2759
  const { args: args2 } = getService("internals");
2758
2760
  const { modelType } = contentType2;
2759
2761
  if (modelType === "component") {
2760
- if (!multiple)
2761
- return {};
2762
+ if (!multiple) return {};
2762
2763
  return {
2763
2764
  filters: naming2.getFiltersInputTypeName(contentType2),
2764
2765
  pagination: args2.PaginationArg,
@@ -3090,4 +3091,3 @@ const index = {
3090
3091
  export {
3091
3092
  index as default
3092
3093
  };
3093
- //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAW1C,wBAAsB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,iBAkIlE"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAW1C,wBAAsB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,iBA6IlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "5.4.2",
3
+ "version": "5.5.1",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -53,9 +53,9 @@
53
53
  "@graphql-tools/schema": "10.0.3",
54
54
  "@graphql-tools/utils": "^10.1.3",
55
55
  "@koa/cors": "5.0.0",
56
- "@strapi/design-system": "2.0.0-rc.13",
57
- "@strapi/icons": "2.0.0-rc.13",
58
- "@strapi/utils": "5.4.2",
56
+ "@strapi/design-system": "2.0.0-rc.14",
57
+ "@strapi/icons": "2.0.0-rc.14",
58
+ "@strapi/utils": "5.5.1",
59
59
  "graphql": "^16.8.1",
60
60
  "graphql-depth-limit": "^1.1.0",
61
61
  "graphql-playground-middleware-koa": "^1.6.21",
@@ -67,20 +67,20 @@
67
67
  "pluralize": "8.0.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@strapi/sdk-plugin": "^5.0.0",
71
- "@strapi/strapi": "5.4.2",
72
- "@strapi/types": "5.4.2",
70
+ "@strapi/sdk-plugin": "^5.2.0",
71
+ "@strapi/strapi": "5.5.1",
72
+ "@strapi/types": "5.5.1",
73
73
  "@types/graphql-depth-limit": "1.1.5",
74
74
  "@types/koa-bodyparser": "4.3.12",
75
75
  "@types/koa__cors": "5.0.0",
76
76
  "cross-env": "^7.0.3",
77
- "eslint-config-custom": "5.4.2",
77
+ "eslint-config-custom": "5.5.1",
78
78
  "koa": "2.15.2",
79
79
  "react": "18.3.1",
80
80
  "react-dom": "18.3.1",
81
81
  "react-router-dom": "6.22.3",
82
82
  "styled-components": "6.1.8",
83
- "tsconfig": "5.4.2",
83
+ "tsconfig": "5.5.1",
84
84
  "typescript": "5.3.2"
85
85
  },
86
86
  "peerDependencies": {
@@ -99,6 +99,5 @@
99
99
  "name": "graphql",
100
100
  "description": "Adds GraphQL endpoint with default API methods.",
101
101
  "kind": "plugin"
102
- },
103
- "gitHead": "6b5242714b3612e0bd49ddc4f14205d6505eb5b9"
102
+ }
104
103
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"dk-BbJCmDw6.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dk-C9NcSzyg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"en-BiKpmhCU.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"en-YIQYYlvv.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"es-BbsZ5Fh0.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"es-DE22V9D4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fr-BgqFw7G8.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fr-Ca-HowfR.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pl-CbET57Jb.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pl-DVnJGR87.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ru-BFz40YSA.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ru-o4zaP02C.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sv-9qK4y9fb.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sv-CNYcKBn2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tr-H1PrR6RM.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tr-fBBDNMBY.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zh-BEh3jejH.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zh-CyCKPuL0.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zh-Hans-Btuz6Y7W.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zh-Hans-CRQss50D.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/pluginId.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/index.ts"],"sourcesContent":["export const pluginId = 'graphql';\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","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 // TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n register(app: any) {\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":["pluginId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,WAAW;ACExB,MAAM,2BAA2B,CAAC,MAAmBA,cAAkC;AAIrF,SAAO,OAAO,KAAK,IAAI,EAAE,OAA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ACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/index.ts"],"sourcesContent":["export const pluginId = 'graphql';\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","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 // TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n register(app: any) {\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":["pluginId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,WAAW;ACExB,MAAM,2BAA2B,CAAC,MAAmBA,cAAkC;AAIrF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