@orpc/contract 2.0.0-beta.30 → 2.0.0-beta.31
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.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/plugins/index.mjs +1 -1
- package/dist/shared/{contract.DUiXUlmP.d.mts → contract.CQzrFGcD.d.mts} +2 -2
- package/dist/shared/{contract.DUiXUlmP.d.ts → contract.CQzrFGcD.d.ts} +2 -2
- package/dist/shared/{contract.DjQcyGZi.mjs → contract.Civ5dUNU.mjs} +2 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ErrorMap, A as AnySchema, P as ProcedureContract, M as MetaPlugin, a as MergedSchema, b as Meta, c as AnyMetaPlugin, R as RouterContract, d as AnyProcedureContract, S as Schema, I as InferSchemaInput, e as InferSchemaOutput, O as ORPCErrorFromErrorMap, f as ErrorMapItem, g as SchemaIssue } from './shared/contract.
|
|
2
|
-
export { H as HIDDEN_META_PLUGINS_SYMBOL, h as InferContractRouterErrorMap, i as InferContractRouterInputs, j as InferContractRouterOutputs, k as InferRouterContractError, h as InferRouterContractErrorMap, l as InferRouterContractErrors, i as InferRouterContractInputs, j as InferRouterContractOutputs, m as MetaPluginDefinition, n as ProcedureContractDefinition, V as ValidationError, o as ValidationErrorOptions, p as getHiddenMetaPlugins, s as setHiddenMetaPlugins } from './shared/contract.
|
|
1
|
+
import { E as ErrorMap, A as AnySchema, P as ProcedureContract, M as MetaPlugin, a as MergedSchema, b as Meta, c as AnyMetaPlugin, R as RouterContract, d as AnyProcedureContract, S as Schema, I as InferSchemaInput, e as InferSchemaOutput, O as ORPCErrorFromErrorMap, f as ErrorMapItem, g as SchemaIssue } from './shared/contract.CQzrFGcD.mjs';
|
|
2
|
+
export { H as HIDDEN_META_PLUGINS_SYMBOL, h as InferContractRouterErrorMap, i as InferContractRouterInputs, j as InferContractRouterOutputs, k as InferRouterContractError, h as InferRouterContractErrorMap, l as InferRouterContractErrors, i as InferRouterContractInputs, j as InferRouterContractOutputs, m as MetaPluginDefinition, n as ProcedureContractDefinition, V as ValidationError, o as ValidationErrorOptions, p as getHiddenMetaPlugins, s as setHiddenMetaPlugins } from './shared/contract.CQzrFGcD.mjs';
|
|
3
3
|
import { AnyORPCError, ClientContext, Client, ORPCClientOptions, ClientLink, ORPCErrorCode, ORPCErrorOptions, ORPCError } from '@orpc/client';
|
|
4
4
|
export { Client, ClientContext, ClientOptions, ClientRest, FriendlyClientOptions } from '@orpc/client';
|
|
5
5
|
import { ThrowableError, MaybeOptionalOptions, AsyncIteratorClass, Promisable, IsEqual } from '@orpc/shared';
|
|
@@ -234,7 +234,7 @@ interface ContractClientFactoryOptions<TClientContext extends ClientContext> ext
|
|
|
234
234
|
* @remarks
|
|
235
235
|
* **Warning**: Every procedure contract passed to the factory must define `meta.path` matching its location in the root contract.
|
|
236
236
|
*
|
|
237
|
-
* @see {@link https://orpc.dev/docs/
|
|
237
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
238
238
|
*/
|
|
239
239
|
declare function createContractClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractClientFactoryOptions<TClientContext>): ContractClientFactory<TClientContext>;
|
|
240
240
|
|
|
@@ -322,7 +322,7 @@ interface PathMetaPlugin<TInputSchema extends AnySchema, TOutputSchema extends A
|
|
|
322
322
|
* `meta.path` records a procedure contract's path inside the root contract,
|
|
323
323
|
* which is required for the contract client factory pattern.
|
|
324
324
|
*
|
|
325
|
-
* @see {@link https://orpc.dev/docs/
|
|
325
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
326
326
|
*/
|
|
327
327
|
declare const meta: {
|
|
328
328
|
path<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap>(path: string[]): PathMetaPlugin<TInputSchema, TOutputSchema, TErrorMap>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ErrorMap, A as AnySchema, P as ProcedureContract, M as MetaPlugin, a as MergedSchema, b as Meta, c as AnyMetaPlugin, R as RouterContract, d as AnyProcedureContract, S as Schema, I as InferSchemaInput, e as InferSchemaOutput, O as ORPCErrorFromErrorMap, f as ErrorMapItem, g as SchemaIssue } from './shared/contract.
|
|
2
|
-
export { H as HIDDEN_META_PLUGINS_SYMBOL, h as InferContractRouterErrorMap, i as InferContractRouterInputs, j as InferContractRouterOutputs, k as InferRouterContractError, h as InferRouterContractErrorMap, l as InferRouterContractErrors, i as InferRouterContractInputs, j as InferRouterContractOutputs, m as MetaPluginDefinition, n as ProcedureContractDefinition, V as ValidationError, o as ValidationErrorOptions, p as getHiddenMetaPlugins, s as setHiddenMetaPlugins } from './shared/contract.
|
|
1
|
+
import { E as ErrorMap, A as AnySchema, P as ProcedureContract, M as MetaPlugin, a as MergedSchema, b as Meta, c as AnyMetaPlugin, R as RouterContract, d as AnyProcedureContract, S as Schema, I as InferSchemaInput, e as InferSchemaOutput, O as ORPCErrorFromErrorMap, f as ErrorMapItem, g as SchemaIssue } from './shared/contract.CQzrFGcD.js';
|
|
2
|
+
export { H as HIDDEN_META_PLUGINS_SYMBOL, h as InferContractRouterErrorMap, i as InferContractRouterInputs, j as InferContractRouterOutputs, k as InferRouterContractError, h as InferRouterContractErrorMap, l as InferRouterContractErrors, i as InferRouterContractInputs, j as InferRouterContractOutputs, m as MetaPluginDefinition, n as ProcedureContractDefinition, V as ValidationError, o as ValidationErrorOptions, p as getHiddenMetaPlugins, s as setHiddenMetaPlugins } from './shared/contract.CQzrFGcD.js';
|
|
3
3
|
import { AnyORPCError, ClientContext, Client, ORPCClientOptions, ClientLink, ORPCErrorCode, ORPCErrorOptions, ORPCError } from '@orpc/client';
|
|
4
4
|
export { Client, ClientContext, ClientOptions, ClientRest, FriendlyClientOptions } from '@orpc/client';
|
|
5
5
|
import { ThrowableError, MaybeOptionalOptions, AsyncIteratorClass, Promisable, IsEqual } from '@orpc/shared';
|
|
@@ -234,7 +234,7 @@ interface ContractClientFactoryOptions<TClientContext extends ClientContext> ext
|
|
|
234
234
|
* @remarks
|
|
235
235
|
* **Warning**: Every procedure contract passed to the factory must define `meta.path` matching its location in the root contract.
|
|
236
236
|
*
|
|
237
|
-
* @see {@link https://orpc.dev/docs/
|
|
237
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
238
238
|
*/
|
|
239
239
|
declare function createContractClientFactory<TClientContext extends ClientContext>(link: ClientLink<TClientContext>, options?: ContractClientFactoryOptions<TClientContext>): ContractClientFactory<TClientContext>;
|
|
240
240
|
|
|
@@ -322,7 +322,7 @@ interface PathMetaPlugin<TInputSchema extends AnySchema, TOutputSchema extends A
|
|
|
322
322
|
* `meta.path` records a procedure contract's path inside the root contract,
|
|
323
323
|
* which is required for the contract client factory pattern.
|
|
324
324
|
*
|
|
325
|
-
* @see {@link https://orpc.dev/docs/
|
|
325
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
326
326
|
*/
|
|
327
327
|
declare const meta: {
|
|
328
328
|
path<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap>(path: string[]): PathMetaPlugin<TInputSchema, TOutputSchema, TErrorMap>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isTypescriptObject, toArray, get, set, isPropertyKey, ORPC_NAME, resolveMaybeOptionalOptions, isAsyncIteratorObject } from '@orpc/shared';
|
|
2
|
-
import { P as ProcedureContract, r as resolveMetaPlugins, m as mergeErrorMap, a as augmentContractRouter, V as ValidationError } from './shared/contract.
|
|
3
|
-
export { d as defineMeta, g as getContractRouter, b as getProcedureContractOrThrow, g as getRouterContract, c as minifyContractRouter, c as minifyRouterContract, e as reconcileORPCError } from './shared/contract.
|
|
1
|
+
import { isTypescriptObject, toArray, get, set, isPropertyKey, ORPC_NAME, resolveMaybeOptionalOptions, getOwn, isAsyncIteratorObject } from '@orpc/shared';
|
|
2
|
+
import { P as ProcedureContract, r as resolveMetaPlugins, m as mergeErrorMap, a as augmentContractRouter, V as ValidationError } from './shared/contract.Civ5dUNU.mjs';
|
|
3
|
+
export { d as defineMeta, g as getContractRouter, b as getProcedureContractOrThrow, g as getRouterContract, c as minifyContractRouter, c as minifyRouterContract, e as reconcileORPCError } from './shared/contract.Civ5dUNU.mjs';
|
|
4
4
|
import { createORPCClient, ORPCError, wrapAsyncIteratorPreservingEventMeta } from '@orpc/client';
|
|
5
5
|
|
|
6
6
|
const HIDDEN_META_PLUGINS_SYMBOL = Symbol.for("ORPC_HIDDEN_META_PLUGINS");
|
|
@@ -261,7 +261,7 @@ function createORPCErrorConstructorMap(errorMap) {
|
|
|
261
261
|
}
|
|
262
262
|
const item = (...rest) => {
|
|
263
263
|
const options = resolveMaybeOptionalOptions(rest);
|
|
264
|
-
const config = errorMap
|
|
264
|
+
const config = getOwn(errorMap, code);
|
|
265
265
|
const error2 = new ORPCError(code, {
|
|
266
266
|
message: options.message ?? config?.message,
|
|
267
267
|
data: options.data,
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { toArray, isPlainObject, mergeTwoLevels } from '@orpc/shared';
|
|
3
|
-
import { b as getProcedureContractOrThrow, V as ValidationError, e as reconcileORPCError } from '../shared/contract.
|
|
3
|
+
import { b as getProcedureContractOrThrow, V as ValidationError, e as reconcileORPCError } from '../shared/contract.Civ5dUNU.mjs';
|
|
4
4
|
|
|
5
5
|
class RequestValidationLinkPlugin {
|
|
6
6
|
constructor(contract, options = {}) {
|
|
@@ -59,7 +59,7 @@ interface ValidationErrorOptions extends ErrorOptions {
|
|
|
59
59
|
* carrying the standard-schema `issues` and the invalid data.
|
|
60
60
|
* Usually found as the `cause` of an `ORPCError`.
|
|
61
61
|
*
|
|
62
|
-
* @see {@link https://orpc.dev/docs/
|
|
62
|
+
* @see {@link https://orpc.dev/docs/recipes/validation-customization | Validation Customization}
|
|
63
63
|
*/
|
|
64
64
|
declare class ValidationError extends Error {
|
|
65
65
|
name: string;
|
|
@@ -153,7 +153,7 @@ type AnyProcedureContract = ProcedureContract<any, any, any>;
|
|
|
153
153
|
/**
|
|
154
154
|
* A router contract: a single procedure contract or a nested record of them.
|
|
155
155
|
*
|
|
156
|
-
* @see {@link https://orpc.dev/docs/
|
|
156
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
157
157
|
*/
|
|
158
158
|
type RouterContract = AnyProcedureContract | {
|
|
159
159
|
[k: string]: RouterContract;
|
|
@@ -59,7 +59,7 @@ interface ValidationErrorOptions extends ErrorOptions {
|
|
|
59
59
|
* carrying the standard-schema `issues` and the invalid data.
|
|
60
60
|
* Usually found as the `cause` of an `ORPCError`.
|
|
61
61
|
*
|
|
62
|
-
* @see {@link https://orpc.dev/docs/
|
|
62
|
+
* @see {@link https://orpc.dev/docs/recipes/validation-customization | Validation Customization}
|
|
63
63
|
*/
|
|
64
64
|
declare class ValidationError extends Error {
|
|
65
65
|
name: string;
|
|
@@ -153,7 +153,7 @@ type AnyProcedureContract = ProcedureContract<any, any, any>;
|
|
|
153
153
|
/**
|
|
154
154
|
* A router contract: a single procedure contract or a nested record of them.
|
|
155
155
|
*
|
|
156
|
-
* @see {@link https://orpc.dev/docs/
|
|
156
|
+
* @see {@link https://orpc.dev/docs/contract/client-factory | Contract Client Factory}
|
|
157
157
|
*/
|
|
158
158
|
type RouterContract = AnyProcedureContract | {
|
|
159
159
|
[k: string]: RouterContract;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { toArray, getConstructor, isTypescriptObject } from '@orpc/shared';
|
|
1
|
+
import { getOwn, toArray, getConstructor, isTypescriptObject } from '@orpc/shared';
|
|
2
2
|
import { cloneORPCError } from '@orpc/client';
|
|
3
3
|
|
|
4
4
|
function mergeErrorMap(errorMap1, errorMap2) {
|
|
5
5
|
return { ...errorMap1, ...errorMap2 };
|
|
6
6
|
}
|
|
7
7
|
async function reconcileORPCError(map, error) {
|
|
8
|
-
const config = map
|
|
8
|
+
const config = getOwn(map, error.code);
|
|
9
9
|
if (!config) {
|
|
10
10
|
if (!error.defined) {
|
|
11
11
|
return error;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.31",
|
|
5
5
|
"description": "Define typesafe API contracts as the single source of truth for oRPC, powered by Standard Schema",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@standard-schema/spec": "^1.1.0",
|
|
47
|
-
"@orpc/client": "2.0.0-beta.
|
|
48
|
-
"@orpc/shared": "2.0.0-beta.
|
|
47
|
+
"@orpc/client": "2.0.0-beta.31",
|
|
48
|
+
"@orpc/shared": "2.0.0-beta.31"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"arktype": "^2.2.1",
|