@orpc/contract 0.0.0-next.cba521d → 0.0.0-next.cc8802c

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/index.mjs ADDED
@@ -0,0 +1,252 @@
1
+ import { mapEventIterator, ORPCError } from '@orpc/client';
2
+ export { ORPCError } from '@orpc/client';
3
+ import { isAsyncIteratorObject } from '@orpc/shared';
4
+
5
+ class ValidationError extends Error {
6
+ issues;
7
+ constructor(options) {
8
+ super(options.message, options);
9
+ this.issues = options.issues;
10
+ }
11
+ }
12
+ function mergeErrorMap(errorMap1, errorMap2) {
13
+ return { ...errorMap1, ...errorMap2 };
14
+ }
15
+
16
+ function mergeMeta(meta1, meta2) {
17
+ return { ...meta1, ...meta2 };
18
+ }
19
+
20
+ class ContractProcedure {
21
+ "~orpc";
22
+ constructor(def) {
23
+ if (def.route?.successStatus && (def.route.successStatus < 200 || def.route?.successStatus > 299)) {
24
+ throw new Error("[ContractProcedure] The successStatus must be between 200 and 299");
25
+ }
26
+ if (Object.values(def.errorMap).some((val) => val && val.status && (val.status < 400 || val.status > 599))) {
27
+ throw new Error("[ContractProcedure] The error status code must be in the 400-599 range.");
28
+ }
29
+ this["~orpc"] = def;
30
+ }
31
+ }
32
+ function isContractProcedure(item) {
33
+ if (item instanceof ContractProcedure) {
34
+ return true;
35
+ }
36
+ return (typeof item === "object" || typeof item === "function") && item !== null && "~orpc" in item && typeof item["~orpc"] === "object" && item["~orpc"] !== null && "errorMap" in item["~orpc"] && "route" in item["~orpc"] && "meta" in item["~orpc"];
37
+ }
38
+
39
+ function mergeRoute(a, b) {
40
+ return { ...a, ...b };
41
+ }
42
+ function prefixRoute(route, prefix) {
43
+ if (!route.path) {
44
+ return route;
45
+ }
46
+ return {
47
+ ...route,
48
+ path: `${prefix}${route.path}`
49
+ };
50
+ }
51
+ function unshiftTagRoute(route, tags) {
52
+ return {
53
+ ...route,
54
+ tags: [...tags, ...route.tags ?? []]
55
+ };
56
+ }
57
+ function mergePrefix(a, b) {
58
+ return a ? `${a}${b}` : b;
59
+ }
60
+ function mergeTags(a, b) {
61
+ return a ? [...a, ...b] : b;
62
+ }
63
+ function enhanceRoute(route, options) {
64
+ let router = route;
65
+ if (options.prefix) {
66
+ router = prefixRoute(router, options.prefix);
67
+ }
68
+ if (options.tags?.length) {
69
+ router = unshiftTagRoute(router, options.tags);
70
+ }
71
+ return router;
72
+ }
73
+
74
+ function getContractRouter(router, path) {
75
+ let current = router;
76
+ for (let i = 0; i < path.length; i++) {
77
+ const segment = path[i];
78
+ if (!current) {
79
+ return void 0;
80
+ }
81
+ if (isContractProcedure(current)) {
82
+ return void 0;
83
+ }
84
+ current = current[segment];
85
+ }
86
+ return current;
87
+ }
88
+ function enhanceContractRouter(router, options) {
89
+ if (isContractProcedure(router)) {
90
+ const enhanced2 = new ContractProcedure({
91
+ ...router["~orpc"],
92
+ errorMap: mergeErrorMap(options.errorMap, router["~orpc"].errorMap),
93
+ route: enhanceRoute(router["~orpc"].route, options)
94
+ });
95
+ return enhanced2;
96
+ }
97
+ const enhanced = {};
98
+ for (const key in router) {
99
+ enhanced[key] = enhanceContractRouter(router[key], options);
100
+ }
101
+ return enhanced;
102
+ }
103
+
104
+ class ContractBuilder extends ContractProcedure {
105
+ constructor(def) {
106
+ super(def);
107
+ this["~orpc"].prefix = def.prefix;
108
+ this["~orpc"].tags = def.tags;
109
+ }
110
+ /**
111
+ * Reset initial meta
112
+ */
113
+ $meta(initialMeta) {
114
+ return new ContractBuilder({
115
+ ...this["~orpc"],
116
+ meta: initialMeta
117
+ });
118
+ }
119
+ /**
120
+ * Reset initial route
121
+ */
122
+ $route(initialRoute) {
123
+ return new ContractBuilder({
124
+ ...this["~orpc"],
125
+ route: initialRoute
126
+ });
127
+ }
128
+ errors(errors) {
129
+ return new ContractBuilder({
130
+ ...this["~orpc"],
131
+ errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
132
+ });
133
+ }
134
+ meta(meta) {
135
+ return new ContractBuilder({
136
+ ...this["~orpc"],
137
+ meta: mergeMeta(this["~orpc"].meta, meta)
138
+ });
139
+ }
140
+ route(route) {
141
+ return new ContractBuilder({
142
+ ...this["~orpc"],
143
+ route: mergeRoute(this["~orpc"].route, route)
144
+ });
145
+ }
146
+ input(schema) {
147
+ return new ContractBuilder({
148
+ ...this["~orpc"],
149
+ inputSchema: schema
150
+ });
151
+ }
152
+ output(schema) {
153
+ return new ContractBuilder({
154
+ ...this["~orpc"],
155
+ outputSchema: schema
156
+ });
157
+ }
158
+ prefix(prefix) {
159
+ return new ContractBuilder({
160
+ ...this["~orpc"],
161
+ prefix: mergePrefix(this["~orpc"].prefix, prefix)
162
+ });
163
+ }
164
+ tag(...tags) {
165
+ return new ContractBuilder({
166
+ ...this["~orpc"],
167
+ tags: mergeTags(this["~orpc"].tags, tags)
168
+ });
169
+ }
170
+ router(router) {
171
+ return enhanceContractRouter(router, this["~orpc"]);
172
+ }
173
+ }
174
+ const oc = new ContractBuilder({
175
+ errorMap: {},
176
+ route: {},
177
+ meta: {}
178
+ });
179
+
180
+ const DEFAULT_CONFIG = {
181
+ defaultMethod: "POST",
182
+ defaultSuccessStatus: 200,
183
+ defaultSuccessDescription: "OK",
184
+ defaultInputStructure: "compact",
185
+ defaultOutputStructure: "compact"
186
+ };
187
+ function fallbackContractConfig(key, value) {
188
+ if (value === void 0) {
189
+ return DEFAULT_CONFIG[key];
190
+ }
191
+ return value;
192
+ }
193
+
194
+ const EVENT_ITERATOR_DETAILS_SYMBOL = Symbol("ORPC_EVENT_ITERATOR_DETAILS");
195
+ function eventIterator(yields, returns) {
196
+ return {
197
+ "~standard": {
198
+ [EVENT_ITERATOR_DETAILS_SYMBOL]: { yields, returns },
199
+ vendor: "orpc",
200
+ version: 1,
201
+ validate(iterator) {
202
+ if (!isAsyncIteratorObject(iterator)) {
203
+ return { issues: [{ message: "Expect event iterator", path: [] }] };
204
+ }
205
+ const mapped = mapEventIterator(iterator, {
206
+ async value(value, done) {
207
+ const schema = done ? returns : yields;
208
+ if (!schema) {
209
+ return value;
210
+ }
211
+ const result = await schema["~standard"].validate(value);
212
+ if (result.issues) {
213
+ throw new ORPCError("EVENT_ITERATOR_VALIDATION_FAILED", {
214
+ message: "Event iterator validation failed",
215
+ cause: new ValidationError({
216
+ issues: result.issues,
217
+ message: "Event iterator validation failed"
218
+ })
219
+ });
220
+ }
221
+ return result.value;
222
+ },
223
+ error: async (error) => error
224
+ });
225
+ return { value: mapped };
226
+ }
227
+ }
228
+ };
229
+ }
230
+ function getEventIteratorSchemaDetails(schema) {
231
+ if (schema === void 0) {
232
+ return void 0;
233
+ }
234
+ return schema["~standard"][EVENT_ITERATOR_DETAILS_SYMBOL];
235
+ }
236
+
237
+ function type(...[map]) {
238
+ return {
239
+ "~standard": {
240
+ vendor: "custom",
241
+ version: 1,
242
+ async validate(value) {
243
+ if (map) {
244
+ return { value: await map(value) };
245
+ }
246
+ return { value };
247
+ }
248
+ }
249
+ };
250
+ }
251
+
252
+ export { ContractBuilder, ContractProcedure, ValidationError, enhanceContractRouter, enhanceRoute, eventIterator, fallbackContractConfig, getContractRouter, getEventIteratorSchemaDetails, isContractProcedure, mergeErrorMap, mergeMeta, mergePrefix, mergeRoute, mergeTags, oc, prefixRoute, type, unshiftTagRoute };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/contract",
3
3
  "type": "module",
4
- "version": "0.0.0-next.cba521d",
4
+ "version": "0.0.0-next.cc8802c",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -15,30 +15,27 @@
15
15
  ],
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/src/index.d.ts",
19
- "import": "./dist/index.js",
20
- "default": "./dist/index.js"
21
- },
22
- "./🔒/*": {
23
- "types": "./dist/src/*.d.ts"
18
+ "types": "./dist/index.d.mts",
19
+ "import": "./dist/index.mjs",
20
+ "default": "./dist/index.mjs"
24
21
  }
25
22
  },
26
23
  "files": [
27
- "!**/*.map",
28
- "!**/*.tsbuildinfo",
29
24
  "dist"
30
25
  ],
31
26
  "dependencies": {
32
- "@standard-schema/spec": "1.0.0-beta.4",
33
- "@orpc/shared": "0.0.0-next.cba521d"
27
+ "@standard-schema/spec": "^1.0.0",
28
+ "@orpc/shared": "0.0.0-next.cc8802c",
29
+ "@orpc/standard-server": "0.0.0-next.cc8802c",
30
+ "@orpc/client": "0.0.0-next.cc8802c"
34
31
  },
35
32
  "devDependencies": {
36
33
  "arktype": "2.0.0-rc.26",
37
34
  "valibot": "1.0.0-beta.9",
38
- "zod": "3.24.1"
35
+ "zod": "^3.24.2"
39
36
  },
40
37
  "scripts": {
41
- "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
38
+ "build": "unbuild",
42
39
  "build:watch": "pnpm run build --watch",
43
40
  "type:check": "tsc -b"
44
41
  }
package/dist/index.js DELETED
@@ -1,380 +0,0 @@
1
- // src/procedure.ts
2
- var ContractProcedure = class {
3
- "~type" = "ContractProcedure";
4
- "~orpc";
5
- constructor(def) {
6
- if (def.route?.successStatus && (def.route.successStatus < 200 || def.route?.successStatus > 299)) {
7
- throw new Error("[ContractProcedure] The successStatus must be between 200 and 299");
8
- }
9
- if (Object.values(def.errorMap ?? {}).some((val) => val && val.status && (val.status < 400 || val.status > 599))) {
10
- throw new Error("[ContractProcedure] The error status code must be in the 400-599 range.");
11
- }
12
- this["~orpc"] = def;
13
- }
14
- };
15
- function isContractProcedure(item) {
16
- if (item instanceof ContractProcedure) {
17
- return true;
18
- }
19
- return (typeof item === "object" || typeof item === "function") && item !== null && "~type" in item && item["~type"] === "ContractProcedure" && "~orpc" in item && typeof item["~orpc"] === "object" && item["~orpc"] !== null && "InputSchema" in item["~orpc"] && "OutputSchema" in item["~orpc"] && "errorMap" in item["~orpc"];
20
- }
21
-
22
- // src/procedure-decorated.ts
23
- var DecoratedContractProcedure = class _DecoratedContractProcedure extends ContractProcedure {
24
- static decorate(procedure) {
25
- if (procedure instanceof _DecoratedContractProcedure) {
26
- return procedure;
27
- }
28
- return new _DecoratedContractProcedure(procedure["~orpc"]);
29
- }
30
- route(route) {
31
- return new _DecoratedContractProcedure({
32
- ...this["~orpc"],
33
- route: {
34
- ...this["~orpc"].route,
35
- ...route
36
- }
37
- });
38
- }
39
- prefix(prefix) {
40
- return new _DecoratedContractProcedure({
41
- ...this["~orpc"],
42
- ...this["~orpc"].route?.path ? {
43
- route: {
44
- ...this["~orpc"].route,
45
- path: `${prefix}${this["~orpc"].route.path}`
46
- }
47
- } : void 0
48
- });
49
- }
50
- unshiftTag(...tags) {
51
- return new _DecoratedContractProcedure({
52
- ...this["~orpc"],
53
- route: {
54
- ...this["~orpc"].route,
55
- tags: [
56
- ...tags,
57
- ...this["~orpc"].route?.tags?.filter((tag) => !tags.includes(tag)) ?? []
58
- ]
59
- }
60
- });
61
- }
62
- input(schema, example) {
63
- return new _DecoratedContractProcedure({
64
- ...this["~orpc"],
65
- InputSchema: schema,
66
- inputExample: example
67
- });
68
- }
69
- output(schema, example) {
70
- return new _DecoratedContractProcedure({
71
- ...this["~orpc"],
72
- OutputSchema: schema,
73
- outputExample: example
74
- });
75
- }
76
- errors(errorMap) {
77
- return new _DecoratedContractProcedure({
78
- ...this["~orpc"],
79
- errorMap
80
- });
81
- }
82
- };
83
-
84
- // src/router-builder.ts
85
- var ContractRouterBuilder = class _ContractRouterBuilder {
86
- "~type" = "ContractProcedure";
87
- "~orpc";
88
- constructor(def) {
89
- this["~orpc"] = def;
90
- }
91
- prefix(prefix) {
92
- return new _ContractRouterBuilder({
93
- ...this["~orpc"],
94
- prefix: `${this["~orpc"].prefix ?? ""}${prefix}`
95
- });
96
- }
97
- tag(...tags) {
98
- return new _ContractRouterBuilder({
99
- ...this["~orpc"],
100
- tags: [...this["~orpc"].tags ?? [], ...tags]
101
- });
102
- }
103
- router(router) {
104
- if (isContractProcedure(router)) {
105
- let decorated = DecoratedContractProcedure.decorate(router);
106
- if (this["~orpc"].tags) {
107
- decorated = decorated.unshiftTag(...this["~orpc"].tags);
108
- }
109
- if (this["~orpc"].prefix) {
110
- decorated = decorated.prefix(this["~orpc"].prefix);
111
- }
112
- return decorated;
113
- }
114
- const adapted = {};
115
- for (const key in router) {
116
- adapted[key] = this.router(router[key]);
117
- }
118
- return adapted;
119
- }
120
- };
121
-
122
- // src/builder.ts
123
- var ContractBuilder = class {
124
- prefix(prefix) {
125
- return new ContractRouterBuilder({
126
- prefix
127
- });
128
- }
129
- tag(...tags) {
130
- return new ContractRouterBuilder({
131
- tags
132
- });
133
- }
134
- route(route) {
135
- return new DecoratedContractProcedure({
136
- route,
137
- InputSchema: void 0,
138
- OutputSchema: void 0,
139
- errorMap: void 0
140
- });
141
- }
142
- input(schema, example) {
143
- return new DecoratedContractProcedure({
144
- InputSchema: schema,
145
- inputExample: example,
146
- OutputSchema: void 0,
147
- errorMap: void 0
148
- });
149
- }
150
- output(schema, example) {
151
- return new DecoratedContractProcedure({
152
- OutputSchema: schema,
153
- outputExample: example,
154
- InputSchema: void 0,
155
- errorMap: void 0
156
- });
157
- }
158
- errors(errorMap) {
159
- return new DecoratedContractProcedure({
160
- InputSchema: void 0,
161
- OutputSchema: void 0,
162
- errorMap
163
- });
164
- }
165
- router(router) {
166
- return router;
167
- }
168
- };
169
-
170
- // src/error-orpc.ts
171
- import { isPlainObject } from "@orpc/shared";
172
- var COMMON_ORPC_ERROR_DEFS = {
173
- BAD_REQUEST: {
174
- status: 400,
175
- message: "Bad Request"
176
- },
177
- UNAUTHORIZED: {
178
- status: 401,
179
- message: "Unauthorized"
180
- },
181
- FORBIDDEN: {
182
- status: 403,
183
- message: "Forbidden"
184
- },
185
- NOT_FOUND: {
186
- status: 404,
187
- message: "Not Found"
188
- },
189
- METHOD_NOT_SUPPORTED: {
190
- status: 405,
191
- message: "Method Not Supported"
192
- },
193
- NOT_ACCEPTABLE: {
194
- status: 406,
195
- message: "Not Acceptable"
196
- },
197
- TIMEOUT: {
198
- status: 408,
199
- message: "Request Timeout"
200
- },
201
- CONFLICT: {
202
- status: 409,
203
- message: "Conflict"
204
- },
205
- PRECONDITION_FAILED: {
206
- status: 412,
207
- message: "Precondition Failed"
208
- },
209
- PAYLOAD_TOO_LARGE: {
210
- status: 413,
211
- message: "Payload Too Large"
212
- },
213
- UNSUPPORTED_MEDIA_TYPE: {
214
- status: 415,
215
- message: "Unsupported Media Type"
216
- },
217
- UNPROCESSABLE_CONTENT: {
218
- status: 422,
219
- message: "Unprocessable Content"
220
- },
221
- TOO_MANY_REQUESTS: {
222
- status: 429,
223
- message: "Too Many Requests"
224
- },
225
- CLIENT_CLOSED_REQUEST: {
226
- status: 499,
227
- message: "Client Closed Request"
228
- },
229
- INTERNAL_SERVER_ERROR: {
230
- status: 500,
231
- message: "Internal Server Error"
232
- },
233
- NOT_IMPLEMENTED: {
234
- status: 501,
235
- message: "Not Implemented"
236
- },
237
- BAD_GATEWAY: {
238
- status: 502,
239
- message: "Bad Gateway"
240
- },
241
- SERVICE_UNAVAILABLE: {
242
- status: 503,
243
- message: "Service Unavailable"
244
- },
245
- GATEWAY_TIMEOUT: {
246
- status: 504,
247
- message: "Gateway Timeout"
248
- }
249
- };
250
- function fallbackORPCErrorStatus(code, status) {
251
- return status ?? COMMON_ORPC_ERROR_DEFS[code]?.status ?? 500;
252
- }
253
- function fallbackORPCErrorMessage(code, message) {
254
- return message || COMMON_ORPC_ERROR_DEFS[code]?.message || code;
255
- }
256
- var ORPCError = class extends Error {
257
- defined;
258
- code;
259
- status;
260
- data;
261
- constructor(options) {
262
- if (options.status && (options.status < 400 || options.status >= 600)) {
263
- throw new Error("[ORPCError] The error status code must be in the 400-599 range.");
264
- }
265
- const message = fallbackORPCErrorMessage(options.code, options.message);
266
- super(message, options);
267
- this.code = options.code;
268
- this.status = fallbackORPCErrorStatus(options.code, options.status);
269
- this.defined = options.defined ?? false;
270
- this.data = options.data;
271
- }
272
- toJSON() {
273
- return {
274
- defined: this.defined,
275
- code: this.code,
276
- status: this.status,
277
- message: this.message,
278
- data: this.data
279
- };
280
- }
281
- static isValidJSON(json) {
282
- return isPlainObject(json) && "defined" in json && typeof json.defined === "boolean" && "code" in json && typeof json.code === "string" && "status" in json && typeof json.status === "number" && "message" in json && typeof json.message === "string";
283
- }
284
- };
285
- function isDefinedError(error) {
286
- return error instanceof ORPCError && error.defined;
287
- }
288
- async function validateORPCError(map, error) {
289
- const { code, status, message, data, cause, defined } = error;
290
- const config = map?.[error.code];
291
- if (!config || fallbackORPCErrorStatus(error.code, config.status) !== error.status) {
292
- return defined ? new ORPCError({ defined: false, code, status, message, data, cause }) : error;
293
- }
294
- if (!config.data) {
295
- return defined ? error : new ORPCError({ defined: true, code, status, message, data, cause });
296
- }
297
- const validated = await config.data["~standard"].validate(error.data);
298
- if (validated.issues) {
299
- return defined ? new ORPCError({ defined: false, code, status, message, data, cause }) : error;
300
- }
301
- return new ORPCError({
302
- defined: true,
303
- code,
304
- status,
305
- message,
306
- data: validated.value,
307
- cause
308
- });
309
- }
310
-
311
- // src/client-utils.ts
312
- async function safe(promise) {
313
- try {
314
- const output = await promise;
315
- return [output, void 0, false];
316
- } catch (e) {
317
- const error = e;
318
- if (isDefinedError(error)) {
319
- return [void 0, error, true];
320
- }
321
- return [void 0, error, false];
322
- }
323
- }
324
-
325
- // src/config.ts
326
- var DEFAULT_CONFIG = {
327
- defaultMethod: "POST",
328
- defaultSuccessStatus: 200,
329
- defaultSuccessDescription: "OK",
330
- defaultInputStructure: "compact",
331
- defaultOutputStructure: "compact"
332
- };
333
- var GLOBAL_CONFIG_REF = { value: DEFAULT_CONFIG };
334
- function configGlobal(config) {
335
- if (config.defaultSuccessStatus !== void 0 && (config.defaultSuccessStatus < 200 || config.defaultSuccessStatus > 299)) {
336
- throw new Error("[configGlobal] The defaultSuccessStatus must be between 200 and 299");
337
- }
338
- GLOBAL_CONFIG_REF.value = config;
339
- }
340
- function fallbackToGlobalConfig(key, value) {
341
- if (value === void 0) {
342
- const fallback = GLOBAL_CONFIG_REF.value[key];
343
- if (fallback === void 0) {
344
- return DEFAULT_CONFIG[key];
345
- }
346
- return fallback;
347
- }
348
- return value;
349
- }
350
-
351
- // src/error.ts
352
- var ValidationError = class extends Error {
353
- issues;
354
- constructor(options) {
355
- super(options.message, options);
356
- this.issues = options.issues;
357
- }
358
- };
359
-
360
- // src/index.ts
361
- var oc = new ContractBuilder();
362
- export {
363
- COMMON_ORPC_ERROR_DEFS,
364
- ContractBuilder,
365
- ContractProcedure,
366
- ContractRouterBuilder,
367
- DecoratedContractProcedure,
368
- ORPCError,
369
- ValidationError,
370
- configGlobal,
371
- fallbackORPCErrorMessage,
372
- fallbackORPCErrorStatus,
373
- fallbackToGlobalConfig,
374
- isContractProcedure,
375
- isDefinedError,
376
- oc,
377
- safe,
378
- validateORPCError
379
- };
380
- //# sourceMappingURL=index.js.map
@@ -1,16 +0,0 @@
1
- import type { ErrorMap } from './error-map';
2
- import type { RouteOptions } from './procedure';
3
- import type { ContractRouter } from './router';
4
- import type { HTTPPath, Schema, SchemaInput, SchemaOutput } from './types';
5
- import { DecoratedContractProcedure } from './procedure-decorated';
6
- import { ContractRouterBuilder } from './router-builder';
7
- export declare class ContractBuilder {
8
- prefix(prefix: HTTPPath): ContractRouterBuilder;
9
- tag(...tags: string[]): ContractRouterBuilder;
10
- route(route: RouteOptions): DecoratedContractProcedure<undefined, undefined, undefined>;
11
- input<U extends Schema>(schema: U, example?: SchemaInput<U>): DecoratedContractProcedure<U, undefined, undefined>;
12
- output<U extends Schema>(schema: U, example?: SchemaOutput<U>): DecoratedContractProcedure<undefined, U, undefined>;
13
- errors<const U extends ErrorMap>(errorMap: U): DecoratedContractProcedure<undefined, undefined, U>;
14
- router<T extends ContractRouter>(router: T): T;
15
- }
16
- //# sourceMappingURL=builder.d.ts.map
@@ -1,5 +0,0 @@
1
- import type { ClientPromiseResult } from './client';
2
- import { type ORPCError } from './error-orpc';
3
- export type SafeResult<TOutput, TError extends Error> = [output: TOutput, error: undefined, isDefinedError: false] | [output: undefined, error: TError, isDefinedError: false] | [output: undefined, error: Extract<TError, ORPCError<any, any>>, isDefinedError: true];
4
- export declare function safe<TOutput, TError extends Error>(promise: ClientPromiseResult<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
5
- //# sourceMappingURL=client-utils.d.ts.map