@dokploy/trpc-openapi 0.0.11 → 0.0.12
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/esm/adapters/{express.js → express.mjs} +1 -1
- package/dist/esm/adapters/{fastify.js → fastify.mjs} +1 -1
- package/dist/esm/adapters/{fetch.js → fetch.mjs} +1 -1
- package/dist/esm/adapters/index.mjs +9 -0
- package/dist/esm/adapters/{koa.js → koa.mjs} +1 -1
- package/dist/esm/adapters/{next.js → next.mjs} +2 -2
- package/dist/esm/adapters/node-http/{core.js → core.mjs} +5 -5
- package/dist/esm/adapters/node-http/index.mjs +5 -0
- package/dist/esm/adapters/node-http/{procedures.js → procedures.mjs} +1 -1
- package/dist/esm/adapters/{nuxt.js → nuxt.mjs} +2 -2
- package/dist/esm/adapters/{standalone.js → standalone.mjs} +1 -1
- package/dist/esm/generator/{index.js → index.mjs} +1 -1
- package/dist/esm/generator/{paths.js → paths.mjs} +2 -2
- package/dist/esm/generator/{schema.js → schema.mjs} +3 -3
- package/dist/esm/index.mjs +6 -0
- package/dist/esm/utils/index.mjs +5 -0
- package/package.json +1 -1
- package/dist/esm/adapters/index.js +0 -9
- package/dist/esm/adapters/node-http/index.js +0 -5
- package/dist/esm/index.js +0 -6
- package/dist/esm/utils/index.js +0 -5
- /package/dist/esm/adapters/node-http/{errors.js → errors.mjs} +0 -0
- /package/dist/esm/adapters/node-http/{input.js → input.mjs} +0 -0
- /package/dist/esm/{types.js → types.mjs} +0 -0
- /package/dist/esm/utils/{method.js → method.mjs} +0 -0
- /package/dist/esm/utils/{path.js → path.mjs} +0 -0
- /package/dist/esm/utils/{procedure.js → procedure.mjs} +0 -0
- /package/dist/esm/utils/{zod.js → zod.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createOpenApiNodeHttpHandler } from './node-http';
|
|
1
|
+
import { createOpenApiNodeHttpHandler } from './node-http/index.mjs';
|
|
2
2
|
export const createOpenApiExpressMiddleware = (opts) => {
|
|
3
3
|
const openApiHttpHandler = createOpenApiNodeHttpHandler(opts);
|
|
4
4
|
return async (req, res) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createOpenApiNodeHttpHandler } from './node-http';
|
|
1
|
+
import { createOpenApiNodeHttpHandler } from './node-http/index.mjs';
|
|
2
2
|
export function fastifyTRPCOpenApiPlugin(fastify, opts, done) {
|
|
3
3
|
let prefix = opts.basePath ?? '';
|
|
4
4
|
// if prefix ends with a slash, remove it
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/server';
|
|
2
|
-
import { createOpenApiNodeHttpHandler } from './node-http';
|
|
2
|
+
import { createOpenApiNodeHttpHandler } from './node-http/index.mjs';
|
|
3
3
|
const getUrlEncodedBody = async (req) => {
|
|
4
4
|
const params = new URLSearchParams(await req.text());
|
|
5
5
|
const data = {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './standalone.mjs';
|
|
2
|
+
export * from './express.mjs';
|
|
3
|
+
export * from './next.mjs';
|
|
4
|
+
export * from './fastify.mjs';
|
|
5
|
+
export * from './fetch.mjs';
|
|
6
|
+
export * from './nuxt.mjs';
|
|
7
|
+
export * from './node-http/index.mjs';
|
|
8
|
+
export * from './koa.mjs';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createOpenApiNodeHttpHandler } from './node-http';
|
|
1
|
+
import { createOpenApiNodeHttpHandler } from './node-http/index.mjs';
|
|
2
2
|
export const createOpenApiKoaMiddleware = (opts) => {
|
|
3
3
|
const openApiHttpHandler = createOpenApiNodeHttpHandler(opts);
|
|
4
4
|
return async (ctx, next) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/server';
|
|
2
|
-
import { normalizePath } from '../utils';
|
|
3
|
-
import { createOpenApiNodeHttpHandler } from './node-http';
|
|
2
|
+
import { normalizePath } from '../utils/index.mjs';
|
|
3
|
+
import { createOpenApiNodeHttpHandler } from './node-http/index.mjs';
|
|
4
4
|
export const createOpenApiNextHandler = (opts) => {
|
|
5
5
|
const openApiHttpHandler = createOpenApiNodeHttpHandler(opts);
|
|
6
6
|
return async (req, res) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/server';
|
|
2
2
|
import { getErrorShape } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import { ZodArray } from 'zod';
|
|
4
|
-
import { generateOpenApiDocument } from '../../generator';
|
|
5
|
-
import { acceptsRequestBody, normalizePath, getInputOutputParsers, coerceSchema, instanceofZodTypeLikeVoid, instanceofZodTypeObject, instanceofZodTypeOptional, unwrapZodType, zodSupportsCoerce, getContentType, getRequestSignal, } from '../../utils';
|
|
6
|
-
import { TRPC_ERROR_CODE_HTTP_STATUS, getErrorFromUnknown } from './errors';
|
|
7
|
-
import { getBody, getQuery } from './input';
|
|
8
|
-
import { createProcedureCache } from './procedures';
|
|
4
|
+
import { generateOpenApiDocument } from '../../generator/index.mjs';
|
|
5
|
+
import { acceptsRequestBody, normalizePath, getInputOutputParsers, coerceSchema, instanceofZodTypeLikeVoid, instanceofZodTypeObject, instanceofZodTypeOptional, unwrapZodType, zodSupportsCoerce, getContentType, getRequestSignal, } from '../../utils/index.mjs';
|
|
6
|
+
import { TRPC_ERROR_CODE_HTTP_STATUS, getErrorFromUnknown } from './errors.mjs';
|
|
7
|
+
import { getBody, getQuery } from './input.mjs';
|
|
8
|
+
import { createProcedureCache } from './procedures.mjs';
|
|
9
9
|
export const createOpenApiNodeHttpHandler = (opts) => {
|
|
10
10
|
const router = Object.assign({}, opts.router);
|
|
11
11
|
// Validate router
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPathRegExp, normalizePath, forEachOpenApiProcedure } from '../../utils';
|
|
1
|
+
import { getPathRegExp, normalizePath, forEachOpenApiProcedure } from '../../utils/index.mjs';
|
|
2
2
|
export const createProcedureCache = (router) => {
|
|
3
3
|
const procedureCache = new Map();
|
|
4
4
|
forEachOpenApiProcedure(router._def.procedures, ({ path: queryPath, procedure, meta: { openapi } }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/server';
|
|
2
2
|
import { defineEventHandler, getQuery } from 'h3';
|
|
3
|
-
import { normalizePath } from '../utils';
|
|
4
|
-
import { createOpenApiNodeHttpHandler } from './node-http';
|
|
3
|
+
import { normalizePath } from '../utils/index.mjs';
|
|
4
|
+
import { createOpenApiNodeHttpHandler } from './node-http/index.mjs';
|
|
5
5
|
export const createOpenApiNuxtHandler = (opts) => {
|
|
6
6
|
const openApiHttpHandler = createOpenApiNodeHttpHandler(opts);
|
|
7
7
|
return defineEventHandler(async (event) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { incomingMessageToRequest } from '@trpc/server/adapters/node-http';
|
|
2
|
-
import { createOpenApiNodeHttpHandler, } from './node-http/core';
|
|
2
|
+
import { createOpenApiNodeHttpHandler, } from './node-http/core.mjs';
|
|
3
3
|
export const createOpenApiHttpHandler = (opts) => {
|
|
4
4
|
const openApiHttpHandler = createOpenApiNodeHttpHandler(opts);
|
|
5
5
|
return async (req, res) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDocument } from 'zod-openapi';
|
|
2
|
-
import { getOpenApiPathsObject, mergePaths } from './paths';
|
|
2
|
+
import { getOpenApiPathsObject, mergePaths } from './paths.mjs';
|
|
3
3
|
export const generateOpenApiDocument = (appRouter, opts) => {
|
|
4
4
|
const securitySchemes = opts.securitySchemes ?? {
|
|
5
5
|
Authorization: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/server';
|
|
2
|
-
import { acceptsRequestBody, getPathParameters, normalizePath, forEachOpenApiProcedure, getInputOutputParsers, instanceofZodType, instanceofZodTypeLikeVoid, instanceofZodTypeObject, unwrapZodType, } from '../utils';
|
|
3
|
-
import { getParameterObjects, getRequestBodyObject, getResponsesObject, hasInputs } from './schema';
|
|
2
|
+
import { acceptsRequestBody, getPathParameters, normalizePath, forEachOpenApiProcedure, getInputOutputParsers, instanceofZodType, instanceofZodTypeLikeVoid, instanceofZodTypeObject, unwrapZodType, } from '../utils/index.mjs';
|
|
3
|
+
import { getParameterObjects, getRequestBodyObject, getResponsesObject, hasInputs } from './schema.mjs';
|
|
4
4
|
export var HttpMethods;
|
|
5
5
|
(function (HttpMethods) {
|
|
6
6
|
HttpMethods["GET"] = "get";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/server';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { HTTP_STATUS_TRPC_ERROR_CODE, TRPC_ERROR_CODE_HTTP_STATUS, TRPC_ERROR_CODE_MESSAGE, } from '../adapters';
|
|
4
|
-
import { instanceofZodType, instanceofZodTypeCoercible, instanceofZodTypeKind, instanceofZodTypeLikeString, instanceofZodTypeLikeVoid, instanceofZodTypeOptional, unwrapZodType, zodSupportsCoerce, } from '../utils';
|
|
5
|
-
import { HttpMethods } from './paths';
|
|
3
|
+
import { HTTP_STATUS_TRPC_ERROR_CODE, TRPC_ERROR_CODE_HTTP_STATUS, TRPC_ERROR_CODE_MESSAGE, } from '../adapters/index.mjs';
|
|
4
|
+
import { instanceofZodType, instanceofZodTypeCoercible, instanceofZodTypeKind, instanceofZodTypeLikeString, instanceofZodTypeLikeVoid, instanceofZodTypeOptional, unwrapZodType, zodSupportsCoerce, } from '../utils/index.mjs';
|
|
5
|
+
import { HttpMethods } from './paths.mjs';
|
|
6
6
|
export const getParameterObjects = (schema, required, pathParameters, headersSchema, inType) => {
|
|
7
7
|
const shape = schema.shape;
|
|
8
8
|
const shapeKeys = Object.keys(shape);
|
package/package.json
CHANGED
package/dist/esm/index.js
DELETED
package/dist/esm/utils/index.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|