New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@orpc/server

Package Overview
Dependencies
Maintainers
0
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orpc/server - npm Package Compare versions

Comparing version 0.0.0-next.a055cad to 0.0.0-next.a895960

dist/chunk-3JMSDC5L.js

17

dist/fetch.js

@@ -5,3 +5,3 @@ import {

isProcedure
} from "./chunk-MZXEMHFS.js";
} from "./chunk-3JMSDC5L.js";

@@ -28,3 +28,3 @@ // src/fetch/handle.ts

import { ORPC_HEADER, ORPC_HEADER_VALUE } from "@orpc/contract";
import { trim, value } from "@orpc/shared";
import { executeWithHooks, trim, value } from "@orpc/shared";
import { ORPCError as ORPCError2 } from "@orpc/shared/error";

@@ -53,3 +53,3 @@ import { ORPCDeserializer, ORPCSerializer } from "@orpc/transformer";

});
const output = await caller(input);
const output = await caller(input, { signal: options.signal });
const { body, headers } = serializer.serialize(output);

@@ -62,6 +62,11 @@ return new Response(body, {

try {
return await options.hooks?.(
return await executeWithHooks({
hooks: options,
context,
{ next: handler, response: (response) => response }
) ?? await handler();
execute: handler,
input: options.request,
meta: {
signal: options.signal
}
});
} catch (e) {

@@ -68,0 +73,0 @@ const error = e instanceof ORPCError2 ? e : new ORPCError2({

@@ -15,3 +15,3 @@ import {

mergeContext
} from "./chunk-MZXEMHFS.js";
} from "./chunk-3JMSDC5L.js";

@@ -18,0 +18,0 @@ // src/builder.ts

@@ -1,7 +0,4 @@

import type { PartialOnUndefinedDeep, Promisable, Value } from '@orpc/shared';
import type { Hooks, PartialOnUndefinedDeep, Value } from '@orpc/shared';
import type { Router } from '../router';
export interface FetchHandlerHooks {
next: () => Promise<Response>;
response: (response: Response) => Response;
}
import type { CallerOptions } from '../types';
export type FetchHandlerOptions<TRouter extends Router<any>> = {

@@ -24,6 +21,2 @@ /**

prefix?: string;
/**
* Hooks for executing logics on lifecycle events.
*/
hooks?: (context: TRouter extends Router<infer UContext> ? UContext : never, hooks: FetchHandlerHooks) => Promisable<Response>;
} & PartialOnUndefinedDeep<{

@@ -34,4 +27,4 @@ /**

context: Value<TRouter extends Router<infer UContext> ? UContext : never>;
}>;
}> & CallerOptions & Hooks<Request, Response, TRouter extends Router<infer UContext> ? UContext : never, CallerOptions>;
export type FetchHandler = <TRouter extends Router<any>>(options: FetchHandlerOptions<TRouter>) => Promise<Response | undefined>;
//# sourceMappingURL=types.d.ts.map

@@ -5,2 +5,3 @@ import type { SchemaInput, SchemaOutput } from '@orpc/contract';

import type { ANY_LAZY_PROCEDURE, ANY_PROCEDURE, Procedure } from './procedure';
import type { Caller } from './types';
export type CreateProcedureCallerOptions<T extends ANY_PROCEDURE | ANY_LAZY_PROCEDURE> = T extends Procedure<infer UContext, any, any, infer UOutputSchema, infer UFuncOutput> | Lazy<Procedure<infer UContext, any, any, infer UOutputSchema, infer UFuncOutput>> ? {

@@ -23,5 +24,5 @@ procedure: T;

}> : never;
export type ProcedureCaller<TProcedure extends ANY_PROCEDURE | ANY_LAZY_PROCEDURE> = TProcedure extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> | Lazy<Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput>> ? (...input: [input: SchemaInput<UInputSchema>] | (undefined extends SchemaInput<UInputSchema> ? [] : never)) => Promise<SchemaOutput<UOutputSchema, UFuncOutput>> : never;
export type ProcedureCaller<TProcedure extends ANY_PROCEDURE | ANY_LAZY_PROCEDURE> = TProcedure extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> | Lazy<Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput>> ? Caller<SchemaInput<UInputSchema>, SchemaOutput<UOutputSchema, UFuncOutput>> : never;
export declare function createProcedureCaller<TProcedure extends ANY_PROCEDURE | ANY_LAZY_PROCEDURE>(options: CreateProcedureCallerOptions<TProcedure>): ProcedureCaller<TProcedure>;
export declare function loadProcedure(procedure: ANY_PROCEDURE | ANY_LAZY_PROCEDURE): Promise<ANY_PROCEDURE>;
//# sourceMappingURL=procedure-caller.d.ts.map

@@ -16,7 +16,7 @@ import type { ContractProcedure, ContractRouter, SchemaInput, SchemaOutput } from '@orpc/contract';

export type InferRouterInputs<T extends Router<any>> = {
[K in keyof T]: T[K] extends Procedure<any, any, infer UInputSchema, any, any> ? SchemaInput<UInputSchema> : T[K] extends Router<any> ? InferRouterInputs<T[K]> : never;
[K in keyof T]: T[K] extends Procedure<any, any, infer UInputSchema, any, any> | Lazy<Procedure<any, any, infer UInputSchema, any, any>> ? SchemaInput<UInputSchema> : T[K] extends Router<any> ? InferRouterInputs<T[K]> : never;
};
export type InferRouterOutputs<T extends Router<any>> = {
[K in keyof T]: T[K] extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput> ? SchemaOutput<UOutputSchema, UFuncOutput> : T[K] extends Router<any> ? InferRouterOutputs<T[K]> : never;
[K in keyof T]: T[K] extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput> | Lazy<Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput>> ? SchemaOutput<UOutputSchema, UFuncOutput> : T[K] extends Router<any> ? InferRouterOutputs<T[K]> : never;
};
//# sourceMappingURL=router.d.ts.map
import type { WELL_DEFINED_PROCEDURE } from './procedure';
export type Context = Record<string, unknown> | undefined;
export type MergeContext<TA extends Context, TB extends Context> = TA extends undefined ? TB : TB extends undefined ? TA : TA & TB;
export interface Meta {
export interface CallerOptions {
signal?: AbortSignal;
}
export interface Caller<TInput, TOutput> {
(...opts: [input: TInput, options?: CallerOptions] | (undefined extends TInput ? [] : never)): Promise<TOutput>;
}
export interface Meta extends CallerOptions {
path: string[];

@@ -6,0 +12,0 @@ procedure: WELL_DEFINED_PROCEDURE;

{
"name": "@orpc/server",
"type": "module",
"version": "0.0.0-next.a055cad",
"version": "0.0.0-next.a895960",
"license": "MIT",

@@ -38,11 +38,11 @@ "homepage": "https://orpc.unnoq.com",

"zod": ">=3.23.0",
"@orpc/zod": "0.0.0-next.a055cad"
"@orpc/zod": "0.0.0-next.a895960"
},
"dependencies": {
"@orpc/contract": "0.0.0-next.a055cad",
"@orpc/transformer": "0.0.0-next.a055cad",
"@orpc/shared": "0.0.0-next.a055cad"
"@orpc/contract": "0.0.0-next.a895960",
"@orpc/shared": "0.0.0-next.a895960",
"@orpc/transformer": "0.0.0-next.a895960"
},
"devDependencies": {
"@orpc/openapi": "0.0.0-next.a055cad"
"@orpc/openapi": "0.0.0-next.a895960"
},

@@ -49,0 +49,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc