@strapi/openapi 0.0.0-experimental.4e03c41e8e44fa7b77c41c3e0edd86c7f1fc9c52 → 0.0.0-experimental.50e7f41993c2e6e11d3c5a39b47f003ddb06cddc
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/assemblers/document/factory.js +1 -1
- package/dist/assemblers/document/factory.mjs +1 -1
- package/dist/assemblers/document/info.js +1 -1
- package/dist/assemblers/document/info.js.map +1 -1
- package/dist/assemblers/document/info.mjs +1 -1
- package/dist/assemblers/document/info.mjs.map +1 -1
- package/dist/assemblers/document/metadata.js +1 -1
- package/dist/assemblers/document/metadata.mjs +1 -1
- package/dist/assemblers/document/path/factory.js +1 -1
- package/dist/assemblers/document/path/factory.mjs +1 -1
- package/dist/assemblers/document/path/path-item/factory.js +1 -1
- package/dist/assemblers/document/path/path-item/factory.mjs +1 -1
- package/dist/assemblers/document/path/path-item/operation/body.d.ts.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/body.js.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/body.mjs.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation-id.js +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation-id.js.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation-id.mjs +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation-id.mjs.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation.d.ts.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation.js +5 -2
- package/dist/assemblers/document/path/path-item/operation/operation.js.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/operation.mjs +5 -2
- package/dist/assemblers/document/path/path-item/operation/operation.mjs.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/parameters.js +2 -2
- package/dist/assemblers/document/path/path-item/operation/parameters.js.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/parameters.mjs +2 -2
- package/dist/assemblers/document/path/path-item/operation/parameters.mjs.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/responses.js.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/responses.mjs.map +1 -1
- package/dist/assemblers/document/path/path-item/operation/tags.js +1 -1
- package/dist/assemblers/document/path/path-item/operation/tags.mjs +1 -1
- package/dist/assemblers/document/path/path-item/path-item.js +1 -1
- package/dist/assemblers/document/path/path-item/path-item.js.map +1 -1
- package/dist/assemblers/document/path/path-item/path-item.mjs +1 -1
- package/dist/assemblers/document/path/path-item/path-item.mjs.map +1 -1
- package/dist/assemblers/document/path/path.js +1 -1
- package/dist/assemblers/document/path/path.js.map +1 -1
- package/dist/assemblers/document/path/path.mjs +1 -1
- package/dist/assemblers/document/path/path.mjs.map +1 -1
- package/dist/context/factories/document.d.ts +2 -2
- package/dist/context/factories/document.d.ts.map +1 -1
- package/dist/context/factories/document.js +1 -1
- package/dist/context/factories/document.js.map +1 -1
- package/dist/context/factories/document.mjs +1 -1
- package/dist/context/factories/document.mjs.map +1 -1
- package/dist/context/factories/operation.d.ts +2 -2
- package/dist/context/factories/operation.d.ts.map +1 -1
- package/dist/context/factories/operation.js +1 -1
- package/dist/context/factories/operation.js.map +1 -1
- package/dist/context/factories/operation.mjs +1 -1
- package/dist/context/factories/operation.mjs.map +1 -1
- package/dist/context/factories/path-item.js +1 -1
- package/dist/context/factories/path-item.js.map +1 -1
- package/dist/context/factories/path-item.mjs +1 -1
- package/dist/context/factories/path-item.mjs.map +1 -1
- package/dist/context/factories/path.js +1 -1
- package/dist/context/factories/path.js.map +1 -1
- package/dist/context/factories/path.mjs +1 -1
- package/dist/context/factories/path.mjs.map +1 -1
- package/dist/exports.d.ts +27 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js +28 -1
- package/dist/exports.js.map +1 -1
- package/dist/exports.mjs +28 -1
- package/dist/exports.mjs.map +1 -1
- package/dist/generator/generator.js +1 -1
- package/dist/generator/generator.js.map +1 -1
- package/dist/generator/generator.mjs +1 -1
- package/dist/generator/generator.mjs.map +1 -1
- package/dist/generator/types.d.ts +2 -2
- package/dist/generator/types.d.ts.map +1 -1
- package/dist/post-processor/component-writer.js +21 -2
- package/dist/post-processor/component-writer.js.map +1 -1
- package/dist/post-processor/component-writer.mjs +1 -1
- package/dist/post-processor/component-writer.mjs.map +1 -1
- package/dist/registries/types.d.ts +2 -2
- package/dist/registries/types.d.ts.map +1 -1
- package/dist/routes/collector.js +1 -1
- package/dist/routes/collector.js.map +1 -1
- package/dist/routes/collector.mjs +1 -1
- package/dist/routes/collector.mjs.map +1 -1
- package/dist/routes/matcher.js.map +1 -1
- package/dist/routes/matcher.mjs.map +1 -1
- package/dist/routes/providers/admin.js +1 -1
- package/dist/routes/providers/admin.mjs +1 -1
- package/dist/routes/providers/api.js +1 -1
- package/dist/routes/providers/api.mjs +1 -1
- package/dist/routes/providers/plugin.js +1 -1
- package/dist/routes/providers/plugin.mjs +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/debug.mjs.map +1 -1
- package/dist/utils/timer/timer.js.map +1 -1
- package/dist/utils/timer/timer.mjs.map +1 -1
- package/dist/utils/zod.d.ts +4 -4
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +2 -2
- package/dist/utils/zod.js.map +1 -1
- package/dist/utils/zod.mjs +2 -2
- package/dist/utils/zod.mjs.map +1 -1
- package/package.json +4 -5
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var z = require('zod');
|
|
3
|
+
var z = require('zod/v4');
|
|
4
4
|
var zod = require('../utils/zod.js');
|
|
5
5
|
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
|
|
24
|
+
|
|
6
25
|
class ComponentsWriter {
|
|
7
26
|
postProcess(context) {
|
|
8
27
|
const { output } = context;
|
|
9
|
-
const { schemas } =
|
|
28
|
+
const { schemas } = z__namespace.toJSONSchema(z__namespace.globalRegistry, {
|
|
10
29
|
uri: zod.toComponentsPath
|
|
11
30
|
});
|
|
12
31
|
output.data.components = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-writer.js","sources":["../../src/post-processor/component-writer.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"component-writer.js","sources":["../../src/post-processor/component-writer.ts"],"sourcesContent":["import { OpenAPIV3_1 } from 'openapi-types';\nimport * as z from 'zod/v4';\nimport type { DocumentContext } from '../types';\nimport { toComponentsPath } from '../utils/zod';\nimport type { PostProcessor } from './types';\n\nexport class ComponentsWriter implements PostProcessor {\n postProcess(context: DocumentContext): void {\n const { output } = context;\n\n const { schemas } = z.toJSONSchema(z.globalRegistry, {\n uri: toComponentsPath,\n }) as OpenAPIV3_1.ComponentsObject;\n\n output.data.components = { schemas };\n }\n}\n"],"names":["ComponentsWriter","postProcess","context","output","schemas","z","toJSONSchema","globalRegistry","uri","toComponentsPath","data","components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAMA,gBAAAA,CAAAA;AACXC,IAAAA,WAAAA,CAAYC,OAAwB,EAAQ;QAC1C,MAAM,EAAEC,MAAM,EAAE,GAAGD,OAAAA;QAEnB,MAAM,EAAEE,OAAO,EAAE,GAAGC,aAAEC,YAAY,CAACD,YAAEE,CAAAA,cAAc,EAAE;YACnDC,GAAKC,EAAAA;AACP,SAAA,CAAA;QAEAN,MAAOO,CAAAA,IAAI,CAACC,UAAU,GAAG;AAAEP,YAAAA;AAAQ,SAAA;AACrC;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-writer.mjs","sources":["../../src/post-processor/component-writer.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"component-writer.mjs","sources":["../../src/post-processor/component-writer.ts"],"sourcesContent":["import { OpenAPIV3_1 } from 'openapi-types';\nimport * as z from 'zod/v4';\nimport type { DocumentContext } from '../types';\nimport { toComponentsPath } from '../utils/zod';\nimport type { PostProcessor } from './types';\n\nexport class ComponentsWriter implements PostProcessor {\n postProcess(context: DocumentContext): void {\n const { output } = context;\n\n const { schemas } = z.toJSONSchema(z.globalRegistry, {\n uri: toComponentsPath,\n }) as OpenAPIV3_1.ComponentsObject;\n\n output.data.components = { schemas };\n }\n}\n"],"names":["ComponentsWriter","postProcess","context","output","schemas","z","toJSONSchema","globalRegistry","uri","toComponentsPath","data","components"],"mappings":";;;AAMO,MAAMA,gBAAAA,CAAAA;AACXC,IAAAA,WAAAA,CAAYC,OAAwB,EAAQ;QAC1C,MAAM,EAAEC,MAAM,EAAE,GAAGD,OAAAA;QAEnB,MAAM,EAAEE,OAAO,EAAE,GAAGC,EAAEC,YAAY,CAACD,CAAEE,CAAAA,cAAc,EAAE;YACnDC,GAAKC,EAAAA;AACP,SAAA,CAAA;QAEAN,MAAOO,CAAAA,IAAI,CAACC,UAAU,GAAG;AAAEP,YAAAA;AAAQ,SAAA;AACrC;AACF;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type ComponentType = keyof
|
|
1
|
+
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
export type ComponentType = keyof OpenAPIV3_1.ComponentsObject;
|
|
3
3
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registries/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registries/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,gBAAgB,CAAC"}
|
package/dist/routes/collector.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sources":["../../src/routes/collector.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { createDebugger } from '../utils';\nimport { RouteMatcher } from './matcher';\n\nimport type { RoutesProvider } from './providers';\n\nconst debug = createDebugger('routes:collector');\n\n/**\n * Class responsible for collecting and filtering routes from multiple providers.\n */\nexport class RouteCollector {\n private readonly _providers: RoutesProvider[];\n\n private readonly _matcher: RouteMatcher;\n\n /**\n * @param providers - An array of route providers to collect routes from. Defaults to an empty array.\n * @param matcher - An instance of RouteMatcher to filter routes. Defaults to a new {@link RouteMatcher} with no rules.\n */\n constructor(providers: RoutesProvider[] = [], matcher: RouteMatcher = new RouteMatcher()) {\n this._providers = providers;\n this._matcher = matcher;\n }\n\n /**\n * Collects routes from all providers and filters them based on the matcher rules.\n *\n * @returns An array of {@link Core.Route} that pass the filter rules.\n */\n public collect(): Core.Route[] {\n const routes = this._providers.flatMap((provider) => Array.from(provider));\n const sanitizedRoutes = this.filter(routes);\n\n debug(\n 'collected %o/%o routes from %o providers %o',\n sanitizedRoutes.length,\n routes.length,\n this._providers.length,\n this._providers.map((provider) => provider.constructor.name)\n );\n\n return sanitizedRoutes;\n }\n\n /**\n * Filters the given array of routes based on the matcher rules.\n *\n * @param routes - The list of routes to filter.\n * @returns An array of routes that match the rules.\n */\n private filter(routes: Core.Route[]): Core.Route[] {\n return routes.filter((route) => this._matcher.match(route));\n }\n}\n"],"names":["debug","createDebugger","RouteCollector","routes","_providers","flatMap","provider","Array","from","sanitizedRoutes","filter","length","map","
|
|
1
|
+
{"version":3,"file":"collector.js","sources":["../../src/routes/collector.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { createDebugger } from '../utils';\nimport { RouteMatcher } from './matcher';\n\nimport type { RoutesProvider } from './providers';\n\nconst debug = createDebugger('routes:collector');\n\n/**\n * Class responsible for collecting and filtering routes from multiple providers.\n */\nexport class RouteCollector {\n private readonly _providers: RoutesProvider[];\n\n private readonly _matcher: RouteMatcher;\n\n /**\n * @param providers - An array of route providers to collect routes from. Defaults to an empty array.\n * @param matcher - An instance of RouteMatcher to filter routes. Defaults to a new {@link RouteMatcher} with no rules.\n */\n constructor(providers: RoutesProvider[] = [], matcher: RouteMatcher = new RouteMatcher()) {\n this._providers = providers;\n this._matcher = matcher;\n }\n\n /**\n * Collects routes from all providers and filters them based on the matcher rules.\n *\n * @returns An array of {@link Core.Route} that pass the filter rules.\n */\n public collect(): Core.Route[] {\n const routes = this._providers.flatMap((provider) => Array.from(provider));\n const sanitizedRoutes = this.filter(routes);\n\n debug(\n 'collected %o/%o routes from %o providers %o',\n sanitizedRoutes.length,\n routes.length,\n this._providers.length,\n this._providers.map((provider) => provider.constructor.name)\n );\n\n return sanitizedRoutes;\n }\n\n /**\n * Filters the given array of routes based on the matcher rules.\n *\n * @param routes - The list of routes to filter.\n * @returns An array of routes that match the rules.\n */\n private filter(routes: Core.Route[]): Core.Route[] {\n return routes.filter((route) => this._matcher.match(route));\n }\n}\n"],"names":["debug","createDebugger","RouteCollector","routes","_providers","flatMap","provider","Array","from","sanitizedRoutes","filter","length","map","name","route","_matcher","match","providers","matcher","RouteMatcher"],"mappings":";;;;;;;AAOA,MAAMA,QAAQC,sBAAe,CAAA,kBAAA,CAAA;AAE7B;;AAEC,IACM,MAAMC,cAAAA,CAAAA;AAcX;;;;AAIC,MACD,OAA+B,GAAA;QAC7B,MAAMC,MAAAA,GAAS,IAAI,CAACC,UAAU,CAACC,OAAO,CAAC,CAACC,QAAAA,GAAaC,KAAMC,CAAAA,IAAI,CAACF,QAAAA,CAAAA,CAAAA;AAChE,QAAA,MAAMG,eAAkB,GAAA,IAAI,CAACC,MAAM,CAACP,MAAAA,CAAAA;QAEpCH,KACE,CAAA,6CAAA,EACAS,eAAgBE,CAAAA,MAAM,EACtBR,MAAAA,CAAOQ,MAAM,EACb,IAAI,CAACP,UAAU,CAACO,MAAM,EACtB,IAAI,CAACP,UAAU,CAACQ,GAAG,CAAC,CAACN,QAAaA,GAAAA,QAAAA,CAAS,WAAW,CAACO,IAAI,CAAA,CAAA;QAG7D,OAAOJ,eAAAA;AACT;AAEA;;;;;MAMQC,MAAOP,CAAAA,MAAoB,EAAgB;QACjD,OAAOA,MAAAA,CAAOO,MAAM,CAAC,CAACI,KAAAA,GAAU,IAAI,CAACC,QAAQ,CAACC,KAAK,CAACF,KAAAA,CAAAA,CAAAA;AACtD;AArCA;;;AAGC,MACD,YAAYG,SAA8B,GAAA,EAAE,EAAEC,SAAwB,GAAA,IAAIC,sBAAc,CAAE;QACxF,IAAI,CAACf,UAAU,GAAGa,SAAAA;QAClB,IAAI,CAACF,QAAQ,GAAGG,SAAAA;AAClB;AA+BF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.mjs","sources":["../../src/routes/collector.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { createDebugger } from '../utils';\nimport { RouteMatcher } from './matcher';\n\nimport type { RoutesProvider } from './providers';\n\nconst debug = createDebugger('routes:collector');\n\n/**\n * Class responsible for collecting and filtering routes from multiple providers.\n */\nexport class RouteCollector {\n private readonly _providers: RoutesProvider[];\n\n private readonly _matcher: RouteMatcher;\n\n /**\n * @param providers - An array of route providers to collect routes from. Defaults to an empty array.\n * @param matcher - An instance of RouteMatcher to filter routes. Defaults to a new {@link RouteMatcher} with no rules.\n */\n constructor(providers: RoutesProvider[] = [], matcher: RouteMatcher = new RouteMatcher()) {\n this._providers = providers;\n this._matcher = matcher;\n }\n\n /**\n * Collects routes from all providers and filters them based on the matcher rules.\n *\n * @returns An array of {@link Core.Route} that pass the filter rules.\n */\n public collect(): Core.Route[] {\n const routes = this._providers.flatMap((provider) => Array.from(provider));\n const sanitizedRoutes = this.filter(routes);\n\n debug(\n 'collected %o/%o routes from %o providers %o',\n sanitizedRoutes.length,\n routes.length,\n this._providers.length,\n this._providers.map((provider) => provider.constructor.name)\n );\n\n return sanitizedRoutes;\n }\n\n /**\n * Filters the given array of routes based on the matcher rules.\n *\n * @param routes - The list of routes to filter.\n * @returns An array of routes that match the rules.\n */\n private filter(routes: Core.Route[]): Core.Route[] {\n return routes.filter((route) => this._matcher.match(route));\n }\n}\n"],"names":["debug","createDebugger","RouteCollector","routes","_providers","flatMap","provider","Array","from","sanitizedRoutes","filter","length","map","
|
|
1
|
+
{"version":3,"file":"collector.mjs","sources":["../../src/routes/collector.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { createDebugger } from '../utils';\nimport { RouteMatcher } from './matcher';\n\nimport type { RoutesProvider } from './providers';\n\nconst debug = createDebugger('routes:collector');\n\n/**\n * Class responsible for collecting and filtering routes from multiple providers.\n */\nexport class RouteCollector {\n private readonly _providers: RoutesProvider[];\n\n private readonly _matcher: RouteMatcher;\n\n /**\n * @param providers - An array of route providers to collect routes from. Defaults to an empty array.\n * @param matcher - An instance of RouteMatcher to filter routes. Defaults to a new {@link RouteMatcher} with no rules.\n */\n constructor(providers: RoutesProvider[] = [], matcher: RouteMatcher = new RouteMatcher()) {\n this._providers = providers;\n this._matcher = matcher;\n }\n\n /**\n * Collects routes from all providers and filters them based on the matcher rules.\n *\n * @returns An array of {@link Core.Route} that pass the filter rules.\n */\n public collect(): Core.Route[] {\n const routes = this._providers.flatMap((provider) => Array.from(provider));\n const sanitizedRoutes = this.filter(routes);\n\n debug(\n 'collected %o/%o routes from %o providers %o',\n sanitizedRoutes.length,\n routes.length,\n this._providers.length,\n this._providers.map((provider) => provider.constructor.name)\n );\n\n return sanitizedRoutes;\n }\n\n /**\n * Filters the given array of routes based on the matcher rules.\n *\n * @param routes - The list of routes to filter.\n * @returns An array of routes that match the rules.\n */\n private filter(routes: Core.Route[]): Core.Route[] {\n return routes.filter((route) => this._matcher.match(route));\n }\n}\n"],"names":["debug","createDebugger","RouteCollector","routes","_providers","flatMap","provider","Array","from","sanitizedRoutes","filter","length","map","name","route","_matcher","match","providers","matcher","RouteMatcher"],"mappings":";;;;;AAOA,MAAMA,QAAQC,cAAe,CAAA,kBAAA,CAAA;AAE7B;;AAEC,IACM,MAAMC,cAAAA,CAAAA;AAcX;;;;AAIC,MACD,OAA+B,GAAA;QAC7B,MAAMC,MAAAA,GAAS,IAAI,CAACC,UAAU,CAACC,OAAO,CAAC,CAACC,QAAAA,GAAaC,KAAMC,CAAAA,IAAI,CAACF,QAAAA,CAAAA,CAAAA;AAChE,QAAA,MAAMG,eAAkB,GAAA,IAAI,CAACC,MAAM,CAACP,MAAAA,CAAAA;QAEpCH,KACE,CAAA,6CAAA,EACAS,eAAgBE,CAAAA,MAAM,EACtBR,MAAAA,CAAOQ,MAAM,EACb,IAAI,CAACP,UAAU,CAACO,MAAM,EACtB,IAAI,CAACP,UAAU,CAACQ,GAAG,CAAC,CAACN,QAAaA,GAAAA,QAAAA,CAAS,WAAW,CAACO,IAAI,CAAA,CAAA;QAG7D,OAAOJ,eAAAA;AACT;AAEA;;;;;MAMQC,MAAOP,CAAAA,MAAoB,EAAgB;QACjD,OAAOA,MAAAA,CAAOO,MAAM,CAAC,CAACI,KAAAA,GAAU,IAAI,CAACC,QAAQ,CAACC,KAAK,CAACF,KAAAA,CAAAA,CAAAA;AACtD;AArCA;;;AAGC,MACD,YAAYG,SAA8B,GAAA,EAAE,EAAEC,OAAwB,GAAA,IAAIC,cAAc,CAAE;QACxF,IAAI,CAACf,UAAU,GAAGa,SAAAA;QAClB,IAAI,CAACF,QAAQ,GAAGG,OAAAA;AAClB;AA+BF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matcher.js","sources":["../../src/routes/matcher.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { MatcherRule } from './types';\n\n/**\n * Class responsible for matching routes based on provided rules.\n */\nexport class RouteMatcher {\n /**\n * Array of rules to match routes against.\n */\n private readonly _rules: MatcherRule[];\n\n /**\n * @param rules - A list of matcher rules to apply. Defaults to an empty array.\n */\n constructor(rules: MatcherRule[] = []) {\n this._rules = rules;\n }\n\n /**\n * Checks if a given route matches all provided rules.\n *\n * Exits early if any rule fails.\n *\n * @param route - The route to check.\n * @returns `true` if the route satisfies all rules, otherwise `false`.\n */\n match(route: Core.Route): boolean {\n return this._rules.every((rule) => rule(route));\n }\n}\n"],"names":["RouteMatcher","match","route","_rules","every","rule","
|
|
1
|
+
{"version":3,"file":"matcher.js","sources":["../../src/routes/matcher.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { MatcherRule } from './types';\n\n/**\n * Class responsible for matching routes based on provided rules.\n */\nexport class RouteMatcher {\n /**\n * Array of rules to match routes against.\n */\n private readonly _rules: MatcherRule[];\n\n /**\n * @param rules - A list of matcher rules to apply. Defaults to an empty array.\n */\n constructor(rules: MatcherRule[] = []) {\n this._rules = rules;\n }\n\n /**\n * Checks if a given route matches all provided rules.\n *\n * Exits early if any rule fails.\n *\n * @param route - The route to check.\n * @returns `true` if the route satisfies all rules, otherwise `false`.\n */\n match(route: Core.Route): boolean {\n return this._rules.every((rule) => rule(route));\n }\n}\n"],"names":["RouteMatcher","match","route","_rules","every","rule","rules"],"mappings":";;AAIA;;AAEC,IACM,MAAMA,YAAAA,CAAAA;AAaX;;;;;;;MAQAC,KAAAA,CAAMC,KAAiB,EAAW;QAChC,OAAO,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAACC,OAASA,IAAKH,CAAAA,KAAAA,CAAAA,CAAAA;AAC1C;AAjBA;;MAGA,WAAA,CAAYI,KAAuB,GAAA,EAAE,CAAE;QACrC,IAAI,CAACH,MAAM,GAAGG,KAAAA;AAChB;AAaF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matcher.mjs","sources":["../../src/routes/matcher.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { MatcherRule } from './types';\n\n/**\n * Class responsible for matching routes based on provided rules.\n */\nexport class RouteMatcher {\n /**\n * Array of rules to match routes against.\n */\n private readonly _rules: MatcherRule[];\n\n /**\n * @param rules - A list of matcher rules to apply. Defaults to an empty array.\n */\n constructor(rules: MatcherRule[] = []) {\n this._rules = rules;\n }\n\n /**\n * Checks if a given route matches all provided rules.\n *\n * Exits early if any rule fails.\n *\n * @param route - The route to check.\n * @returns `true` if the route satisfies all rules, otherwise `false`.\n */\n match(route: Core.Route): boolean {\n return this._rules.every((rule) => rule(route));\n }\n}\n"],"names":["RouteMatcher","match","route","_rules","every","rule","
|
|
1
|
+
{"version":3,"file":"matcher.mjs","sources":["../../src/routes/matcher.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { MatcherRule } from './types';\n\n/**\n * Class responsible for matching routes based on provided rules.\n */\nexport class RouteMatcher {\n /**\n * Array of rules to match routes against.\n */\n private readonly _rules: MatcherRule[];\n\n /**\n * @param rules - A list of matcher rules to apply. Defaults to an empty array.\n */\n constructor(rules: MatcherRule[] = []) {\n this._rules = rules;\n }\n\n /**\n * Checks if a given route matches all provided rules.\n *\n * Exits early if any rule fails.\n *\n * @param route - The route to check.\n * @returns `true` if the route satisfies all rules, otherwise `false`.\n */\n match(route: Core.Route): boolean {\n return this._rules.every((rule) => rule(route));\n }\n}\n"],"names":["RouteMatcher","match","route","_rules","every","rule","rules"],"mappings":"AAIA;;AAEC,IACM,MAAMA,YAAAA,CAAAA;AAaX;;;;;;;MAQAC,KAAAA,CAAMC,KAAiB,EAAW;QAChC,OAAO,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAACC,OAASA,IAAKH,CAAAA,KAAAA,CAAAA,CAAAA;AAC1C;AAjBA;;MAGA,WAAA,CAAYI,KAAuB,GAAA,EAAE,CAAE;QACrC,IAAI,CAACH,MAAM,GAAGG,KAAAA;AAChB;AAaF;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
2
2
|
import type { Context } from './context';
|
|
3
|
-
export type DocumentContextData = Partial<
|
|
3
|
+
export type DocumentContextData = Partial<OpenAPIV3_1.Document>;
|
|
4
4
|
export type DocumentContext = Context<DocumentContextData>;
|
|
5
|
-
export type OperationContextData = Partial<
|
|
5
|
+
export type OperationContextData = Partial<OpenAPIV3_1.OperationObject>;
|
|
6
6
|
export type OperationContext = Context<OperationContextData>;
|
|
7
|
-
export type PathContextData = Partial<
|
|
7
|
+
export type PathContextData = Partial<OpenAPIV3_1.PathsObject>;
|
|
8
8
|
export type PathContext = Context<PathContextData>;
|
|
9
|
-
export type PathItemContextData = Partial<
|
|
9
|
+
export type PathItemContextData = Partial<OpenAPIV3_1.PathItemObject>;
|
|
10
10
|
export type PathItemContext = Context<PathItemContextData>;
|
|
11
11
|
export interface GenerationOptions {
|
|
12
12
|
type: 'admin' | 'content-api';
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE7D,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC/D,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,GAAG,aAAa,CAAC;CAC/B"}
|
package/dist/utils/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sources":["../../src/utils/debug.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEBUG_NAMESPACE } from '../constants';\n\nexport const createDebugger = (\n section: string | null = null,\n namespace: string = DEBUG_NAMESPACE\n) => {\n return section !== null ? createDebug(`${namespace}:${section}`) : createDebug(namespace);\n};\n"],"names":["createDebugger","section","namespace","DEBUG_NAMESPACE","createDebug"],"mappings":";;;;;MAIaA,cAAiB,GAAA,CAC5BC,UAAyB,IAAI,EAC7BC,YAAoBC,yBAAe,GAAA;IAEnC,OAAOF,OAAAA,KAAY,
|
|
1
|
+
{"version":3,"file":"debug.js","sources":["../../src/utils/debug.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEBUG_NAMESPACE } from '../constants';\n\nexport const createDebugger = (\n section: string | null = null,\n namespace: string = DEBUG_NAMESPACE\n) => {\n return section !== null ? createDebug(`${namespace}:${section}`) : createDebug(namespace);\n};\n"],"names":["createDebugger","section","namespace","DEBUG_NAMESPACE","createDebug"],"mappings":";;;;;MAIaA,cAAiB,GAAA,CAC5BC,UAAyB,IAAI,EAC7BC,YAAoBC,yBAAe,GAAA;IAEnC,OAAOF,OAAAA,KAAY,OAAOG,WAAY,CAAA,CAAA,EAAGF,UAAU,CAAC,EAAED,OAAS,CAAA,CAAA,CAAA,GAAIG,WAAYF,CAAAA,SAAAA,CAAAA;AACjF;;;;"}
|
package/dist/utils/debug.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.mjs","sources":["../../src/utils/debug.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEBUG_NAMESPACE } from '../constants';\n\nexport const createDebugger = (\n section: string | null = null,\n namespace: string = DEBUG_NAMESPACE\n) => {\n return section !== null ? createDebug(`${namespace}:${section}`) : createDebug(namespace);\n};\n"],"names":["createDebugger","section","namespace","DEBUG_NAMESPACE","createDebug"],"mappings":";;;MAIaA,cAAiB,GAAA,CAC5BC,UAAyB,IAAI,EAC7BC,YAAoBC,eAAe,GAAA;IAEnC,OAAOF,OAAAA,KAAY,
|
|
1
|
+
{"version":3,"file":"debug.mjs","sources":["../../src/utils/debug.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEBUG_NAMESPACE } from '../constants';\n\nexport const createDebugger = (\n section: string | null = null,\n namespace: string = DEBUG_NAMESPACE\n) => {\n return section !== null ? createDebug(`${namespace}:${section}`) : createDebug(namespace);\n};\n"],"names":["createDebugger","section","namespace","DEBUG_NAMESPACE","createDebug"],"mappings":";;;MAIaA,cAAiB,GAAA,CAC5BC,UAAyB,IAAI,EAC7BC,YAAoBC,eAAe,GAAA;IAEnC,OAAOF,OAAAA,KAAY,OAAOG,WAAY,CAAA,CAAA,EAAGF,UAAU,CAAC,EAAED,OAAS,CAAA,CAAA,CAAA,GAAIG,WAAYF,CAAAA,SAAAA,CAAAA;AACjF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.js","sources":["../../../src/utils/timer/timer.ts"],"sourcesContent":["export class Timer {\n private _startTime: number | null;\n\n private _endTime: number | null;\n\n private _elapsedTime: number | null;\n\n constructor() {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n\n start(): number {\n if (this._startTime !== null) {\n throw new Error(\n 'Timer is already started. Use `reset()` to reset the timer before starting it again.'\n );\n }\n\n this._startTime = Date.now();\n\n this._endTime = null;\n this._elapsedTime = null;\n\n return this._startTime;\n }\n\n stop() {\n if (this._startTime === null) {\n throw new Error('Timer is not started. Use `start()` to start the timer before stopping it.');\n }\n\n this._endTime = Date.now();\n this._elapsedTime = this._endTime - this._startTime;\n\n return { startTime: this._startTime, endTime: this._endTime, elapsedTime: this._elapsedTime };\n }\n\n reset(): void {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n}\n"],"names":["Timer","start","_startTime","Error","Date","now","_endTime","_elapsedTime","stop","startTime","endTime","elapsedTime","reset"
|
|
1
|
+
{"version":3,"file":"timer.js","sources":["../../../src/utils/timer/timer.ts"],"sourcesContent":["export class Timer {\n private _startTime: number | null;\n\n private _endTime: number | null;\n\n private _elapsedTime: number | null;\n\n constructor() {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n\n start(): number {\n if (this._startTime !== null) {\n throw new Error(\n 'Timer is already started. Use `reset()` to reset the timer before starting it again.'\n );\n }\n\n this._startTime = Date.now();\n\n this._endTime = null;\n this._elapsedTime = null;\n\n return this._startTime;\n }\n\n stop() {\n if (this._startTime === null) {\n throw new Error('Timer is not started. Use `start()` to start the timer before stopping it.');\n }\n\n this._endTime = Date.now();\n this._elapsedTime = this._endTime - this._startTime;\n\n return { startTime: this._startTime, endTime: this._endTime, elapsedTime: this._elapsedTime };\n }\n\n reset(): void {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n}\n"],"names":["Timer","start","_startTime","Error","Date","now","_endTime","_elapsedTime","stop","startTime","endTime","elapsedTime","reset"],"mappings":";;AAAO,MAAMA,KAAAA,CAAAA;IAaXC,KAAgB,GAAA;AACd,QAAA,IAAI,IAAI,CAACC,UAAU,KAAK,IAAM,EAAA;AAC5B,YAAA,MAAM,IAAIC,KACR,CAAA,sFAAA,CAAA;AAEJ;AAEA,QAAA,IAAI,CAACD,UAAU,GAAGE,IAAAA,CAAKC,GAAG,EAAA;QAE1B,IAAI,CAACC,QAAQ,GAAG,IAAA;QAChB,IAAI,CAACC,YAAY,GAAG,IAAA;QAEpB,OAAO,IAAI,CAACL,UAAU;AACxB;IAEAM,IAAO,GAAA;AACL,QAAA,IAAI,IAAI,CAACN,UAAU,KAAK,IAAM,EAAA;AAC5B,YAAA,MAAM,IAAIC,KAAM,CAAA,4EAAA,CAAA;AAClB;AAEA,QAAA,IAAI,CAACG,QAAQ,GAAGF,IAAAA,CAAKC,GAAG,EAAA;QACxB,IAAI,CAACE,YAAY,GAAG,IAAI,CAACD,QAAQ,GAAG,IAAI,CAACJ,UAAU;QAEnD,OAAO;YAAEO,SAAW,EAAA,IAAI,CAACP,UAAU;YAAEQ,OAAS,EAAA,IAAI,CAACJ,QAAQ;YAAEK,WAAa,EAAA,IAAI,CAACJ;AAAa,SAAA;AAC9F;IAEAK,KAAc,GAAA;QACZ,IAAI,CAACV,UAAU,GAAG,IAAA;QAClB,IAAI,CAACI,QAAQ,GAAG,IAAA;QAChB,IAAI,CAACC,YAAY,GAAG,IAAA;AACtB;IApCA,WAAc,EAAA;QACZ,IAAI,CAACL,UAAU,GAAG,IAAA;QAClB,IAAI,CAACI,QAAQ,GAAG,IAAA;QAChB,IAAI,CAACC,YAAY,GAAG,IAAA;AACtB;AAiCF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.mjs","sources":["../../../src/utils/timer/timer.ts"],"sourcesContent":["export class Timer {\n private _startTime: number | null;\n\n private _endTime: number | null;\n\n private _elapsedTime: number | null;\n\n constructor() {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n\n start(): number {\n if (this._startTime !== null) {\n throw new Error(\n 'Timer is already started. Use `reset()` to reset the timer before starting it again.'\n );\n }\n\n this._startTime = Date.now();\n\n this._endTime = null;\n this._elapsedTime = null;\n\n return this._startTime;\n }\n\n stop() {\n if (this._startTime === null) {\n throw new Error('Timer is not started. Use `start()` to start the timer before stopping it.');\n }\n\n this._endTime = Date.now();\n this._elapsedTime = this._endTime - this._startTime;\n\n return { startTime: this._startTime, endTime: this._endTime, elapsedTime: this._elapsedTime };\n }\n\n reset(): void {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n}\n"],"names":["Timer","start","_startTime","Error","Date","now","_endTime","_elapsedTime","stop","startTime","endTime","elapsedTime","reset"
|
|
1
|
+
{"version":3,"file":"timer.mjs","sources":["../../../src/utils/timer/timer.ts"],"sourcesContent":["export class Timer {\n private _startTime: number | null;\n\n private _endTime: number | null;\n\n private _elapsedTime: number | null;\n\n constructor() {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n\n start(): number {\n if (this._startTime !== null) {\n throw new Error(\n 'Timer is already started. Use `reset()` to reset the timer before starting it again.'\n );\n }\n\n this._startTime = Date.now();\n\n this._endTime = null;\n this._elapsedTime = null;\n\n return this._startTime;\n }\n\n stop() {\n if (this._startTime === null) {\n throw new Error('Timer is not started. Use `start()` to start the timer before stopping it.');\n }\n\n this._endTime = Date.now();\n this._elapsedTime = this._endTime - this._startTime;\n\n return { startTime: this._startTime, endTime: this._endTime, elapsedTime: this._elapsedTime };\n }\n\n reset(): void {\n this._startTime = null;\n this._endTime = null;\n this._elapsedTime = null;\n }\n}\n"],"names":["Timer","start","_startTime","Error","Date","now","_endTime","_elapsedTime","stop","startTime","endTime","elapsedTime","reset"],"mappings":"AAAO,MAAMA,KAAAA,CAAAA;IAaXC,KAAgB,GAAA;AACd,QAAA,IAAI,IAAI,CAACC,UAAU,KAAK,IAAM,EAAA;AAC5B,YAAA,MAAM,IAAIC,KACR,CAAA,sFAAA,CAAA;AAEJ;AAEA,QAAA,IAAI,CAACD,UAAU,GAAGE,IAAAA,CAAKC,GAAG,EAAA;QAE1B,IAAI,CAACC,QAAQ,GAAG,IAAA;QAChB,IAAI,CAACC,YAAY,GAAG,IAAA;QAEpB,OAAO,IAAI,CAACL,UAAU;AACxB;IAEAM,IAAO,GAAA;AACL,QAAA,IAAI,IAAI,CAACN,UAAU,KAAK,IAAM,EAAA;AAC5B,YAAA,MAAM,IAAIC,KAAM,CAAA,4EAAA,CAAA;AAClB;AAEA,QAAA,IAAI,CAACG,QAAQ,GAAGF,IAAAA,CAAKC,GAAG,EAAA;QACxB,IAAI,CAACE,YAAY,GAAG,IAAI,CAACD,QAAQ,GAAG,IAAI,CAACJ,UAAU;QAEnD,OAAO;YAAEO,SAAW,EAAA,IAAI,CAACP,UAAU;YAAEQ,OAAS,EAAA,IAAI,CAACJ,QAAQ;YAAEK,WAAa,EAAA,IAAI,CAACJ;AAAa,SAAA;AAC9F;IAEAK,KAAc,GAAA;QACZ,IAAI,CAACV,UAAU,GAAG,IAAA;QAClB,IAAI,CAACI,QAAQ,GAAG,IAAA;QAChB,IAAI,CAACC,YAAY,GAAG,IAAA;AACtB;IApCA,WAAc,EAAA;QACZ,IAAI,CAACL,UAAU,GAAG,IAAA;QAClB,IAAI,CAACI,QAAQ,GAAG,IAAA;QAChB,IAAI,CAACC,YAAY,GAAG,IAAA;AACtB;AAiCF;;;;"}
|
package/dist/utils/zod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
import type {
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
3
3
|
/**
|
|
4
4
|
* Converts a Zod schema to an OpenAPI Schema Object.
|
|
5
5
|
*
|
|
@@ -15,7 +15,7 @@ import type { OpenAPIV3 } from 'openapi-types';
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```typescript
|
|
18
|
-
* import
|
|
18
|
+
* import * as z from 'zod/v4';
|
|
19
19
|
*
|
|
20
20
|
* // Create a Zod schema
|
|
21
21
|
* const userSchema = z.object({
|
|
@@ -28,7 +28,7 @@ import type { OpenAPIV3 } from 'openapi-types';
|
|
|
28
28
|
* const openAPISchema = zodToOpenAPI(userSchema);
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export declare const zodToOpenAPI: (zodSchema: z.ZodType) =>
|
|
31
|
+
export declare const zodToOpenAPI: (zodSchema: z.ZodType) => OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject;
|
|
32
32
|
/**
|
|
33
33
|
* Generates a path string for referencing a component schema by its identifier.
|
|
34
34
|
*
|
package/dist/utils/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/utils/zod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/utils/zod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,eAAO,MAAM,YAAY,cACZ,EAAE,OAAO,KACnB,YAAY,YAAY,GAAG,YAAY,eAsBzC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,OAAQ,MAAM,WAAiC,CAAC"}
|
package/dist/utils/zod.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var z = require('zod');
|
|
4
|
+
var z = require('zod/v4');
|
|
5
5
|
|
|
6
6
|
function _interopNamespaceDefault(e) {
|
|
7
7
|
var n = Object.create(null);
|
|
@@ -37,7 +37,7 @@ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* ```typescript
|
|
40
|
-
* import
|
|
40
|
+
* import * as z from 'zod/v4';
|
|
41
41
|
*
|
|
42
42
|
* // Create a Zod schema
|
|
43
43
|
* const userSchema = z.object({
|
package/dist/utils/zod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.js","sources":["../../src/utils/zod.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport * as z from 'zod';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"zod.js","sources":["../../src/utils/zod.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport * as z from 'zod/v4';\n\nimport type { OpenAPIV3_1 } from 'openapi-types';\n\n/**\n * Converts a Zod schema to an OpenAPI Schema Object.\n *\n * @description\n * Takes a Zod schema and converts it into an OpenAPI Schema Object (v3.1).\n * It uses a local registry to handle the conversion process and generates the appropriate\n * OpenAPI components.\n *\n * @param zodSchema - The Zod schema to convert to OpenAPI format. Can be any valid Zod schema.\n *\n * @returns An OpenAPI Schema Object representing the input Zod schema structure.\n * If the conversion cannot be completed, returns undefined.\n *\n * @example\n * ```typescript\n * import * as z from 'zod/v4';\n *\n * // Create a Zod schema\n * const userSchema = z.object({\n * id: z.number(),\n * name: z.string(),\n * email: z.string().email()\n * });\n *\n * // Convert to OpenAPI schema\n * const openAPISchema = zodToOpenAPI(userSchema);\n * ```\n */\n\nexport const zodToOpenAPI = (\n zodSchema: z.ZodType\n): OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject => {\n try {\n const id = randomUUID();\n const registry = z.registry<{ id: string }>();\n\n // Add the schema to the local registry with a custom, unique ID\n registry.add(zodSchema, { id });\n\n // Copy the global registry definitions into the local registry to make sure references are resolved\n // This prevent \"__shared\" definitions from being created\n for (const [key, value] of z.globalRegistry._idmap) {\n registry.add(value, { id: key });\n }\n\n // Generate the schemas and only return the one we want, transform the URI path to be OpenAPI compliant\n const { schemas } = z.toJSONSchema(registry, { uri: toComponentsPath });\n\n // TODO: make sure it's compliant\n return schemas[id] as OpenAPIV3_1.SchemaObject;\n } catch (e) {\n throw new Error(\"Couldn't transform the zod schema into an OpenAPI schema\");\n }\n};\n\n/**\n * Generates a path string for referencing a component schema by its identifier.\n *\n * @param id - The identifier of the component schema.\n * @returns The constructed path string for the specified component schema.\n */\nexport const toComponentsPath = (id: string) => `#/components/schemas/${id}`;\n"],"names":["zodToOpenAPI","zodSchema","id","randomUUID","registry","z","add","key","value","globalRegistry","_idmap","schemas","toJSONSchema","uri","toComponentsPath","e","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BaA,MAAAA,YAAAA,GAAe,CAC1BC,SAAAA,GAAAA;IAEA,IAAI;AACF,QAAA,MAAMC,EAAKC,GAAAA,sBAAAA,EAAAA;QACX,MAAMC,QAAAA,GAAWC,aAAED,QAAQ,EAAA;;QAG3BA,QAASE,CAAAA,GAAG,CAACL,SAAW,EAAA;AAAEC,YAAAA;AAAG,SAAA,CAAA;;;QAI7B,KAAK,MAAM,CAACK,GAAKC,EAAAA,KAAAA,CAAM,IAAIH,YAAEI,CAAAA,cAAc,CAACC,MAAM,CAAE;YAClDN,QAASE,CAAAA,GAAG,CAACE,KAAO,EAAA;gBAAEN,EAAIK,EAAAA;AAAI,aAAA,CAAA;AAChC;;AAGA,QAAA,MAAM,EAAEI,OAAO,EAAE,GAAGN,YAAEO,CAAAA,YAAY,CAACR,QAAU,EAAA;YAAES,GAAKC,EAAAA;AAAiB,SAAA,CAAA;;QAGrE,OAAOH,OAAO,CAACT,EAAG,CAAA;AACpB,KAAA,CAAE,OAAOa,CAAG,EAAA;AACV,QAAA,MAAM,IAAIC,KAAM,CAAA,0DAAA,CAAA;AAClB;AACF;AAEA;;;;;UAMaF,gBAAmB,GAAA,CAACZ,KAAe,CAAC,qBAAqB,EAAEA,EAAAA,CAAAA;;;;;"}
|
package/dist/utils/zod.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import * as z from 'zod';
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Converts a Zod schema to an OpenAPI Schema Object.
|
|
@@ -16,7 +16,7 @@ import * as z from 'zod';
|
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```typescript
|
|
19
|
-
* import
|
|
19
|
+
* import * as z from 'zod/v4';
|
|
20
20
|
*
|
|
21
21
|
* // Create a Zod schema
|
|
22
22
|
* const userSchema = z.object({
|
package/dist/utils/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","sources":["../../src/utils/zod.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport * as z from 'zod';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"zod.mjs","sources":["../../src/utils/zod.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport * as z from 'zod/v4';\n\nimport type { OpenAPIV3_1 } from 'openapi-types';\n\n/**\n * Converts a Zod schema to an OpenAPI Schema Object.\n *\n * @description\n * Takes a Zod schema and converts it into an OpenAPI Schema Object (v3.1).\n * It uses a local registry to handle the conversion process and generates the appropriate\n * OpenAPI components.\n *\n * @param zodSchema - The Zod schema to convert to OpenAPI format. Can be any valid Zod schema.\n *\n * @returns An OpenAPI Schema Object representing the input Zod schema structure.\n * If the conversion cannot be completed, returns undefined.\n *\n * @example\n * ```typescript\n * import * as z from 'zod/v4';\n *\n * // Create a Zod schema\n * const userSchema = z.object({\n * id: z.number(),\n * name: z.string(),\n * email: z.string().email()\n * });\n *\n * // Convert to OpenAPI schema\n * const openAPISchema = zodToOpenAPI(userSchema);\n * ```\n */\n\nexport const zodToOpenAPI = (\n zodSchema: z.ZodType\n): OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject => {\n try {\n const id = randomUUID();\n const registry = z.registry<{ id: string }>();\n\n // Add the schema to the local registry with a custom, unique ID\n registry.add(zodSchema, { id });\n\n // Copy the global registry definitions into the local registry to make sure references are resolved\n // This prevent \"__shared\" definitions from being created\n for (const [key, value] of z.globalRegistry._idmap) {\n registry.add(value, { id: key });\n }\n\n // Generate the schemas and only return the one we want, transform the URI path to be OpenAPI compliant\n const { schemas } = z.toJSONSchema(registry, { uri: toComponentsPath });\n\n // TODO: make sure it's compliant\n return schemas[id] as OpenAPIV3_1.SchemaObject;\n } catch (e) {\n throw new Error(\"Couldn't transform the zod schema into an OpenAPI schema\");\n }\n};\n\n/**\n * Generates a path string for referencing a component schema by its identifier.\n *\n * @param id - The identifier of the component schema.\n * @returns The constructed path string for the specified component schema.\n */\nexport const toComponentsPath = (id: string) => `#/components/schemas/${id}`;\n"],"names":["zodToOpenAPI","zodSchema","id","randomUUID","registry","z","add","key","value","globalRegistry","_idmap","schemas","toJSONSchema","uri","toComponentsPath","e","Error"],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BaA,MAAAA,YAAAA,GAAe,CAC1BC,SAAAA,GAAAA;IAEA,IAAI;AACF,QAAA,MAAMC,EAAKC,GAAAA,UAAAA,EAAAA;QACX,MAAMC,QAAAA,GAAWC,EAAED,QAAQ,EAAA;;QAG3BA,QAASE,CAAAA,GAAG,CAACL,SAAW,EAAA;AAAEC,YAAAA;AAAG,SAAA,CAAA;;;QAI7B,KAAK,MAAM,CAACK,GAAKC,EAAAA,KAAAA,CAAM,IAAIH,CAAEI,CAAAA,cAAc,CAACC,MAAM,CAAE;YAClDN,QAASE,CAAAA,GAAG,CAACE,KAAO,EAAA;gBAAEN,EAAIK,EAAAA;AAAI,aAAA,CAAA;AAChC;;AAGA,QAAA,MAAM,EAAEI,OAAO,EAAE,GAAGN,CAAEO,CAAAA,YAAY,CAACR,QAAU,EAAA;YAAES,GAAKC,EAAAA;AAAiB,SAAA,CAAA;;QAGrE,OAAOH,OAAO,CAACT,EAAG,CAAA;AACpB,KAAA,CAAE,OAAOa,CAAG,EAAA;AACV,QAAA,MAAM,IAAIC,KAAM,CAAA,0DAAA,CAAA;AAClB;AACF;AAEA;;;;;UAMaF,gBAAmB,GAAA,CAACZ,KAAe,CAAC,qBAAqB,EAAEA,EAAAA,CAAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/openapi",
|
|
3
|
-
"version": "0.0.0-experimental.
|
|
3
|
+
"version": "0.0.0-experimental.50e7f41993c2e6e11d3c5a39b47f003ddb06cddc",
|
|
4
4
|
"description": "A tool set to help generate and validate API documentation for Strapi projects",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -52,17 +52,16 @@
|
|
|
52
52
|
"test:unit:watch": "run -T jest --watch"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
|
-
"node": ">=
|
|
55
|
+
"node": ">=20.0.0 <=24.x.x",
|
|
56
56
|
"npm": ">=6.0.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@strapi/types": "0.0.0-experimental.4e03c41e8e44fa7b77c41c3e0edd86c7f1fc9c52",
|
|
60
59
|
"debug": "4.3.4",
|
|
61
60
|
"openapi-types": "12.1.3",
|
|
62
|
-
"zod": "
|
|
61
|
+
"zod": "3.25.67"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
|
-
"@strapi/types": "
|
|
64
|
+
"@strapi/types": "0.0.0-experimental.50e7f41993c2e6e11d3c5a39b47f003ddb06cddc",
|
|
66
65
|
"@types/debug": "^4"
|
|
67
66
|
}
|
|
68
67
|
}
|