@temporary-name/server 1.9.3-alpha.9f176ca3f9388d51e8dffa98a15fcf9f14f6a75e → 1.9.3-alpha.afd18ec2afa743b08cf1b5c2eb6252ded18a1f43
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/adapters/aws-lambda/index.d.mts +12 -6
- package/dist/adapters/aws-lambda/index.d.ts +12 -6
- package/dist/adapters/aws-lambda/index.mjs +14 -4
- package/dist/adapters/fetch/index.d.mts +12 -6
- package/dist/adapters/fetch/index.d.ts +12 -6
- package/dist/adapters/fetch/index.mjs +11 -8
- package/dist/adapters/node/index.d.mts +12 -6
- package/dist/adapters/node/index.d.ts +12 -6
- package/dist/adapters/node/index.mjs +11 -8
- package/dist/adapters/standard/index.d.mts +85 -13
- package/dist/adapters/standard/index.d.ts +85 -13
- package/dist/adapters/standard/index.mjs +7 -97
- package/dist/index.d.mts +6 -108
- package/dist/index.d.ts +6 -108
- package/dist/index.mjs +2 -3
- package/dist/openapi/index.d.mts +221 -0
- package/dist/openapi/index.d.ts +221 -0
- package/dist/openapi/index.mjs +784 -0
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/shared/{server.C1YnHvvf.d.ts → server.BKSOrA6h.d.mts} +2 -2
- package/dist/shared/{server.C1YnHvvf.d.mts → server.BKSOrA6h.d.ts} +2 -2
- package/dist/shared/{server.BEQrAa3A.mjs → server.BKh8I1Ny.mjs} +34 -2
- package/dist/shared/server.BeuTpcmO.d.mts +23 -0
- package/dist/shared/{server.Btxrgkj5.d.ts → server.C1fnTLq0.d.mts} +8 -24
- package/dist/shared/{server.Bo94xDTv.d.mts → server.CQyYNJ1H.d.ts} +8 -24
- package/dist/shared/server.DhdDYN-Z.mjs +261 -0
- package/dist/shared/server.SLLuK6_v.d.ts +23 -0
- package/dist/shared/server._YqJjI50.mjs +297 -0
- package/package.json +15 -9
- package/dist/shared/server.D6K9uoPI.mjs +0 -35
- package/dist/shared/server.DZ5BIITo.mjs +0 -9
- package/dist/shared/server.X0YaZxSJ.mjs +0 -13
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { AnySchema, ErrorMap, Meta, MergedErrorMap, Route, InferSchemaOutput, In
|
|
|
2
2
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@temporary-name/contract';
|
|
3
3
|
import { IntersectPick, ClientContext, MaybeOptionalOptions, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
4
4
|
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
5
|
-
import { C as Context,
|
|
6
|
-
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs,
|
|
5
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.BKSOrA6h.mjs';
|
|
6
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.BKSOrA6h.mjs';
|
|
7
7
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
8
8
|
|
|
9
9
|
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
@@ -140,7 +140,7 @@ interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContex
|
|
|
140
140
|
*
|
|
141
141
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
142
142
|
*/
|
|
143
|
-
'output'<USchema extends AnySchema>(schema: USchema):
|
|
143
|
+
'output'<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
144
144
|
/**
|
|
145
145
|
* Defines the handler of the procedure.
|
|
146
146
|
*
|
|
@@ -226,7 +226,7 @@ interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext exte
|
|
|
226
226
|
*
|
|
227
227
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
228
228
|
*/
|
|
229
|
-
'output'<USchema extends AnySchema>(schema: USchema):
|
|
229
|
+
'output'<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
230
230
|
/**
|
|
231
231
|
* Defines the handler of the procedure.
|
|
232
232
|
*
|
|
@@ -234,108 +234,6 @@ interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext exte
|
|
|
234
234
|
*/
|
|
235
235
|
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, Schema<UFuncOutput, UFuncOutput>, TErrorMap, TMeta>;
|
|
236
236
|
}
|
|
237
|
-
interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
|
|
238
|
-
/**
|
|
239
|
-
* This property holds the defined options.
|
|
240
|
-
*/
|
|
241
|
-
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
242
|
-
/**
|
|
243
|
-
* Adds type-safe custom errors.
|
|
244
|
-
* The provided errors are spared-merged with any existing errors.
|
|
245
|
-
*
|
|
246
|
-
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
247
|
-
*/
|
|
248
|
-
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
249
|
-
/**
|
|
250
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
251
|
-
*
|
|
252
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
253
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
254
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
255
|
-
*/
|
|
256
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilderWithOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
257
|
-
/**
|
|
258
|
-
* Sets or updates the metadata.
|
|
259
|
-
* The provided metadata is spared-merged with any existing metadata.
|
|
260
|
-
*
|
|
261
|
-
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
262
|
-
*/
|
|
263
|
-
'meta'(meta: TMeta): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
264
|
-
/**
|
|
265
|
-
* Sets or updates the route definition.
|
|
266
|
-
* The provided route is spared-merged with any existing route.
|
|
267
|
-
* This option is typically relevant when integrating with OpenAPI.
|
|
268
|
-
*
|
|
269
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
270
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
271
|
-
*/
|
|
272
|
-
'route'(route: Route): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
273
|
-
/**
|
|
274
|
-
* Defines the input validation schema.
|
|
275
|
-
*
|
|
276
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
|
|
277
|
-
*/
|
|
278
|
-
'input'<USchema extends AnySchema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
279
|
-
/**
|
|
280
|
-
* Defines the handler of the procedure.
|
|
281
|
-
*
|
|
282
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
283
|
-
*/
|
|
284
|
-
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
285
|
-
}
|
|
286
|
-
interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
|
|
287
|
-
/**
|
|
288
|
-
* This property holds the defined options.
|
|
289
|
-
*/
|
|
290
|
-
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
291
|
-
/**
|
|
292
|
-
* Adds type-safe custom errors.
|
|
293
|
-
* The provided errors are spared-merged with any existing errors.
|
|
294
|
-
*
|
|
295
|
-
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
296
|
-
*/
|
|
297
|
-
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
298
|
-
/**
|
|
299
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
300
|
-
*
|
|
301
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
302
|
-
* @info Pass second argument to map the input.
|
|
303
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
304
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
305
|
-
*/
|
|
306
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilderWithInputOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
307
|
-
/**
|
|
308
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
309
|
-
*
|
|
310
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
311
|
-
* @info Pass second argument to map the input.
|
|
312
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
313
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
314
|
-
*/
|
|
315
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): ProcedureBuilderWithInputOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
316
|
-
/**
|
|
317
|
-
* Sets or updates the metadata.
|
|
318
|
-
* The provided metadata is spared-merged with any existing metadata.
|
|
319
|
-
*
|
|
320
|
-
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
321
|
-
*/
|
|
322
|
-
'meta'(meta: TMeta): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
323
|
-
/**
|
|
324
|
-
* Sets or updates the route definition.
|
|
325
|
-
* The provided route is spared-merged with any existing route.
|
|
326
|
-
* This option is typically relevant when integrating with OpenAPI.
|
|
327
|
-
*
|
|
328
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
329
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
330
|
-
*/
|
|
331
|
-
'route'(route: Route): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
332
|
-
/**
|
|
333
|
-
* Defines the handler of the procedure.
|
|
334
|
-
*
|
|
335
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
336
|
-
*/
|
|
337
|
-
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
338
|
-
}
|
|
339
237
|
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
340
238
|
/**
|
|
341
239
|
* This property holds the defined options.
|
|
@@ -480,7 +378,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
|
480
378
|
*
|
|
481
379
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
482
380
|
*/
|
|
483
|
-
output<USchema extends AnySchema>(schema: USchema):
|
|
381
|
+
output<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
484
382
|
/**
|
|
485
383
|
* Defines the handler of the procedure.
|
|
486
384
|
*
|
|
@@ -702,4 +600,4 @@ declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router:
|
|
|
702
600
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
703
601
|
|
|
704
602
|
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
|
705
|
-
export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, BuilderWithMiddlewares, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureBuilder,
|
|
603
|
+
export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, BuilderWithMiddlewares, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureBuilder, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProcedureCallbackOptions, TraverseContractProceduresOptions, UnlaziedRouter };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { AnySchema, ErrorMap, Meta, MergedErrorMap, Route, InferSchemaOutput, In
|
|
|
2
2
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@temporary-name/contract';
|
|
3
3
|
import { IntersectPick, ClientContext, MaybeOptionalOptions, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
4
4
|
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
5
|
-
import { C as Context,
|
|
6
|
-
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs,
|
|
5
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.BKSOrA6h.js';
|
|
6
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.BKSOrA6h.js';
|
|
7
7
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
8
8
|
|
|
9
9
|
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
@@ -140,7 +140,7 @@ interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContex
|
|
|
140
140
|
*
|
|
141
141
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
142
142
|
*/
|
|
143
|
-
'output'<USchema extends AnySchema>(schema: USchema):
|
|
143
|
+
'output'<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
144
144
|
/**
|
|
145
145
|
* Defines the handler of the procedure.
|
|
146
146
|
*
|
|
@@ -226,7 +226,7 @@ interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext exte
|
|
|
226
226
|
*
|
|
227
227
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
228
228
|
*/
|
|
229
|
-
'output'<USchema extends AnySchema>(schema: USchema):
|
|
229
|
+
'output'<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
230
230
|
/**
|
|
231
231
|
* Defines the handler of the procedure.
|
|
232
232
|
*
|
|
@@ -234,108 +234,6 @@ interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext exte
|
|
|
234
234
|
*/
|
|
235
235
|
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, Schema<UFuncOutput, UFuncOutput>, TErrorMap, TMeta>;
|
|
236
236
|
}
|
|
237
|
-
interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
|
|
238
|
-
/**
|
|
239
|
-
* This property holds the defined options.
|
|
240
|
-
*/
|
|
241
|
-
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
242
|
-
/**
|
|
243
|
-
* Adds type-safe custom errors.
|
|
244
|
-
* The provided errors are spared-merged with any existing errors.
|
|
245
|
-
*
|
|
246
|
-
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
247
|
-
*/
|
|
248
|
-
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
249
|
-
/**
|
|
250
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
251
|
-
*
|
|
252
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
253
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
254
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
255
|
-
*/
|
|
256
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilderWithOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
257
|
-
/**
|
|
258
|
-
* Sets or updates the metadata.
|
|
259
|
-
* The provided metadata is spared-merged with any existing metadata.
|
|
260
|
-
*
|
|
261
|
-
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
262
|
-
*/
|
|
263
|
-
'meta'(meta: TMeta): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
264
|
-
/**
|
|
265
|
-
* Sets or updates the route definition.
|
|
266
|
-
* The provided route is spared-merged with any existing route.
|
|
267
|
-
* This option is typically relevant when integrating with OpenAPI.
|
|
268
|
-
*
|
|
269
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
270
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
271
|
-
*/
|
|
272
|
-
'route'(route: Route): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
273
|
-
/**
|
|
274
|
-
* Defines the input validation schema.
|
|
275
|
-
*
|
|
276
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
|
|
277
|
-
*/
|
|
278
|
-
'input'<USchema extends AnySchema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
279
|
-
/**
|
|
280
|
-
* Defines the handler of the procedure.
|
|
281
|
-
*
|
|
282
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
283
|
-
*/
|
|
284
|
-
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
285
|
-
}
|
|
286
|
-
interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
|
|
287
|
-
/**
|
|
288
|
-
* This property holds the defined options.
|
|
289
|
-
*/
|
|
290
|
-
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
291
|
-
/**
|
|
292
|
-
* Adds type-safe custom errors.
|
|
293
|
-
* The provided errors are spared-merged with any existing errors.
|
|
294
|
-
*
|
|
295
|
-
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
296
|
-
*/
|
|
297
|
-
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
298
|
-
/**
|
|
299
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
300
|
-
*
|
|
301
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
302
|
-
* @info Pass second argument to map the input.
|
|
303
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
304
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
305
|
-
*/
|
|
306
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilderWithInputOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
307
|
-
/**
|
|
308
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
309
|
-
*
|
|
310
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
311
|
-
* @info Pass second argument to map the input.
|
|
312
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
313
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
314
|
-
*/
|
|
315
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): ProcedureBuilderWithInputOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
316
|
-
/**
|
|
317
|
-
* Sets or updates the metadata.
|
|
318
|
-
* The provided metadata is spared-merged with any existing metadata.
|
|
319
|
-
*
|
|
320
|
-
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
321
|
-
*/
|
|
322
|
-
'meta'(meta: TMeta): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
323
|
-
/**
|
|
324
|
-
* Sets or updates the route definition.
|
|
325
|
-
* The provided route is spared-merged with any existing route.
|
|
326
|
-
* This option is typically relevant when integrating with OpenAPI.
|
|
327
|
-
*
|
|
328
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
329
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
330
|
-
*/
|
|
331
|
-
'route'(route: Route): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
332
|
-
/**
|
|
333
|
-
* Defines the handler of the procedure.
|
|
334
|
-
*
|
|
335
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
336
|
-
*/
|
|
337
|
-
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
338
|
-
}
|
|
339
237
|
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
340
238
|
/**
|
|
341
239
|
* This property holds the defined options.
|
|
@@ -480,7 +378,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
|
480
378
|
*
|
|
481
379
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
482
380
|
*/
|
|
483
|
-
output<USchema extends AnySchema>(schema: USchema):
|
|
381
|
+
output<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
484
382
|
/**
|
|
485
383
|
* Defines the handler of the procedure.
|
|
486
384
|
*
|
|
@@ -702,4 +600,4 @@ declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router:
|
|
|
702
600
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
703
601
|
|
|
704
602
|
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
|
705
|
-
export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, BuilderWithMiddlewares, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureBuilder,
|
|
603
|
+
export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, BuilderWithMiddlewares, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureBuilder, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProcedureCallbackOptions, TraverseContractProceduresOptions, UnlaziedRouter };
|
package/dist/index.mjs
CHANGED
|
@@ -2,9 +2,8 @@ import { isContractProcedure, mergeErrorMap, mergeMeta, mergeRoute, mergePrefix,
|
|
|
2
2
|
export { ValidationError, eventIterator, type, validateORPCError } from '@temporary-name/contract';
|
|
3
3
|
import { onError, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
4
4
|
export { AsyncIteratorClass, EventPublisher, ORPCError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
5
|
-
import { g as gatingContext } from './shared/server.
|
|
6
|
-
|
|
7
|
-
export { L as LAZY_SYMBOL, a as createORPCErrorConstructorMap, m as mergeCurrentContext, b as middlewareOutputFn } from './shared/server.BEQrAa3A.mjs';
|
|
5
|
+
import { c as createProcedureClient, i as isLazy, g as getLazyMeta, l as lazy, u as unlazy, a as gatingContext } from './shared/server.BKh8I1Ny.mjs';
|
|
6
|
+
export { L as LAZY_SYMBOL, b as createORPCErrorConstructorMap, m as mergeCurrentContext, d as middlewareOutputFn } from './shared/server.BKh8I1Ny.mjs';
|
|
8
7
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
8
|
import 'node:async_hooks';
|
|
10
9
|
import 'zod';
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { OpenAPI, AnyContractProcedure, AnySchema, AnyContractRouter } from '@temporary-name/contract';
|
|
2
|
+
export { OpenAPI } from '@temporary-name/contract';
|
|
3
|
+
import { AnyProcedure, TraverseContractProcedureCallbackOptions, AnyRouter, ORPCError, ClientContext, Lazyable, CreateProcedureClientOptions, InferRouterInitialContext, Schema, ErrorMap, Meta, RouterClient } from '@temporary-name/server';
|
|
4
|
+
import { Promisable, Value, HTTPPath, HTTPMethod, NestedClient, Client, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
5
|
+
import { JSONSchema } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
6
|
+
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
7
|
+
|
|
8
|
+
type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: OpenAPI.OperationObject, procedure: AnyContractProcedure) => OpenAPI.OperationObject);
|
|
9
|
+
/**
|
|
10
|
+
* Customize The Operation Object by proxy an error map item or a middleware.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#customizing-operation-objects Customizing Operation Objects Docs}
|
|
13
|
+
*/
|
|
14
|
+
declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
|
|
15
|
+
declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
|
|
16
|
+
declare function applyCustomOpenAPIOperation(operation: OpenAPI.OperationObject, contract: AnyContractProcedure): OpenAPI.OperationObject;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
type ObjectSchema = JSONSchema & {
|
|
22
|
+
type: 'object';
|
|
23
|
+
} & object;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
type FileSchema = JSONSchema & {
|
|
28
|
+
type: 'string';
|
|
29
|
+
contentMediaType: string;
|
|
30
|
+
} & object;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
declare const LOGIC_KEYWORDS: string[];
|
|
35
|
+
|
|
36
|
+
interface SchemaConverterComponent {
|
|
37
|
+
allowedStrategies: readonly SchemaConvertOptions['strategy'][];
|
|
38
|
+
schema: AnySchema;
|
|
39
|
+
required: boolean;
|
|
40
|
+
ref: string;
|
|
41
|
+
}
|
|
42
|
+
interface SchemaConvertOptions {
|
|
43
|
+
strategy: 'input' | 'output';
|
|
44
|
+
/**
|
|
45
|
+
* Common components should use `$ref` to represent themselves if matched.
|
|
46
|
+
*/
|
|
47
|
+
components?: readonly SchemaConverterComponent[];
|
|
48
|
+
/**
|
|
49
|
+
* Minimum schema structure depth required before using `$ref` for components.
|
|
50
|
+
*
|
|
51
|
+
* For example, if set to 2, `$ref` will only be used for schemas nested at depth 2 or greater.
|
|
52
|
+
*
|
|
53
|
+
* @default 0 - No depth limit;
|
|
54
|
+
*/
|
|
55
|
+
minStructureDepthForRef?: number;
|
|
56
|
+
}
|
|
57
|
+
interface SchemaConverter {
|
|
58
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
59
|
+
}
|
|
60
|
+
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
61
|
+
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<boolean>;
|
|
62
|
+
}
|
|
63
|
+
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
64
|
+
private readonly converters;
|
|
65
|
+
constructor(converters: readonly ConditionalSchemaConverter[]);
|
|
66
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promise<[required: boolean, jsonSchema: JSONSchema]>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface OpenAPIGeneratorOptions {
|
|
70
|
+
schemaConverters?: ConditionalSchemaConverter[];
|
|
71
|
+
}
|
|
72
|
+
interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document, 'openapi'>> {
|
|
73
|
+
/**
|
|
74
|
+
* Exclude procedures from the OpenAPI specification.
|
|
75
|
+
*
|
|
76
|
+
* @deprecated Use `filter` option instead.
|
|
77
|
+
* @default () => false
|
|
78
|
+
*/
|
|
79
|
+
exclude?: (procedure: AnyProcedure | AnyContractProcedure, path: readonly string[]) => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Filter procedures. Return `false` to exclude a procedure from the OpenAPI specification.
|
|
82
|
+
*
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
filter?: Value<boolean, [options: TraverseContractProcedureCallbackOptions]>;
|
|
86
|
+
/**
|
|
87
|
+
* Common schemas to be used for $ref resolution.
|
|
88
|
+
*/
|
|
89
|
+
commonSchemas?: Record<string, {
|
|
90
|
+
/**
|
|
91
|
+
* Determines which schema definition to use when input and output schemas differ.
|
|
92
|
+
* This is needed because some schemas transform data differently between input and output,
|
|
93
|
+
* making it impossible to use a single $ref for both cases.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* // This schema transforms a string input into a number output
|
|
98
|
+
* const Schema = z.string()
|
|
99
|
+
* .transform(v => Number(v))
|
|
100
|
+
* .pipe(z.number())
|
|
101
|
+
*
|
|
102
|
+
* // Input schema: { type: 'string' }
|
|
103
|
+
* // Output schema: { type: 'number' }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* When schemas differ between input and output, you must explicitly choose
|
|
107
|
+
* which version to use for the OpenAPI specification.
|
|
108
|
+
*
|
|
109
|
+
* @default 'input' - Uses the input schema definition by default
|
|
110
|
+
*/
|
|
111
|
+
strategy?: SchemaConvertOptions['strategy'];
|
|
112
|
+
schema: AnySchema;
|
|
113
|
+
} | {
|
|
114
|
+
error: 'UndefinedError';
|
|
115
|
+
schema?: never;
|
|
116
|
+
}>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The generator that converts oRPC routers/contracts to OpenAPI specifications.
|
|
120
|
+
*
|
|
121
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
122
|
+
*/
|
|
123
|
+
declare class OpenAPIGenerator {
|
|
124
|
+
#private;
|
|
125
|
+
private readonly serializer;
|
|
126
|
+
private readonly converter;
|
|
127
|
+
constructor(options?: OpenAPIGeneratorOptions);
|
|
128
|
+
/**
|
|
129
|
+
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
130
|
+
*
|
|
131
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
132
|
+
*/
|
|
133
|
+
generate(router: AnyContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
declare function toOpenAPIPath(path: HTTPPath): string;
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
|
|
144
|
+
/**
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPI.MediaTypeObject>;
|
|
148
|
+
/**
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPI.MediaTypeObject>;
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPI.ParameterObject[];
|
|
156
|
+
/**
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
declare function checkParamsSchema(schema: ObjectSchema, params: string[]): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
declare function toOpenAPISchema(schema: JSONSchema): OpenAPI.SchemaObject & object;
|
|
164
|
+
declare function resolveOpenAPIJsonSchemaRef(doc: OpenAPI.Document, schema: JSONSchema): JSONSchema;
|
|
165
|
+
|
|
166
|
+
type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
|
|
167
|
+
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
168
|
+
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
|
|
169
|
+
type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [
|
|
170
|
+
U extends undefined ? null : JsonifiedValue<U>,
|
|
171
|
+
...JsonifiedArray<V>
|
|
172
|
+
] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
|
|
173
|
+
/**
|
|
174
|
+
* Convert types that JSON not support to corresponding json types
|
|
175
|
+
*
|
|
176
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/client/openapi-link OpenAPI Link Docs}
|
|
177
|
+
*/
|
|
178
|
+
type JsonifiedClient<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? Client<UClientContext, UInput, JsonifiedValue<UOutput>, UError extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : UError> : {
|
|
179
|
+
[K in keyof T]: T[K] extends NestedClient<any> ? JsonifiedClient<T[K]> : T[K];
|
|
180
|
+
};
|
|
181
|
+
declare function createJsonifiedRouterClient<T extends AnyRouter, TClientContext extends ClientContext>(router: Lazyable<T | undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<T>, Schema<unknown, unknown>, ErrorMap, Meta, TClientContext>>): JsonifiedClient<RouterClient<T, TClientContext>>;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
*@internal
|
|
185
|
+
*/
|
|
186
|
+
declare function isFileSchema(schema: JSONSchema): schema is FileSchema;
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
declare function isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
|
|
191
|
+
/**
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
declare function isAnySchema(schema: JSONSchema): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* @internal
|
|
197
|
+
*/
|
|
198
|
+
declare function separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
|
|
199
|
+
/**
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
|
|
203
|
+
declare function applySchemaOptionality(required: boolean, schema: JSONSchema): JSONSchema;
|
|
204
|
+
/**
|
|
205
|
+
* Takes a JSON schema and, if it's primarily a union type (anyOf, oneOf),
|
|
206
|
+
* recursively expands it into an array of its constituent, non-union base schemas.
|
|
207
|
+
* If the schema is not a simple union or is a base type, it's returned as a single-element array.
|
|
208
|
+
*/
|
|
209
|
+
declare function expandUnionSchema(schema: JSONSchema): JSONSchema[];
|
|
210
|
+
declare function expandArrayableSchema(schema: JSONSchema): undefined | [items: JSONSchema, array: JSONSchema & {
|
|
211
|
+
type: 'array';
|
|
212
|
+
items?: JSONSchema;
|
|
213
|
+
}];
|
|
214
|
+
declare function isPrimitiveSchema(schema: JSONSchema): boolean;
|
|
215
|
+
|
|
216
|
+
declare const oo: {
|
|
217
|
+
spec: typeof customOpenAPIOperation;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export { CompositeSchemaConverter, LOGIC_KEYWORDS, OpenAPIGenerator, applyCustomOpenAPIOperation, applySchemaOptionality, checkParamsSchema, createJsonifiedRouterClient, customOpenAPIOperation, expandArrayableSchema, expandUnionSchema, filterSchemaBranches, getCustomOpenAPIOperation, isAnySchema, isFileSchema, isObjectSchema, isPrimitiveSchema, oo, resolveOpenAPIJsonSchemaRef, separateObjectSchema, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|
|
221
|
+
export type { ConditionalSchemaConverter, FileSchema, JsonifiedArray, JsonifiedClient, JsonifiedValue, ObjectSchema, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, OverrideOperationValue, SchemaConvertOptions, SchemaConverter, SchemaConverterComponent };
|