@visulima/api-platform 4.0.0-alpha.7 → 4.0.0-alpha.8
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/CHANGELOG.md +30 -0
- package/LICENSE.md +109 -0
- package/dist/connect/create-node-router.d.cts +24 -0
- package/dist/connect/create-node-router.d.mts +24 -0
- package/dist/connect/create-node-router.d.ts +24 -0
- package/dist/connect/handler.d.cts +5 -0
- package/dist/connect/handler.d.mts +5 -0
- package/dist/connect/handler.d.ts +5 -0
- package/dist/connect/middleware/cors-middleware.d.cts +5 -0
- package/dist/connect/middleware/cors-middleware.d.mts +5 -0
- package/dist/connect/middleware/cors-middleware.d.ts +5 -0
- package/dist/connect/middleware/http-header-normalizer.d.cts +12 -0
- package/dist/connect/middleware/http-header-normalizer.d.mts +12 -0
- package/dist/connect/middleware/http-header-normalizer.d.ts +12 -0
- package/dist/connect/middleware/rate-limiter-middleware.d.cts +7 -0
- package/dist/connect/middleware/rate-limiter-middleware.d.mts +7 -0
- package/dist/connect/middleware/rate-limiter-middleware.d.ts +7 -0
- package/dist/connect/middleware/serializers-middleware.d.cts +6 -0
- package/dist/connect/middleware/serializers-middleware.d.mts +6 -0
- package/dist/connect/middleware/serializers-middleware.d.ts +6 -0
- package/dist/error-handler/jsonapi-error-handler.d.cts +3 -0
- package/dist/error-handler/jsonapi-error-handler.d.mts +3 -0
- package/dist/error-handler/jsonapi-error-handler.d.ts +3 -0
- package/dist/error-handler/problem-error-handler.d.cts +7 -0
- package/dist/error-handler/problem-error-handler.d.mts +7 -0
- package/dist/error-handler/problem-error-handler.d.ts +7 -0
- package/dist/error-handler/utils.d.cts +9 -0
- package/dist/error-handler/utils.d.mts +9 -0
- package/dist/error-handler/utils.d.ts +9 -0
- package/dist/framework/cli/command/list/get-routes.d.cts +7 -0
- package/dist/framework/cli/command/list/get-routes.d.mts +7 -0
- package/dist/framework/cli/command/list/get-routes.d.ts +7 -0
- package/dist/framework/cli/command/list/list-command.d.cts +9 -0
- package/dist/framework/cli/command/list/list-command.d.mts +9 -0
- package/dist/framework/cli/command/list/list-command.d.ts +9 -0
- package/dist/framework/cli/command/list/routes/express/express-path-parser.d.cts +16 -0
- package/dist/framework/cli/command/list/routes/express/express-path-parser.d.mts +16 -0
- package/dist/framework/cli/command/list/routes/express/express-path-parser.d.ts +16 -0
- package/dist/framework/cli/command/list/routes/express/map-keys-to-path.d.cts +9 -0
- package/dist/framework/cli/command/list/routes/express/map-keys-to-path.d.mts +9 -0
- package/dist/framework/cli/command/list/routes/express/map-keys-to-path.d.ts +9 -0
- package/dist/framework/cli/command/list/routes/express/path-regex-parser.d.cts +11 -0
- package/dist/framework/cli/command/list/routes/express/path-regex-parser.d.mts +11 -0
- package/dist/framework/cli/command/list/routes/express/path-regex-parser.d.ts +11 -0
- package/dist/framework/cli/command/list/routes/express-routes.d.cts +4 -0
- package/dist/framework/cli/command/list/routes/express-routes.d.mts +4 -0
- package/dist/framework/cli/command/list/routes/express-routes.d.ts +4 -0
- package/dist/framework/cli/command/list/routes/fastify-routes.d.cts +4 -0
- package/dist/framework/cli/command/list/routes/fastify-routes.d.mts +4 -0
- package/dist/framework/cli/command/list/routes/fastify-routes.d.ts +4 -0
- package/dist/framework/cli/command/list/routes/hapi-routes.d.cts +4 -0
- package/dist/framework/cli/command/list/routes/hapi-routes.d.mts +4 -0
- package/dist/framework/cli/command/list/routes/hapi-routes.d.ts +4 -0
- package/dist/framework/cli/command/list/routes/koa-routes.d.cts +4 -0
- package/dist/framework/cli/command/list/routes/koa-routes.d.mts +4 -0
- package/dist/framework/cli/command/list/routes/koa-routes.d.ts +4 -0
- package/dist/framework/cli/command/list/routes/next/api-route-file-parser.d.cts +3 -0
- package/dist/framework/cli/command/list/routes/next/api-route-file-parser.d.mts +3 -0
- package/dist/framework/cli/command/list/routes/next/api-route-file-parser.d.ts +3 -0
- package/dist/framework/cli/command/list/routes/next/collect-api-route-files.d.cts +2 -0
- package/dist/framework/cli/command/list/routes/next/collect-api-route-files.d.mts +2 -0
- package/dist/framework/cli/command/list/routes/next/collect-api-route-files.d.ts +2 -0
- package/dist/framework/cli/command/list/routes/routes-group-by.d.cts +3 -0
- package/dist/framework/cli/command/list/routes/routes-group-by.d.mts +3 -0
- package/dist/framework/cli/command/list/routes/routes-group-by.d.ts +3 -0
- package/dist/framework/cli/command/list/routes/routes-render.d.cts +5 -0
- package/dist/framework/cli/command/list/routes/routes-render.d.mts +5 -0
- package/dist/framework/cli/command/list/routes/routes-render.d.ts +5 -0
- package/dist/framework/cli/command/list/routes/types.d.cts +6 -0
- package/dist/framework/cli/command/list/routes/types.d.mts +6 -0
- package/dist/framework/cli/command/list/routes/types.d.ts +6 -0
- package/dist/framework/cli/command/list/utils.d.cts +11 -0
- package/dist/framework/cli/command/list/utils.d.mts +11 -0
- package/dist/framework/cli/command/list/utils.d.ts +11 -0
- package/dist/framework/cli/index.cjs +1 -0
- package/dist/framework/cli/index.d.cts +1 -0
- package/dist/framework/cli/index.d.mts +1 -10
- package/dist/framework/cli/index.d.ts +1 -10
- package/dist/framework/cli/index.mjs +1 -2
- package/dist/framework/next/index-browser.d.cts +1 -0
- package/dist/framework/next/index-browser.d.mts +1 -5
- package/dist/framework/next/index-browser.d.ts +1 -5
- package/dist/framework/next/index-browser.mjs +1 -2
- package/dist/framework/next/index-server.cjs +1 -0
- package/dist/framework/next/index-server.d.cts +3 -0
- package/dist/framework/next/index-server.d.mts +3 -20
- package/dist/framework/next/index-server.d.ts +3 -20
- package/dist/framework/next/index-server.mjs +1 -2
- package/dist/framework/next/routes/api/swagger.d.cts +6 -0
- package/dist/framework/next/routes/api/swagger.d.mts +6 -0
- package/dist/framework/next/routes/api/swagger.d.ts +6 -0
- package/dist/framework/next/routes/pages/get-static-properties-swagger.d.cts +3 -0
- package/dist/framework/next/routes/pages/get-static-properties-swagger.d.mts +3 -0
- package/dist/framework/next/routes/pages/get-static-properties-swagger.d.ts +3 -0
- package/dist/framework/next/routes/pages/redoc/index.cjs +5 -0
- package/dist/framework/next/routes/pages/redoc/index.d.cts +6 -0
- package/dist/framework/next/routes/pages/redoc/index.d.mts +3 -5
- package/dist/framework/next/routes/pages/redoc/index.d.ts +2 -4
- package/dist/framework/next/routes/pages/redoc/index.mjs +2 -3
- package/dist/framework/next/routes/pages/swagger/index.cjs +5 -0
- package/dist/framework/next/routes/pages/swagger/index.d.cts +5 -0
- package/dist/framework/next/routes/pages/swagger/index.d.mts +4 -6
- package/dist/framework/next/routes/pages/swagger/index.d.ts +3 -5
- package/dist/framework/next/routes/pages/swagger/index.mjs +2 -3
- package/dist/framework/next/webpack/with-open-api.d.cts +11 -0
- package/dist/framework/next/webpack/with-open-api.d.mts +11 -0
- package/dist/framework/next/webpack/with-open-api.d.ts +11 -0
- package/dist/index-browser.d.cts +1 -0
- package/dist/index-browser.d.mts +1 -2
- package/dist/index-browser.d.ts +1 -2
- package/dist/index-browser.mjs +1 -2
- package/dist/index-server.cjs +1 -0
- package/dist/index-server.d.cts +14 -0
- package/dist/index-server.d.mts +14 -75
- package/dist/index-server.d.ts +14 -75
- package/dist/index-server.mjs +1 -3
- package/dist/packem_shared/corsMiddleware-D1pyvOyv.mjs +1 -0
- package/dist/packem_shared/corsMiddleware-DWTsl8B1.cjs +1 -0
- package/dist/packem_shared/createNodeRouter-Dm5Whmms.mjs +1 -0
- package/dist/packem_shared/createNodeRouter-iaG84YWy.cjs +1 -0
- package/dist/packem_shared/dateIn-C9Ti6fo7.mjs +1 -0
- package/dist/packem_shared/dateIn-DylTg8aG.cjs +1 -0
- package/dist/packem_shared/getSwaggerStaticProps-CyQoc8U9.cjs +1 -0
- package/dist/packem_shared/getSwaggerStaticProps-HLLlemG9.js +1 -0
- package/dist/packem_shared/getSwaggerStaticProps-HLLlemG9.mjs +1 -0
- package/dist/packem_shared/httpHeaderNormalizerMiddleware-DjISyK8_.mjs +1 -0
- package/dist/packem_shared/httpHeaderNormalizerMiddleware-QqE89aK5.cjs +1 -0
- package/dist/packem_shared/index-BjPTPgei.cjs +1 -0
- package/dist/packem_shared/index-C3aJF6SV.mjs +1 -0
- package/dist/packem_shared/listCommand-BQnW5VPN.mjs +5 -0
- package/dist/packem_shared/listCommand-CUt5_WGC.cjs +5 -0
- package/dist/packem_shared/onError-DIbxlS28.cjs +1 -0
- package/dist/packem_shared/onError-DzFkIIU_.mjs +1 -0
- package/dist/packem_shared/rateLimiterMiddleware-Ohn-bfGn.mjs +1 -0
- package/dist/packem_shared/rateLimiterMiddleware-iKphEEyl.cjs +1 -0
- package/dist/packem_shared/serialize-BQ5nNuTA.mjs +1 -0
- package/dist/packem_shared/serialize-DrSd3bRJ.cjs +1 -0
- package/dist/packem_shared/serializersMiddleware-DmYV9JsS.cjs +1 -0
- package/dist/packem_shared/serializersMiddleware-WsnnEh4z.mjs +1 -0
- package/dist/packem_shared/swaggerApiRoute-Bg8TT2PM.cjs +1 -0
- package/dist/packem_shared/swaggerApiRoute-uMNR4Fq6.mjs +1 -0
- package/dist/packem_shared/swaggerHandler-D4zaMC6r.cjs +1 -0
- package/dist/packem_shared/swaggerHandler-Dcg9F7KZ.mjs +1 -0
- package/dist/packem_shared/utils-B3c9VYrK.cjs +1 -0
- package/dist/packem_shared/utils-CDFMC8qn.mjs +1 -0
- package/dist/packem_shared/withOpenApi-D27jB-z-.cjs +1 -0
- package/dist/packem_shared/withOpenApi-DXirQ48v.mjs +1 -0
- package/dist/packem_shared/xmlTransformer-D49hlcok.mjs +1 -0
- package/dist/packem_shared/xmlTransformer-sHYc31_g.cjs +1 -0
- package/dist/packem_shared/yamlTransformer-CJsV5N3c.mjs +1 -0
- package/dist/packem_shared/yamlTransformer-DgcCb8ww.cjs +1 -0
- package/dist/packem_shared/zod-Bvj53ziu.cjs +1 -0
- package/dist/packem_shared/zod-D9vLMypI.mjs +1 -0
- package/dist/serializers/has-json-structure.d.cts +2 -0
- package/dist/serializers/has-json-structure.d.mts +2 -0
- package/dist/serializers/has-json-structure.d.ts +2 -0
- package/dist/serializers/index.d.cts +4 -0
- package/dist/serializers/index.d.mts +4 -0
- package/dist/serializers/index.d.ts +4 -0
- package/dist/serializers/serialize.d.cts +6 -0
- package/dist/serializers/serialize.d.mts +6 -0
- package/dist/serializers/serialize.d.ts +6 -0
- package/dist/serializers/transformer/xml.d.cts +3 -0
- package/dist/serializers/transformer/xml.d.mts +3 -0
- package/dist/serializers/transformer/xml.d.ts +3 -0
- package/dist/serializers/transformer/yaml.d.cts +3 -0
- package/dist/serializers/transformer/yaml.d.mts +3 -0
- package/dist/serializers/transformer/yaml.d.ts +3 -0
- package/dist/swagger/api/swagger-handler.d.cts +15 -0
- package/dist/swagger/api/swagger-handler.d.mts +15 -0
- package/dist/swagger/api/swagger-handler.d.ts +15 -0
- package/dist/swagger/extend-swagger-spec.d.cts +7 -0
- package/dist/swagger/extend-swagger-spec.d.mts +7 -0
- package/dist/swagger/extend-swagger-spec.d.ts +7 -0
- package/dist/utils.d.cts +10 -0
- package/dist/utils.d.mts +10 -0
- package/dist/utils.d.ts +10 -0
- package/dist/zod/date-in-schema.d.cts +12 -0
- package/dist/zod/date-in-schema.d.mts +12 -0
- package/dist/zod/date-in-schema.d.ts +12 -0
- package/dist/zod/date-out-schema.d.cts +11 -0
- package/dist/zod/date-out-schema.d.mts +11 -0
- package/dist/zod/date-out-schema.d.ts +11 -0
- package/dist/zod/index.d.cts +5 -0
- package/dist/zod/index.d.mts +5 -0
- package/dist/zod/index.d.ts +5 -0
- package/package.json +62 -39
- package/dist/chunk-2RCSQLSQ.js +0 -2
- package/dist/chunk-2RCSQLSQ.js.map +0 -1
- package/dist/chunk-4C666HHU.js +0 -2
- package/dist/chunk-4C666HHU.js.map +0 -1
- package/dist/chunk-5DME62EW.mjs +0 -2
- package/dist/chunk-5DME62EW.mjs.map +0 -1
- package/dist/chunk-BJSUSPWM.mjs +0 -2
- package/dist/chunk-BJSUSPWM.mjs.map +0 -1
- package/dist/chunk-EEEP2HBM.js +0 -2
- package/dist/chunk-EEEP2HBM.js.map +0 -1
- package/dist/chunk-FQUHP33M.js +0 -6
- package/dist/chunk-FQUHP33M.js.map +0 -1
- package/dist/chunk-HZWWJL43.mjs +0 -2
- package/dist/chunk-HZWWJL43.mjs.map +0 -1
- package/dist/chunk-JPUMGEAE.mjs +0 -6
- package/dist/chunk-JPUMGEAE.mjs.map +0 -1
- package/dist/chunk-LTU4LAD7.mjs +0 -2
- package/dist/chunk-LTU4LAD7.mjs.map +0 -1
- package/dist/chunk-NCNFFJRK.js +0 -2
- package/dist/chunk-NCNFFJRK.js.map +0 -1
- package/dist/framework/cli/commander/index.d.mts +0 -5
- package/dist/framework/cli/commander/index.d.ts +0 -5
- package/dist/framework/cli/commander/index.js +0 -2
- package/dist/framework/cli/commander/index.js.map +0 -1
- package/dist/framework/cli/commander/index.mjs +0 -2
- package/dist/framework/cli/commander/index.mjs.map +0 -1
- package/dist/framework/cli/index.js +0 -2
- package/dist/framework/cli/index.js.map +0 -1
- package/dist/framework/cli/index.mjs.map +0 -1
- package/dist/framework/next/index-browser.js +0 -2
- package/dist/framework/next/index-browser.js.map +0 -1
- package/dist/framework/next/index-browser.mjs.map +0 -1
- package/dist/framework/next/index-server.js +0 -2
- package/dist/framework/next/index-server.js.map +0 -1
- package/dist/framework/next/index-server.mjs.map +0 -1
- package/dist/framework/next/routes/pages/redoc/index.js +0 -8
- package/dist/framework/next/routes/pages/redoc/index.js.map +0 -1
- package/dist/framework/next/routes/pages/redoc/index.mjs.map +0 -1
- package/dist/framework/next/routes/pages/swagger/index.js +0 -8
- package/dist/framework/next/routes/pages/swagger/index.js.map +0 -1
- package/dist/framework/next/routes/pages/swagger/index.mjs.map +0 -1
- package/dist/index-browser-Cy6Ywaan.d.mts +0 -30
- package/dist/index-browser-Cy6Ywaan.d.ts +0 -30
- package/dist/index-browser.js +0 -2
- package/dist/index-browser.js.map +0 -1
- package/dist/index-browser.mjs.map +0 -1
- package/dist/index-server.js +0 -3
- package/dist/index-server.js.map +0 -1
- package/dist/index-server.mjs.map +0 -1
- package/dist/swagger-handler-BPZJNDgC.d.mts +0 -17
- package/dist/swagger-handler-BPZJNDgC.d.ts +0 -17
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { ModelsToOpenApiParameters, SwaggerModelsConfig } from "@visulima/crud";
|
|
3
|
+
import type { OpenAPIV3 } from "openapi-types";
|
|
4
|
+
declare const swaggerHandler: <M extends string, PrismaClient>(options?: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => ((request: IncomingMessage, response: ServerResponse) => Promise<void>);
|
|
5
|
+
export interface SwaggerHandlerOptions<M extends string, PrismaClient> {
|
|
6
|
+
allowedMediaTypes: Record<string, boolean>;
|
|
7
|
+
crud: Exclude<ModelsToOpenApiParameters<M, PrismaClient>, "swagger"> & {
|
|
8
|
+
swagger?: {
|
|
9
|
+
models?: SwaggerModelsConfig<M>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
specs?: Partial<OpenAPIV3.Document>[];
|
|
13
|
+
swaggerFilePath: string;
|
|
14
|
+
}
|
|
15
|
+
export = swaggerHandler;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { ModelsToOpenApiParameters, SwaggerModelsConfig } from "@visulima/crud";
|
|
3
|
+
import type { OpenAPIV3 } from "openapi-types";
|
|
4
|
+
declare const swaggerHandler: <M extends string, PrismaClient>(options?: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => ((request: IncomingMessage, response: ServerResponse) => Promise<void>);
|
|
5
|
+
export interface SwaggerHandlerOptions<M extends string, PrismaClient> {
|
|
6
|
+
allowedMediaTypes: Record<string, boolean>;
|
|
7
|
+
crud: Exclude<ModelsToOpenApiParameters<M, PrismaClient>, "swagger"> & {
|
|
8
|
+
swagger?: {
|
|
9
|
+
models?: SwaggerModelsConfig<M>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
specs?: Partial<OpenAPIV3.Document>[];
|
|
13
|
+
swaggerFilePath: string;
|
|
14
|
+
}
|
|
15
|
+
export default swaggerHandler;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { ModelsToOpenApiParameters, SwaggerModelsConfig } from "@visulima/crud";
|
|
3
|
+
import type { OpenAPIV3 } from "openapi-types";
|
|
4
|
+
declare const swaggerHandler: <M extends string, PrismaClient>(options?: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => ((request: IncomingMessage, response: ServerResponse) => Promise<void>);
|
|
5
|
+
export interface SwaggerHandlerOptions<M extends string, PrismaClient> {
|
|
6
|
+
allowedMediaTypes: Record<string, boolean>;
|
|
7
|
+
crud: Exclude<ModelsToOpenApiParameters<M, PrismaClient>, "swagger"> & {
|
|
8
|
+
swagger?: {
|
|
9
|
+
models?: SwaggerModelsConfig<M>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
specs?: Partial<OpenAPIV3.Document>[];
|
|
13
|
+
swaggerFilePath: string;
|
|
14
|
+
}
|
|
15
|
+
export = swaggerHandler;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
type Transformers = {
|
|
3
|
+
regex: RegExp;
|
|
4
|
+
transformer: (data: any) => string;
|
|
5
|
+
}[];
|
|
6
|
+
export default function extendSwaggerSpec(spec: Partial<OpenAPIV3.Document>, allowedMediaTypes?: Record<string, boolean>, transformers?: Transformers): Partial<OpenAPIV3.Document>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
type Transformers = {
|
|
3
|
+
regex: RegExp;
|
|
4
|
+
transformer: (data: any) => string;
|
|
5
|
+
}[];
|
|
6
|
+
export default function extendSwaggerSpec(spec: Partial<OpenAPIV3.Document>, allowedMediaTypes?: Record<string, boolean>, transformers?: Transformers): Partial<OpenAPIV3.Document>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
type Transformers = {
|
|
3
|
+
regex: RegExp;
|
|
4
|
+
transformer: (data: any) => string;
|
|
5
|
+
}[];
|
|
6
|
+
export default function extendSwaggerSpec(spec: Partial<OpenAPIV3.Document>, allowedMediaTypes?: Record<string, boolean>, transformers?: Transformers): Partial<OpenAPIV3.Document>;
|
|
7
|
+
export {};
|
package/dist/utils.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
type IncomingApiRequest<TApiRequest = IncomingMessage> = TApiRequest & {
|
|
3
|
+
body?: any;
|
|
4
|
+
query?: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const jsonResponse: (response: ServerResponse, status: number, data?: unknown) => void;
|
|
7
|
+
export declare const parseBody: (request: IncomingApiRequest) => Promise<any>;
|
|
8
|
+
export declare const parseQuery: (request: IncomingApiRequest) => Record<string, unknown>;
|
|
9
|
+
export declare const toHeaderCase: (string_: string) => string;
|
|
10
|
+
export {};
|
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
type IncomingApiRequest<TApiRequest = IncomingMessage> = TApiRequest & {
|
|
3
|
+
body?: any;
|
|
4
|
+
query?: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const jsonResponse: (response: ServerResponse, status: number, data?: unknown) => void;
|
|
7
|
+
export declare const parseBody: (request: IncomingApiRequest) => Promise<any>;
|
|
8
|
+
export declare const parseQuery: (request: IncomingApiRequest) => Record<string, unknown>;
|
|
9
|
+
export declare const toHeaderCase: (string_: string) => string;
|
|
10
|
+
export {};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
type IncomingApiRequest<TApiRequest = IncomingMessage> = TApiRequest & {
|
|
3
|
+
body?: any;
|
|
4
|
+
query?: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const jsonResponse: (response: ServerResponse, status: number, data?: unknown) => void;
|
|
7
|
+
export declare const parseBody: (request: IncomingApiRequest) => Promise<any>;
|
|
8
|
+
export declare const parseQuery: (request: IncomingApiRequest) => Record<string, unknown>;
|
|
9
|
+
export declare const toHeaderCase: (string_: string) => string;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParseInput, ParseReturnType, ZodTypeDef } from "zod";
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
|
+
declare const zodDateInKind = "ZodDateIn";
|
|
4
|
+
export declare const isoDateRegex: RegExp;
|
|
5
|
+
export interface ZodDateInDef extends ZodTypeDef {
|
|
6
|
+
typeName: typeof zodDateInKind;
|
|
7
|
+
}
|
|
8
|
+
export declare class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {
|
|
9
|
+
static create: () => ZodDateIn;
|
|
10
|
+
_parse(input: ParseInput): ParseReturnType<Date>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParseInput, ParseReturnType, ZodTypeDef } from "zod";
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
|
+
declare const zodDateInKind = "ZodDateIn";
|
|
4
|
+
export declare const isoDateRegex: RegExp;
|
|
5
|
+
export interface ZodDateInDef extends ZodTypeDef {
|
|
6
|
+
typeName: typeof zodDateInKind;
|
|
7
|
+
}
|
|
8
|
+
export declare class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {
|
|
9
|
+
static create: () => ZodDateIn;
|
|
10
|
+
_parse(input: ParseInput): ParseReturnType<Date>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParseInput, ParseReturnType, ZodTypeDef } from "zod";
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
|
+
declare const zodDateInKind = "ZodDateIn";
|
|
4
|
+
export declare const isoDateRegex: RegExp;
|
|
5
|
+
export interface ZodDateInDef extends ZodTypeDef {
|
|
6
|
+
typeName: typeof zodDateInKind;
|
|
7
|
+
}
|
|
8
|
+
export declare class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {
|
|
9
|
+
static create: () => ZodDateIn;
|
|
10
|
+
_parse(input: ParseInput): ParseReturnType<Date>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParseInput, ParseReturnType, ZodTypeDef } from "zod";
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
|
+
declare const zodDateOutKind = "ZodDateOut";
|
|
4
|
+
export interface ZodDateOutDef extends ZodTypeDef {
|
|
5
|
+
typeName: typeof zodDateOutKind;
|
|
6
|
+
}
|
|
7
|
+
export declare class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {
|
|
8
|
+
static create: () => ZodDateOut;
|
|
9
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParseInput, ParseReturnType, ZodTypeDef } from "zod";
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
|
+
declare const zodDateOutKind = "ZodDateOut";
|
|
4
|
+
export interface ZodDateOutDef extends ZodTypeDef {
|
|
5
|
+
typeName: typeof zodDateOutKind;
|
|
6
|
+
}
|
|
7
|
+
export declare class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {
|
|
8
|
+
static create: () => ZodDateOut;
|
|
9
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParseInput, ParseReturnType, ZodTypeDef } from "zod";
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
|
+
declare const zodDateOutKind = "ZodDateOut";
|
|
4
|
+
export interface ZodDateOutDef extends ZodTypeDef {
|
|
5
|
+
typeName: typeof zodDateOutKind;
|
|
6
|
+
}
|
|
7
|
+
export declare class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {
|
|
8
|
+
static create: () => ZodDateOut;
|
|
9
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { withGetType } from "zod-to-ts";
|
|
2
|
+
import { ZodDateIn } from "./date-in-schema.d.cts";
|
|
3
|
+
import { ZodDateOut } from "./date-out-schema.d.cts";
|
|
4
|
+
export declare const dateIn: (...parameters: Parameters<typeof ZodDateIn.create>) => ReturnType<typeof withGetType<ZodDateIn>>;
|
|
5
|
+
export declare const dateOut: (...parameters: Parameters<typeof ZodDateOut.create>) => ReturnType<typeof withGetType<ZodDateOut>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { withGetType } from "zod-to-ts";
|
|
2
|
+
import { ZodDateIn } from "./date-in-schema.d.mts";
|
|
3
|
+
import { ZodDateOut } from "./date-out-schema.d.mts";
|
|
4
|
+
export declare const dateIn: (...parameters: Parameters<typeof ZodDateIn.create>) => ReturnType<typeof withGetType<ZodDateIn>>;
|
|
5
|
+
export declare const dateOut: (...parameters: Parameters<typeof ZodDateOut.create>) => ReturnType<typeof withGetType<ZodDateOut>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { withGetType } from "zod-to-ts";
|
|
2
|
+
import { ZodDateIn } from "./date-in-schema.d.ts";
|
|
3
|
+
import { ZodDateOut } from "./date-out-schema.d.ts";
|
|
4
|
+
export declare const dateIn: (...parameters: Parameters<typeof ZodDateIn.create>) => ReturnType<typeof withGetType<ZodDateIn>>;
|
|
5
|
+
export declare const dateOut: (...parameters: Parameters<typeof ZodDateOut.create>) => ReturnType<typeof withGetType<ZodDateOut>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/api-platform",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
4
|
"description": "Visulima API platform is a set of tools to build and consume web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -54,65 +54,86 @@
|
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"exports": {
|
|
56
56
|
".": {
|
|
57
|
-
"browser": "./dist/index-browser.
|
|
58
|
-
"require": {
|
|
59
|
-
"types": "./dist/index-server.d.ts",
|
|
60
|
-
"default": "./dist/index-server.js"
|
|
61
|
-
},
|
|
57
|
+
"browser": "./dist/index-browser.mjs",
|
|
62
58
|
"import": {
|
|
63
59
|
"types": "./dist/index-server.d.mts",
|
|
64
60
|
"default": "./dist/index-server.mjs"
|
|
61
|
+
},
|
|
62
|
+
"require": {
|
|
63
|
+
"types": "./dist/index-server.d.cts",
|
|
64
|
+
"default": "./dist/index-server.cjs"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"./next": {
|
|
68
|
-
"browser": "./dist/framework/next/index-browser.
|
|
69
|
-
"require": {
|
|
70
|
-
"types": "./dist/framework/next/index-server.d.ts",
|
|
71
|
-
"default": "./dist/framework/next/index-server.js"
|
|
72
|
-
},
|
|
68
|
+
"browser": "./dist/framework/next/index-browser.mjs",
|
|
73
69
|
"import": {
|
|
74
70
|
"types": "./dist/framework/next/index-server.d.mts",
|
|
75
71
|
"default": "./dist/framework/next/index-server.mjs"
|
|
72
|
+
},
|
|
73
|
+
"require": {
|
|
74
|
+
"types": "./dist/framework/next/index-server.d.cts",
|
|
75
|
+
"default": "./dist/framework/next/index-server.cjs"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"./next/pages/swagger": {
|
|
79
|
-
"browser": "./dist/framework/next/routes/pages/swagger/index.
|
|
80
|
-
"require": {
|
|
81
|
-
"types": "./dist/framework/next/routes/pages/swagger/index.d.ts",
|
|
82
|
-
"default": "./dist/framework/next/routes/pages/swagger/index.js"
|
|
83
|
-
},
|
|
79
|
+
"browser": "./dist/framework/next/routes/pages/swagger/index.mjs",
|
|
84
80
|
"import": {
|
|
85
81
|
"types": "./dist/framework/next/routes/pages/swagger/index.d.mts",
|
|
86
82
|
"default": "./dist/framework/next/routes/pages/swagger/index.mjs"
|
|
83
|
+
},
|
|
84
|
+
"require": {
|
|
85
|
+
"types": "./dist/framework/next/routes/pages/swagger/index.d.cts",
|
|
86
|
+
"default": "./dist/framework/next/routes/pages/swagger/index.cjs"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"./next/pages/redoc": {
|
|
90
|
-
"browser": "./dist/framework/next/routes/pages/redoc/index.
|
|
91
|
-
"require": {
|
|
92
|
-
"types": "./dist/framework/next/routes/pages/redoc/index.d.ts",
|
|
93
|
-
"default": "./dist/framework/next/routes/pages/redoc/index.js"
|
|
94
|
-
},
|
|
90
|
+
"browser": "./dist/framework/next/routes/pages/redoc/index.mjs",
|
|
95
91
|
"import": {
|
|
96
92
|
"types": "./dist/framework/next/routes/pages/redoc/index.d.mts",
|
|
97
93
|
"default": "./dist/framework/next/routes/pages/redoc/index.mjs"
|
|
94
|
+
},
|
|
95
|
+
"require": {
|
|
96
|
+
"types": "./dist/framework/next/routes/pages/redoc/index.d.cts",
|
|
97
|
+
"default": "./dist/framework/next/routes/pages/redoc/index.cjs"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"./cli": {
|
|
101
|
-
"require": {
|
|
102
|
-
"types": "./dist/framework/cli/index.d.ts",
|
|
103
|
-
"default": "./dist/framework/cli/index.js"
|
|
104
|
-
},
|
|
105
101
|
"import": {
|
|
106
102
|
"types": "./dist/framework/cli/index.d.mts",
|
|
107
103
|
"default": "./dist/framework/cli/index.mjs"
|
|
104
|
+
},
|
|
105
|
+
"require": {
|
|
106
|
+
"types": "./dist/framework/cli/index.d.cts",
|
|
107
|
+
"default": "./dist/framework/cli/index.cjs"
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"./package.json": "./package.json"
|
|
111
111
|
},
|
|
112
|
-
"main": "dist/index-server.
|
|
112
|
+
"main": "dist/index-server.cjs",
|
|
113
113
|
"module": "dist/index-server.mjs",
|
|
114
114
|
"browser": "dist/index-browser.mjs",
|
|
115
|
-
"types": "dist/index-server.d.
|
|
115
|
+
"types": "dist/index-server.d.cts",
|
|
116
|
+
"typesVersions": {
|
|
117
|
+
">=5.0": {
|
|
118
|
+
".": [
|
|
119
|
+
"./dist/index-browser.d.ts",
|
|
120
|
+
"./dist/index-server.d.ts"
|
|
121
|
+
],
|
|
122
|
+
"next": [
|
|
123
|
+
"./dist/framework/next/index-browser.d.ts",
|
|
124
|
+
"./dist/framework/next/index-server.d.ts"
|
|
125
|
+
],
|
|
126
|
+
"next/pages/swagger": [
|
|
127
|
+
"./dist/framework/next/routes/pages/swagger/index.d.ts"
|
|
128
|
+
],
|
|
129
|
+
"next/pages/redoc": [
|
|
130
|
+
"./dist/framework/next/routes/pages/redoc/index.d.ts"
|
|
131
|
+
],
|
|
132
|
+
"cli": [
|
|
133
|
+
"./dist/framework/cli/index.d.ts"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
},
|
|
116
137
|
"bin": {
|
|
117
138
|
"api-platform": "./bin/index.js"
|
|
118
139
|
},
|
|
@@ -125,39 +146,40 @@
|
|
|
125
146
|
"LICENSE.md"
|
|
126
147
|
],
|
|
127
148
|
"dependencies": {
|
|
128
|
-
"@visulima/connect": "4.0.0-alpha.
|
|
129
|
-
"@visulima/fs": "5.0.0-alpha.
|
|
130
|
-
"@visulima/jsdoc-open-api": "3.0.0-alpha.
|
|
131
|
-
"@visulima/path": "3.0.0-alpha.
|
|
149
|
+
"@visulima/connect": "4.0.0-alpha.8",
|
|
150
|
+
"@visulima/fs": "5.0.0-alpha.7",
|
|
151
|
+
"@visulima/jsdoc-open-api": "3.0.0-alpha.7",
|
|
152
|
+
"@visulima/path": "3.0.0-alpha.8",
|
|
132
153
|
"accepts": "^1.3.8",
|
|
133
154
|
"debug": "^4.4.3",
|
|
134
155
|
"http-errors": "^2.0.1",
|
|
135
156
|
"http-status-codes": "^2.3.0",
|
|
136
157
|
"jstoxml": "^7.1.0",
|
|
137
158
|
"lodash.merge": "^4.6.2",
|
|
138
|
-
"schema-dts": "^
|
|
159
|
+
"schema-dts": "^2.0.0",
|
|
139
160
|
"ts-japi": "^1.12.3",
|
|
161
|
+
"type-fest": "5.5.0",
|
|
140
162
|
"yaml": "2.8.3",
|
|
141
163
|
"zod-to-ts": "^1.2.0"
|
|
142
164
|
},
|
|
143
165
|
"peerDependencies": {
|
|
144
|
-
"@hapi/hapi": "21.4.
|
|
166
|
+
"@hapi/hapi": "21.4.8",
|
|
145
167
|
"@koa/router": "15.4.0",
|
|
146
|
-
"@visulima/crud": "3.0.0-alpha.
|
|
168
|
+
"@visulima/crud": "3.0.0-alpha.9",
|
|
147
169
|
"chalk": "5.6.2",
|
|
148
170
|
"commander": "14.0.3",
|
|
149
171
|
"cors": "2.8.6",
|
|
150
172
|
"express": "^4.22.1",
|
|
151
|
-
"fastify": "
|
|
152
|
-
"koa": "
|
|
153
|
-
"next": "16.2.
|
|
154
|
-
"rate-limiter-flexible": "
|
|
173
|
+
"fastify": "5.8.4",
|
|
174
|
+
"koa": "3.2.0",
|
|
175
|
+
"next": "16.2.2",
|
|
176
|
+
"rate-limiter-flexible": "11.0.0",
|
|
155
177
|
"react": "19.2.4",
|
|
156
178
|
"react-dom": "19.2.4",
|
|
157
179
|
"redoc": "2.5.2",
|
|
158
180
|
"swagger-ui-dist": "^4.19.1",
|
|
159
181
|
"swagger-ui-react": "^4.19.1",
|
|
160
|
-
"webpack": "^5.
|
|
182
|
+
"webpack": "^5.106.0",
|
|
161
183
|
"zod": "^3"
|
|
162
184
|
},
|
|
163
185
|
"peerDependenciesMeta": {
|
|
@@ -216,6 +238,7 @@
|
|
|
216
238
|
"optional": true
|
|
217
239
|
}
|
|
218
240
|
},
|
|
241
|
+
"optionalDependencies": {},
|
|
219
242
|
"engines": {
|
|
220
243
|
"node": ">=22.13 <=25.x"
|
|
221
244
|
},
|
package/dist/chunk-2RCSQLSQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var yaml=require('yaml'),fs=require('fs'),crud=require('@visulima/crud'),path=require('@visulima/path'),H=require('debug'),I=require('lodash.merge'),jstoxml=require('jstoxml');require('url');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var H__default=/*#__PURE__*/_interopDefault(H);var I__default=/*#__PURE__*/_interopDefault(I);var R=e=>yaml.stringify(e,{indent:2}),A=R;var d=e=>e.toLowerCase().replaceAll(/[^\s\w]/gu," ").trimEnd().replaceAll(/\s+|_/gu,"-").replaceAll(/\b\w/gu,n=>n.toUpperCase());var P="application/json",j=(e,n,s)=>{e.responses[n].content===void 0&&(e.responses[n].content={}),e.responses[n].content?.[s]===void 0&&(e.responses[n].content[s]={});},w=(e,n,s)=>{typeof e.components!="object"&&(e.components={}),typeof e.components.schemas!="object"&&(e.components.schemas={}),e.components.schemas[n]===void 0&&(e.components.schemas[n]=s);},h=(e,n,s,o,f)=>{j(e,n,s),e.responses[n].content?.[s]?.schema===void 0&&(e.responses[n].content[s].schema={}),e.responses[n].content[s].schema=f?{items:{$ref:`#/components/schemas/${o}`},type:"array"}:{$ref:`#/components/schemas/${o}`};},E=(e,n,s,o,f,p)=>{let a,t;return Object.entries(n.content).forEach(([c,r])=>{if(typeof r.schema=="object"){let{schema:i}=r;c===P&&r.examples!==void 0?t=r.examples:c===P&&r.example!==void 0&&(a=r.example);let l=i.type==="array";Object.entries(s??{}).forEach(([O,u])=>{if(!u)return;let g;i?.$ref===void 0?(g=`${d(o.trim().replace("/",""))}${O==="application/ld+json"?".jsonld":""}`,w(f,g,i)):g=i.$ref.replace("#/components/schemas/",""),h(e,p,O,g,l);});}}),{example:a,examples:t}},M=(e,n,s,o,f,p)=>{Object.keys(n.content).forEach(a=>{a!==P&&Object.entries(o??{}).forEach(([t,c])=>{if(!c)return;j(e,s,t),e.responses[s].content?.[t]?.example===void 0&&(e.responses[s].content[t].example={});let r=false;f.forEach(({regex:i,transformer:l})=>{!r&&i.test(t)&&(e.responses[s].content[t].example=l(p),r=true);}),r||(e.responses[s].content[t].example=p);});});},T=(e,n,s)=>{typeof e.components!="object"&&(e.components={}),typeof e.components.examples!="object"&&(e.components.examples={}),e.components.examples[n]===void 0&&s[n]!==void 0&&(e.components.examples[n]=s[n]);},C=(e,n,s,o,f,p)=>{j(n,s,o),n.responses[s].content?.[o]?.examples===void 0&&(n.responses[s].content[o].examples={});let a={};Object.entries(p).forEach(([t,c])=>{let r=false;f.forEach(({regex:i,transformer:l})=>{if(!r&&i.test(o)){let O="";e.components?.examples?.[t]?O=e.components.examples[t].value:c.$ref?O=(e.components?.examples?.[c.$ref.replace("#/components/examples/","")]).value:typeof c.value=="string"&&(O=c.value),a[t]={value:l(O)},r=true;}}),r||(a[t]=e.components?.examples?.[t]===void 0?c:{$ref:`#/components/examples/${t}`});}),n.responses[s].content[o].examples=a;},k=(e,n,s,o,f,p,a,t)=>{let c=d(p.trim().replace("/",""));Object.keys(o.content).forEach(r=>{r!==P&&Object.entries(f??{}).forEach(([i,l])=>{l&&(T(e,c,t),C(e,n,s,i,a,t));});});};function m(e,n,s=[{regex:/xml/u,transformer:o=>jstoxml.toXML(o,{header:true,indent:" "})},{regex:/yaml|yml/,transformer:o=>yaml.stringify(o,{indent:2})}]){return typeof e=="object"&&typeof e.paths=="object"&&Object.entries(e.paths).forEach(([o,f])=>{Object.values(f).forEach(p=>{typeof p.responses=="object"&&Object.entries(p.responses).forEach(([a,t])=>{if(typeof t.content=="object"){let{example:c,examples:r}=E(p,t,n,o,e,a);c!==void 0?M(p,t,a,n,s,c):r!==void 0&&k(e,p,a,t,n,o,s,r);}});});}),e}var J=H__default.default("visulima:api-platform:swagger:crud:get-static-properties-swagger"),X=(e={})=>{let{allowedMediaTypes:n={"application/json":true},crud:s,specs:o,swaggerFilePath:f}=e;return async(p,a)=>{let t=path.join(process.cwd(),f??"swagger/swagger.json");if(!fs.existsSync(t))throw new Error(`Swagger file not found at "${t}".`);let c=fs.readFileSync(t,"utf8"),r=m(JSON.parse(c),n),i={};if(s!==void 0)try{let O=await crud.modelsToOpenApi(s);i={components:{examples:O.examples,schemas:O.schemas},paths:O.paths,tags:O.tags},i=m(i,n),J(JSON.stringify(i,null,2)),r=I__default.default(r,i);}catch(O){throw console.log(O),new Error("Please install @visulima/crud to use the crud swagger generator.")}Array.isArray(o)&&o.forEach(O=>{r=I__default.default(r,m(O,n));});let l;typeof p.headers.accept=="string"&&/yaml|yml/.test(p.headers.accept)?(a.setHeader("Content-Type",p.headers.accept),l=A(r)):(a.setHeader("Content-Type","application/json"),l=JSON.stringify(r,null,2)),a.statusCode=200,a.end(l);}},oe=X;exports.a=d;exports.b=A;exports.c=oe;//# sourceMappingURL=chunk-2RCSQLSQ.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-2RCSQLSQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/serializers/transformer/yaml.ts","../src/utils.ts","../src/swagger/extend-swagger-spec.ts","../src/swagger/api/swagger-handler.ts"],"names":["yamlTransformer","data","stringify","yaml_default","toHeaderCase","string_","c","jsonMediaType","prepareStatusContent","methodSpec","status","mediaType","extendComponentSchemas","spec","schemaName","schema","extendResponseSchema","schemaIsArray","extendSwaggerWithMediaTypeSchema","responseSpec","allowedMediaTypes","pathKey","example","examples","mediaName","contentSpec","allowed","extendSwaggerWithMediaTypeExample","transformers","transformed","regex","transformer","extendComponentExamples","exampleName","prepareResponseExamples","transformedExamples","extendSwaggerWithMediaTypeExamples","examplesName","extendSwaggerSpec","value","toXML","pathSpec","swaggerCrudDebug","debug","swaggerHandler","options","crud","specs","swaggerFilePath","request","response","swaggerPath","join","existsSync","fileContents","readFileSync","crudSw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,CAAI,EACrB,CACJ,CAAA,CAaO4D,EAAAA,CAAQjB","file":"chunk-2RCSQLSQ.js","sourcesContent":["import { stringify } from \"yaml\";\n\nimport type { Serializer } from \"../types\";\n\nconst yamlTransformer: Serializer = (data) => stringify(data, { indent: 2 });\n\nexport default yamlTransformer;\n","import type { IncomingMessage, ServerResponse } from \"node:http\";\nimport { URL } from \"node:url\";\n\ntype IncomingApiRequest<TApiRequest = IncomingMessage> = TApiRequest & {\n body?: any;\n query?: any;\n};\n\nexport const jsonResponse = (response: ServerResponse, status: number, data?: unknown): void => {\n response.statusCode = status;\n response.setHeader(\"Content-Type\", \"application/json\");\n response.end(data ? JSON.stringify(data) : \"\");\n};\n\nexport const parseBody = async (request: IncomingApiRequest): Promise<any> => {\n if (request.body) {\n return request.body;\n }\n\n const buffers = [];\n\n // eslint-disable-next-line no-loops/no-loops\n for await (const chunk of request) {\n buffers.push(chunk);\n }\n\n const data = Buffer.concat(buffers).toString();\n\n return data ? JSON.parse(data) : null;\n};\n\nexport const parseQuery = (request: IncomingApiRequest): Record<string, unknown> => {\n if (request.query) {\n return request.query;\n }\n\n if (!request.url) {\n return {};\n }\n\n // Note: Fake protocol is required to parse query string\n const url = new URL(`https://${request.headers.host?.replace(/\\/$/u, \"\")}/${request.url}`);\n\n return Object.fromEntries(url.searchParams.entries());\n};\n\nexport const toHeaderCase = (string_: string): string =>\n string_\n .toLowerCase()\n .replaceAll(/[^\\s\\w]/gu, \" \") // Remove all non-word characters\n .trimEnd() // Remove trailing spaces\n .replaceAll(/\\s+|_/gu, \"-\") // Replace multiple spaces or underline with a single hyphen\n .replaceAll(/\\b\\w/gu, (c) => c.toUpperCase());\n","import type { XmlElement } from \"jstoxml\";\nimport { toXML } from \"jstoxml\";\nimport type { OpenAPIV3 } from \"openapi-types\";\nimport { stringify } from \"yaml\";\n\nimport { toHeaderCase } from \"../utils\";\n\ntype Transformers = { regex: RegExp; transformer: (data: any) => string }[];\n\nconst jsonMediaType = \"application/json\";\n\nconst prepareStatusContent = (methodSpec: OpenAPIV3.OperationObject, status: string, mediaType: string) => {\n if (((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content === undefined) {\n // eslint-disable-next-line no-param-reassign\n ((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content = {};\n }\n\n if (((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content?.[mediaType] === undefined) {\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n (((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] = {} as OpenAPIV3.MediaTypeObject;\n }\n};\n\nconst extendComponentSchemas = (spec: Partial<OpenAPIV3.Document>, schemaName: string, schema: OpenAPIV3.SchemaObject) => {\n if (typeof spec.components !== \"object\") {\n // eslint-disable-next-line no-param-reassign\n spec.components = {};\n }\n\n if (typeof spec.components.schemas !== \"object\") {\n // eslint-disable-next-line no-param-reassign\n spec.components.schemas = {};\n }\n\n if (spec.components.schemas[schemaName] === undefined) {\n // eslint-disable-next-line no-param-reassign\n spec.components.schemas[schemaName] = schema;\n }\n};\n\nconst extendResponseSchema = (methodSpec: OpenAPIV3.OperationObject, status: string, mediaType: string, schemaName: string, schemaIsArray: boolean) => {\n prepareStatusContent(methodSpec, status, mediaType);\n\n if (((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content?.[mediaType]?.schema === undefined) {\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).schema\n = {} as OpenAPIV3.SchemaObject;\n }\n\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).schema\n = schemaIsArray\n ? {\n items: {\n $ref: `#/components/schemas/${schemaName}`,\n },\n type: \"array\",\n }\n : {\n $ref: `#/components/schemas/${schemaName}`,\n };\n};\n\nconst extendSwaggerWithMediaTypeSchema = (\n methodSpec: OpenAPIV3.OperationObject,\n responseSpec: OpenAPIV3.ResponseObject,\n allowedMediaTypes: Record<string, boolean> | undefined,\n pathKey: string,\n spec: Partial<OpenAPIV3.Document>,\n status: string,\n): {\n example?: any;\n examples?: Record<string, OpenAPIV3.ExampleObject | OpenAPIV3.ReferenceObject>;\n} => {\n let example: any | undefined;\n let examples: Record<string, OpenAPIV3.ExampleObject | OpenAPIV3.ReferenceObject> | undefined;\n\n Object.entries(responseSpec.content as object).forEach(([mediaName, contentSpec]) => {\n if (typeof contentSpec.schema === \"object\") {\n const { schema } = contentSpec;\n\n if (mediaName === jsonMediaType && contentSpec.examples !== undefined) {\n examples = contentSpec.examples;\n } else if (mediaName === jsonMediaType && contentSpec.example !== undefined) {\n example = contentSpec.example;\n }\n\n const schemaIsArray = (schema as OpenAPIV3.SchemaObject).type === \"array\";\n\n Object.entries(allowedMediaTypes ?? {}).forEach(([mediaType, allowed]) => {\n if (!allowed) {\n return;\n }\n\n let schemaName: string;\n\n if (schema?.$ref === undefined) {\n schemaName = `${toHeaderCase(pathKey.trim().replace(\"/\", \"\"))}${mediaType === \"application/ld+json\" ? \".jsonld\" : \"\"}`;\n\n extendComponentSchemas(spec as OpenAPIV3.Document, schemaName, schema as OpenAPIV3.SchemaObject);\n } else {\n schemaName = (schema as OpenAPIV3.ReferenceObject).$ref.replace(\"#/components/schemas/\", \"\");\n }\n\n extendResponseSchema(methodSpec, status, mediaType, schemaName, schemaIsArray);\n });\n }\n });\n\n return { example, examples };\n};\n\nconst extendSwaggerWithMediaTypeExample = (\n methodSpec: OpenAPIV3.OperationObject,\n responseSpec: OpenAPIV3.ResponseObject,\n status: string,\n allowedMediaTypes: Record<string, boolean> | undefined,\n transformers: Transformers,\n example: any,\n) => {\n Object.keys(responseSpec.content as object).forEach((mediaName) => {\n if (mediaName === jsonMediaType) {\n return;\n }\n\n Object.entries(allowedMediaTypes ?? {}).forEach(([mediaType, allowed]) => {\n if (!allowed) {\n return;\n }\n\n prepareStatusContent(methodSpec, status, mediaType);\n\n if (\n ((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content?.[mediaType]?.example === undefined\n ) {\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).example\n = {};\n }\n\n let transformed = false;\n\n transformers.forEach(({ regex, transformer }) => {\n if (!transformed && regex.test(mediaType)) {\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).example\n = transformer(example);\n\n transformed = true;\n }\n });\n\n if (!transformed) {\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).example\n = example;\n }\n });\n });\n};\n\nconst extendComponentExamples = (\n spec: Partial<OpenAPIV3.Document>,\n exampleName: string,\n examples: Record<string, OpenAPIV3.ExampleObject | OpenAPIV3.ReferenceObject>,\n) => {\n if (typeof spec.components !== \"object\") {\n // eslint-disable-next-line no-param-reassign\n spec.components = {};\n }\n\n if (typeof spec.components.examples !== \"object\") {\n // eslint-disable-next-line no-param-reassign\n spec.components.examples = {};\n }\n\n if (spec.components.examples[exampleName] === undefined && examples[exampleName] !== undefined) {\n // eslint-disable-next-line no-param-reassign\n spec.components.examples[exampleName] = examples[exampleName] as OpenAPIV3.ExampleObject;\n }\n};\n\nconst prepareResponseExamples = (\n spec: Partial<OpenAPIV3.Document>,\n methodSpec: OpenAPIV3.OperationObject,\n status: string,\n mediaType: string,\n transformers: Transformers,\n examples: Record<string, OpenAPIV3.ExampleObject | OpenAPIV3.ReferenceObject>,\n) => {\n prepareStatusContent(methodSpec, status, mediaType);\n\n if (((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content?.[mediaType]?.examples === undefined) {\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).examples\n = {};\n }\n\n const transformedExamples: Record<string, OpenAPIV3.ExampleObject | OpenAPIV3.ReferenceObject> = {};\n\n Object.entries(examples).forEach(([exampleName, example]) => {\n let transformed = false;\n\n transformers.forEach(({ regex, transformer }) => {\n if (!transformed && regex.test(mediaType)) {\n let data: any = \"\";\n\n if (spec.components?.examples?.[exampleName]) {\n data = (spec.components.examples[exampleName] as OpenAPIV3.ExampleObject).value;\n } else if ((example as OpenAPIV3.ReferenceObject).$ref) {\n data = (\n spec.components?.examples?.[\n (example as OpenAPIV3.ReferenceObject).$ref.replace(\"#/components/examples/\", \"\")\n ] as OpenAPIV3.ExampleObject\n ).value;\n } else if (typeof (example as OpenAPIV3.ExampleObject).value === \"string\") {\n data = (example as OpenAPIV3.ExampleObject).value;\n }\n\n transformedExamples[exampleName] = {\n value: transformer(data),\n };\n\n transformed = true;\n }\n });\n\n if (!transformed) {\n transformedExamples[exampleName]\n = spec.components?.examples?.[exampleName] === undefined\n ? example\n : {\n $ref: `#/components/examples/${exampleName}`,\n };\n }\n });\n\n // prettier-ignore\n // eslint-disable-next-line no-param-reassign\n ((((methodSpec.responses as unknown as OpenAPIV3.ResponsesObject)[status] as OpenAPIV3.ResponseObject).content as Record<\n string,\n OpenAPIV3.MediaTypeObject\n >)[\n mediaType\n ] as OpenAPIV3.MediaTypeObject).examples\n = transformedExamples;\n};\n\nconst extendSwaggerWithMediaTypeExamples = (\n spec: Partial<OpenAPIV3.Document>,\n methodSpec: OpenAPIV3.OperationObject,\n status: string,\n responseSpec: OpenAPIV3.ResponseObject,\n allowedMediaTypes: Record<string, boolean> | undefined,\n pathKey: string,\n transformers: Transformers,\n examples: Record<string, OpenAPIV3.ExampleObject | OpenAPIV3.ReferenceObject>,\n) => {\n const examplesName = toHeaderCase(pathKey.trim().replace(\"/\", \"\"));\n\n Object.keys(responseSpec.content as object).forEach((mediaName) => {\n if (mediaName === jsonMediaType) {\n return;\n }\n\n Object.entries(allowedMediaTypes ?? {}).forEach(([mediaType, allowed]) => {\n if (!allowed) {\n return;\n }\n\n extendComponentExamples(spec, examplesName, examples);\n\n prepareResponseExamples(spec, methodSpec, status, mediaType, transformers, examples);\n });\n });\n};\n\nexport default function extendSwaggerSpec(\n spec: Partial<OpenAPIV3.Document>,\n allowedMediaTypes?: Record<string, boolean>,\n transformers: Transformers = [\n {\n regex: /xml/u,\n transformer: (value: XmlElement | XmlElement[] | undefined) =>\n toXML(value, {\n header: true,\n indent: \" \",\n }),\n },\n {\n regex: /yaml|yml/,\n transformer: (value) => stringify(value, { indent: 2 }),\n },\n ],\n): Partial<OpenAPIV3.Document> {\n if (typeof spec === \"object\" && typeof spec.paths === \"object\") {\n Object.entries(spec.paths).forEach(([pathKey, pathSpec]) => {\n Object.values(pathSpec as OpenAPIV3.OperationObject & OpenAPIV3.PathsObject).forEach((methodSpec) => {\n if (typeof (methodSpec as OpenAPIV3.OperationObject).responses === \"object\") {\n Object.entries((methodSpec as OpenAPIV3.OperationObject).responses).forEach(([status, responseSpec]) => {\n if (typeof (responseSpec as OpenAPIV3.ResponseObject).content === \"object\") {\n const { example, examples } = extendSwaggerWithMediaTypeSchema(\n methodSpec as OpenAPIV3.OperationObject,\n responseSpec as OpenAPIV3.ResponseObject,\n allowedMediaTypes,\n pathKey,\n spec,\n status,\n );\n\n if (example !== undefined) {\n extendSwaggerWithMediaTypeExample(\n methodSpec as OpenAPIV3.OperationObject,\n responseSpec as OpenAPIV3.ResponseObject,\n status,\n allowedMediaTypes,\n transformers,\n example,\n );\n } else if (examples !== undefined) {\n extendSwaggerWithMediaTypeExamples(\n spec,\n methodSpec as OpenAPIV3.OperationObject,\n status,\n responseSpec as OpenAPIV3.ResponseObject,\n allowedMediaTypes,\n pathKey,\n transformers,\n examples,\n );\n }\n }\n });\n }\n });\n });\n }\n\n return spec;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\n\nimport type { ModelsToOpenApiParameters, SwaggerModelsConfig } from \"@visulima/crud\";\nimport { modelsToOpenApi } from \"@visulima/crud\";\nimport { join } from \"@visulima/path\";\nimport debug from \"debug\";\n// eslint-disable-next-line no-restricted-imports\nimport merge from \"lodash.merge\";\nimport type { OpenAPIV3 } from \"openapi-types\";\n\nimport yamlTransformer from \"../../serializers/transformer/yaml\";\nimport extendSwaggerSpec from \"../extend-swagger-spec\";\n\nconst swaggerCrudDebug = debug(\"visulima:api-platform:swagger:crud:get-static-properties-swagger\");\n\nconst swaggerHandler = <M extends string, PrismaClient>(\n options: Partial<SwaggerHandlerOptions<M, PrismaClient>> = {},\n): (request: IncomingMessage, response: ServerResponse) => Promise<void> => {\n const {\n allowedMediaTypes = {\n \"application/json\": true,\n },\n crud,\n specs,\n swaggerFilePath,\n } = options;\n\n return async <Request extends IncomingMessage, Response extends ServerResponse>(request: Request, response: Response) => {\n const swaggerPath = join(process.cwd(), swaggerFilePath ?? \"swagger/swagger.json\");\n\n if (!existsSync(swaggerPath)) {\n throw new Error(`Swagger file not found at \"${swaggerPath}\".`);\n }\n\n const fileContents = readFileSync(swaggerPath, \"utf8\");\n\n let spec = extendSwaggerSpec(JSON.parse(fileContents) as OpenAPIV3.Document, allowedMediaTypes) as OpenAPIV3.Document;\n let crudSwagger: Partial<OpenAPIV3.Document> = {};\n\n if (crud !== undefined) {\n try {\n const modelsOpenApi = await modelsToOpenApi(crud);\n\n crudSwagger = {\n components: { examples: modelsOpenApi.examples, schemas: modelsOpenApi.schemas },\n paths: modelsOpenApi.paths,\n tags: modelsOpenApi.tags,\n };\n\n crudSwagger = extendSwaggerSpec(crudSwagger, allowedMediaTypes);\n\n swaggerCrudDebug(JSON.stringify(crudSwagger, null, 2));\n\n spec = merge(spec, crudSwagger);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.log(error);\n\n throw new Error(\"Please install @visulima/crud to use the crud swagger generator.\");\n }\n }\n\n if (Array.isArray(specs)) {\n specs.forEach((value) => {\n spec = merge(spec, extendSwaggerSpec(value, allowedMediaTypes));\n });\n }\n\n let data: Buffer | Uint8Array | string;\n\n if (typeof request.headers.accept === \"string\" && /yaml|yml/.test(request.headers.accept)) {\n response.setHeader(\"Content-Type\", request.headers.accept);\n\n data = yamlTransformer(spec);\n } else {\n response.setHeader(\"Content-Type\", \"application/json\");\n\n data = JSON.stringify(spec, null, 2);\n }\n\n response.statusCode = 200;\n response.end(data);\n };\n};\n\nexport interface SwaggerHandlerOptions<M extends string, PrismaClient> {\n allowedMediaTypes: Record<string, boolean>;\n crud: Exclude<ModelsToOpenApiParameters<M, PrismaClient>, \"swagger\"> & {\n swagger?: {\n models?: SwaggerModelsConfig<M>;\n };\n };\n specs?: Partial<OpenAPIV3.Document>[];\n swaggerFilePath: string;\n}\n\nexport default swaggerHandler;\n"]}
|
package/dist/chunk-4C666HHU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-4C666HHU.js"}
|
package/dist/chunk-5DME62EW.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import a from'debug';var p=a("visulima:api-platform:swagger:get-static-properties-swagger"),o=t=>async()=>{let e=await(await fetch(t)).json();return p(e),{props:{swaggerData:JSON.parse(JSON.stringify(e)),swaggerUrl:t}}},g=o;export{g as a};//# sourceMappingURL=chunk-5DME62EW.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-5DME62EW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/framework/next/routes/pages/get-static-properties-swagger.ts"],"names":["swaggerDebug","debug","getStaticProps","swaggerUrl","swaggerData","get_static_properties_swagger_default"],"mappings":"qBAIA,IAAMA,EAAeC,CAAAA,CAAM,6DAA6D,EAElFC,CAAAA,CACCC,CAAAA,EACC,SAKM,CAGF,IAAMC,CAAAA,CAAc,KAAA,CADH,MAAM,KAAA,CAAMD,CAAU,GACJ,IAAA,EAAK,CAExC,OAAAH,CAAAA,CAAaI,CAAW,CAAA,CAEjB,CACH,MAAO,CACH,WAAA,CAAa,KAAK,KAAA,CAAM,IAAA,CAAK,SAAA,CAAUA,CAAW,CAAC,CAAA,CACnD,UAAA,CAAAD,CACJ,CACJ,CACJ,EAEDE,CAAAA,CAAQH","file":"chunk-5DME62EW.mjs","sourcesContent":["import debug from \"debug\";\nimport type { GetStaticProps } from \"next/types\";\nimport type { OpenAPIV3 } from \"openapi-types\";\n\nconst swaggerDebug = debug(\"visulima:api-platform:swagger:get-static-properties-swagger\");\n\nconst getStaticProps: (swaggerUrl: string) => GetStaticProps\n = (swaggerUrl) =>\n async (): Promise<{\n props: {\n swaggerData: OpenAPIV3.Document;\n swaggerUrl: string;\n };\n }> => {\n // eslint-disable-next-line compat/compat\n const response = await fetch(swaggerUrl);\n const swaggerData = await response.json();\n\n swaggerDebug(swaggerData);\n\n return {\n props: {\n swaggerData: JSON.parse(JSON.stringify(swaggerData)) as OpenAPIV3.Document,\n swaggerUrl,\n },\n };\n };\n\nexport default getStaticProps;\n"]}
|
package/dist/chunk-BJSUSPWM.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-HZWWJL43.mjs';import {withGetType}from'zod-to-ts';import {ZodType,ZodParsedType,INVALID,addIssueToContext,ZodIssueCode}from'zod';var x={};a(x,{dateIn:()=>K,dateOut:()=>O});var g="ZodDateIn",N=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?)?Z?$/,d=class a extends ZodType{static create=()=>new a({typeName:g});_parse(t){let{ctx:e,status:r}=this._processInputParams(t);if(e.parsedType!==ZodParsedType.string)return addIssueToContext(e,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:e.parsedType}),INVALID;N.test(e.data)||(addIssueToContext(e,{code:ZodIssueCode.invalid_string,validation:"regex"}),r.dirty());let u=new Date(e.data);return Number.isNaN(u.getTime())?(addIssueToContext(e,{code:ZodIssueCode.invalid_date}),INVALID):{status:r.value,value:u}}};var v="ZodDateOut",o=class a extends ZodType{static create=()=>new a({typeName:v});_parse(t){let{ctx:e,status:r}=this._processInputParams(t);return e.parsedType!==ZodParsedType.date?(addIssueToContext(e,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:e.parsedType}),INVALID):Number.isNaN(e.data.getTime())?(addIssueToContext(e,{code:ZodIssueCode.invalid_date}),INVALID):{status:r.value,value:e.data.toISOString()}}};var K=(...a)=>withGetType(d.create(...a),t=>t.factory.createKeywordTypeNode(t.SyntaxKind.StringKeyword)),O=(...a)=>withGetType(o.create(...a),t=>t.factory.createKeywordTypeNode(t.SyntaxKind.StringKeyword));export{K as a,O as b,x as c};//# sourceMappingURL=chunk-BJSUSPWM.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-BJSUSPWM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/zod/index.ts","../src/zod/date-in-schema.ts","../src/zod/date-out-schema.ts"],"names":["zod_exports","__export","dateIn","dateOut","zodDateInKind","isoDateRegex","ZodDateIn","_ZodDateIn","ZodType","input","ctx","status","ZodParsedType","addIssueToContext","ZodIssueCode","INVALID","date","zodDateOutKind","ZodDateOut","_ZodDateOut","parameters","withGetType","ts"],"mappings":"wJAAA,IAAAA,CAAAA,CAAA,GAAAC,CAAAA,CAAAD,CAAAA,CAAA,CAAA,MAAA,CAAA,IAAAE,CAAAA,CAAA,OAAA,CAAA,IAAAC,CAAAA,CAAAA,CAAAA,CCGA,IAAMC,CAAAA,CAAgB,WAAA,CAQTC,CAAAA,CAAe,sDAAA,CAOfC,CAAAA,CAAN,MAAMC,CAAAA,SAAkBC,OAAoC,CAC/D,OAAc,MAAA,CAAS,IACnB,IAAID,CAAAA,CAAU,CACV,QAAA,CAAUH,CACd,CAAC,CAAA,CAGE,MAAA,CAAOK,CAAAA,CAA0C,CAEpD,GAAM,CAAE,GAAA,CAAAC,CAAAA,CAAK,MAAA,CAAAC,CAAO,CAAA,CAAI,IAAA,CAAK,mBAAA,CAAoBF,CAAK,CAAA,CAEtD,GAAIC,CAAAA,CAAI,aAAeE,aAAAA,CAAc,MAAA,CACjC,OAAAC,iBAAAA,CAAkBH,CAAAA,CAAK,CACnB,IAAA,CAAMI,YAAAA,CAAa,YAAA,CACnB,QAAA,CAAUF,aAAAA,CAAc,MAAA,CACxB,QAAA,CAAUF,CAAAA,CAAI,UAClB,CAAC,CAAA,CAEMK,OAAAA,CAGNV,CAAAA,CAAa,IAAA,CAAKK,CAAAA,CAAI,IAAc,CAAA,GACrCG,iBAAAA,CAAkBH,CAAAA,CAAK,CACnB,IAAA,CAAMI,YAAAA,CAAa,cAAA,CACnB,UAAA,CAAY,OAChB,CAAC,CAAA,CACDH,CAAAA,CAAO,KAAA,EAAM,CAAA,CAGjB,IAAMK,CAAAA,CAAO,IAAI,IAAA,CAAKN,CAAAA,CAAI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,GAAGc,CAAU,CAAA,CAAIE,CAAAA,EAAOA,CAAAA,CAAG,OAAA,CAAQ,qBAAA,CAAsBA,CAAAA,CAAG,UAAA,CAAW,aAAa,CAAC,CAAA,CAEzGnB,CAAAA,CAAU,CAAA,GAAIiB,CAAAA,GACvBC,WAAAA,CAAYH,CAAAA,CAAW,MAAA,CAAO,GAAGE,CAAU,CAAA,CAAIE,CAAAA,EAAOA,CAAAA,CAAG,OAAA,CAAQ,qBAAA,CAAsBA,CAAAA,CAAG,UAAA,CAAW,aAAa,CAAC","file":"chunk-BJSUSPWM.mjs","sourcesContent":["import { withGetType } from \"zod-to-ts\";\n\nimport { ZodDateIn } from \"./date-in-schema\";\nimport { ZodDateOut } from \"./date-out-schema\";\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const dateIn = (...parameters: Parameters<typeof ZodDateIn.create>) =>\n withGetType(ZodDateIn.create(...parameters), (ts) => ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword));\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const dateOut = (...parameters: Parameters<typeof ZodDateOut.create>) =>\n withGetType(ZodDateOut.create(...parameters), (ts) => ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword));\n","import type { ParseInput, ParseReturnType, ZodTypeDef } from \"zod\";\nimport { addIssueToContext, INVALID, ZodIssueCode, ZodParsedType, ZodType } from \"zod\";\n\nconst zodDateInKind = \"ZodDateIn\";\n\n// simple regex for ISO date, supports the following formats:\n// 2021-01-01T00:00:00.000Z\n// 2021-01-01T00:00:00Z\n// 2021-01-01T00:00:00\n// 2021-01-01\n// eslint-disable-next-line security/detect-unsafe-regex\nexport const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?)?Z?$/;\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nexport interface ZodDateInDef extends ZodTypeDef {\n typeName: typeof zodDateInKind;\n}\n\nexport class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {\n public static create = (): ZodDateIn =>\n new ZodDateIn({\n typeName: zodDateInKind,\n });\n\n // eslint-disable-next-line no-underscore-dangle\n public _parse(input: ParseInput): ParseReturnType<Date> {\n // eslint-disable-next-line no-underscore-dangle\n const { ctx, status } = this._processInputParams(input);\n\n if (ctx.parsedType !== ZodParsedType.string) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n\n return INVALID;\n }\n\n if (!isoDateRegex.test(ctx.data as string)) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"regex\",\n });\n status.dirty();\n }\n\n const date = new Date(ctx.data as string);\n\n if (Number.isNaN(date.getTime())) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n\n return INVALID;\n }\n\n return { status: status.value, value: date };\n }\n}\n","import type { ParseInput, ParseReturnType, ZodTypeDef } from \"zod\";\nimport { addIssueToContext, INVALID, ZodIssueCode, ZodParsedType, ZodType } from \"zod\";\n\nconst zodDateOutKind = \"ZodDateOut\";\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nexport interface ZodDateOutDef extends ZodTypeDef {\n typeName: typeof zodDateOutKind;\n}\n\nexport class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {\n public static create = (): ZodDateOut =>\n new ZodDateOut({\n typeName: zodDateOutKind,\n });\n\n // eslint-disable-next-line no-underscore-dangle\n public _parse(input: ParseInput): ParseReturnType<string> {\n // eslint-disable-next-line no-underscore-dangle\n const { ctx, status } = this._processInputParams(input);\n\n if (ctx.parsedType !== ZodParsedType.date) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n\n return INVALID;\n }\n\n if (Number.isNaN(ctx.data.getTime())) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n\n return INVALID;\n }\n\n return { status: status.value, value: (ctx.data as Date).toISOString() };\n }\n}\n"]}
|
package/dist/chunk-EEEP2HBM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var s=require('debug');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var s__default=/*#__PURE__*/_interopDefault(s);var a=s__default.default("visulima:api-platform:swagger:get-static-properties-swagger"),p=t=>async()=>{let e=await(await fetch(t)).json();return a(e),{props:{swaggerData:JSON.parse(JSON.stringify(e)),swaggerUrl:t}}},o=p;exports.a=o;//# sourceMappingURL=chunk-EEEP2HBM.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-EEEP2HBM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/framework/next/routes/pages/get-static-properties-swagger.ts"],"names":["swaggerDebug","debug","getStaticProps","swaggerUrl","swaggerData","get_static_properties_swagger_default"],"mappings":"oJAIA,IAAMA,EAAeC,kBAAAA,CAAM,6DAA6D,EAElFC,CAAAA,CACCC,CAAAA,EACC,SAKM,CAGF,IAAMC,CAAAA,CAAc,KAAA,CADH,MAAM,KAAA,CAAMD,CAAU,GACJ,IAAA,EAAK,CAExC,OAAAH,CAAAA,CAAaI,CAAW,CAAA,CAEjB,CACH,MAAO,CACH,WAAA,CAAa,KAAK,KAAA,CAAM,IAAA,CAAK,SAAA,CAAUA,CAAW,CAAC,CAAA,CACnD,UAAA,CAAAD,CACJ,CACJ,CACJ,EAEDE,CAAAA,CAAQH","file":"chunk-EEEP2HBM.js","sourcesContent":["import debug from \"debug\";\nimport type { GetStaticProps } from \"next/types\";\nimport type { OpenAPIV3 } from \"openapi-types\";\n\nconst swaggerDebug = debug(\"visulima:api-platform:swagger:get-static-properties-swagger\");\n\nconst getStaticProps: (swaggerUrl: string) => GetStaticProps\n = (swaggerUrl) =>\n async (): Promise<{\n props: {\n swaggerData: OpenAPIV3.Document;\n swaggerUrl: string;\n };\n }> => {\n // eslint-disable-next-line compat/compat\n const response = await fetch(swaggerUrl);\n const swaggerData = await response.json();\n\n swaggerDebug(swaggerData);\n\n return {\n props: {\n swaggerData: JSON.parse(JSON.stringify(swaggerData)) as OpenAPIV3.Document,\n swaggerUrl,\n },\n };\n };\n\nexport default getStaticProps;\n"]}
|
package/dist/chunk-FQUHP33M.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';var child_process=require('child_process'),fs=require('fs'),q=require('process'),path=require('@visulima/path'),m=require('chalk'),jsdocOpenApi=require('@visulima/jsdoc-open-api'),fs$1=require('@visulima/fs');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var q__default=/*#__PURE__*/_interopDefault(q);var m__default=/*#__PURE__*/_interopDefault(m);var z=(e,r)=>{if(r.length===0)throw new Error("must include at least one key to map");let t=e.toString();return r.forEach(o=>{t=o.optional?t.replace("(?:\\/([^\\/]+?))?\\",`/:${o.name}?`):t.replace(String.raw`(?:([^\/]+?))`,`:${o.name}`);}),t.replace(String.raw`/?(?=\/|$)/i`,"").replace("/^","").replaceAll("\\","").replaceAll(/\/{2,}/gu,"/")},k=z;var Q=(e,r)=>{if(typeof e=="string")return e;if(e.fast_slash)return "";if(e.fast_star)return "*";let t="";r.length>0&&(t=k(e,r));let o=/^\/\^((?:\\[$()*+./?[\\\]^{|}]|[^$()*+./?[\\\]^{|}])*)\$\//u.exec(e.toString().replace(String.raw`\/?`,"").replace(String.raw`(?=\/|$)`,"$"));return Array.isArray(o)&&o.length>1?o[1].replaceAll(/\\(.)/gu,"$1").slice(1):t?t.slice(1):e.toString()},T=Q;var V=(e,r,t)=>{let o=e.route.stack.at(-1),n=r.map(a=>({in:"path",name:a.name,required:!a.optional})),s=e.route.stack.filter(a=>a.handle.metadata);if(s.length>1)throw new Error("Only one metadata middleware is allowed per route");let p=(t+e.route.path).replaceAll(/\/{2,}/gu,"/");return s.length===0?{method:o.method,path:p,pathParams:n}:{metadata:s[0].handle.metadata,method:o.method,path:p,pathParams:n}},D=(e,r,t,o)=>{if(o=[...o,...t.keys],t.name==="router"&&t.handle?.stack!==void 0)for(let n of t.handle.stack)r=r||"",D(e,`${r}/${T(t.regexp,t.keys)}`,n,o);!t.route||t.route.stack.length===0||e.push(V(t,o,r));},Z=e=>{let r=e._router||e.router,t=[];for(let o of r.stack)D(t,"",o,[]);return t},$=Z;var ee=e=>{let r=[];return $(e).forEach(t=>{r.push({file:"unknown",method:t.method.toUpperCase(),path:t.path,tags:[]});}),r},j=ee;var v=e=>e.replaceAll(/ \(.*\)/gu,"").trim(),O=e=>e.trim().split(" ")[1].slice(1,-1),te=e=>{let t=e.printRoutes().replaceAll(/[─│└├]/gu," ").trimEnd().split(`
|
|
2
|
-
`),o=t.reduce((s,p,a)=>{let i=v(p);if(v(t[a-1]??"")===i){let x=s.filter(A=>A.index<a&&A.segment===i),{methods:S}=x.at(-1);return S!==null&&S.push(O(p)),s}let c=p.replaceAll(/ \(.*\)/gu,"").match(/ /gu);if(c===null)throw new Error("Invalid spaces");let l=c.length/4,h=p.includes("("),E=h?[O(p)]:null;return s.push({depth:l,index:a,isRoute:h,methods:E,segment:i}),s},[]),n=[];return o.filter(s=>s.isRoute).forEach(s=>{let a=[...o.filter(i=>i.index<s.index&&i.depth<s.depth).filter((i,u,c)=>!c.find(l=>l.depth===i.depth&&l.index>i.index)).map(i=>i.segment),s.segment].join("");if(s.methods===null)throw new Error("Invalid methods");s.methods.forEach(i=>{n.push({file:"unknown",method:i.toUpperCase(),path:a,tags:[]});});}),n},b=te;var re=e=>{let t=e._core.router.routes,o=[];return [...t.keys()].forEach(n=>{t.get(n).routes.forEach(s=>{o.push({file:"unknown",method:s.route.method.toUpperCase(),path:s.path,tags:[]});});}),o},C=re;var oe=e=>{let r=[];return e.middleware.filter(t=>t.router).flatMap(t=>t.router.stack).forEach(t=>{r.push({file:"unknown",method:t.methods.join("|").toUpperCase(),path:t.path,tags:[]});}),r},F=oe;var N=/\.(js|ts|mjs|cjs)$/u,pe=(e,r,t=false)=>{e=path.toNamespacedPath(e);let o=path.toNamespacedPath(q.cwd()),n=[],s=jsdocOpenApi.parseFile(e,jsdocOpenApi.jsDocumentCommentsToOpenApi,t);n=[...n,...s.map(i=>i.spec)];let p=jsdocOpenApi.parseFile(e,jsdocOpenApi.swaggerJsDocumentCommentsToOpenApi,t);n=[...n,...p.map(i=>i.spec)];let a=[];return n.length===0?(fs.readFileSync(e,"utf8").split(/\r?\n/u).forEach(u=>{let c=/[=aces|]+\s["'|](GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS)["'|]/u.exec(u);if(c){let[,l]=c;l==="GET"&&(l="GET|HEAD"),a.push({file:e.replace(`${o}/`,""),method:l,path:path.toNamespacedPath(e.replace(r,"").replace(N,"")),tags:[]});}}),a.length===0&&a.push({file:e.replace(`${o}/`,""),method:"GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS",path:path.toNamespacedPath(e.replace(r,"").replace(N,"")),tags:[]}),a):(n.forEach(i=>{Object.entries(i?.paths??{}).forEach(([c,l])=>{Object.entries(l).forEach(([E,x])=>{a.push({file:e.replace(`${o}/`,""),method:E.toUpperCase(),path:path.toNamespacedPath(c),tags:x.tags});});});}),a)},M=pe;var y=[".js",".ts",".mjs",".cjs"],H=e=>{let r=path.parse(e);for(;r.base&&r.root!==r.dir;){if(fs.readdirSync(r.dir).find(n=>n==="package.json"))return r.dir;r=path.parse(r.dir);}return null},K=e=>{let r=`${e}/package.json`,{dependencies:t}=JSON.parse(fs.readFileSync(r).toString());return t?.express?"express":t?.koa&&(t["@koa/router"]||t["koa-router"])?"koa":t?.next?"next":t?.["@hapi/hapi"]?"hapi":t?.fastify?"fastify":null},G=(e,r)=>Object.keys(e).length===0?null:r==="hapi"?typeof e.app.app=="string"?e.app:e:e.app??e;var _=e=>{try{return fs.statSync(e).isDirectory()}catch{return false}},me=async(e="")=>{let r=path.join(e,"pages/api");return !_(r)&&(r=path.join(e,"src/pages/api"),!_(r))?[]:fs$1.collect(r,{extensions:y,includeDirs:false})},U=me;var R=async(e,r,t)=>{if(r==="express")return j(e);if(r==="koa")return F(e);if(r==="hapi")return C(e);if(r==="fastify")return b(e);if(r==="next"){let o=await U(e);if(o.length===0)throw new Error(`No API routes found, in "${e}".`);return o.flatMap(n=>M(n,e,t))}return null};var he=(e,r)=>{let t=new Map;return e.forEach(o=>{let n=r(o),s=t.get(n);s?s.push(o):t.set(n,[o]);}),t},W=he;var de=(e,r)=>{let t={ANY:m__default.default.redBright,DELETE:m__default.default.redBright,GET:m__default.default.blue,HEAD:m__default.default.hex("#6C7280"),OPTIONS:m__default.default.hex("#6C7280"),PATCH:m__default.default.yellow,POST:m__default.default.yellow,PUT:m__default.default.yellow},o;if(e==="GET|HEAD")o=`${m__default.default.blue("GET")}${m__default.default.grey("|HEAD")}`;else {let u=t[e](e);o=e==="GET"?`${u}${m__default.default.grey("|HEAD")}`:u;}let n=e==="GET"?6:14-e.length,s=Array.from({length:n}).fill(" ").join(""),p=process.stdout.columns-16-r.length-4,a=p>0?Array.from({length:p}).fill(".").join(""):"",i=r.split("/").map(u=>[":","["].includes(u[0]??"")?m__default.default.yellowBright(u):u).join("/");return ` ${o}${s}${i}${m__default.default.grey(a)}`},ge=(e,r={})=>e.map(t=>{if(!(Array.isArray(r.methods)&&r.methods.includes(t.method)))return t.method==="GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS"&&(t.method="ANY"),de(t.method,t.path.replace("/pages",""))}).filter(Boolean),w=ge;var xe=async(e,r,t={})=>{let o=path.join(q__default.default.cwd(),r);if(!fs.existsSync(o))throw new Error("No such file, invalid path provided.");let n=H(o);if(!n)throw new Error("Please initialize local package.json.");if(e===void 0){let p=K(n);if(!p)throw new Error("Couldn't detect supported back-end framework.");e=p;}let s=null;if(e==="next")s=await R(o,"next",t.verbose??false);else {if(!fs.statSync(o).isFile())throw new Error(`${o} is directory, but file expected.`);if(!y.includes(path.extname(o)))throw new Error("Please specify application .ts/.js/.mjs/.cjs file.");let p=`${n}/.env`;fs.existsSync(p)&&(await import(`${n}/node_modules/dotenv/lib/main.js`)).config({path:p});let a=path.extname(o)===".ts",i=path.join(n,"node_modules/.bin/tsc");if(a&&!fs.existsSync(i))throw new Error(`Please install typescript in ${n}`);try{if(a)try{child_process.execSync(`${i} --outDir framework-list >&2`,{cwd:n});}catch(l){console.log(`TSC compilation failed. Please resolve issues in your project.
|
|
3
|
-
`),console.log(l),fs.rmSync(path.join(n,"framework-list"),{recursive:!0});}let u=a?path.join(n,"framework-list",o.replace(n,"").replace(".ts",".js")):o,{default:c}=await import(u);s=await R(["AsyncFunction","Function"].includes(c.constructor.name)?await c():G(c,e),e,t.verbose??!1);}finally{a&&fs.rmSync(path.join(n,"framework-list"),{recursive:true});}}if(s===null)throw new Error(`Framework "${e}" is not supported.`);if(Array.isArray(t.includePaths)&&t.includePaths.length>0&&(s=t.includePaths.flatMap(p=>s.filter(a=>a.path.startsWith(p)))),Array.isArray(t.excludePaths)&&t.excludePaths.length>0&&(s=t.excludePaths.flatMap(p=>s.filter(a=>!a.path.startsWith(p)))),typeof t.group=="string"&&t.group!==""){console.log();let p=W(s,i=>t.group==="path"?i.path.replace("/pages","").split("/")[1]:i.tags[0]??"unsorted"),a=0;p.forEach((i,u)=>{a>0&&console.log();let c=(q__default.default.stdout.columns-16-u.length)/2,l=c>0?Array.from({length:c}).fill(" ").join(""):"";console.log(l+m__default.default.bold.underline(u)),w(i,t).forEach(h=>{console.log(h);}),a+=1;});}else console.log(),w(s,t).forEach(p=>{console.log(p);});console.log(`
|
|
4
|
-
Listed ${m__default.default.greenBright(String(s.length))} HTTP ${s.length===1?"route":"routes"}.
|
|
5
|
-
`);},wt=xe;exports.a=wt;//# sourceMappingURL=chunk-FQUHP33M.js.map
|
|
6
|
-
//# sourceMappingURL=chunk-FQUHP33M.js.map
|