@temporary-name/server 1.9.3-alpha.5c041722542bb790586629fc98d4c72d9f6ee65e → 1.9.3-alpha.5dc8b200530586870ac736830d4584e0333cfd05
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 +3 -4
- package/dist/adapters/aws-lambda/index.d.ts +3 -4
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/fetch/index.d.mts +3 -4
- package/dist/adapters/fetch/index.d.ts +3 -4
- package/dist/adapters/fetch/index.mjs +3 -3
- package/dist/adapters/node/index.d.mts +3 -4
- package/dist/adapters/node/index.d.ts +3 -4
- package/dist/adapters/node/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +10 -6
- package/dist/adapters/standard/index.d.ts +10 -6
- package/dist/adapters/standard/index.mjs +4 -4
- package/dist/helpers/index.mjs +3 -29
- package/dist/index.d.mts +29 -23
- package/dist/index.d.ts +29 -23
- package/dist/index.mjs +121 -15
- package/dist/openapi/index.d.mts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.mjs +51 -34
- package/dist/plugins/index.d.mts +4 -80
- package/dist/plugins/index.d.ts +4 -80
- package/dist/plugins/index.mjs +17 -189
- package/dist/shared/{server.C4l2ZA3m.d.ts → server.B-meye9-.d.ts} +2 -3
- package/dist/shared/{server.SmOM3Fae.mjs → server.Ba0Z2fNc.mjs} +18 -26
- package/dist/shared/server.C1RJffw4.mjs +30 -0
- package/dist/shared/{server.B5czSQQh.d.mts → server.DkYpsO6W.d.mts} +71 -55
- package/dist/shared/{server.B5czSQQh.d.ts → server.DkYpsO6W.d.ts} +71 -55
- package/dist/shared/{server.D7UjcuIv.d.ts → server.DwNnHUZP.d.ts} +2 -2
- package/dist/shared/{server.Bk8Hmx7Z.d.mts → server.I-tTl_ce.d.mts} +2 -2
- package/dist/shared/{server.Kxw442A9.mjs → server.JtIZ8YG7.mjs} +1 -11
- package/dist/shared/{server.BdGbIyq8.mjs → server.miXh-9wo.mjs} +38 -18
- package/dist/shared/{server.TgmlNh8r.d.mts → server.vLcMd_kA.d.mts} +2 -3
- package/package.json +10 -22
|
@@ -1,10 +1,9 @@
|
|
|
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, R as Router } from '../../shared/server.
|
|
4
|
-
import { b as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DkYpsO6W.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.vLcMd_kA.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.I-tTl_ce.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
8
|
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
10
9
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
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, R as Router } from '../../shared/server.
|
|
4
|
-
import { b as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DkYpsO6W.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.B-meye9-.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DwNnHUZP.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
8
|
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
10
9
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.Ba0Z2fNc.mjs';
|
|
4
4
|
import '@temporary-name/contract';
|
|
5
5
|
import '@temporary-name/standard-server';
|
|
6
6
|
import '@temporary-name/server';
|
|
7
7
|
import 'rou3';
|
|
8
|
-
import '../../shared/server.
|
|
8
|
+
import '../../shared/server.miXh-9wo.mjs';
|
|
9
9
|
import '@temporary-name/zod';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
11
|
|
|
12
12
|
class AwsLambdaHandler {
|
|
13
13
|
sendStandardResponseOptions;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DkYpsO6W.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.vLcMd_kA.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.I-tTl_ce.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
8
|
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
10
9
|
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DkYpsO6W.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.B-meye9-.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DwNnHUZP.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
8
|
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
10
9
|
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ORPCError, toArray, intercept, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { toStandardLazyRequest, toFetchResponse } from '@temporary-name/standard-server-fetch';
|
|
3
|
-
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.Ba0Z2fNc.mjs';
|
|
4
4
|
import '@temporary-name/contract';
|
|
5
5
|
import '@temporary-name/standard-server';
|
|
6
6
|
import '@temporary-name/server';
|
|
7
7
|
import 'rou3';
|
|
8
8
|
import '@temporary-name/zod';
|
|
9
|
-
import '../../shared/server.
|
|
10
|
-
import '../../shared/server.
|
|
9
|
+
import '../../shared/server.miXh-9wo.mjs';
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
11
|
|
|
12
12
|
class BodyLimitPlugin {
|
|
13
13
|
maxBodySize;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DkYpsO6W.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.vLcMd_kA.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.I-tTl_ce.mjs';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
|
-
import '@temporary-name/standard-server';
|
|
9
8
|
|
|
10
9
|
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
11
10
|
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DkYpsO6W.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.B-meye9-.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DwNnHUZP.js';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
|
-
import '@temporary-name/standard-server';
|
|
9
8
|
|
|
10
9
|
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
11
10
|
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { once, ORPCError, toArray, intercept, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import compression from '@temporary-name/interop/compression';
|
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.Ba0Z2fNc.mjs';
|
|
5
5
|
import '@temporary-name/contract';
|
|
6
6
|
import '@temporary-name/standard-server';
|
|
7
7
|
import '@temporary-name/server';
|
|
8
8
|
import 'rou3';
|
|
9
9
|
import '@temporary-name/zod';
|
|
10
|
-
import '../../shared/server.
|
|
11
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.miXh-9wo.mjs';
|
|
11
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
12
12
|
|
|
13
13
|
class BodyLimitPlugin {
|
|
14
14
|
maxBodySize;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
export { C as CompositeStandardHandlerPlugin, c as StandardHandleOptions, d as StandardHandleResult, e as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, c as StandardHandleOptions, d as StandardHandleResult, e as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.vLcMd_kA.mjs';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
-
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
-
|
|
5
|
-
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.Bk8Hmx7Z.mjs';
|
|
3
|
+
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.I-tTl_ce.mjs';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
6
|
+
import '../../shared/server.DkYpsO6W.mjs';
|
|
8
7
|
|
|
9
|
-
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<
|
|
8
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
9
|
+
path: unknown;
|
|
10
|
+
query: unknown;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
body: unknown;
|
|
13
|
+
}>;
|
|
10
14
|
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
15
|
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
12
16
|
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
export { C as CompositeStandardHandlerPlugin, c as StandardHandleOptions, d as StandardHandleResult, e as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, c as StandardHandleOptions, d as StandardHandleResult, e as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.B-meye9-.js';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
-
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
-
|
|
5
|
-
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.D7UjcuIv.js';
|
|
3
|
+
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.DwNnHUZP.js';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
6
|
+
import '../../shared/server.DkYpsO6W.js';
|
|
8
7
|
|
|
9
|
-
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<
|
|
8
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
9
|
+
path: unknown;
|
|
10
|
+
query: unknown;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
body: unknown;
|
|
13
|
+
}>;
|
|
10
14
|
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
15
|
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
12
16
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, b as StandardOpenAPIMatcher, d as decode, c as decodeParams, e as encode, a as encodeError, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, b as StandardOpenAPIMatcher, d as decode, c as decodeParams, e as encode, a as encodeError, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.Ba0Z2fNc.mjs';
|
|
2
2
|
import '@temporary-name/shared';
|
|
3
|
-
import '
|
|
4
|
-
import '../../shared/server.BdGbIyq8.mjs';
|
|
3
|
+
import '../../shared/server.miXh-9wo.mjs';
|
|
5
4
|
import '@temporary-name/contract';
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
6
|
import '@temporary-name/zod';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
8
8
|
import '@temporary-name/server';
|
|
9
9
|
import 'rou3';
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { d as deleteCookie, g as getCookie, s as setCookie } from '../shared/server.C1RJffw4.mjs';
|
|
2
|
+
import 'cookie';
|
|
2
3
|
|
|
3
4
|
function encodeBase64url(data) {
|
|
4
5
|
const chunkSize = 8192;
|
|
@@ -30,33 +31,6 @@ function decodeBase64url(base64url) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
function setCookie(headers, name, value, options = {}) {
|
|
34
|
-
if (headers === void 0) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const cookieString = serialize(name, value, {
|
|
38
|
-
path: "/",
|
|
39
|
-
...options
|
|
40
|
-
});
|
|
41
|
-
headers.append("Set-Cookie", cookieString);
|
|
42
|
-
}
|
|
43
|
-
function getCookie(headers, name, options = {}) {
|
|
44
|
-
if (headers === void 0) {
|
|
45
|
-
return void 0;
|
|
46
|
-
}
|
|
47
|
-
const cookieHeader = headers.get("cookie");
|
|
48
|
-
if (cookieHeader === null) {
|
|
49
|
-
return void 0;
|
|
50
|
-
}
|
|
51
|
-
return parse(cookieHeader, options)[name];
|
|
52
|
-
}
|
|
53
|
-
function deleteCookie(headers, name, options = {}) {
|
|
54
|
-
return setCookie(headers, name, "", {
|
|
55
|
-
...options,
|
|
56
|
-
maxAge: 0
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
34
|
const PBKDF2_CONFIG = {
|
|
61
35
|
name: "PBKDF2",
|
|
62
36
|
iterations: 6e4,
|
|
@@ -165,4 +139,4 @@ function getSignedValue(signedValue) {
|
|
|
165
139
|
return signedValue.slice(0, lastDotIndex);
|
|
166
140
|
}
|
|
167
141
|
|
|
168
|
-
export { decodeBase64url, decrypt,
|
|
142
|
+
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getSignedValue, sign, unsign };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap,
|
|
1
|
+
import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap, AnyShape, MergedSchemas, WrapShape, UnionToIntersection, AnySchema, Route, InferHandlerInputs, InferSchemaInput, ContractRouter, ContractProcedureDef, InitialSchemas, AnyContractRouter, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure, InferProcedureClientInputs, InferSchemaOutput, ErrorFromErrorMap, Schema } from '@temporary-name/contract';
|
|
2
2
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
3
|
-
import { ClientContext, MaybeOptionalOptions, IntersectPick, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
3
|
+
import { ClientContext, MaybeOptionalOptions, HTTPEndpoint, IntersectPick, OptionalIfEmpty, 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 {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, A as AuthType, V as ValidatedAuthContext, e as AuthConfig, B as BuildContextWithAuth, f as ProcedureHandler, E as EnhanceRouterOptions, R as Router, g as EnhancedRouter, h as MapInputMiddleware, i as AnyMiddleware, T as TypedAuthConfig, L as Lazy, j as AnyProcedure, k as Lazyable, l as AnyRouter, I as InferRouterInitialContext } from './shared/server.DkYpsO6W.mjs';
|
|
6
|
+
export { Z as AccessibleLazyRouter, a2 as ContractProcedureCallbackOptions, G as DefaultProcedureHandlerOptions, U as InferRouterCurrentContexts, S as InferRouterInitialContexts, W as InferRouterInputs, X as InferRouterOutputs, q as LAZY_SYMBOL, r as LazyMeta, a3 as LazyTraverseContractProceduresOptions, y as MiddlewareNextFn, D as MiddlewareOptions, z as MiddlewareOutputFn, x as MiddlewareResult, o as ORPCErrorConstructorMapItem, n as ORPCErrorConstructorMapItemOptions, N as ProcedureClientInterceptorOptions, J as ProcedureDef, H as ProcedureHandlerOptions, a1 as TraverseContractProcedureCallbackOptions, a0 as TraverseContractProceduresOptions, a6 as UnlaziedRouter, _ as createAccessibleLazyRouter, p as createORPCErrorConstructorMap, Q as createProcedureClient, $ as enhanceRouter, v as getLazyMeta, Y as getRouter, u as isLazy, K as isProcedure, t as lazy, s as lazyInternal, m as mergeCurrentContext, F as middlewareOutputFn, a5 as resolveContractProcedures, a4 as traverseContractProcedures, w as unlazy, a7 as unlazyRouter } from './shared/server.DkYpsO6W.mjs';
|
|
7
|
+
import { SchemaClass, core } from '@temporary-name/zod';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
|
|
@@ -37,6 +37,12 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
37
37
|
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
38
38
|
*/
|
|
39
39
|
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
40
|
+
endpoint<U extends AnyShape[]>(strings: TemplateStringsArray, ...values: [...U]): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
41
|
+
pathSchema: WrapShape<UnionToIntersection<U>>;
|
|
42
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
43
|
+
endpoint<U extends AnySchema | AnyShape = core.$ZodType<Record<string, never>, Record<string, never>>>(endpoint: HTTPEndpoint, schema?: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
44
|
+
pathSchema: WrapShape<U>;
|
|
45
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
40
46
|
/**
|
|
41
47
|
* Sets or updates the route definition for the contract.
|
|
42
48
|
* The provided route is spared-merged with any existing route in the contract.
|
|
@@ -45,22 +51,20 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
45
51
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
46
52
|
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
47
53
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
55
|
-
inputSchema: USchema;
|
|
54
|
+
endpointOpts(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
55
|
+
query<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
56
|
+
querySchema: WrapShape<U>;
|
|
57
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
58
|
+
body<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
59
|
+
bodySchema: WrapShape<U>;
|
|
56
60
|
}>, TErrorMap, TMeta, TGateName>;
|
|
57
61
|
/**
|
|
58
62
|
* Defines the output validation schema.
|
|
59
63
|
*
|
|
60
64
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
61
65
|
*/
|
|
62
|
-
output<
|
|
63
|
-
outputSchema:
|
|
66
|
+
output<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
67
|
+
outputSchema: WrapShape<U>;
|
|
64
68
|
}>, TErrorMap, TMeta, TGateName>;
|
|
65
69
|
/**
|
|
66
70
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
@@ -70,6 +74,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
70
74
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
71
75
|
*/
|
|
72
76
|
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
77
|
+
useAuth<const TAuthType extends AuthType & {}, TAuthContext extends ValidatedAuthContext = false>(type: TAuthType, ...rest: OptionalIfEmpty<AuthConfig<TAuthType, TAuthContext>>): ProcedureBuilder<TInitialContext, BuildContextWithAuth<TCurrentContext, TAuthContext>, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
73
78
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
74
79
|
isGateEnabled: typeof isGateEnabled;
|
|
75
80
|
}>, TSchemas, TErrorMap, TMeta, TInferredGateName>;
|
|
@@ -78,7 +83,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
78
83
|
*
|
|
79
84
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
80
85
|
*/
|
|
81
|
-
handler(handler: ProcedureHandler<TCurrentContext,
|
|
86
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
82
87
|
}
|
|
83
88
|
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName> {
|
|
84
89
|
/**
|
|
@@ -135,6 +140,7 @@ declare function decorateMiddleware<TInContext extends Context, TOutContext exte
|
|
|
135
140
|
|
|
136
141
|
interface BuilderDef<TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
|
|
137
142
|
middlewares: readonly AnyMiddleware[];
|
|
143
|
+
authConfigs: TypedAuthConfig[];
|
|
138
144
|
inputValidationIndex: number;
|
|
139
145
|
outputValidationIndex: number;
|
|
140
146
|
}
|
|
@@ -172,7 +178,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
172
178
|
* @note The current context must be satisfy middleware dependent-context
|
|
173
179
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
174
180
|
*/
|
|
175
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext,
|
|
181
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
176
182
|
/**
|
|
177
183
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
178
184
|
*
|
|
@@ -181,7 +187,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
181
187
|
* @note The current context must be satisfy middleware dependent-context
|
|
182
188
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
183
189
|
*/
|
|
184
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<
|
|
190
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferHandlerInputs<TSchemas>, UInput>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
185
191
|
/**
|
|
186
192
|
* Make this procedure callable (works like a function while still being a procedure).
|
|
187
193
|
*
|
|
@@ -202,7 +208,7 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
202
208
|
* @note The current context must be satisfy middleware dependent-context
|
|
203
209
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
204
210
|
*/
|
|
205
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext,
|
|
211
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
206
212
|
/**
|
|
207
213
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
208
214
|
*
|
|
@@ -211,13 +217,13 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
211
217
|
* @note The current context must be satisfy middleware dependent-context
|
|
212
218
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
213
219
|
*/
|
|
214
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<
|
|
220
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferHandlerInputs<TSchemas>, UInput>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
215
221
|
/**
|
|
216
222
|
* Defines the handler of the procedure.
|
|
217
223
|
*
|
|
218
224
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
219
225
|
*/
|
|
220
|
-
'handler'(handler: ProcedureHandler<TCurrentContext,
|
|
226
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
|
@@ -310,7 +316,7 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
|
310
316
|
* ```
|
|
311
317
|
*
|
|
312
318
|
*/
|
|
313
|
-
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input:
|
|
319
|
+
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input: InferProcedureClientInputs<TSchemas>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
|
|
314
320
|
|
|
315
321
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer USchemas, infer UErrorMap, any> ? ProcedureClient<TClientContext, USchemas, UErrorMap> : {
|
|
316
322
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
|
@@ -325,5 +331,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
|
|
|
325
331
|
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
|
326
332
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
327
333
|
|
|
328
|
-
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, getHiddenRouterContract, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, setHiddenRouterContract };
|
|
334
|
+
export { AnyMiddleware, AnyProcedure, AnyRouter, BuildContextWithAuth, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, getHiddenRouterContract, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, setHiddenRouterContract };
|
|
329
335
|
export type { ApiBuilder, BuilderDef, DecoratedMiddleware, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap,
|
|
1
|
+
import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap, AnyShape, MergedSchemas, WrapShape, UnionToIntersection, AnySchema, Route, InferHandlerInputs, InferSchemaInput, ContractRouter, ContractProcedureDef, InitialSchemas, AnyContractRouter, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure, InferProcedureClientInputs, InferSchemaOutput, ErrorFromErrorMap, Schema } from '@temporary-name/contract';
|
|
2
2
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
3
|
-
import { ClientContext, MaybeOptionalOptions, IntersectPick, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
3
|
+
import { ClientContext, MaybeOptionalOptions, HTTPEndpoint, IntersectPick, OptionalIfEmpty, 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 {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, A as AuthType, V as ValidatedAuthContext, e as AuthConfig, B as BuildContextWithAuth, f as ProcedureHandler, E as EnhanceRouterOptions, R as Router, g as EnhancedRouter, h as MapInputMiddleware, i as AnyMiddleware, T as TypedAuthConfig, L as Lazy, j as AnyProcedure, k as Lazyable, l as AnyRouter, I as InferRouterInitialContext } from './shared/server.DkYpsO6W.js';
|
|
6
|
+
export { Z as AccessibleLazyRouter, a2 as ContractProcedureCallbackOptions, G as DefaultProcedureHandlerOptions, U as InferRouterCurrentContexts, S as InferRouterInitialContexts, W as InferRouterInputs, X as InferRouterOutputs, q as LAZY_SYMBOL, r as LazyMeta, a3 as LazyTraverseContractProceduresOptions, y as MiddlewareNextFn, D as MiddlewareOptions, z as MiddlewareOutputFn, x as MiddlewareResult, o as ORPCErrorConstructorMapItem, n as ORPCErrorConstructorMapItemOptions, N as ProcedureClientInterceptorOptions, J as ProcedureDef, H as ProcedureHandlerOptions, a1 as TraverseContractProcedureCallbackOptions, a0 as TraverseContractProceduresOptions, a6 as UnlaziedRouter, _ as createAccessibleLazyRouter, p as createORPCErrorConstructorMap, Q as createProcedureClient, $ as enhanceRouter, v as getLazyMeta, Y as getRouter, u as isLazy, K as isProcedure, t as lazy, s as lazyInternal, m as mergeCurrentContext, F as middlewareOutputFn, a5 as resolveContractProcedures, a4 as traverseContractProcedures, w as unlazy, a7 as unlazyRouter } from './shared/server.DkYpsO6W.js';
|
|
7
|
+
import { SchemaClass, core } from '@temporary-name/zod';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
|
|
@@ -37,6 +37,12 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
37
37
|
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
38
38
|
*/
|
|
39
39
|
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
40
|
+
endpoint<U extends AnyShape[]>(strings: TemplateStringsArray, ...values: [...U]): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
41
|
+
pathSchema: WrapShape<UnionToIntersection<U>>;
|
|
42
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
43
|
+
endpoint<U extends AnySchema | AnyShape = core.$ZodType<Record<string, never>, Record<string, never>>>(endpoint: HTTPEndpoint, schema?: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
44
|
+
pathSchema: WrapShape<U>;
|
|
45
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
40
46
|
/**
|
|
41
47
|
* Sets or updates the route definition for the contract.
|
|
42
48
|
* The provided route is spared-merged with any existing route in the contract.
|
|
@@ -45,22 +51,20 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
45
51
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
46
52
|
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
47
53
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
55
|
-
inputSchema: USchema;
|
|
54
|
+
endpointOpts(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
55
|
+
query<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
56
|
+
querySchema: WrapShape<U>;
|
|
57
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
58
|
+
body<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
59
|
+
bodySchema: WrapShape<U>;
|
|
56
60
|
}>, TErrorMap, TMeta, TGateName>;
|
|
57
61
|
/**
|
|
58
62
|
* Defines the output validation schema.
|
|
59
63
|
*
|
|
60
64
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
61
65
|
*/
|
|
62
|
-
output<
|
|
63
|
-
outputSchema:
|
|
66
|
+
output<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
67
|
+
outputSchema: WrapShape<U>;
|
|
64
68
|
}>, TErrorMap, TMeta, TGateName>;
|
|
65
69
|
/**
|
|
66
70
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
@@ -70,6 +74,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
70
74
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
71
75
|
*/
|
|
72
76
|
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
77
|
+
useAuth<const TAuthType extends AuthType & {}, TAuthContext extends ValidatedAuthContext = false>(type: TAuthType, ...rest: OptionalIfEmpty<AuthConfig<TAuthType, TAuthContext>>): ProcedureBuilder<TInitialContext, BuildContextWithAuth<TCurrentContext, TAuthContext>, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
73
78
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
74
79
|
isGateEnabled: typeof isGateEnabled;
|
|
75
80
|
}>, TSchemas, TErrorMap, TMeta, TInferredGateName>;
|
|
@@ -78,7 +83,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
78
83
|
*
|
|
79
84
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
80
85
|
*/
|
|
81
|
-
handler(handler: ProcedureHandler<TCurrentContext,
|
|
86
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
82
87
|
}
|
|
83
88
|
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName> {
|
|
84
89
|
/**
|
|
@@ -135,6 +140,7 @@ declare function decorateMiddleware<TInContext extends Context, TOutContext exte
|
|
|
135
140
|
|
|
136
141
|
interface BuilderDef<TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
|
|
137
142
|
middlewares: readonly AnyMiddleware[];
|
|
143
|
+
authConfigs: TypedAuthConfig[];
|
|
138
144
|
inputValidationIndex: number;
|
|
139
145
|
outputValidationIndex: number;
|
|
140
146
|
}
|
|
@@ -172,7 +178,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
172
178
|
* @note The current context must be satisfy middleware dependent-context
|
|
173
179
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
174
180
|
*/
|
|
175
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext,
|
|
181
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
176
182
|
/**
|
|
177
183
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
178
184
|
*
|
|
@@ -181,7 +187,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
181
187
|
* @note The current context must be satisfy middleware dependent-context
|
|
182
188
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
183
189
|
*/
|
|
184
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<
|
|
190
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferHandlerInputs<TSchemas>, UInput>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
185
191
|
/**
|
|
186
192
|
* Make this procedure callable (works like a function while still being a procedure).
|
|
187
193
|
*
|
|
@@ -202,7 +208,7 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
202
208
|
* @note The current context must be satisfy middleware dependent-context
|
|
203
209
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
204
210
|
*/
|
|
205
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext,
|
|
211
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
206
212
|
/**
|
|
207
213
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
208
214
|
*
|
|
@@ -211,13 +217,13 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
211
217
|
* @note The current context must be satisfy middleware dependent-context
|
|
212
218
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
213
219
|
*/
|
|
214
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<
|
|
220
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferHandlerInputs<TSchemas>, UInput>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
215
221
|
/**
|
|
216
222
|
* Defines the handler of the procedure.
|
|
217
223
|
*
|
|
218
224
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
219
225
|
*/
|
|
220
|
-
'handler'(handler: ProcedureHandler<TCurrentContext,
|
|
226
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
|
@@ -310,7 +316,7 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
|
310
316
|
* ```
|
|
311
317
|
*
|
|
312
318
|
*/
|
|
313
|
-
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input:
|
|
319
|
+
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input: InferProcedureClientInputs<TSchemas>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
|
|
314
320
|
|
|
315
321
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer USchemas, infer UErrorMap, any> ? ProcedureClient<TClientContext, USchemas, UErrorMap> : {
|
|
316
322
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
|
@@ -325,5 +331,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
|
|
|
325
331
|
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
|
326
332
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
327
333
|
|
|
328
|
-
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, getHiddenRouterContract, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, setHiddenRouterContract };
|
|
334
|
+
export { AnyMiddleware, AnyProcedure, AnyRouter, BuildContextWithAuth, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, getHiddenRouterContract, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, setHiddenRouterContract };
|
|
329
335
|
export type { ApiBuilder, BuilderDef, DecoratedMiddleware, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares };
|