@trpc/openapi 11.22.2-canary.9.85bcf328a → 11.23.1-canary.10.8a0997add
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/README.md +0 -8
- package/dist/cli.mjs +13 -5
- package/dist/heyapi/index.cjs +4 -0
- package/dist/heyapi/index.d.cts +25 -0
- package/dist/heyapi/index.d.cts.map +1 -1
- package/dist/heyapi/index.d.mts +25 -0
- package/dist/heyapi/index.d.mts.map +1 -1
- package/dist/heyapi/index.mjs +4 -0
- package/dist/heyapi/index.mjs.map +1 -1
- package/dist/index.cjs +13 -5
- package/dist/index.d.cts +17 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -20
- package/skills/openapi/SKILL.md +229 -164
- package/src/cli.ts +1 -1
- package/src/generate.ts +17 -5
- package/src/heyapi/index.ts +27 -1
- package/src/index.ts +3 -0
- package/src/types.ts +7 -1
- package/bin/intent.js +0 -20
package/README.md
CHANGED
|
@@ -39,14 +39,6 @@ The generator statically analyses your router's TypeScript types — it never ex
|
|
|
39
39
|
|
|
40
40
|
Full documentation is available at [trpc.io/docs/openapi](https://trpc.io/docs/openapi).
|
|
41
41
|
|
|
42
|
-
## AI Agents
|
|
43
|
-
|
|
44
|
-
If you use an AI coding agent, install tRPC skills for better code generation:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npx @tanstack/intent@latest install
|
|
48
|
-
```
|
|
49
|
-
|
|
50
42
|
## TODO
|
|
51
43
|
|
|
52
44
|
- [ ] SSE subscriptions
|
package/dist/cli.mjs
CHANGED
|
@@ -1027,12 +1027,20 @@ function buildOpenAPIDocument(procedures, options, meta = { errorSchema: null })
|
|
|
1027
1027
|
};
|
|
1028
1028
|
}
|
|
1029
1029
|
/**
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1030
|
+
* Reads your router file with the TypeScript compiler and returns an OpenAPI
|
|
1031
|
+
* 3.1 document for its queries and mutations.
|
|
1032
1032
|
*
|
|
1033
|
-
* @param routerFilePath -
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1033
|
+
* @param routerFilePath - Path to the file that exports your router type.
|
|
1034
|
+
* @param options - Export name, title, version and servers.
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```ts
|
|
1038
|
+
* const doc = await generateOpenAPIDocument('./src/server/router.ts', {
|
|
1039
|
+
* title: 'My API',
|
|
1040
|
+
* });
|
|
1041
|
+
* ```
|
|
1042
|
+
*
|
|
1043
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
1036
1044
|
*/
|
|
1037
1045
|
async function generateOpenAPIDocument(routerFilePath, options = {}) {
|
|
1038
1046
|
const resolvedPath = path.resolve(routerFilePath);
|
package/dist/heyapi/index.cjs
CHANGED
|
@@ -48,6 +48,8 @@ function resolveTransformer(transformer) {
|
|
|
48
48
|
* ],
|
|
49
49
|
* });
|
|
50
50
|
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see https://trpc.io/docs/openapi#hey-api-typescript
|
|
51
53
|
*/
|
|
52
54
|
function createTRPCHeyApiTypeResolvers() {
|
|
53
55
|
return {
|
|
@@ -113,6 +115,8 @@ function createTRPCErrorInterceptor(transformerOpts) {
|
|
|
113
115
|
* transformer: superjson,
|
|
114
116
|
* });
|
|
115
117
|
* ```
|
|
118
|
+
*
|
|
119
|
+
* @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc
|
|
116
120
|
*/
|
|
117
121
|
function configureTRPCHeyApiClient(client, opts) {
|
|
118
122
|
const { transformer } = opts, heyConfig = _objectWithoutProperties(opts, _excluded);
|
package/dist/heyapi/index.d.cts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { Plugins } from "@hey-api/openapi-ts";
|
|
2
2
|
import { TRPCCombinedDataTransformer, TRPCDataTransformer } from "@trpc/server";
|
|
3
3
|
//#region src/heyapi/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A tRPC data transformer, such as `superjson`.
|
|
6
|
+
* @see https://trpc.io/docs/openapi#transformers
|
|
7
|
+
*/
|
|
4
8
|
export type DataTransformerOptions = TRPCDataTransformer | TRPCCombinedDataTransformer;
|
|
9
|
+
/**
|
|
10
|
+
* tRPC options for {@link configureTRPCHeyApiClient}.
|
|
11
|
+
*/
|
|
5
12
|
export interface TRPCHeyApiClientOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The data transformer your tRPC server uses. Leave it out if the server
|
|
15
|
+
* has none.
|
|
16
|
+
* @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc
|
|
17
|
+
*/
|
|
6
18
|
transformer?: DataTransformerOptions;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The `~resolvers` type of the `@hey-api/typescript` plugin.
|
|
22
|
+
*/
|
|
8
23
|
export type HeyAPIResolvers = Plugins.HeyApiTypeScript.Resolvers;
|
|
24
|
+
/**
|
|
25
|
+
* The config of a hey-api fetch client.
|
|
26
|
+
*/
|
|
9
27
|
export type HeyApiConfig = ReturnType<Plugins.HeyApiClientFetch.Client['getConfig']>;
|
|
28
|
+
/**
|
|
29
|
+
* The parts of a hey-api client config that tRPC sets.
|
|
30
|
+
*/
|
|
10
31
|
export type TRPCHeyApiClientConfig = Required<Pick<HeyApiConfig, 'querySerializer'>> & Pick<HeyApiConfig, 'bodySerializer' | 'responseTransformer'>;
|
|
11
32
|
/**
|
|
12
33
|
* Returns the `~resolvers` object for the `@hey-api/typescript` plugin.
|
|
@@ -25,6 +46,8 @@ export type TRPCHeyApiClientConfig = Required<Pick<HeyApiConfig, 'querySerialize
|
|
|
25
46
|
* ],
|
|
26
47
|
* });
|
|
27
48
|
* ```
|
|
49
|
+
*
|
|
50
|
+
* @see https://trpc.io/docs/openapi#hey-api-typescript
|
|
28
51
|
*/
|
|
29
52
|
export declare function createTRPCHeyApiTypeResolvers(): HeyAPIResolvers;
|
|
30
53
|
/**
|
|
@@ -57,6 +80,8 @@ export declare function createTRPCErrorInterceptor(transformerOpts: DataTransfor
|
|
|
57
80
|
* transformer: superjson,
|
|
58
81
|
* });
|
|
59
82
|
* ```
|
|
83
|
+
*
|
|
84
|
+
* @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc
|
|
60
85
|
*/
|
|
61
86
|
export declare function configureTRPCHeyApiClient(client: Plugins.HeyApiClientFetch.Client, opts: TRPCHeyApiClientOptions & Omit<HeyApiConfig, keyof TRPCHeyApiClientConfig>): void;
|
|
62
87
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/heyapi/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/heyapi/index.ts"],"mappings":";;;;;;;YAUY,yBACR,sBACA;;;;iBAIa;;;;;;EAMf,cAAc;;;;;YAMJ,kBAAkB,QAAQ,iBAAiB;;;;YAK3C,eAAe,WACzB,QAAQ,kBAAkB;;;;YAMhB,yBAAyB,SACnC,KAAK,oCAEL,KAAK;;;;;;;;;;;;;;;;;;;;;wBA+BS,iCAAiC;;;;wBAoBjC,6BAA6B,OAAO;WA4BvB,mBAAA;WAIW,wBAAA,kBAAO;WA1BlB,kBAAA,OAAA;;;;;wBA2Cb,2BACd,iBAAiB,0BAGT;;;;;;;;;;;;;;;;;;;;;;wBA+BM,0BACd,QAAQ,QAAQ,kBAAkB,QAClC,MAAM,0BACJ,KAAK,oBAAoB"}
|
package/dist/heyapi/index.d.mts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { Plugins } from "@hey-api/openapi-ts";
|
|
2
2
|
import { TRPCCombinedDataTransformer, TRPCDataTransformer } from "@trpc/server";
|
|
3
3
|
//#region src/heyapi/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A tRPC data transformer, such as `superjson`.
|
|
6
|
+
* @see https://trpc.io/docs/openapi#transformers
|
|
7
|
+
*/
|
|
4
8
|
export type DataTransformerOptions = TRPCDataTransformer | TRPCCombinedDataTransformer;
|
|
9
|
+
/**
|
|
10
|
+
* tRPC options for {@link configureTRPCHeyApiClient}.
|
|
11
|
+
*/
|
|
5
12
|
export interface TRPCHeyApiClientOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The data transformer your tRPC server uses. Leave it out if the server
|
|
15
|
+
* has none.
|
|
16
|
+
* @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc
|
|
17
|
+
*/
|
|
6
18
|
transformer?: DataTransformerOptions;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The `~resolvers` type of the `@hey-api/typescript` plugin.
|
|
22
|
+
*/
|
|
8
23
|
export type HeyAPIResolvers = Plugins.HeyApiTypeScript.Resolvers;
|
|
24
|
+
/**
|
|
25
|
+
* The config of a hey-api fetch client.
|
|
26
|
+
*/
|
|
9
27
|
export type HeyApiConfig = ReturnType<Plugins.HeyApiClientFetch.Client['getConfig']>;
|
|
28
|
+
/**
|
|
29
|
+
* The parts of a hey-api client config that tRPC sets.
|
|
30
|
+
*/
|
|
10
31
|
export type TRPCHeyApiClientConfig = Required<Pick<HeyApiConfig, 'querySerializer'>> & Pick<HeyApiConfig, 'bodySerializer' | 'responseTransformer'>;
|
|
11
32
|
/**
|
|
12
33
|
* Returns the `~resolvers` object for the `@hey-api/typescript` plugin.
|
|
@@ -25,6 +46,8 @@ export type TRPCHeyApiClientConfig = Required<Pick<HeyApiConfig, 'querySerialize
|
|
|
25
46
|
* ],
|
|
26
47
|
* });
|
|
27
48
|
* ```
|
|
49
|
+
*
|
|
50
|
+
* @see https://trpc.io/docs/openapi#hey-api-typescript
|
|
28
51
|
*/
|
|
29
52
|
export declare function createTRPCHeyApiTypeResolvers(): HeyAPIResolvers;
|
|
30
53
|
/**
|
|
@@ -57,6 +80,8 @@ export declare function createTRPCErrorInterceptor(transformerOpts: DataTransfor
|
|
|
57
80
|
* transformer: superjson,
|
|
58
81
|
* });
|
|
59
82
|
* ```
|
|
83
|
+
*
|
|
84
|
+
* @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc
|
|
60
85
|
*/
|
|
61
86
|
export declare function configureTRPCHeyApiClient(client: Plugins.HeyApiClientFetch.Client, opts: TRPCHeyApiClientOptions & Omit<HeyApiConfig, keyof TRPCHeyApiClientConfig>): void;
|
|
62
87
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/heyapi/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/heyapi/index.ts"],"mappings":";;;;;;;YAUY,yBACR,sBACA;;;;iBAIa;;;;;;EAMf,cAAc;;;;;YAMJ,kBAAkB,QAAQ,iBAAiB;;;;YAK3C,eAAe,WACzB,QAAQ,kBAAkB;;;;YAMhB,yBAAyB,SACnC,KAAK,oCAEL,KAAK;;;;;;;;;;;;;;;;;;;;;wBA+BS,iCAAiC;;;;wBAoBjC,6BAA6B,OAAO;WA4BvB,mBAAA;WAIW,wBAAA,kBAAO;WA1BlB,kBAAA,OAAA;;;;;wBA2Cb,2BACd,iBAAiB,0BAGT;;;;;;;;;;;;;;;;;;;;;;wBA+BM,0BACd,QAAQ,QAAQ,kBAAkB,QAClC,MAAM,0BACJ,KAAK,oBAAoB"}
|
package/dist/heyapi/index.mjs
CHANGED
|
@@ -47,6 +47,8 @@ function resolveTransformer(transformer) {
|
|
|
47
47
|
* ],
|
|
48
48
|
* });
|
|
49
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see https://trpc.io/docs/openapi#hey-api-typescript
|
|
50
52
|
*/
|
|
51
53
|
function createTRPCHeyApiTypeResolvers() {
|
|
52
54
|
return {
|
|
@@ -112,6 +114,8 @@ function createTRPCErrorInterceptor(transformerOpts) {
|
|
|
112
114
|
* transformer: superjson,
|
|
113
115
|
* });
|
|
114
116
|
* ```
|
|
117
|
+
*
|
|
118
|
+
* @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc
|
|
115
119
|
*/
|
|
116
120
|
function configureTRPCHeyApiClient(client, opts) {
|
|
117
121
|
const { transformer } = opts, heyConfig = _objectWithoutProperties(opts, _excluded);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/heyapi/index.ts"],"sourcesContent":["import type { Plugins } from '@hey-api/openapi-ts';\nimport type {\n TRPCCombinedDataTransformer,\n TRPCDataTransformer,\n} from '@trpc/server';\n\nexport type DataTransformerOptions =\n TRPCDataTransformer
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/heyapi/index.ts"],"sourcesContent":["import type { Plugins } from '@hey-api/openapi-ts';\nimport type {\n TRPCCombinedDataTransformer,\n TRPCDataTransformer,\n} from '@trpc/server';\n\n/**\n * A tRPC data transformer, such as `superjson`.\n * @see https://trpc.io/docs/openapi#transformers\n */\nexport type DataTransformerOptions =\n | TRPCDataTransformer\n | TRPCCombinedDataTransformer;\n/**\n * tRPC options for {@link configureTRPCHeyApiClient}.\n */\nexport interface TRPCHeyApiClientOptions {\n /**\n * The data transformer your tRPC server uses. Leave it out if the server\n * has none.\n * @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc\n */\n transformer?: DataTransformerOptions;\n}\n\n/**\n * The `~resolvers` type of the `@hey-api/typescript` plugin.\n */\nexport type HeyAPIResolvers = Plugins.HeyApiTypeScript.Resolvers;\n\n/**\n * The config of a hey-api fetch client.\n */\nexport type HeyApiConfig = ReturnType<\n Plugins.HeyApiClientFetch.Client['getConfig']\n>;\n\n/**\n * The parts of a hey-api client config that tRPC sets.\n */\nexport type TRPCHeyApiClientConfig = Required<\n Pick<HeyApiConfig, 'querySerializer'>\n> &\n Pick<HeyApiConfig, 'bodySerializer' | 'responseTransformer'>;\n\nfunction resolveTransformer(\n transformer: DataTransformerOptions,\n): TRPCCombinedDataTransformer {\n if ('input' in transformer) {\n return transformer;\n }\n return { input: transformer, output: transformer };\n}\n\n/**\n * Returns the `~resolvers` object for the `@hey-api/typescript` plugin.\n *\n * Maps `date` and `date-time` string formats to `Date` so that the\n * generated SDK uses `Date` instead of `string` for those fields.\n *\n * @example\n * ```ts\n * import { createClient } from '@hey-api/openapi-ts';\n * import { createTRPCHeyApiTypeResolvers } from '@trpc/openapi/heyapi';\n *\n * await createClient({\n * plugins: [\n * { name: '@hey-api/typescript', '~resolvers': createTRPCHeyApiTypeResolvers() },\n * ],\n * });\n * ```\n *\n * @see https://trpc.io/docs/openapi#hey-api-typescript\n */\nexport function createTRPCHeyApiTypeResolvers(): HeyAPIResolvers {\n return {\n string(ctx) {\n if (ctx.schema.format === 'date-time' || ctx.schema.format === 'date') {\n return ctx.$.type('Date');\n }\n return undefined;\n },\n number(ctx) {\n if (ctx.schema.format === 'bigint') {\n return ctx.$.type('bigint');\n }\n return undefined;\n },\n };\n}\n\n/**\n * @internal - Prefer `configureTRPCHeyApiClient`\n */\nexport function createTRPCHeyApiClientConfig(opts?: TRPCHeyApiClientOptions) {\n const transformer = opts?.transformer\n ? resolveTransformer(opts.transformer)\n : undefined;\n\n return {\n querySerializer: (query: Record<string, unknown>) => {\n const params = new URLSearchParams();\n\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined) {\n continue;\n }\n\n if (key === 'input' && transformer) {\n params.append(\n key,\n JSON.stringify(transformer.input.serialize(value)),\n );\n } else {\n params.append(key, JSON.stringify(value));\n }\n }\n\n return params.toString();\n },\n\n ...(transformer && {\n bodySerializer: (body: unknown) => {\n return JSON.stringify(transformer.input.serialize(body));\n },\n\n responseTransformer: async (data: unknown) => {\n if (!!data && typeof data === 'object' && 'result' in data) {\n const result = (data as any).result;\n if (!result.type || result.type === 'data') {\n result.data = transformer.output.deserialize(result.data);\n }\n }\n\n return data;\n },\n }),\n } as const satisfies TRPCHeyApiClientConfig;\n}\n\n/**\n * @internal - Prefer `configureTRPCHeyApiClient`\n */\nexport function createTRPCErrorInterceptor(\n transformerOpts: DataTransformerOptions,\n) {\n const transformer = resolveTransformer(transformerOpts);\n return (error: unknown) => {\n if (!!error && typeof error === 'object' && 'error' in error) {\n (error as any).error = transformer.output.deserialize(\n (error as any).error,\n );\n }\n return error;\n };\n}\n\n/**\n * Configures a hey-api client for use with a tRPC OpenAPI backend.\n *\n * Sets up querySerializer, bodySerializer, responseTransformer, and\n * an error interceptor (for transformer-based error deserialization)\n * in a single call.\n *\n * @example\n * ```ts\n * import { configureTRPCHeyApiClient } from '@trpc/openapi/heyapi';\n * import superjson from 'superjson';\n * import { client } from './generated/client.gen';\n *\n * configureTRPCHeyApiClient(client, {\n * baseUrl: 'http://localhost:3000',\n * transformer: superjson,\n * });\n * ```\n *\n * @see https://trpc.io/docs/openapi#with-a-transformer-superjson-devalue-etc\n */\nexport function configureTRPCHeyApiClient(\n client: Plugins.HeyApiClientFetch.Client,\n opts: TRPCHeyApiClientOptions &\n Omit<HeyApiConfig, keyof TRPCHeyApiClientConfig>,\n) {\n const { transformer, ...heyConfig } = opts;\n const trpcConfig = createTRPCHeyApiClientConfig({ transformer });\n\n client.setConfig({ ...heyConfig, ...trpcConfig });\n\n if (transformer) {\n client.interceptors.error.use(createTRPCErrorInterceptor(transformer));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuLU,MAAA,YAAA,CAAA,aAAA;AA1IV,SAAS,mBACP,aAC6B;CAC7B,IAAI,WAAW,aACb,OAAO;CAET,OAAO;EAAE,OAAO;EAAa,QAAQ;CAAY;AACnD;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,gCAAiD;CAC/D,OAAO;EACL,OAAO,KAAK;GACV,IAAI,IAAI,OAAO,WAAW,eAAe,IAAI,OAAO,WAAW,QAC7D,OAAO,IAAI,EAAE,KAAK,MAAM;EAG5B;EACA,OAAO,KAAK;GACV,IAAI,IAAI,OAAO,WAAW,UACxB,OAAO,IAAI,EA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D,OAAO,UAAA,eAAA,eAAA,CAAA,GAAe,SAAA,GAAc,UAAW,CAAC;CAEhD,IAAI,aACF,OAAO,aAAa,MAAM,IAAI,2BAA2B,WAAW,CAAC;AAEzE"}
|
package/dist/index.cjs
CHANGED
|
@@ -1083,12 +1083,20 @@ function buildOpenAPIDocument(procedures, options, meta = { errorSchema: null })
|
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
1085
|
/**
|
|
1086
|
-
*
|
|
1087
|
-
*
|
|
1086
|
+
* Reads your router file with the TypeScript compiler and returns an OpenAPI
|
|
1087
|
+
* 3.1 document for its queries and mutations.
|
|
1088
1088
|
*
|
|
1089
|
-
* @param routerFilePath -
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1089
|
+
* @param routerFilePath - Path to the file that exports your router type.
|
|
1090
|
+
* @param options - Export name, title, version and servers.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```ts
|
|
1094
|
+
* const doc = await generateOpenAPIDocument('./src/server/router.ts', {
|
|
1095
|
+
* title: 'My API',
|
|
1096
|
+
* });
|
|
1097
|
+
* ```
|
|
1098
|
+
*
|
|
1099
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
1092
1100
|
*/
|
|
1093
1101
|
async function generateOpenAPIDocument(routerFilePath, options = {}) {
|
|
1094
1102
|
var _options$exportName;
|
package/dist/index.d.cts
CHANGED
|
@@ -92,6 +92,10 @@ type Document<T extends {} = {}> = Replace<OpenAPIV3_1.Document<T>, {
|
|
|
92
92
|
}>;
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/generate.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* Options for {@link generateOpenAPIDocument}.
|
|
97
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
98
|
+
*/
|
|
95
99
|
interface GenerateOptions {
|
|
96
100
|
/**
|
|
97
101
|
* The name of the exported router symbol.
|
|
@@ -111,12 +115,20 @@ interface GenerateOptions {
|
|
|
111
115
|
servers?: ServerObject[];
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
118
|
+
* Reads your router file with the TypeScript compiler and returns an OpenAPI
|
|
119
|
+
* 3.1 document for its queries and mutations.
|
|
120
|
+
*
|
|
121
|
+
* @param routerFilePath - Path to the file that exports your router type.
|
|
122
|
+
* @param options - Export name, title, version and servers.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const doc = await generateOpenAPIDocument('./src/server/router.ts', {
|
|
127
|
+
* title: 'My API',
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
116
130
|
*
|
|
117
|
-
* @
|
|
118
|
-
* the AppRouter.
|
|
119
|
-
* @param options - Optional generation settings (export name, title, version).
|
|
131
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
120
132
|
*/
|
|
121
133
|
export declare function generateOpenAPIDocument(routerFilePath: string, options?: GenerateOptions): Promise<Document>;
|
|
122
134
|
//#endregion
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/generate.ts"],"mappings":";;;;KAEY,QAAQ,SAAS,gBAAgB,KAAK,eAAe,gBAC/D;KAEU;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/generate.ts"],"mappings":";;;;KAEY,QAAQ,SAAS,gBAAgB,KAAK,eAAe,gBAC/D;KAEU;KASA,sBAAsB;KAEtB,cAAc,YAAgB;KAC9B,kBAAkB,YAAgB;KAClC,gBAAgB,YAAgB;KAChC,sBAAsB,YAAgB;KACtC,8BACV,YAAgB;KACN,YAAY,YAAgB;KAC5B,aAAa,YAAgB;KAC7B,uBAAuB,YAAgB;KACvC,eAAe,YAAgB;KAE/B,eAAe,QACzB,YAAgB;EAEd;EACA,QAAQ,eAAe;EACvB;EACA;EACA,aAAa,eAAe;EAC5B;EACA,QAAQ;EACR,c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;EAOA,UAAU;;;;;;;;;;;;;;;;;;wBA6oDU,wBACpB,wBACA,UAAS,kBACR,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -92,6 +92,10 @@ type Document<T extends {} = {}> = Replace<OpenAPIV3_1.Document<T>, {
|
|
|
92
92
|
}>;
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/generate.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* Options for {@link generateOpenAPIDocument}.
|
|
97
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
98
|
+
*/
|
|
95
99
|
interface GenerateOptions {
|
|
96
100
|
/**
|
|
97
101
|
* The name of the exported router symbol.
|
|
@@ -111,12 +115,20 @@ interface GenerateOptions {
|
|
|
111
115
|
servers?: ServerObject[];
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
118
|
+
* Reads your router file with the TypeScript compiler and returns an OpenAPI
|
|
119
|
+
* 3.1 document for its queries and mutations.
|
|
120
|
+
*
|
|
121
|
+
* @param routerFilePath - Path to the file that exports your router type.
|
|
122
|
+
* @param options - Export name, title, version and servers.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const doc = await generateOpenAPIDocument('./src/server/router.ts', {
|
|
127
|
+
* title: 'My API',
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
116
130
|
*
|
|
117
|
-
* @
|
|
118
|
-
* the AppRouter.
|
|
119
|
-
* @param options - Optional generation settings (export name, title, version).
|
|
131
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
120
132
|
*/
|
|
121
133
|
export declare function generateOpenAPIDocument(routerFilePath: string, options?: GenerateOptions): Promise<Document>;
|
|
122
134
|
//#endregion
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/generate.ts"],"mappings":";;;;KAEY,QAAQ,SAAS,gBAA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,UAAU,eAAe,gBAAgB;KAGhC,YAAY,mBAAmB,yBAAyB,gBAEjE,eAAe,KAAK;KAGX,iBAAiB,eAAe,iBAAiB;KAEjD,mBAAmB,QAC7B,YAAgB;EAEd,UAAU,eAAe;EACzB,YAAY,eAAe,kBAAkB;EAC7C,aAAa,eAAe,kBAAkB;EAC9C,gBAAgB,eAAe,kBAAkB;EACjD,UAAU,eAAe,kBAAkB;EAC3C,QAAQ,eAAe,kBAAkB;EACzC,YAAY,eAAe,kBAAkB;EAC7C,YAAY,eAAe,kBAAkB;;KAIrC,SAAS,qBAAqB,QACxC,YAAgB,SAAS;EAEvB,QAAQ,YAAY;EACpB,aAAa;;;;;;;;UC9GA;;;;;EAKf;;EAEA;;EAEA;;;;;;;EAOA,UAAU;;;;;;;;;;;;;;;;;;wBA6oDU,wBACpB,wBACA,UAAS,kBACR,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1049,12 +1049,20 @@ function buildOpenAPIDocument(procedures, options, meta = { errorSchema: null })
|
|
|
1049
1049
|
});
|
|
1050
1050
|
}
|
|
1051
1051
|
/**
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1052
|
+
* Reads your router file with the TypeScript compiler and returns an OpenAPI
|
|
1053
|
+
* 3.1 document for its queries and mutations.
|
|
1054
1054
|
*
|
|
1055
|
-
* @param routerFilePath -
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1055
|
+
* @param routerFilePath - Path to the file that exports your router type.
|
|
1056
|
+
* @param options - Export name, title, version and servers.
|
|
1057
|
+
*
|
|
1058
|
+
* @example
|
|
1059
|
+
* ```ts
|
|
1060
|
+
* const doc = await generateOpenAPIDocument('./src/server/router.ts', {
|
|
1061
|
+
* title: 'My API',
|
|
1062
|
+
* });
|
|
1063
|
+
* ```
|
|
1064
|
+
*
|
|
1065
|
+
* @see https://trpc.io/docs/openapi#programmatic
|
|
1058
1066
|
*/
|
|
1059
1067
|
async function generateOpenAPIDocument(routerFilePath, options = {}) {
|
|
1060
1068
|
var _options$exportName;
|