@strapi/core 5.48.1 → 5.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Strapi.js +9 -5
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs +0 -1
- package/dist/Strapi.mjs.map +1 -1
- package/dist/ai.d.ts +2 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +8 -0
- package/dist/ai.js.map +1 -0
- package/dist/ai.mjs +3 -0
- package/dist/ai.mjs.map +1 -0
- package/dist/configuration/config-loader.js +11 -6
- package/dist/configuration/config-loader.js.map +1 -1
- package/dist/configuration/index.js +22 -15
- package/dist/configuration/index.js.map +1 -1
- package/dist/configuration/urls.js +11 -7
- package/dist/configuration/urls.js.map +1 -1
- package/dist/core-api/routes/index.js +3 -2
- package/dist/core-api/routes/index.js.map +1 -1
- package/dist/core-api/routes/validation/common.js +3 -2
- package/dist/core-api/routes/validation/common.js.map +1 -1
- package/dist/core-api/routes/validation/content-type.js +3 -2
- package/dist/core-api/routes/validation/content-type.js.map +1 -1
- package/dist/core-api/routes/validation/mappers.js +3 -2
- package/dist/core-api/routes/validation/mappers.js.map +1 -1
- package/dist/core-api/routes/validation/utils.js +3 -2
- package/dist/core-api/routes/validation/utils.js.map +1 -1
- package/dist/domain/content-type/index.js +9 -5
- package/dist/domain/content-type/index.js.map +1 -1
- package/dist/domain/content-type/validator.js +6 -2
- package/dist/domain/content-type/validator.js.map +1 -1
- package/dist/domain/module/index.js +6 -2
- package/dist/domain/module/index.js.map +1 -1
- package/dist/ee/license.js +8 -3
- package/dist/ee/license.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/loaders/admin.js +5 -1
- package/dist/loaders/admin.js.map +1 -1
- package/dist/loaders/apis.js +16 -11
- package/dist/loaders/apis.js.map +1 -1
- package/dist/loaders/components.js +6 -2
- package/dist/loaders/components.js.map +1 -1
- package/dist/loaders/middlewares.js +6 -2
- package/dist/loaders/middlewares.js.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.js +5 -1
- package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
- package/dist/loaders/plugins/get-user-plugins-config.js +6 -2
- package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
- package/dist/loaders/plugins/index.js +8 -4
- package/dist/loaders/plugins/index.js.map +1 -1
- package/dist/loaders/policies.js +6 -2
- package/dist/loaders/policies.js.map +1 -1
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +12 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mcp.mjs +4 -0
- package/dist/mcp.mjs.map +1 -0
- package/dist/middlewares/body.js +8 -3
- package/dist/middlewares/body.js.map +1 -1
- package/dist/middlewares/compression.js +5 -1
- package/dist/middlewares/compression.js.map +1 -1
- package/dist/middlewares/cors.js +5 -1
- package/dist/middlewares/cors.js.map +1 -1
- package/dist/middlewares/favicon.js +5 -1
- package/dist/middlewares/favicon.js.map +1 -1
- package/dist/middlewares/ip.js +5 -1
- package/dist/middlewares/ip.js.map +1 -1
- package/dist/middlewares/public.js +5 -1
- package/dist/middlewares/public.js.map +1 -1
- package/dist/middlewares/query.js +6 -2
- package/dist/middlewares/query.js.map +1 -1
- package/dist/middlewares/security.js +5 -1
- package/dist/middlewares/security.js.map +1 -1
- package/dist/migrations/database/5.0.0-discard-drafts.js +5 -1
- package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
- package/dist/migrations/first-published-at.js +5 -1
- package/dist/migrations/first-published-at.js.map +1 -1
- package/dist/package.json.js +15 -15
- package/dist/package.json.mjs +15 -15
- package/dist/registries/sanitizers.js +7 -3
- package/dist/registries/sanitizers.js.map +1 -1
- package/dist/registries/validators.js +7 -3
- package/dist/registries/validators.js.map +1 -1
- package/dist/services/auth/index.js +7 -3
- package/dist/services/auth/index.js.map +1 -1
- package/dist/services/content-api/index.js +10 -6
- package/dist/services/content-api/index.js.map +1 -1
- package/dist/services/content-api/permissions/engine.js +5 -1
- package/dist/services/content-api/permissions/engine.js.map +1 -1
- package/dist/services/content-api/permissions/index.js +10 -6
- package/dist/services/content-api/permissions/index.js.map +1 -1
- package/dist/services/document-service/attributes/transforms.js +5 -1
- package/dist/services/document-service/attributes/transforms.js.map +1 -1
- package/dist/services/document-service/components.d.ts.map +1 -1
- package/dist/services/document-service/components.js +14 -10
- package/dist/services/document-service/components.js.map +1 -1
- package/dist/services/document-service/components.mjs.map +1 -1
- package/dist/services/document-service/draft-and-publish.js +1 -1
- package/dist/services/document-service/draft-and-publish.js.map +1 -1
- package/dist/services/document-service/draft-and-publish.mjs +1 -1
- package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
- package/dist/services/document-service/entries.d.ts.map +1 -1
- package/dist/services/document-service/entries.js +6 -2
- package/dist/services/document-service/entries.js.map +1 -1
- package/dist/services/document-service/entries.mjs +7 -3
- package/dist/services/document-service/entries.mjs.map +1 -1
- package/dist/services/document-service/internationalization.js.map +1 -1
- package/dist/services/document-service/internationalization.mjs.map +1 -1
- package/dist/services/document-service/transform/data.d.ts +2 -0
- package/dist/services/document-service/transform/data.d.ts.map +1 -1
- package/dist/services/document-service/transform/data.js +7 -1
- package/dist/services/document-service/transform/data.js.map +1 -1
- package/dist/services/document-service/transform/data.mjs +7 -2
- package/dist/services/document-service/transform/data.mjs.map +1 -1
- package/dist/services/document-service/utils/populate.d.ts +1 -1
- package/dist/services/document-service/utils/populate.d.ts.map +1 -1
- package/dist/services/document-service/utils/populate.js.map +1 -1
- package/dist/services/document-service/utils/populate.mjs.map +1 -1
- package/dist/services/entity-service/index.js +9 -4
- package/dist/services/entity-service/index.js.map +1 -1
- package/dist/services/entity-validator/index.d.ts.map +1 -1
- package/dist/services/entity-validator/index.js +9 -4
- package/dist/services/entity-validator/index.js.map +1 -1
- package/dist/services/entity-validator/index.mjs.map +1 -1
- package/dist/services/entity-validator/validators.js +10 -6
- package/dist/services/entity-validator/validators.js.map +1 -1
- package/dist/services/errors.js +7 -3
- package/dist/services/errors.js.map +1 -1
- package/dist/services/fs.js +10 -5
- package/dist/services/fs.js.map +1 -1
- package/dist/services/mcp/prompt-registry.d.ts +31 -3
- package/dist/services/mcp/prompt-registry.d.ts.map +1 -1
- package/dist/services/mcp/prompt-registry.js +31 -0
- package/dist/services/mcp/prompt-registry.js.map +1 -1
- package/dist/services/mcp/prompt-registry.mjs +31 -1
- package/dist/services/mcp/prompt-registry.mjs.map +1 -1
- package/dist/services/mcp/resource-registry.d.ts +31 -1
- package/dist/services/mcp/resource-registry.d.ts.map +1 -1
- package/dist/services/mcp/resource-registry.js +31 -0
- package/dist/services/mcp/resource-registry.js.map +1 -1
- package/dist/services/mcp/resource-registry.mjs +31 -1
- package/dist/services/mcp/resource-registry.mjs.map +1 -1
- package/dist/services/mcp/tool-registry.d.ts +36 -9
- package/dist/services/mcp/tool-registry.d.ts.map +1 -1
- package/dist/services/mcp/tool-registry.js +35 -3
- package/dist/services/mcp/tool-registry.js.map +1 -1
- package/dist/services/mcp/tool-registry.mjs +35 -3
- package/dist/services/mcp/tool-registry.mjs.map +1 -1
- package/dist/services/mcp/tools/log.d.ts +15 -85
- package/dist/services/mcp/tools/log.d.ts.map +1 -1
- package/dist/services/metrics/admin-user-hash.js +5 -1
- package/dist/services/metrics/admin-user-hash.js.map +1 -1
- package/dist/services/metrics/is-truthy.js +5 -1
- package/dist/services/metrics/is-truthy.js.map +1 -1
- package/dist/services/metrics/sender.js +17 -9
- package/dist/services/metrics/sender.js.map +1 -1
- package/dist/services/server/api.js +5 -1
- package/dist/services/server/api.js.map +1 -1
- package/dist/services/server/compose-endpoint.js +5 -1
- package/dist/services/server/compose-endpoint.js.map +1 -1
- package/dist/services/server/http-server.js +5 -1
- package/dist/services/server/http-server.js.map +1 -1
- package/dist/services/server/index.js +5 -1
- package/dist/services/server/index.js.map +1 -1
- package/dist/services/server/koa.js +12 -5
- package/dist/services/server/koa.js.map +1 -1
- package/dist/services/server/middleware.js +5 -1
- package/dist/services/server/middleware.js.map +1 -1
- package/dist/services/server/openapi.js +11 -6
- package/dist/services/server/openapi.js.map +1 -1
- package/dist/services/server/register-routes.js +8 -4
- package/dist/services/server/register-routes.js.map +1 -1
- package/dist/services/server/routing.js +5 -1
- package/dist/services/server/routing.js.map +1 -1
- package/dist/services/session-manager.js +14 -9
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/webhook-runner.js +7 -2
- package/dist/services/webhook-runner.js.map +1 -1
- package/dist/services/worker-queue.js +5 -1
- package/dist/services/worker-queue.js.map +1 -1
- package/dist/utils/filepath-to-prop-path.js +13 -8
- package/dist/utils/filepath-to-prop-path.js.map +1 -1
- package/dist/utils/load-config-file.js +7 -2
- package/dist/utils/load-config-file.js.map +1 -1
- package/dist/utils/load-files.js +12 -6
- package/dist/utils/load-files.js.map +1 -1
- package/dist/utils/open-browser.js +5 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/resolve-working-dirs.js +6 -2
- package/dist/utils/resolve-working-dirs.js.map +1 -1
- package/dist/utils/startup-logger.js +27 -21
- package/dist/utils/startup-logger.js.map +1 -1
- package/dist/utils/transform-content-types-to-models.js +10 -5
- package/dist/utils/transform-content-types-to-models.js.map +1 -1
- package/dist/utils/update-notifier/index.d.ts.map +1 -1
- package/dist/utils/update-notifier/index.js +21 -8
- package/dist/utils/update-notifier/index.js.map +1 -1
- package/dist/utils/update-notifier/index.mjs +6 -1
- package/dist/utils/update-notifier/index.mjs.map +1 -1
- package/package.json +15 -15
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
var strapiUtils = require('@strapi/utils');
|
|
4
4
|
var _ = require('lodash');
|
|
5
5
|
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
9
|
+
|
|
6
10
|
const enableFirstPublishedAt = async ({ oldContentTypes, contentTypes })=>{
|
|
7
11
|
if (!oldContentTypes) {
|
|
8
12
|
return;
|
|
@@ -22,7 +26,7 @@ const enableFirstPublishedAt = async ({ oldContentTypes, contentTypes })=>{
|
|
|
22
26
|
const content = await strapi.db.queryBuilder(uid).select('*').transacting(trx).execute();
|
|
23
27
|
// Process content types in pairs: draft and published.
|
|
24
28
|
// If only one exist, which means the value is not published yet and we can ignore it
|
|
25
|
-
const groupedContent =
|
|
29
|
+
const groupedContent = ___default.default.groupBy(content, (item)=>`${item.documentId}-${item.locale}`);
|
|
26
30
|
for (const items of Object.values(groupedContent)){
|
|
27
31
|
// If there is only one item, which means nothing is published yet for this locale
|
|
28
32
|
if (items.length <= 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-published-at.js","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":"
|
|
1
|
+
{"version":3,"file":"first-published-at.js","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;;;;;;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAAA,EAAiB;AACpB,QAAA;AACF,IAAA;AAEA,IAAA,OAAOE,MAAAA,CAAOC,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,YAAAA,CAAc;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF,YAAA;YAEA,MAAMC,WAAAA,GAAcN,YAAY,CAACK,GAAAA,CAAI;AAErC,YAAA,IAAI,CAACE,wBAAAA,CAAkBC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;AAC5D,gBAAA;AACF,YAAA;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAAA,EAAkB;AAC7C,gBAAA;AACF,YAAA;AAEA,YAAA,MAAMC,OAAAA,GAA6B,MAAMV,MAAAA,CAAOC,EAAE,CAC/CU,YAAY,CAACP,GAAAA,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
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "@strapi/core";
|
|
6
|
-
var version = "5.
|
|
6
|
+
var version = "5.49.0";
|
|
7
7
|
var description = "Core of Strapi";
|
|
8
8
|
var homepage = "https://strapi.io";
|
|
9
9
|
var bugs = {
|
|
@@ -64,15 +64,15 @@ var dependencies = {
|
|
|
64
64
|
"@koa/router": "12.0.2",
|
|
65
65
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
66
66
|
"@paralleldrive/cuid2": "2.2.2",
|
|
67
|
-
"@strapi/admin": "5.
|
|
68
|
-
"@strapi/database": "5.
|
|
69
|
-
"@strapi/generators": "5.
|
|
70
|
-
"@strapi/logger": "5.
|
|
71
|
-
"@strapi/openapi": "5.
|
|
72
|
-
"@strapi/permissions": "5.
|
|
73
|
-
"@strapi/types": "5.
|
|
74
|
-
"@strapi/typescript-utils": "5.
|
|
75
|
-
"@strapi/utils": "5.
|
|
67
|
+
"@strapi/admin": "5.49.0",
|
|
68
|
+
"@strapi/database": "5.49.0",
|
|
69
|
+
"@strapi/generators": "5.49.0",
|
|
70
|
+
"@strapi/logger": "5.49.0",
|
|
71
|
+
"@strapi/openapi": "5.49.0",
|
|
72
|
+
"@strapi/permissions": "5.49.0",
|
|
73
|
+
"@strapi/types": "5.49.0",
|
|
74
|
+
"@strapi/typescript-utils": "5.49.0",
|
|
75
|
+
"@strapi/utils": "5.49.0",
|
|
76
76
|
"@vercel/stega": "0.1.2",
|
|
77
77
|
bcryptjs: "2.4.3",
|
|
78
78
|
boxen: "5.1.2",
|
|
@@ -108,14 +108,14 @@ var dependencies = {
|
|
|
108
108
|
"node-schedule": "2.1.1",
|
|
109
109
|
open: "8.4.2",
|
|
110
110
|
ora: "5.4.1",
|
|
111
|
-
"package-json": "
|
|
111
|
+
"package-json": "10.0.1",
|
|
112
112
|
"pkg-up": "3.1.0",
|
|
113
113
|
qs: "6.15.2",
|
|
114
114
|
"resolve.exports": "2.0.2",
|
|
115
115
|
semver: "7.7.4",
|
|
116
116
|
statuses: "2.0.1",
|
|
117
117
|
typescript: "5.4.5",
|
|
118
|
-
undici: "6.
|
|
118
|
+
undici: "6.27.0",
|
|
119
119
|
yup: "0.32.9",
|
|
120
120
|
zod: "3.25.67"
|
|
121
121
|
};
|
|
@@ -139,11 +139,11 @@ var devDependencies = {
|
|
|
139
139
|
"@types/node": "24.10.0",
|
|
140
140
|
"@types/node-schedule": "2.1.7",
|
|
141
141
|
"@types/statuses": "2.0.1",
|
|
142
|
-
"eslint-config-custom": "5.
|
|
142
|
+
"eslint-config-custom": "5.49.0",
|
|
143
143
|
supertest: "7.2.2",
|
|
144
|
-
tsconfig: "5.
|
|
144
|
+
tsconfig: "5.49.0",
|
|
145
145
|
vitest: "catalog:",
|
|
146
|
-
"vitest-config": "5.
|
|
146
|
+
"vitest-config": "5.49.0"
|
|
147
147
|
};
|
|
148
148
|
var engines = {
|
|
149
149
|
node: ">=20.0.0 <=26.x.x",
|
package/dist/package.json.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var name = "@strapi/core";
|
|
2
|
-
var version = "5.
|
|
2
|
+
var version = "5.49.0";
|
|
3
3
|
var description = "Core of Strapi";
|
|
4
4
|
var homepage = "https://strapi.io";
|
|
5
5
|
var bugs = {
|
|
@@ -60,15 +60,15 @@ var dependencies = {
|
|
|
60
60
|
"@koa/router": "12.0.2",
|
|
61
61
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
62
62
|
"@paralleldrive/cuid2": "2.2.2",
|
|
63
|
-
"@strapi/admin": "5.
|
|
64
|
-
"@strapi/database": "5.
|
|
65
|
-
"@strapi/generators": "5.
|
|
66
|
-
"@strapi/logger": "5.
|
|
67
|
-
"@strapi/openapi": "5.
|
|
68
|
-
"@strapi/permissions": "5.
|
|
69
|
-
"@strapi/types": "5.
|
|
70
|
-
"@strapi/typescript-utils": "5.
|
|
71
|
-
"@strapi/utils": "5.
|
|
63
|
+
"@strapi/admin": "5.49.0",
|
|
64
|
+
"@strapi/database": "5.49.0",
|
|
65
|
+
"@strapi/generators": "5.49.0",
|
|
66
|
+
"@strapi/logger": "5.49.0",
|
|
67
|
+
"@strapi/openapi": "5.49.0",
|
|
68
|
+
"@strapi/permissions": "5.49.0",
|
|
69
|
+
"@strapi/types": "5.49.0",
|
|
70
|
+
"@strapi/typescript-utils": "5.49.0",
|
|
71
|
+
"@strapi/utils": "5.49.0",
|
|
72
72
|
"@vercel/stega": "0.1.2",
|
|
73
73
|
bcryptjs: "2.4.3",
|
|
74
74
|
boxen: "5.1.2",
|
|
@@ -104,14 +104,14 @@ var dependencies = {
|
|
|
104
104
|
"node-schedule": "2.1.1",
|
|
105
105
|
open: "8.4.2",
|
|
106
106
|
ora: "5.4.1",
|
|
107
|
-
"package-json": "
|
|
107
|
+
"package-json": "10.0.1",
|
|
108
108
|
"pkg-up": "3.1.0",
|
|
109
109
|
qs: "6.15.2",
|
|
110
110
|
"resolve.exports": "2.0.2",
|
|
111
111
|
semver: "7.7.4",
|
|
112
112
|
statuses: "2.0.1",
|
|
113
113
|
typescript: "5.4.5",
|
|
114
|
-
undici: "6.
|
|
114
|
+
undici: "6.27.0",
|
|
115
115
|
yup: "0.32.9",
|
|
116
116
|
zod: "3.25.67"
|
|
117
117
|
};
|
|
@@ -135,11 +135,11 @@ var devDependencies = {
|
|
|
135
135
|
"@types/node": "24.10.0",
|
|
136
136
|
"@types/node-schedule": "2.1.7",
|
|
137
137
|
"@types/statuses": "2.0.1",
|
|
138
|
-
"eslint-config-custom": "5.
|
|
138
|
+
"eslint-config-custom": "5.49.0",
|
|
139
139
|
supertest: "7.2.2",
|
|
140
|
-
tsconfig: "5.
|
|
140
|
+
tsconfig: "5.49.0",
|
|
141
141
|
vitest: "catalog:",
|
|
142
|
-
"vitest-config": "5.
|
|
142
|
+
"vitest-config": "5.49.0"
|
|
143
143
|
};
|
|
144
144
|
var engines = {
|
|
145
145
|
node: ">=20.0.0 <=26.x.x",
|
|
@@ -2,22 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
4
|
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
8
|
+
|
|
5
9
|
const sanitizersRegistry = ()=>{
|
|
6
10
|
const sanitizers = {};
|
|
7
11
|
return {
|
|
8
12
|
get (path) {
|
|
9
|
-
return
|
|
13
|
+
return ___default.default.get(sanitizers, path, []);
|
|
10
14
|
},
|
|
11
15
|
add (path, sanitizer) {
|
|
12
16
|
this.get(path).push(sanitizer);
|
|
13
17
|
return this;
|
|
14
18
|
},
|
|
15
19
|
set (path, value = []) {
|
|
16
|
-
|
|
20
|
+
___default.default.set(sanitizers, path, value);
|
|
17
21
|
return this;
|
|
18
22
|
},
|
|
19
23
|
has (path) {
|
|
20
|
-
return
|
|
24
|
+
return ___default.default.has(sanitizers, path);
|
|
21
25
|
}
|
|
22
26
|
};
|
|
23
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizers.js","sources":["../../src/registries/sanitizers.ts"],"sourcesContent":["import _, { PropertyName } from 'lodash';\n\ntype Sanitizer = (value: unknown) => unknown;\n\nconst sanitizersRegistry = () => {\n const sanitizers: Record<string, Sanitizer[]> = {};\n\n return {\n get(path: PropertyName): Sanitizer[] {\n return _.get(sanitizers, path, []);\n },\n\n add(path: PropertyName, sanitizer: Sanitizer) {\n this.get(path).push(sanitizer);\n return this;\n },\n\n set(path: PropertyName, value = []) {\n _.set(sanitizers, path, value);\n return this;\n },\n\n has(path: PropertyName) {\n return _.has(sanitizers, path);\n },\n };\n};\n\nexport default sanitizersRegistry;\n"],"names":["sanitizersRegistry","sanitizers","get","path","_","add","sanitizer","push","set","value","has"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitizers.js","sources":["../../src/registries/sanitizers.ts"],"sourcesContent":["import _, { PropertyName } from 'lodash';\n\ntype Sanitizer = (value: unknown) => unknown;\n\nconst sanitizersRegistry = () => {\n const sanitizers: Record<string, Sanitizer[]> = {};\n\n return {\n get(path: PropertyName): Sanitizer[] {\n return _.get(sanitizers, path, []);\n },\n\n add(path: PropertyName, sanitizer: Sanitizer) {\n this.get(path).push(sanitizer);\n return this;\n },\n\n set(path: PropertyName, value = []) {\n _.set(sanitizers, path, value);\n return this;\n },\n\n has(path: PropertyName) {\n return _.has(sanitizers, path);\n },\n };\n};\n\nexport default sanitizersRegistry;\n"],"names":["sanitizersRegistry","sanitizers","get","path","_","add","sanitizer","push","set","value","has"],"mappings":";;;;;;;;AAIA,MAAMA,kBAAAA,GAAqB,IAAA;AACzB,IAAA,MAAMC,aAA0C,EAAC;IAEjD,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAkB,EAAA;AACpB,YAAA,OAAOC,kBAAAA,CAAEF,GAAG,CAACD,UAAAA,EAAYE,MAAM,EAAE,CAAA;AACnC,QAAA,CAAA;QAEAE,GAAAA,CAAAA,CAAIF,IAAkB,EAAEG,SAAoB,EAAA;AAC1C,YAAA,IAAI,CAACJ,GAAG,CAACC,IAAAA,CAAAA,CAAMI,IAAI,CAACD,SAAAA,CAAAA;AACpB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;QAEAE,GAAAA,CAAAA,CAAIL,IAAkB,EAAEM,KAAAA,GAAQ,EAAE,EAAA;YAChCL,kBAAAA,CAAEI,GAAG,CAACP,UAAAA,EAAYE,IAAAA,EAAMM,KAAAA,CAAAA;AACxB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEAC,QAAAA,GAAAA,CAAAA,CAAIP,IAAkB,EAAA;YACpB,OAAOC,kBAAAA,CAAEM,GAAG,CAACT,UAAAA,EAAYE,IAAAA,CAAAA;AAC3B,QAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -2,22 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
4
|
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
8
|
+
|
|
5
9
|
const validatorsRegistry = ()=>{
|
|
6
10
|
const validators = {};
|
|
7
11
|
return {
|
|
8
12
|
get (path) {
|
|
9
|
-
return
|
|
13
|
+
return ___default.default.get(validators, path, []);
|
|
10
14
|
},
|
|
11
15
|
add (path, validator) {
|
|
12
16
|
this.get(path).push(validator);
|
|
13
17
|
return this;
|
|
14
18
|
},
|
|
15
19
|
set (path, value = []) {
|
|
16
|
-
|
|
20
|
+
___default.default.set(validators, path, value);
|
|
17
21
|
return this;
|
|
18
22
|
},
|
|
19
23
|
has (path) {
|
|
20
|
-
return
|
|
24
|
+
return ___default.default.has(validators, path);
|
|
21
25
|
}
|
|
22
26
|
};
|
|
23
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sources":["../../src/registries/validators.ts"],"sourcesContent":["import _, { PropertyName } from 'lodash';\n\ntype Validator = unknown;\n\nconst validatorsRegistry = () => {\n const validators: Record<string, Validator[]> = {};\n\n return {\n get(path: PropertyName): Validator[] {\n return _.get(validators, path, []);\n },\n\n add(path: PropertyName, validator: Validator) {\n this.get(path).push(validator);\n return this;\n },\n\n set(path: PropertyName, value = []) {\n _.set(validators, path, value);\n return this;\n },\n\n has(path: PropertyName) {\n return _.has(validators, path);\n },\n };\n};\n\nexport default validatorsRegistry;\n"],"names":["validatorsRegistry","validators","get","path","_","add","validator","push","set","value","has"],"mappings":"
|
|
1
|
+
{"version":3,"file":"validators.js","sources":["../../src/registries/validators.ts"],"sourcesContent":["import _, { PropertyName } from 'lodash';\n\ntype Validator = unknown;\n\nconst validatorsRegistry = () => {\n const validators: Record<string, Validator[]> = {};\n\n return {\n get(path: PropertyName): Validator[] {\n return _.get(validators, path, []);\n },\n\n add(path: PropertyName, validator: Validator) {\n this.get(path).push(validator);\n return this;\n },\n\n set(path: PropertyName, value = []) {\n _.set(validators, path, value);\n return this;\n },\n\n has(path: PropertyName) {\n return _.has(validators, path);\n },\n };\n};\n\nexport default validatorsRegistry;\n"],"names":["validatorsRegistry","validators","get","path","_","add","validator","push","set","value","has"],"mappings":";;;;;;;;AAIA,MAAMA,kBAAAA,GAAqB,IAAA;AACzB,IAAA,MAAMC,aAA0C,EAAC;IAEjD,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAkB,EAAA;AACpB,YAAA,OAAOC,kBAAAA,CAAEF,GAAG,CAACD,UAAAA,EAAYE,MAAM,EAAE,CAAA;AACnC,QAAA,CAAA;QAEAE,GAAAA,CAAAA,CAAIF,IAAkB,EAAEG,SAAoB,EAAA;AAC1C,YAAA,IAAI,CAACJ,GAAG,CAACC,IAAAA,CAAAA,CAAMI,IAAI,CAACD,SAAAA,CAAAA;AACpB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;QAEAE,GAAAA,CAAAA,CAAIL,IAAkB,EAAEM,KAAAA,GAAQ,EAAE,EAAA;YAChCL,kBAAAA,CAAEI,GAAG,CAACP,UAAAA,EAAYE,IAAAA,EAAMM,KAAAA,CAAAA;AACxB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEAC,QAAAA,GAAAA,CAAAA,CAAIP,IAAkB,EAAA;YACpB,OAAOC,kBAAAA,CAAEM,GAAG,CAACT,UAAAA,EAAYE,IAAAA,CAAAA;AAC3B,QAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -4,12 +4,16 @@ var assert = require('assert/strict');
|
|
|
4
4
|
var fp = require('lodash/fp');
|
|
5
5
|
var strapiUtils = require('@strapi/utils');
|
|
6
6
|
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var assert__default = /*#__PURE__*/_interopDefault(assert);
|
|
10
|
+
|
|
7
11
|
const INVALID_STRATEGY_MSG = 'Invalid auth strategy. Expecting an object with properties {name: string, authenticate: function, verify: function}';
|
|
8
12
|
const validStrategy = (strategy)=>{
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
assert__default.default(fp.has('authenticate', strategy), INVALID_STRATEGY_MSG);
|
|
14
|
+
assert__default.default(typeof strategy.authenticate === 'function', INVALID_STRATEGY_MSG);
|
|
11
15
|
if (fp.has('verify', strategy)) {
|
|
12
|
-
|
|
16
|
+
assert__default.default(typeof strategy.verify === 'function', INVALID_STRATEGY_MSG);
|
|
13
17
|
}
|
|
14
18
|
};
|
|
15
19
|
const createAuthentication = ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/services/auth/index.ts"],"sourcesContent":["import assert from 'assert/strict';\nimport { has } from 'lodash/fp';\n\nimport { errors } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport type { ParameterizedContext } from 'koa';\n\ninterface AuthenticationResponse {\n authenticated?: boolean;\n credentials?: unknown;\n ability?: unknown;\n error?: Error | null;\n}\n\ninterface AuthenticationInfo {\n strategy: Strategy;\n credentials: unknown;\n ability: unknown;\n}\n\ninterface Strategy {\n name: string;\n authenticate: (ctx: ParameterizedContext) => Promise<AuthenticationResponse>;\n verify?: (auth: AuthenticationInfo, config: Core.RouteConfig['auth']) => Promise<any>;\n}\n\ninterface Authentication {\n register: (type: string, strategy: Strategy) => Authentication;\n authenticate: Core.MiddlewareHandler;\n verify: (auth: AuthenticationInfo, config?: Core.RouteConfig['auth']) => Promise<any>;\n}\n\nconst INVALID_STRATEGY_MSG =\n 'Invalid auth strategy. Expecting an object with properties {name: string, authenticate: function, verify: function}';\n\nconst validStrategy = (strategy: Strategy) => {\n assert(has('authenticate', strategy), INVALID_STRATEGY_MSG);\n assert(typeof strategy.authenticate === 'function', INVALID_STRATEGY_MSG);\n\n if (has('verify', strategy)) {\n assert(typeof strategy.verify === 'function', INVALID_STRATEGY_MSG);\n }\n};\n\nconst createAuthentication = (): Authentication => {\n const strategies: Record<string, Strategy[]> = {};\n\n return {\n register(type, strategy) {\n validStrategy(strategy);\n\n if (!strategies[type]) {\n strategies[type] = [];\n }\n\n strategies[type].push(strategy);\n\n return this;\n },\n\n async authenticate(ctx, next) {\n const route: Core.Route = ctx.state.route;\n\n // use route strategy\n const config = route?.config?.auth;\n\n if (config === false) {\n return next();\n }\n\n const routeStrategies = route.info.type ? strategies[route.info.type] : [];\n const configStrategies = (config?.strategies ?? routeStrategies ?? []) as Array<\n string | Strategy\n >;\n\n const strategiesToUse: Strategy[] = configStrategies.reduce(\n (acc, strategy: string | Strategy) => {\n // Resolve by strategy name\n if (typeof strategy === 'string') {\n const routeStrategy = routeStrategies.find((rs) => rs.name === strategy);\n\n if (routeStrategy) {\n acc.push(routeStrategy);\n }\n }\n\n // Use the given strategy as is\n else if (typeof strategy === 'object') {\n validStrategy(strategy);\n\n acc.push(strategy);\n }\n\n return acc;\n },\n [] as Strategy[]\n );\n\n for (const strategy of strategiesToUse) {\n const result = await strategy.authenticate(ctx);\n\n const { authenticated = false, credentials, ability = null, error = null } = result || {};\n\n if (error !== null) {\n return ctx.unauthorized(error);\n }\n\n if (authenticated) {\n ctx.state.isAuthenticated = true;\n ctx.state.auth = {\n strategy,\n credentials,\n ability,\n };\n\n return next();\n }\n }\n\n return ctx.unauthorized('Missing or invalid credentials');\n },\n\n async verify(auth, config = {}) {\n if (config === false) {\n return;\n }\n\n if (!auth) {\n throw new errors.UnauthorizedError();\n }\n\n if (typeof auth.strategy.verify === 'function') {\n return auth.strategy.verify(auth, config);\n }\n },\n };\n};\n\nexport default createAuthentication;\n"],"names":["INVALID_STRATEGY_MSG","validStrategy","strategy","assert","has","authenticate","verify","createAuthentication","strategies","register","type","push","ctx","next","route","state","config","auth","routeStrategies","info","configStrategies","strategiesToUse","reduce","acc","routeStrategy","find","rs","name","result","authenticated","credentials","ability","error","unauthorized","isAuthenticated","errors","UnauthorizedError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/services/auth/index.ts"],"sourcesContent":["import assert from 'assert/strict';\nimport { has } from 'lodash/fp';\n\nimport { errors } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport type { ParameterizedContext } from 'koa';\n\ninterface AuthenticationResponse {\n authenticated?: boolean;\n credentials?: unknown;\n ability?: unknown;\n error?: Error | null;\n}\n\ninterface AuthenticationInfo {\n strategy: Strategy;\n credentials: unknown;\n ability: unknown;\n}\n\ninterface Strategy {\n name: string;\n authenticate: (ctx: ParameterizedContext) => Promise<AuthenticationResponse>;\n verify?: (auth: AuthenticationInfo, config: Core.RouteConfig['auth']) => Promise<any>;\n}\n\ninterface Authentication {\n register: (type: string, strategy: Strategy) => Authentication;\n authenticate: Core.MiddlewareHandler;\n verify: (auth: AuthenticationInfo, config?: Core.RouteConfig['auth']) => Promise<any>;\n}\n\nconst INVALID_STRATEGY_MSG =\n 'Invalid auth strategy. Expecting an object with properties {name: string, authenticate: function, verify: function}';\n\nconst validStrategy = (strategy: Strategy) => {\n assert(has('authenticate', strategy), INVALID_STRATEGY_MSG);\n assert(typeof strategy.authenticate === 'function', INVALID_STRATEGY_MSG);\n\n if (has('verify', strategy)) {\n assert(typeof strategy.verify === 'function', INVALID_STRATEGY_MSG);\n }\n};\n\nconst createAuthentication = (): Authentication => {\n const strategies: Record<string, Strategy[]> = {};\n\n return {\n register(type, strategy) {\n validStrategy(strategy);\n\n if (!strategies[type]) {\n strategies[type] = [];\n }\n\n strategies[type].push(strategy);\n\n return this;\n },\n\n async authenticate(ctx, next) {\n const route: Core.Route = ctx.state.route;\n\n // use route strategy\n const config = route?.config?.auth;\n\n if (config === false) {\n return next();\n }\n\n const routeStrategies = route.info.type ? strategies[route.info.type] : [];\n const configStrategies = (config?.strategies ?? routeStrategies ?? []) as Array<\n string | Strategy\n >;\n\n const strategiesToUse: Strategy[] = configStrategies.reduce(\n (acc, strategy: string | Strategy) => {\n // Resolve by strategy name\n if (typeof strategy === 'string') {\n const routeStrategy = routeStrategies.find((rs) => rs.name === strategy);\n\n if (routeStrategy) {\n acc.push(routeStrategy);\n }\n }\n\n // Use the given strategy as is\n else if (typeof strategy === 'object') {\n validStrategy(strategy);\n\n acc.push(strategy);\n }\n\n return acc;\n },\n [] as Strategy[]\n );\n\n for (const strategy of strategiesToUse) {\n const result = await strategy.authenticate(ctx);\n\n const { authenticated = false, credentials, ability = null, error = null } = result || {};\n\n if (error !== null) {\n return ctx.unauthorized(error);\n }\n\n if (authenticated) {\n ctx.state.isAuthenticated = true;\n ctx.state.auth = {\n strategy,\n credentials,\n ability,\n };\n\n return next();\n }\n }\n\n return ctx.unauthorized('Missing or invalid credentials');\n },\n\n async verify(auth, config = {}) {\n if (config === false) {\n return;\n }\n\n if (!auth) {\n throw new errors.UnauthorizedError();\n }\n\n if (typeof auth.strategy.verify === 'function') {\n return auth.strategy.verify(auth, config);\n }\n },\n };\n};\n\nexport default createAuthentication;\n"],"names":["INVALID_STRATEGY_MSG","validStrategy","strategy","assert","has","authenticate","verify","createAuthentication","strategies","register","type","push","ctx","next","route","state","config","auth","routeStrategies","info","configStrategies","strategiesToUse","reduce","acc","routeStrategy","find","rs","name","result","authenticated","credentials","ability","error","unauthorized","isAuthenticated","errors","UnauthorizedError"],"mappings":";;;;;;;;;;AAgCA,MAAMA,oBAAAA,GACJ,qHAAA;AAEF,MAAMC,gBAAgB,CAACC,QAAAA,GAAAA;IACrBC,uBAAAA,CAAOC,MAAAA,CAAI,gBAAgBF,QAAAA,CAAAA,EAAWF,oBAAAA,CAAAA;AACtCG,IAAAA,uBAAAA,CAAO,OAAOD,QAAAA,CAASG,YAAY,KAAK,UAAA,EAAYL,oBAAAA,CAAAA;IAEpD,IAAII,MAAAA,CAAI,UAAUF,QAAAA,CAAAA,EAAW;AAC3BC,QAAAA,uBAAAA,CAAO,OAAOD,QAAAA,CAASI,MAAM,KAAK,UAAA,EAAYN,oBAAAA,CAAAA;AAChD,IAAA;AACF,CAAA;AAEA,MAAMO,oBAAAA,GAAuB,I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AAY;AAC9C,gBAAA,OAAOW,IAAAA,CAAKf,QAAQ,CAACI,MAAM,CAACW,IAAAA,EAAMD,MAAAA,CAAAA;AACpC,YAAA;AACF,QAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -5,7 +5,10 @@ var strapiUtils = require('@strapi/utils');
|
|
|
5
5
|
var z = require('zod/v4');
|
|
6
6
|
var index = require('./permissions/index.js');
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
9
12
|
var n = Object.create(null);
|
|
10
13
|
if (e) {
|
|
11
14
|
Object.keys(e).forEach(function (k) {
|
|
@@ -22,7 +25,8 @@ function _interopNamespaceDefault(e) {
|
|
|
22
25
|
return Object.freeze(n);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
var
|
|
28
|
+
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
29
|
+
var z__namespace = /*#__PURE__*/_interopNamespace(z);
|
|
26
30
|
|
|
27
31
|
const transformRoutePrefixFor = (pluginName)=>(route)=>{
|
|
28
32
|
const prefix = route.config && route.config.prefix;
|
|
@@ -179,8 +183,8 @@ const mergeOneInputParamIntoRoute = (route, param, schema, matchRoute)=>{
|
|
|
179
183
|
};
|
|
180
184
|
const getRoutesMap = async ()=>{
|
|
181
185
|
const routesMap = {};
|
|
182
|
-
|
|
183
|
-
const routes =
|
|
186
|
+
___default.default.forEach(strapi.apis, (api, apiName)=>{
|
|
187
|
+
const routes = ___default.default.flatMap(api.routes, (route)=>{
|
|
184
188
|
if ('routes' in route) {
|
|
185
189
|
return route.routes;
|
|
186
190
|
}
|
|
@@ -195,12 +199,12 @@ const mergeOneInputParamIntoRoute = (route, param, schema, matchRoute)=>{
|
|
|
195
199
|
path: `${apiPrefix}${route.path}`
|
|
196
200
|
}));
|
|
197
201
|
});
|
|
198
|
-
|
|
202
|
+
___default.default.forEach(strapi.plugins, (plugin, pluginName)=>{
|
|
199
203
|
const transformPrefix = transformRoutePrefixFor(pluginName);
|
|
200
204
|
if (Array.isArray(plugin.routes)) {
|
|
201
205
|
return plugin.routes.map(transformPrefix).filter(filterContentAPI);
|
|
202
206
|
}
|
|
203
|
-
const routes =
|
|
207
|
+
const routes = ___default.default.flatMap(plugin.routes, (route)=>route.routes.map(transformPrefix)).filter(filterContentAPI);
|
|
204
208
|
if (routes.length === 0) {
|
|
205
209
|
return;
|
|
206
210
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport {\n sanitize,\n validate,\n sanitizeRoutesMapForSerialization,\n ALLOWED_QUERY_PARAM_KEYS,\n RESERVED_INPUT_PARAM_KEYS,\n} from '@strapi/utils';\nimport * as z from 'zod/v4';\n\nimport type { Core, Modules, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Runtime check for addQueryParams: we only allow scalar or array-of-scalar schemas (no nested objects).\n * We keep this in addition to the ZodQueryParamSchema type because: (1) TypeScript can be bypassed (JS,\n * any, or schema from another Zod instance); (2) it gives a clear, immediate error at registration\n * time instead of a later failure in validate/sanitize. This list is intentionally tied to Zod v4\n * constructor names; if Zod changes internals, this may need updating.\n * Compatibility: Zod 3 and Zod 4 Classic (zod/v4) both use these constructor names and\n * expose ._def with .innerType / .element for Optional/Default/Array. Zod 4 Core/Mini use\n * ._zod.def instead; we only accept schemas from the same zod/v4 instance used here.\n */\nconst ALLOWED_QUERY_SCHEMA_NAMES = new Set([\n 'ZodString',\n 'ZodNumber',\n 'ZodBoolean',\n 'ZodEnum',\n 'ZodOptional',\n 'ZodDefault',\n 'ZodArray',\n]);\n\nfunction assertQueryParamSchema(schema: unknown, param: string): void {\n const name = (schema as { constructor?: { name?: string } })?.constructor?.name ?? '';\n if (!ALLOWED_QUERY_SCHEMA_NAMES.has(name)) {\n throw new Error(\n `contentAPI.addQueryParams: param \"${param}\" schema must be a scalar (string, number, boolean, enum) or array of scalars; got ${name}. Use addInputParams for nested objects.`\n );\n }\n if (name === 'ZodOptional' || name === 'ZodDefault') {\n const inner = (schema as { _def?: { innerType?: unknown } })?._def?.innerType;\n if (inner) assertQueryParamSchema(inner, param);\n return;\n }\n if (name === 'ZodArray') {\n const element = (schema as { _def?: { element?: unknown } })?._def?.element;\n if (element) assertQueryParamSchema(element, param);\n }\n}\n\nfunction resolveSchema<T>(schemaOrFactory: T | ((zInstance: typeof z) => T)): T {\n if (typeof schemaOrFactory === 'function') {\n return (schemaOrFactory as (zInstance: typeof z) => T)(z);\n }\n return schemaOrFactory;\n}\n\nconst mergeOneQueryParamIntoRoute = (\n route: Core.Route,\n param: string,\n schema: z.ZodType,\n matchRoute?: (route: Core.Route) => boolean\n): void => {\n if (matchRoute && !matchRoute(route)) return;\n const query = { ...(route.request?.query ?? {}) };\n if (param in query) {\n throw new Error(\n `contentAPI.addQueryParams: param \"${param}\" already exists on route ${route.method} ${route.path}`\n );\n }\n route.request = { ...route.request, query: { ...query, [param]: schema } };\n};\n\nconst mergeOneInputParamIntoRoute = (\n route: Core.Route,\n param: string,\n schema: z.ZodType,\n matchRoute?: (route: Core.Route) => boolean\n): void => {\n if (matchRoute && !matchRoute(route)) return;\n const jsonKey = 'application/json';\n type RouteBody = NonNullable<NonNullable<Core.Route['request']>['body']>;\n const body: RouteBody = route.request?.body ? { ...route.request.body } : ({} as RouteBody);\n const existing = body[jsonKey];\n const base =\n existing && typeof existing === 'object' && 'shape' in existing\n ? (existing as { shape: Record<string, z.ZodType> }).shape\n : {};\n if (param in base) {\n throw new Error(\n `contentAPI.addInputParams: param \"${param}\" already exists on route ${route.method} ${route.path}`\n );\n }\n body[jsonKey] = z.object({ ...base, [param]: schema }) as RouteBody[keyof RouteBody];\n route.request = { ...route.request, body };\n};\n\n/** Stored options with schema always resolved (never a function). */\ntype ResolvedQueryParamEntry = {\n param: string;\n schema: z.ZodType;\n matchRoute?: (route: Core.Route) => boolean;\n};\ntype ResolvedInputParamEntry = {\n param: string;\n schema: z.ZodType;\n matchRoute?: (route: Core.Route) => boolean;\n};\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const extraQueryParams: ResolvedQueryParamEntry[] = [];\n const extraInputParams: ResolvedInputParamEntry[] = [];\n\n const addQueryParam = (options: Modules.ContentAPI.QueryParamEntry & { param: string }) => {\n const { param, schema: schemaOrFactory, matchRoute } = options;\n const schema = resolveSchema(schemaOrFactory);\n assertQueryParamSchema(schema, param);\n if ((ALLOWED_QUERY_PARAM_KEYS as readonly string[]).includes(param)) {\n throw new Error(\n `contentAPI.addQueryParams: param \"${param}\" is reserved by Strapi; use a different name`\n );\n }\n if (extraQueryParams.some((o) => o.param === param)) {\n throw new Error(`contentAPI.addQueryParams: param \"${param}\" has already been added`);\n }\n extraQueryParams.push({ param, schema, matchRoute });\n // Params are merged into routes when initRouting() runs (applyExtraParamsToRoutes).\n // We do not merge here: at register() time routes may not exist yet (lazy creation), and\n // merging here would cause double-merge when initRouting runs and 400 \"invalid param\" or\n // \"param already exists\" errors.\n };\n\n const addInputParam = (options: Modules.ContentAPI.InputParamEntry & { param: string }) => {\n const { param, schema: schemaOrFactory, matchRoute } = options;\n const schema = resolveSchema(schemaOrFactory);\n if ((RESERVED_INPUT_PARAM_KEYS as readonly string[]).includes(param)) {\n throw new Error(\n `contentAPI.addInputParams: param \"${param}\" is reserved by Strapi; use a different name`\n );\n }\n if (extraInputParams.some((o) => o.param === param)) {\n throw new Error(`contentAPI.addInputParams: param \"${param}\" has already been added`);\n }\n extraInputParams.push({ param, schema, matchRoute });\n // Params are merged into routes when initRouting() runs (applyExtraParamsToRoutes).\n };\n\n /**\n * Register extra query params. Keys = param names; values = { schema, matchRoute? }.\n * Schemas must be Zod scalar or array-of-scalars (enforced at runtime via assertQueryParamSchema).\n */\n const addQueryParams = (options: Modules.ContentAPI.AddQueryParamsOptions) => {\n Object.entries(options).forEach(([param, rest]) => addQueryParam({ param, ...rest }));\n };\n\n /**\n * Register extra input params (root-level body.data). Keys = param names; values = { schema, matchRoute? }.\n * Any Zod type allowed; enforced at registration time.\n */\n const addInputParams = (options: Modules.ContentAPI.AddInputParamsOptions) => {\n Object.entries(options).forEach(([param, rest]) => addInputParam({ param, ...rest }));\n };\n\n /** Merge all registered extra params into the given routes (mutates in place). Called at route registration. Throws if a param key already exists. */\n const applyExtraParamsToRoutes = (routes: Core.Route[]): void => {\n routes.forEach((route) => {\n for (const { param, schema, matchRoute } of extraQueryParams) {\n mergeOneQueryParamIntoRoute(route, param, schema, matchRoute);\n }\n for (const { param, schema, matchRoute } of extraInputParams) {\n mergeOneInputParamIntoRoute(route, param, schema, matchRoute);\n }\n });\n };\n\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return sanitizeRoutesMapForSerialization(routesMap);\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n addQueryParams,\n addInputParams,\n applyExtraParamsToRoutes,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","ALLOWED_QUERY_SCHEMA_NAMES","Set","assertQueryParamSchema","schema","param","name","has","Error","inner","_def","innerType","element","resolveSchema","schemaOrFactory","z","mergeOneQueryParamIntoRoute","matchRoute","query","request","method","mergeOneInputParamIntoRoute","jsonKey","body","existing","base","shape","object","createContentAPI","strapi","extraQueryParams","extraInputParams","addQueryParam","options","ALLOWED_QUERY_PARAM_KEYS","includes","some","o","push","addInputParam","RESERVED_INPUT_PARAM_KEYS","addQueryParams","Object","entries","forEach","rest","addInputParams","applyExtraParamsToRoutes","routes","getRoutesMap","routesMap","_","apis","api","apiName","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizeRoutesMapForSerialization","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,uBAAAA,GAA0B,CAACC,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mBAAA;AAC/B,aAAA;AACF,QAAA;AACF,KAAA,CAAA;IAEA,OAAO;AACLoB,QAAAA,WAAAA,EAAaC,KAAAA,CAAgCnD,MAAAA,CAAAA;AAC7CoB,QAAAA,YAAAA;QACAmB,QAAAA,EAAUD,SAAAA;QACVS,QAAAA,EAAUD,SAAAA;AACVlC,QAAAA,cAAAA;AACAK,QAAAA,cAAAA;AACAC,QAAAA;AACF,KAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport {\n sanitize,\n validate,\n sanitizeRoutesMapForSerialization,\n ALLOWED_QUERY_PARAM_KEYS,\n RESERVED_INPUT_PARAM_KEYS,\n} from '@strapi/utils';\nimport * as z from 'zod/v4';\n\nimport type { Core, Modules, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Runtime check for addQueryParams: we only allow scalar or array-of-scalar schemas (no nested objects).\n * We keep this in addition to the ZodQueryParamSchema type because: (1) TypeScript can be bypassed (JS,\n * any, or schema from another Zod instance); (2) it gives a clear, immediate error at registration\n * time instead of a later failure in validate/sanitize. This list is intentionally tied to Zod v4\n * constructor names; if Zod changes internals, this may need updating.\n * Compatibility: Zod 3 and Zod 4 Classic (zod/v4) both use these constructor names and\n * expose ._def with .innerType / .element for Optional/Default/Array. Zod 4 Core/Mini use\n * ._zod.def instead; we only accept schemas from the same zod/v4 instance used here.\n */\nconst ALLOWED_QUERY_SCHEMA_NAMES = new Set([\n 'ZodString',\n 'ZodNumber',\n 'ZodBoolean',\n 'ZodEnum',\n 'ZodOptional',\n 'ZodDefault',\n 'ZodArray',\n]);\n\nfunction assertQueryParamSchema(schema: unknown, param: string): void {\n const name = (schema as { constructor?: { name?: string } })?.constructor?.name ?? '';\n if (!ALLOWED_QUERY_SCHEMA_NAMES.has(name)) {\n throw new Error(\n `contentAPI.addQueryParams: param \"${param}\" schema must be a scalar (string, number, boolean, enum) or array of scalars; got ${name}. Use addInputParams for nested objects.`\n );\n }\n if (name === 'ZodOptional' || name === 'ZodDefault') {\n const inner = (schema as { _def?: { innerType?: unknown } })?._def?.innerType;\n if (inner) assertQueryParamSchema(inner, param);\n return;\n }\n if (name === 'ZodArray') {\n const element = (schema as { _def?: { element?: unknown } })?._def?.element;\n if (element) assertQueryParamSchema(element, param);\n }\n}\n\nfunction resolveSchema<T>(schemaOrFactory: T | ((zInstance: typeof z) => T)): T {\n if (typeof schemaOrFactory === 'function') {\n return (schemaOrFactory as (zInstance: typeof z) => T)(z);\n }\n return schemaOrFactory;\n}\n\nconst mergeOneQueryParamIntoRoute = (\n route: Core.Route,\n param: string,\n schema: z.ZodType,\n matchRoute?: (route: Core.Route) => boolean\n): void => {\n if (matchRoute && !matchRoute(route)) return;\n const query = { ...(route.request?.query ?? {}) };\n if (param in query) {\n throw new Error(\n `contentAPI.addQueryParams: param \"${param}\" already exists on route ${route.method} ${route.path}`\n );\n }\n route.request = { ...route.request, query: { ...query, [param]: schema } };\n};\n\nconst mergeOneInputParamIntoRoute = (\n route: Core.Route,\n param: string,\n schema: z.ZodType,\n matchRoute?: (route: Core.Route) => boolean\n): void => {\n if (matchRoute && !matchRoute(route)) return;\n const jsonKey = 'application/json';\n type RouteBody = NonNullable<NonNullable<Core.Route['request']>['body']>;\n const body: RouteBody = route.request?.body ? { ...route.request.body } : ({} as RouteBody);\n const existing = body[jsonKey];\n const base =\n existing && typeof existing === 'object' && 'shape' in existing\n ? (existing as { shape: Record<string, z.ZodType> }).shape\n : {};\n if (param in base) {\n throw new Error(\n `contentAPI.addInputParams: param \"${param}\" already exists on route ${route.method} ${route.path}`\n );\n }\n body[jsonKey] = z.object({ ...base, [param]: schema }) as RouteBody[keyof RouteBody];\n route.request = { ...route.request, body };\n};\n\n/** Stored options with schema always resolved (never a function). */\ntype ResolvedQueryParamEntry = {\n param: string;\n schema: z.ZodType;\n matchRoute?: (route: Core.Route) => boolean;\n};\ntype ResolvedInputParamEntry = {\n param: string;\n schema: z.ZodType;\n matchRoute?: (route: Core.Route) => boolean;\n};\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const extraQueryParams: ResolvedQueryParamEntry[] = [];\n const extraInputParams: ResolvedInputParamEntry[] = [];\n\n const addQueryParam = (options: Modules.ContentAPI.QueryParamEntry & { param: string }) => {\n const { param, schema: schemaOrFactory, matchRoute } = options;\n const schema = resolveSchema(schemaOrFactory);\n assertQueryParamSchema(schema, param);\n if ((ALLOWED_QUERY_PARAM_KEYS as readonly string[]).includes(param)) {\n throw new Error(\n `contentAPI.addQueryParams: param \"${param}\" is reserved by Strapi; use a different name`\n );\n }\n if (extraQueryParams.some((o) => o.param === param)) {\n throw new Error(`contentAPI.addQueryParams: param \"${param}\" has already been added`);\n }\n extraQueryParams.push({ param, schema, matchRoute });\n // Params are merged into routes when initRouting() runs (applyExtraParamsToRoutes).\n // We do not merge here: at register() time routes may not exist yet (lazy creation), and\n // merging here would cause double-merge when initRouting runs and 400 \"invalid param\" or\n // \"param already exists\" errors.\n };\n\n const addInputParam = (options: Modules.ContentAPI.InputParamEntry & { param: string }) => {\n const { param, schema: schemaOrFactory, matchRoute } = options;\n const schema = resolveSchema(schemaOrFactory);\n if ((RESERVED_INPUT_PARAM_KEYS as readonly string[]).includes(param)) {\n throw new Error(\n `contentAPI.addInputParams: param \"${param}\" is reserved by Strapi; use a different name`\n );\n }\n if (extraInputParams.some((o) => o.param === param)) {\n throw new Error(`contentAPI.addInputParams: param \"${param}\" has already been added`);\n }\n extraInputParams.push({ param, schema, matchRoute });\n // Params are merged into routes when initRouting() runs (applyExtraParamsToRoutes).\n };\n\n /**\n * Register extra query params. Keys = param names; values = { schema, matchRoute? }.\n * Schemas must be Zod scalar or array-of-scalars (enforced at runtime via assertQueryParamSchema).\n */\n const addQueryParams = (options: Modules.ContentAPI.AddQueryParamsOptions) => {\n Object.entries(options).forEach(([param, rest]) => addQueryParam({ param, ...rest }));\n };\n\n /**\n * Register extra input params (root-level body.data). Keys = param names; values = { schema, matchRoute? }.\n * Any Zod type allowed; enforced at registration time.\n */\n const addInputParams = (options: Modules.ContentAPI.AddInputParamsOptions) => {\n Object.entries(options).forEach(([param, rest]) => addInputParam({ param, ...rest }));\n };\n\n /** Merge all registered extra params into the given routes (mutates in place). Called at route registration. Throws if a param key already exists. */\n const applyExtraParamsToRoutes = (routes: Core.Route[]): void => {\n routes.forEach((route) => {\n for (const { param, schema, matchRoute } of extraQueryParams) {\n mergeOneQueryParamIntoRoute(route, param, schema, matchRoute);\n }\n for (const { param, schema, matchRoute } of extraInputParams) {\n mergeOneInputParamIntoRoute(route, param, schema, matchRoute);\n }\n });\n };\n\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return sanitizeRoutesMapForSerialization(routesMap);\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n addQueryParams,\n addInputParams,\n applyExtraParamsToRoutes,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","ALLOWED_QUERY_SCHEMA_NAMES","Set","assertQueryParamSchema","schema","param","name","has","Error","inner","_def","innerType","element","resolveSchema","schemaOrFactory","z","mergeOneQueryParamIntoRoute","matchRoute","query","request","method","mergeOneInputParamIntoRoute","jsonKey","body","existing","base","shape","object","createContentAPI","strapi","extraQueryParams","extraInputParams","addQueryParam","options","ALLOWED_QUERY_PARAM_KEYS","includes","some","o","push","addInputParam","RESERVED_INPUT_PARAM_KEYS","addQueryParams","Object","entries","forEach","rest","addInputParams","applyExtraParamsToRoutes","routes","getRoutesMap","routesMap","_","apis","api","apiName","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizeRoutesMapForSerialization","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAAA,CAA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,QAAAA,WAAAA,EAAaC,KAAAA,CAAgCnD,MAAAA,CAAAA;AAC7CoB,QAAAA,YAAAA;QACAmB,QAAAA,EAAUD,SAAAA;QACVS,QAAAA,EAAUD,SAAAA;AACVlC,QAAAA,cAAAA;AACAK,QAAAA,cAAAA;AACAC,QAAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var permissions = require('@strapi/permissions');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var permissions__default = /*#__PURE__*/_interopDefault(permissions);
|
|
8
|
+
|
|
9
|
+
var createPermissionEngine = (({ providers })=>permissions__default.default.engine.new({
|
|
6
10
|
providers
|
|
7
11
|
}));
|
|
8
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sources":["../../../../src/services/content-api/permissions/engine.ts"],"sourcesContent":["import permissions from '@strapi/permissions';\n\ntype Options = Parameters<typeof permissions.engine.new>[0];\n\nexport default ({ providers }: Options) => permissions.engine.new({ providers });\n"],"names":["providers","permissions","engine","new"],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.js","sources":["../../../../src/services/content-api/permissions/engine.ts"],"sourcesContent":["import permissions from '@strapi/permissions';\n\ntype Options = Parameters<typeof permissions.engine.new>[0];\n\nexport default ({ providers }: Options) => permissions.engine.new({ providers });\n"],"names":["providers","permissions","engine","new"],"mappings":";;;;;;;;AAIA,6BAAe,CAAA,CAAC,EAAEA,SAAS,EAAW,GAAKC,4BAAAA,CAAYC,MAAM,CAACC,GAAG,CAAC;AAAEH,QAAAA;AAAU,KAAA,CAAC;;;;"}
|
|
@@ -5,6 +5,10 @@ var action = require('./providers/action.js');
|
|
|
5
5
|
var condition = require('./providers/condition.js');
|
|
6
6
|
var engine = require('./engine.js');
|
|
7
7
|
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
11
|
+
|
|
8
12
|
const typeSymbol = Symbol.for('__type__');
|
|
9
13
|
/**
|
|
10
14
|
* Creates a handler that checks if the permission's action exists in the action registry
|
|
@@ -38,7 +42,7 @@ const typeSymbol = Symbol.for('__type__');
|
|
|
38
42
|
* Check if a controller's action is bound to the
|
|
39
43
|
* content-api by looking at a potential __type__ symbol
|
|
40
44
|
*/ const isContentApi = (action)=>{
|
|
41
|
-
if (!
|
|
45
|
+
if (!___default.default.has(action, typeSymbol)) {
|
|
42
46
|
return false;
|
|
43
47
|
}
|
|
44
48
|
return action[typeSymbol].includes('content-api');
|
|
@@ -46,16 +50,16 @@ const typeSymbol = Symbol.for('__type__');
|
|
|
46
50
|
/**
|
|
47
51
|
* Register actions from a specific API source into the result tree
|
|
48
52
|
*/ const registerAPIsActions = (apis, source)=>{
|
|
49
|
-
|
|
50
|
-
const controllers =
|
|
51
|
-
const contentApiActions =
|
|
52
|
-
if (
|
|
53
|
+
___default.default.forEach(apis, (api, apiName)=>{
|
|
54
|
+
const controllers = ___default.default.reduce(api.controllers, (acc, controller, controllerName)=>{
|
|
55
|
+
const contentApiActions = ___default.default.pickBy(controller, isContentApi);
|
|
56
|
+
if (___default.default.isEmpty(contentApiActions)) {
|
|
53
57
|
return acc;
|
|
54
58
|
}
|
|
55
59
|
acc[controllerName] = Object.keys(contentApiActions);
|
|
56
60
|
return acc;
|
|
57
61
|
}, {});
|
|
58
|
-
if (!
|
|
62
|
+
if (!___default.default.isEmpty(controllers)) {
|
|
59
63
|
actionMap[`${source}::${apiName}`] = {
|
|
60
64
|
controllers
|
|
61
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/services/content-api/permissions/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\nimport { createActionProvider, createConditionProvider } from './providers';\nimport createPermissionEngine from './engine';\n\nconst typeSymbol = Symbol.for('__type__');\n\ninterface ValidatePermissionHandler {\n (params: { permission: { action: string } }): boolean;\n}\n\n/**\n * Creates a handler that checks if the permission's action exists in the action registry\n */\nconst createValidatePermissionHandler =\n (actionProvider: ReturnType<typeof createActionProvider>): ValidatePermissionHandler =>\n ({ permission }) => {\n const action = actionProvider.get(permission.action);\n\n // If the action isn't registered into the action provider, then ignore the permission and warn the user\n if (!action) {\n strapi.log.debug(\n `Unknown action \"${permission.action}\" supplied when registering a new permission`\n );\n\n return false;\n }\n\n return true;\n };\n\n/**\n * Create instances of providers and permission engine for the core content-API service.\n * Also, expose utilities to get information about available actions and such.\n */\nexport default (strapi: Core.Strapi) => {\n // NOTE: Here we define both an action and condition provider,\n // but at the moment, we're only using the action one.\n const providers = {\n action: createActionProvider(),\n condition: createConditionProvider(),\n };\n\n /**\n * Get a tree representation of the available Content API actions\n * based on the methods of the Content API controllers.\n *\n * @note Only actions bound to a content-API route are returned.\n */\n const getActionsMap = () => {\n const actionMap: Record<\n string,\n {\n controllers: Record<string, string[]>;\n }\n > = {};\n\n /**\n * Check if a controller's action is bound to the\n * content-api by looking at a potential __type__ symbol\n */\n const isContentApi = (action: Core.ControllerHandler & { [s: symbol]: any }) => {\n if (!_.has(action, typeSymbol)) {\n return false;\n }\n\n return action[typeSymbol].includes('content-api');\n };\n\n /**\n * Register actions from a specific API source into the result tree\n */\n const registerAPIsActions = (\n apis: Record<string, Core.Plugin | Core.Module>,\n source: 'api' | 'plugin'\n ) => {\n _.forEach(apis, (api, apiName) => {\n const controllers = _.reduce(\n api.controllers,\n (acc, controller, controllerName) => {\n const contentApiActions = _.pickBy(controller, isContentApi);\n\n if (_.isEmpty(contentApiActions)) {\n return acc;\n }\n\n acc[controllerName] = Object.keys(contentApiActions);\n\n return acc;\n },\n {} as Record<string, string[]>\n );\n\n if (!_.isEmpty(controllers)) {\n actionMap[`${source}::${apiName}`] = { controllers };\n }\n });\n };\n\n registerAPIsActions(strapi.apis, 'api');\n registerAPIsActions(strapi.plugins, 'plugin');\n\n return actionMap;\n };\n\n /**\n * Register all the content-API controllers actions into the action provider.\n * This method make use of the {@link getActionsMap} to generate the list of actions to register.\n */\n const registerActions = async () => {\n const actionsMap = getActionsMap();\n\n // For each API\n for (const [api, value] of Object.entries(actionsMap)) {\n const { controllers } = value;\n\n // Register controllers methods as actions\n for (const [controller, actions] of Object.entries(controllers)) {\n // Register each action individually\n await Promise.all(\n actions.map((action) => {\n const actionUID = `${api}.${controller}.${action}`;\n\n return providers.action.register(actionUID, {\n api,\n controller,\n action,\n uid: actionUID,\n });\n })\n );\n }\n }\n };\n\n // Create an instance of a content-API permission engine\n // and binds a custom validation handler to it\n const engine = createPermissionEngine({ providers });\n\n engine.on(\n 'before-format::validate.permission',\n createValidatePermissionHandler(providers.action)\n );\n\n return {\n engine,\n providers,\n registerActions,\n getActionsMap,\n };\n};\n"],"names":["typeSymbol","Symbol","for","createValidatePermissionHandler","actionProvider","permission","action","get","strapi","log","debug","providers","createActionProvider","condition","createConditionProvider","getActionsMap","actionMap","isContentApi","_","has","includes","registerAPIsActions","apis","source","forEach","api","apiName","controllers","reduce","acc","controller","controllerName","contentApiActions","pickBy","isEmpty","Object","keys","plugins","registerActions","actionsMap","value","entries","actions","Promise","all","map","actionUID","register","uid","engine","createPermissionEngine","on"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/services/content-api/permissions/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\nimport { createActionProvider, createConditionProvider } from './providers';\nimport createPermissionEngine from './engine';\n\nconst typeSymbol = Symbol.for('__type__');\n\ninterface ValidatePermissionHandler {\n (params: { permission: { action: string } }): boolean;\n}\n\n/**\n * Creates a handler that checks if the permission's action exists in the action registry\n */\nconst createValidatePermissionHandler =\n (actionProvider: ReturnType<typeof createActionProvider>): ValidatePermissionHandler =>\n ({ permission }) => {\n const action = actionProvider.get(permission.action);\n\n // If the action isn't registered into the action provider, then ignore the permission and warn the user\n if (!action) {\n strapi.log.debug(\n `Unknown action \"${permission.action}\" supplied when registering a new permission`\n );\n\n return false;\n }\n\n return true;\n };\n\n/**\n * Create instances of providers and permission engine for the core content-API service.\n * Also, expose utilities to get information about available actions and such.\n */\nexport default (strapi: Core.Strapi) => {\n // NOTE: Here we define both an action and condition provider,\n // but at the moment, we're only using the action one.\n const providers = {\n action: createActionProvider(),\n condition: createConditionProvider(),\n };\n\n /**\n * Get a tree representation of the available Content API actions\n * based on the methods of the Content API controllers.\n *\n * @note Only actions bound to a content-API route are returned.\n */\n const getActionsMap = () => {\n const actionMap: Record<\n string,\n {\n controllers: Record<string, string[]>;\n }\n > = {};\n\n /**\n * Check if a controller's action is bound to the\n * content-api by looking at a potential __type__ symbol\n */\n const isContentApi = (action: Core.ControllerHandler & { [s: symbol]: any }) => {\n if (!_.has(action, typeSymbol)) {\n return false;\n }\n\n return action[typeSymbol].includes('content-api');\n };\n\n /**\n * Register actions from a specific API source into the result tree\n */\n const registerAPIsActions = (\n apis: Record<string, Core.Plugin | Core.Module>,\n source: 'api' | 'plugin'\n ) => {\n _.forEach(apis, (api, apiName) => {\n const controllers = _.reduce(\n api.controllers,\n (acc, controller, controllerName) => {\n const contentApiActions = _.pickBy(controller, isContentApi);\n\n if (_.isEmpty(contentApiActions)) {\n return acc;\n }\n\n acc[controllerName] = Object.keys(contentApiActions);\n\n return acc;\n },\n {} as Record<string, string[]>\n );\n\n if (!_.isEmpty(controllers)) {\n actionMap[`${source}::${apiName}`] = { controllers };\n }\n });\n };\n\n registerAPIsActions(strapi.apis, 'api');\n registerAPIsActions(strapi.plugins, 'plugin');\n\n return actionMap;\n };\n\n /**\n * Register all the content-API controllers actions into the action provider.\n * This method make use of the {@link getActionsMap} to generate the list of actions to register.\n */\n const registerActions = async () => {\n const actionsMap = getActionsMap();\n\n // For each API\n for (const [api, value] of Object.entries(actionsMap)) {\n const { controllers } = value;\n\n // Register controllers methods as actions\n for (const [controller, actions] of Object.entries(controllers)) {\n // Register each action individually\n await Promise.all(\n actions.map((action) => {\n const actionUID = `${api}.${controller}.${action}`;\n\n return providers.action.register(actionUID, {\n api,\n controller,\n action,\n uid: actionUID,\n });\n })\n );\n }\n }\n };\n\n // Create an instance of a content-API permission engine\n // and binds a custom validation handler to it\n const engine = createPermissionEngine({ providers });\n\n engine.on(\n 'before-format::validate.permission',\n createValidatePermissionHandler(providers.action)\n );\n\n return {\n engine,\n providers,\n registerActions,\n getActionsMap,\n };\n};\n"],"names":["typeSymbol","Symbol","for","createValidatePermissionHandler","actionProvider","permission","action","get","strapi","log","debug","providers","createActionProvider","condition","createConditionProvider","getActionsMap","actionMap","isContentApi","_","has","includes","registerAPIsActions","apis","source","forEach","api","apiName","controllers","reduce","acc","controller","controllerName","contentApiActions","pickBy","isEmpty","Object","keys","plugins","registerActions","actionsMap","value","entries","actions","Promise","all","map","actionUID","register","uid","engine","createPermissionEngine","on"],"mappings":";;;;;;;;;;;AAKA,MAAMA,UAAAA,GAAaC,MAAAA,CAAOC,GAAG,CAAC,UAAA,CAAA;AAM9B;;AAEC,IACD,MAAMC,+BAAAA,GACJ,CAACC,iBACD,CAAC,EAAEC,UAAU,EAAE,GAAA;AACb,QAAA,MAAMC,MAAAA,GAASF,cAAAA,CAAeG,GAAG,CAACF,WAAWC,MAAM,CAAA;;AAGnD,QAAA,IAAI,CAACA,MAAAA,EAAQ;YACXE,MAAAA,CAAOC,GAAG,CAACC,KAAK,CACd,CAAC,gBAAgB,EAAEL,UAAAA,CAAWC,MAAM,CAAC,4CAA4C,CAAC,CAAA;YAGpF,OAAO,KAAA;AACT,QAAA;QAEA,OAAO,IAAA;AACT,IAAA,CAAA;AAEF;;;IAIA,sCAAe,CAAA,CAACE,OAAAA,GAAAA;;;AAGd,IAAA,MAAMG,SAAAA,GAAY;QAChBL,MAAAA,EAAQM,MAAAA,EAAAA;QACRC,SAAAA,EAAWC,SAAAA;AACb,KAAA;AAEA;;;;;AAKC,MACD,MAAMC,aA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;"}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
var fp = require('lodash/fp');
|
|
4
4
|
var bcrypt = require('bcryptjs');
|
|
5
5
|
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var bcrypt__default = /*#__PURE__*/_interopDefault(bcrypt);
|
|
9
|
+
|
|
6
10
|
const transforms = {
|
|
7
11
|
password (value, context) {
|
|
8
12
|
const { attribute } = context;
|
|
@@ -13,7 +17,7 @@ const transforms = {
|
|
|
13
17
|
return value;
|
|
14
18
|
}
|
|
15
19
|
const rounds = fp.toNumber(fp.getOr(10, 'encryption.rounds', attribute));
|
|
16
|
-
return
|
|
20
|
+
return bcrypt__default.default.hashSync(value.toString(), rounds);
|
|
17
21
|
}
|
|
18
22
|
};
|
|
19
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.js","sources":["../../../../src/services/document-service/attributes/transforms.ts"],"sourcesContent":["import { getOr, toNumber, isString } from 'lodash/fp';\nimport type { Schema } from '@strapi/types';\nimport bcrypt from 'bcryptjs';\n\ntype Transforms = {\n [TKind in Schema.Attribute.Kind]?: (\n value: unknown,\n context: {\n attribute: Schema.Attribute.AnyAttribute;\n attributeName: string;\n }\n ) => any;\n};\n\nconst transforms: Transforms = {\n password(value, context) {\n const { attribute } = context;\n\n if (attribute.type !== 'password') {\n throw new Error('Invalid attribute type');\n }\n\n if (!isString(value) && !(value instanceof Buffer)) {\n return value;\n }\n\n const rounds = toNumber(getOr(10, 'encryption.rounds', attribute));\n\n return bcrypt.hashSync(value.toString(), rounds);\n },\n};\n\nexport default transforms;\n"],"names":["transforms","password","value","context","attribute","type","Error","isString","Buffer","rounds","toNumber","getOr","bcrypt","hashSync","toString"],"mappings":"
|
|
1
|
+
{"version":3,"file":"transforms.js","sources":["../../../../src/services/document-service/attributes/transforms.ts"],"sourcesContent":["import { getOr, toNumber, isString } from 'lodash/fp';\nimport type { Schema } from '@strapi/types';\nimport bcrypt from 'bcryptjs';\n\ntype Transforms = {\n [TKind in Schema.Attribute.Kind]?: (\n value: unknown,\n context: {\n attribute: Schema.Attribute.AnyAttribute;\n attributeName: string;\n }\n ) => any;\n};\n\nconst transforms: Transforms = {\n password(value, context) {\n const { attribute } = context;\n\n if (attribute.type !== 'password') {\n throw new Error('Invalid attribute type');\n }\n\n if (!isString(value) && !(value instanceof Buffer)) {\n return value;\n }\n\n const rounds = toNumber(getOr(10, 'encryption.rounds', attribute));\n\n return bcrypt.hashSync(value.toString(), rounds);\n },\n};\n\nexport default transforms;\n"],"names":["transforms","password","value","context","attribute","type","Error","isString","Buffer","rounds","toNumber","getOr","bcrypt","hashSync","toString"],"mappings":";;;;;;;;;AAcA,MAAMA,UAAAA,GAAyB;IAC7BC,QAAAA,CAAAA,CAASC,KAAK,EAAEC,OAAO,EAAA;QACrB,MAAM,EAAEC,SAAS,EAAE,GAAGD,OAAAA;QAEtB,IAAIC,SAAAA,CAAUC,IAAI,KAAK,UAAA,EAAY;AACjC,YAAA,MAAM,IAAIC,KAAAA,CAAM,wBAAA,CAAA;AAClB,QAAA;AAEA,QAAA,IAAI,CAACC,WAAAA,CAASL,KAAAA,CAAAA,IAAU,EAAEA,KAAAA,YAAiBM,MAAK,CAAA,EAAI;YAClD,OAAON,KAAAA;AACT,QAAA;AAEA,QAAA,MAAMO,MAAAA,GAASC,WAAAA,CAASC,QAAAA,CAAM,EAAA,EAAI,mBAAA,EAAqBP,SAAAA,CAAAA,CAAAA;AAEvD,QAAA,OAAOQ,uBAAAA,CAAOC,QAAQ,CAACX,KAAAA,CAAMY,QAAQ,EAAA,EAAIL,MAAAA,CAAAA;AAC3C,IAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/components.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,KAAK,EAAS,G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