@temporary-name/server 1.9.3-alpha.ec3bfb9dce56198911349c322c970208b21b50db → 1.9.3-alpha.fb7b7d19964e1b2def7056f4345b63d6fcacce10
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 +2 -2
- package/dist/adapters/aws-lambda/index.d.ts +2 -2
- package/dist/adapters/fetch/index.d.mts +2 -2
- package/dist/adapters/fetch/index.d.ts +2 -2
- package/dist/adapters/node/index.d.mts +2 -2
- package/dist/adapters/node/index.d.ts +2 -2
- package/dist/adapters/standard/index.d.mts +2 -2
- package/dist/adapters/standard/index.d.ts +2 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +43 -39
- package/dist/openapi/index.d.mts +10 -30
- package/dist/openapi/index.d.ts +10 -30
- package/dist/openapi/index.mjs +335 -293
- package/dist/shared/{server.D8RAzJ_p.d.ts → server.B0LJ_wu-.d.ts} +1 -1
- package/dist/shared/{server.CVhIyQ4x.d.mts → server.BQZMQrPe.d.mts} +1 -1
- package/dist/shared/{server.Cj3_Lp61.d.mts → server.DXPMDozZ.d.mts} +26 -11
- package/dist/shared/{server.Cj3_Lp61.d.ts → server.DXPMDozZ.d.ts} +26 -11
- package/package.json +9 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { SendStandardResponseOptions, APIGatewayProxyEventV2, ResponseStream } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { C as Context,
|
|
4
|
-
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, l as Router } from '../../shared/server.DXPMDozZ.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.BQZMQrPe.mjs';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { SendStandardResponseOptions, APIGatewayProxyEventV2, ResponseStream } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { C as Context,
|
|
4
|
-
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, l as Router } from '../../shared/server.DXPMDozZ.js';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.B0LJ_wu-.js';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
3
|
-
import { C as Context,
|
|
4
|
-
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, l as Router } from '../../shared/server.DXPMDozZ.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.BQZMQrPe.mjs';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
type FetchHandleResult = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
3
|
-
import { C as Context,
|
|
4
|
-
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, l as Router } from '../../shared/server.DXPMDozZ.js';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.B0LJ_wu-.js';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
type FetchHandleResult = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
3
|
-
import { C as Context,
|
|
4
|
-
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, l as Router } from '../../shared/server.DXPMDozZ.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.BQZMQrPe.mjs';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
type NodeHttpHandleResult = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
3
|
-
import { C as Context,
|
|
4
|
-
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, l as Router } from '../../shared/server.DXPMDozZ.js';
|
|
4
|
+
import { b as StandardHandlerOptions, F as FriendlyStandardHandleOptions } from '../../shared/server.B0LJ_wu-.js';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
type NodeHttpHandleResult = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { F as FriendlyStandardHandleOptions, S as StandardHandleOptions, a as StandardHandleResult, c as StandardHandler, b as StandardHandlerOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.
|
|
1
|
+
export { F as FriendlyStandardHandleOptions, S as StandardHandleOptions, a as StandardHandleResult, c as StandardHandler, b as StandardHandlerOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.BQZMQrPe.mjs';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
3
|
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
-
import '../../shared/server.
|
|
4
|
+
import '../../shared/server.DXPMDozZ.mjs';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { F as FriendlyStandardHandleOptions, S as StandardHandleOptions, a as StandardHandleResult, c as StandardHandler, b as StandardHandlerOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.
|
|
1
|
+
export { F as FriendlyStandardHandleOptions, S as StandardHandleOptions, a as StandardHandleResult, c as StandardHandler, b as StandardHandlerOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.B0LJ_wu-.js';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
3
|
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
-
import '../../shared/server.
|
|
4
|
+
import '../../shared/server.DXPMDozZ.js';
|
|
5
5
|
import '@temporary-name/zod';
|
|
6
6
|
|
|
7
7
|
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as z from '@temporary-name/zod';
|
|
2
2
|
import { SchemaClass, core } from '@temporary-name/zod';
|
|
3
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
4
|
-
import { ClientContext, Value, Promisable, Client, MaybeOptionalOptions, HTTPEndpoint as HTTPEndpoint$1, IntersectPick,
|
|
4
|
+
import { ClientContext, Value, Promisable, Client, MaybeOptionalOptions, HTTPEndpoint as HTTPEndpoint$1, IntersectPick, HTTPPath, AsyncIteratorClass, ClientOptions, HTTPMethod } from '@temporary-name/shared';
|
|
5
5
|
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
6
|
-
import { C as Context, S as Schemas, I as InferProcedureClientInputs, a as InferSchemaOutput, M as Meta, L as Lazyable, P as Procedure, b as Contract, A as AnyShape, c as MergedSchemas, W as WrapShape, U as UnionToIntersection, d as AnySchema, R as Route, e as Middleware, f as MergedCurrentContext, g as MergedInitialContext,
|
|
7
|
-
export {
|
|
6
|
+
import { C as Context, S as Schemas, I as InferProcedureClientInputs, a as InferSchemaOutput, M as Meta, L as Lazyable, P as Procedure, b as Contract, A as AnyShape, c as MergedSchemas, W as WrapShape, U as UnionToIntersection, d as AnySchema, R as Route, e as Middleware, f as MergedCurrentContext, g as MergedInitialContext, V as ValidatedAuthContext, h as AuthConfig, B as BuildContextWithAuth, i as ProcedureHandler, j as InferHandlerInputs, k as InferSchemaInput, E as EnhanceRouterOptions, l as Router, m as EnhancedRouter, n as MapInputMiddleware, o as ContractDef, p as SchemaIssue, q as Schema, r as AnyMiddleware, s as Lazy, t as AnyProcedure, u as AnyRouter, v as InferRouterInitialContext } from './shared/server.DXPMDozZ.mjs';
|
|
7
|
+
export { a5 as AccessibleLazyRouter, Y as AnyContractDef, aa as ContractProcedureCallbackOptions, $ as ContractRouter, a1 as InferRouterCurrentContexts, a0 as InferRouterInitialContexts, a2 as InferRouterInputs, a3 as InferRouterOutputs, ai as InitialSchemas, x as LAZY_SYMBOL, y as LazyMeta, ab as LazyTraverseContractProceduresOptions, N as MiddlewareNextFn, Q as MiddlewareOptions, O as MiddlewareOutputFn, K as MiddlewareResult, Z as ProcedureDef, X as ProcedureHandlerOptions, a9 as TraverseContractProcedureCallbackOptions, a8 as TraverseContractProceduresOptions, ag as TypeRest, ae as UnlaziedRouter, a6 as createAccessibleLazyRouter, a7 as enhanceRouter, G as getLazyMeta, a4 as getRouter, ah as initialSchemas, F as isLazy, _ as isProcedure, D as lazy, z as lazyInternal, w as mergeCurrentContext, J as mergeMeta, T as middlewareOutputFn, ad as resolveContractProcedures, ac as traverseContractProcedures, H as unlazy, af as unlazyRouter } from './shared/server.DXPMDozZ.mjs';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
type ProcedureClient<TClientContext extends ClientContext, TSchemas extends Schemas> = Client<TClientContext, InferProcedureClientInputs<TSchemas>, InferSchemaOutput<TSchemas['outputSchema']>>;
|
|
@@ -82,7 +82,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
82
82
|
*/
|
|
83
83
|
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, TMeta>): ProcedureBuilder<TInitialContext, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TMeta, TGateName>;
|
|
84
84
|
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext, UOutContext, unknown, unknown, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TMeta, TGateName>;
|
|
85
|
-
useAuth<
|
|
85
|
+
useAuth<TAuthContext extends ValidatedAuthContext = false>(config: AuthConfig<TAuthContext, TCurrentContext, TMeta>): ProcedureBuilder<TInitialContext, BuildContextWithAuth<TCurrentContext, TAuthContext>, TSchemas, TMeta, TGateName>;
|
|
86
86
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
87
87
|
isGateEnabled: typeof isGateEnabled;
|
|
88
88
|
}>, TSchemas, TMeta, TInferredGateName>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as z from '@temporary-name/zod';
|
|
2
2
|
import { SchemaClass, core } from '@temporary-name/zod';
|
|
3
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
4
|
-
import { ClientContext, Value, Promisable, Client, MaybeOptionalOptions, HTTPEndpoint as HTTPEndpoint$1, IntersectPick,
|
|
4
|
+
import { ClientContext, Value, Promisable, Client, MaybeOptionalOptions, HTTPEndpoint as HTTPEndpoint$1, IntersectPick, HTTPPath, AsyncIteratorClass, ClientOptions, HTTPMethod } from '@temporary-name/shared';
|
|
5
5
|
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
6
|
-
import { C as Context, S as Schemas, I as InferProcedureClientInputs, a as InferSchemaOutput, M as Meta, L as Lazyable, P as Procedure, b as Contract, A as AnyShape, c as MergedSchemas, W as WrapShape, U as UnionToIntersection, d as AnySchema, R as Route, e as Middleware, f as MergedCurrentContext, g as MergedInitialContext,
|
|
7
|
-
export {
|
|
6
|
+
import { C as Context, S as Schemas, I as InferProcedureClientInputs, a as InferSchemaOutput, M as Meta, L as Lazyable, P as Procedure, b as Contract, A as AnyShape, c as MergedSchemas, W as WrapShape, U as UnionToIntersection, d as AnySchema, R as Route, e as Middleware, f as MergedCurrentContext, g as MergedInitialContext, V as ValidatedAuthContext, h as AuthConfig, B as BuildContextWithAuth, i as ProcedureHandler, j as InferHandlerInputs, k as InferSchemaInput, E as EnhanceRouterOptions, l as Router, m as EnhancedRouter, n as MapInputMiddleware, o as ContractDef, p as SchemaIssue, q as Schema, r as AnyMiddleware, s as Lazy, t as AnyProcedure, u as AnyRouter, v as InferRouterInitialContext } from './shared/server.DXPMDozZ.js';
|
|
7
|
+
export { a5 as AccessibleLazyRouter, Y as AnyContractDef, aa as ContractProcedureCallbackOptions, $ as ContractRouter, a1 as InferRouterCurrentContexts, a0 as InferRouterInitialContexts, a2 as InferRouterInputs, a3 as InferRouterOutputs, ai as InitialSchemas, x as LAZY_SYMBOL, y as LazyMeta, ab as LazyTraverseContractProceduresOptions, N as MiddlewareNextFn, Q as MiddlewareOptions, O as MiddlewareOutputFn, K as MiddlewareResult, Z as ProcedureDef, X as ProcedureHandlerOptions, a9 as TraverseContractProcedureCallbackOptions, a8 as TraverseContractProceduresOptions, ag as TypeRest, ae as UnlaziedRouter, a6 as createAccessibleLazyRouter, a7 as enhanceRouter, G as getLazyMeta, a4 as getRouter, ah as initialSchemas, F as isLazy, _ as isProcedure, D as lazy, z as lazyInternal, w as mergeCurrentContext, J as mergeMeta, T as middlewareOutputFn, ad as resolveContractProcedures, ac as traverseContractProcedures, H as unlazy, af as unlazyRouter } from './shared/server.DXPMDozZ.js';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
type ProcedureClient<TClientContext extends ClientContext, TSchemas extends Schemas> = Client<TClientContext, InferProcedureClientInputs<TSchemas>, InferSchemaOutput<TSchemas['outputSchema']>>;
|
|
@@ -82,7 +82,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
82
82
|
*/
|
|
83
83
|
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, TMeta>): ProcedureBuilder<TInitialContext, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TMeta, TGateName>;
|
|
84
84
|
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext, UOutContext, unknown, unknown, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TMeta, TGateName>;
|
|
85
|
-
useAuth<
|
|
85
|
+
useAuth<TAuthContext extends ValidatedAuthContext = false>(config: AuthConfig<TAuthContext, TCurrentContext, TMeta>): ProcedureBuilder<TInitialContext, BuildContextWithAuth<TCurrentContext, TAuthContext>, TSchemas, TMeta, TGateName>;
|
|
86
86
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
87
87
|
isGateEnabled: typeof isGateEnabled;
|
|
88
88
|
}>, TSchemas, TMeta, TInferredGateName>;
|
package/dist/index.mjs
CHANGED
|
@@ -21,41 +21,47 @@ function validateTokenAuth(config, token, options) {
|
|
|
21
21
|
validateTokenPrefix(tokenPrefix, token);
|
|
22
22
|
return validate(token, options);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
24
|
+
function runAuth(config, options) {
|
|
25
|
+
switch (config.type) {
|
|
26
|
+
case "header": {
|
|
27
|
+
const authHeader = options.request.headers.get(config.name);
|
|
28
|
+
return authHeader ? validateTokenAuth(config, authHeader, options) : void 0;
|
|
29
|
+
}
|
|
30
|
+
case "query": {
|
|
31
|
+
const { name, tokenPrefix, validate } = config;
|
|
32
|
+
const query = options.request.url.searchParams;
|
|
33
|
+
const token = query.get(name);
|
|
34
|
+
if (!token) return void 0;
|
|
35
|
+
validateTokenPrefix(tokenPrefix, token);
|
|
36
|
+
return validate(token, options);
|
|
37
|
+
}
|
|
38
|
+
case "cookie": {
|
|
39
|
+
const cookie = getCookie(options.request.headers, config.name);
|
|
40
|
+
return cookie ? validateTokenAuth(config, cookie, options) : void 0;
|
|
41
|
+
}
|
|
42
|
+
case "bearer": {
|
|
43
|
+
const authHeader = options.request.headers.get("Authorization");
|
|
44
|
+
if (!authHeader) return void 0;
|
|
45
|
+
const [authType, bearer] = splitFirst(authHeader, " ");
|
|
46
|
+
return authType === "Bearer" ? validateTokenAuth(config, bearer, options) : void 0;
|
|
47
|
+
}
|
|
48
|
+
case "basic": {
|
|
49
|
+
const authHeader = options.request.headers.get("Authorization");
|
|
50
|
+
if (!authHeader) return void 0;
|
|
51
|
+
const [authType, encoded] = splitFirst(authHeader, " ");
|
|
52
|
+
if (authType !== "Basic") return void 0;
|
|
53
|
+
const decoded = Buffer.from(encoded, "base64").toString("utf-8");
|
|
54
|
+
const [username, password] = splitFirst(decoded, ":");
|
|
55
|
+
validateTokenPrefix(config.tokenPrefix, password);
|
|
56
|
+
return config.validate(username, password, options);
|
|
57
|
+
}
|
|
58
|
+
case "none": {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
default: {
|
|
62
|
+
assertNever(config);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
59
65
|
}
|
|
60
66
|
function authDescription(config) {
|
|
61
67
|
const { type } = config;
|
|
@@ -179,15 +185,13 @@ class ProcedureBuilder extends Contract {
|
|
|
179
185
|
middlewares: addMiddleware(this["~orpc"].middlewares, middleware)
|
|
180
186
|
});
|
|
181
187
|
}
|
|
182
|
-
// `& {}` is so AuthType will be expanded in parameter info tooltips.
|
|
183
188
|
// The default of false for ValidatedAuthContext is used when you pass in the type 'none'. We use false
|
|
184
189
|
// because we can't use null or undefined (see ValidatedAuthContext) but we still want it to be falsy.
|
|
185
|
-
useAuth(
|
|
186
|
-
const config = { type, ...rest[0] };
|
|
190
|
+
useAuth(config) {
|
|
187
191
|
const middleware = baseApi.$context().middleware(async (options) => {
|
|
188
192
|
const { next, context } = options;
|
|
189
193
|
if (context.auth) return next();
|
|
190
|
-
const auth = await
|
|
194
|
+
const auth = await runAuth(config, options);
|
|
191
195
|
if (auth === void 0) {
|
|
192
196
|
const { authConfigs } = options.procedure["~orpc"];
|
|
193
197
|
if (context.auth !== false && config === authConfigs.at(-1)) {
|
package/dist/openapi/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Contract } from '@temporary-name/server';
|
|
2
2
|
import { OpenAPI, Promisable, Value, HTTPPath, HTTPMethod } from '@temporary-name/shared';
|
|
3
3
|
export { OpenAPI } from '@temporary-name/shared';
|
|
4
|
-
import {
|
|
4
|
+
import { ZodToJsonSchemaConverterOptions } from '@temporary-name/json-schema';
|
|
5
|
+
import { d as AnySchema, b as Contract$1, a9 as TraverseContractProcedureCallbackOptions, $ as ContractRouter, u as AnyRouter } from '../shared/server.DXPMDozZ.mjs';
|
|
5
6
|
import { JSONSchema } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
6
7
|
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
7
8
|
import '@temporary-name/zod';
|
|
@@ -55,22 +56,11 @@ interface SchemaConvertOptions {
|
|
|
55
56
|
*/
|
|
56
57
|
minStructureDepthForRef?: number;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
convert(schemas: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
60
|
-
}
|
|
61
|
-
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
62
|
-
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<boolean>;
|
|
63
|
-
}
|
|
64
|
-
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
65
|
-
private readonly converters;
|
|
66
|
-
constructor(converters: readonly ConditionalSchemaConverter[]);
|
|
67
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promise<[required: boolean, jsonSchema: JSONSchema]>;
|
|
68
|
-
}
|
|
59
|
+
type SchemaConverter = (schemas: AnySchema | undefined, options: SchemaConvertOptions) => Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
69
60
|
|
|
70
|
-
interface
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document, 'openapi'>> {
|
|
61
|
+
interface OpenAPIGeneratorGenerateOptions {
|
|
62
|
+
spec?: Partial<Omit<OpenAPI.Document, 'openapi'>>;
|
|
63
|
+
schemaConverter?: ZodToJsonSchemaConverterOptions | SchemaConverter;
|
|
74
64
|
/**
|
|
75
65
|
* Exclude procedures from the OpenAPI specification.
|
|
76
66
|
*
|
|
@@ -117,21 +107,11 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
|
|
|
117
107
|
}>;
|
|
118
108
|
}
|
|
119
109
|
/**
|
|
120
|
-
*
|
|
110
|
+
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
121
111
|
*
|
|
122
112
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
123
113
|
*/
|
|
124
|
-
declare
|
|
125
|
-
#private;
|
|
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: ContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
134
|
-
}
|
|
114
|
+
declare function generateOpenApiSpec(router: ContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
135
115
|
|
|
136
116
|
/**
|
|
137
117
|
* @internal
|
|
@@ -200,5 +180,5 @@ declare const oo: {
|
|
|
200
180
|
spec: typeof customOpenAPIOperation;
|
|
201
181
|
};
|
|
202
182
|
|
|
203
|
-
export {
|
|
204
|
-
export type {
|
|
183
|
+
export { LOGIC_KEYWORDS, applyCustomOpenAPIOperation, applySchemaOptionality, checkParamsSchema, customOpenAPIOperation, expandArrayableSchema, expandUnionSchema, filterSchemaBranches, generateOpenApiSpec, getCustomOpenAPIOperation, isAnySchema, isFileSchema, isObjectSchema, isPrimitiveSchema, oo, resolveOpenAPIJsonSchemaRef, separateObjectSchema, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|
|
184
|
+
export type { FileSchema, ObjectSchema, OpenAPIGeneratorGenerateOptions, OverrideOperationValue, SchemaConvertOptions, SchemaConverter, SchemaConverterComponent };
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Contract } from '@temporary-name/server';
|
|
2
2
|
import { OpenAPI, Promisable, Value, HTTPPath, HTTPMethod } from '@temporary-name/shared';
|
|
3
3
|
export { OpenAPI } from '@temporary-name/shared';
|
|
4
|
-
import {
|
|
4
|
+
import { ZodToJsonSchemaConverterOptions } from '@temporary-name/json-schema';
|
|
5
|
+
import { d as AnySchema, b as Contract$1, a9 as TraverseContractProcedureCallbackOptions, $ as ContractRouter, u as AnyRouter } from '../shared/server.DXPMDozZ.js';
|
|
5
6
|
import { JSONSchema } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
6
7
|
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
7
8
|
import '@temporary-name/zod';
|
|
@@ -55,22 +56,11 @@ interface SchemaConvertOptions {
|
|
|
55
56
|
*/
|
|
56
57
|
minStructureDepthForRef?: number;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
convert(schemas: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
60
|
-
}
|
|
61
|
-
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
62
|
-
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<boolean>;
|
|
63
|
-
}
|
|
64
|
-
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
65
|
-
private readonly converters;
|
|
66
|
-
constructor(converters: readonly ConditionalSchemaConverter[]);
|
|
67
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promise<[required: boolean, jsonSchema: JSONSchema]>;
|
|
68
|
-
}
|
|
59
|
+
type SchemaConverter = (schemas: AnySchema | undefined, options: SchemaConvertOptions) => Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
69
60
|
|
|
70
|
-
interface
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document, 'openapi'>> {
|
|
61
|
+
interface OpenAPIGeneratorGenerateOptions {
|
|
62
|
+
spec?: Partial<Omit<OpenAPI.Document, 'openapi'>>;
|
|
63
|
+
schemaConverter?: ZodToJsonSchemaConverterOptions | SchemaConverter;
|
|
74
64
|
/**
|
|
75
65
|
* Exclude procedures from the OpenAPI specification.
|
|
76
66
|
*
|
|
@@ -117,21 +107,11 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
|
|
|
117
107
|
}>;
|
|
118
108
|
}
|
|
119
109
|
/**
|
|
120
|
-
*
|
|
110
|
+
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
121
111
|
*
|
|
122
112
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
123
113
|
*/
|
|
124
|
-
declare
|
|
125
|
-
#private;
|
|
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: ContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
134
|
-
}
|
|
114
|
+
declare function generateOpenApiSpec(router: ContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
135
115
|
|
|
136
116
|
/**
|
|
137
117
|
* @internal
|
|
@@ -200,5 +180,5 @@ declare const oo: {
|
|
|
200
180
|
spec: typeof customOpenAPIOperation;
|
|
201
181
|
};
|
|
202
182
|
|
|
203
|
-
export {
|
|
204
|
-
export type {
|
|
183
|
+
export { LOGIC_KEYWORDS, applyCustomOpenAPIOperation, applySchemaOptionality, checkParamsSchema, customOpenAPIOperation, expandArrayableSchema, expandUnionSchema, filterSchemaBranches, generateOpenApiSpec, getCustomOpenAPIOperation, isAnySchema, isFileSchema, isObjectSchema, isPrimitiveSchema, oo, resolveOpenAPIJsonSchemaRef, separateObjectSchema, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|
|
184
|
+
export type { FileSchema, ObjectSchema, OpenAPIGeneratorGenerateOptions, OverrideOperationValue, SchemaConvertOptions, SchemaConverter, SchemaConverterComponent };
|