@orpc/contract
Advanced tools
Comparing version 0.0.0-next.b42ba03 to 0.0.0-next.b4e6d3a
@@ -1,4 +0,5 @@ | ||
export type ClientOptions<TClientContext> = { | ||
export type ClientContext = Record<string, any>; | ||
export type ClientOptions<TClientContext extends ClientContext> = { | ||
signal?: AbortSignal; | ||
} & (undefined extends TClientContext ? { | ||
} & (Record<never, never> extends TClientContext ? { | ||
context?: TClientContext; | ||
@@ -8,3 +9,3 @@ } : { | ||
}); | ||
export type ClientRest<TClientContext, TInput> = [input: TInput, options: ClientOptions<TClientContext>] | (undefined extends TInput & TClientContext ? [] : never) | (undefined extends TClientContext ? [input: TInput] : never); | ||
export type ClientRest<TClientContext extends ClientContext, TInput> = [input: TInput, options: ClientOptions<TClientContext>] | (Record<never, never> extends TClientContext ? (undefined extends TInput ? [input?: TInput] : [input: TInput]) : never); | ||
export type ClientPromiseResult<TOutput, TError extends Error> = Promise<TOutput> & { | ||
@@ -15,8 +16,8 @@ __error?: { | ||
}; | ||
export interface Client<TClientContext, TInput, TOutput, TError extends Error> { | ||
export interface Client<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> { | ||
(...rest: ClientRest<TClientContext, TInput>): ClientPromiseResult<TOutput, TError>; | ||
} | ||
export type NestedClient<TClientContext> = Client<TClientContext, any, any, any> | { | ||
export type NestedClient<TClientContext extends ClientContext> = Client<TClientContext, any, any, any> | { | ||
[k: string]: NestedClient<TClientContext>; | ||
}; | ||
//# sourceMappingURL=client.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import type { MaybeOptionalOptions } from '@orpc/shared'; | ||
import type { ErrorMap, ErrorMapItem } from './error-map'; | ||
@@ -97,3 +98,2 @@ import type { SchemaOutput } from './schema'; | ||
}); | ||
export type ORPCErrorOptionsRest<TData> = [options: ORPCErrorOptions<TData>] | (undefined extends TData ? [] : never); | ||
export declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error { | ||
@@ -104,3 +104,3 @@ readonly defined: boolean; | ||
readonly data: TData; | ||
constructor(code: TCode, ...[options]: ORPCErrorOptionsRest<TData>); | ||
constructor(code: TCode, ...[options]: MaybeOptionalOptions<ORPCErrorOptions<TData>>); | ||
toJSON(): ORPCErrorJSON<TCode, TData>; | ||
@@ -107,0 +107,0 @@ static fromJSON<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>): ORPCError<TCode, TData>; |
@@ -0,1 +1,2 @@ | ||
import type { MaybeOptionalOptions } from '@orpc/shared'; | ||
import type { ErrorMap, ErrorMapItem } from './error-map'; | ||
@@ -7,4 +8,3 @@ import type { ORPCErrorCode, ORPCErrorOptions } from './error-orpc'; | ||
export type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>; | ||
export type ORPCErrorConstructorMapItemRest<TData> = [options: ORPCErrorConstructorMapItemOptions<TData>] | (undefined extends TData ? [] : never); | ||
export type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: ORPCErrorConstructorMapItemRest<TInData>) => ORPCError<TCode, TInData>; | ||
export type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>; | ||
export type ORPCErrorConstructorMap<T extends ErrorMap> = { | ||
@@ -11,0 +11,0 @@ [K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, SchemaInput<UInputSchema>> : never : never; |
@@ -1,6 +0,6 @@ | ||
import type { Client } from './client'; | ||
import type { Client, ClientContext } from './client'; | ||
import type { ErrorFromErrorMap } from './error'; | ||
import type { ErrorMap } from './error-map'; | ||
import type { Schema, SchemaInput, SchemaOutput } from './schema'; | ||
export type ContractProcedureClient<TClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>; | ||
export type ContractProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>; | ||
//# sourceMappingURL=procedure-client.d.ts.map |
@@ -0,7 +1,8 @@ | ||
import type { ClientContext } from './client'; | ||
import type { ContractProcedure } from './procedure'; | ||
import type { ContractProcedureClient } from './procedure-client'; | ||
import type { AnyContractRouter } from './router'; | ||
export type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext> = TRouter extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ContractProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : { | ||
export type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext extends ClientContext> = TRouter extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ContractProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : { | ||
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never; | ||
}; | ||
//# sourceMappingURL=router-client.d.ts.map |
{ | ||
"name": "@orpc/contract", | ||
"type": "module", | ||
"version": "0.0.0-next.b42ba03", | ||
"version": "0.0.0-next.b4e6d3a", | ||
"license": "MIT", | ||
@@ -33,3 +33,3 @@ "homepage": "https://orpc.unnoq.com", | ||
"@standard-schema/spec": "1.0.0", | ||
"@orpc/shared": "0.0.0-next.b42ba03" | ||
"@orpc/shared": "0.0.0-next.b4e6d3a" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
35115
809
0
+ Added@orpc/shared@0.0.0-next.b4e6d3a(transitive)
- Removed@orpc/shared@0.0.0-next.b42ba03(transitive)