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

@orpc/shared

Package Overview
Dependencies
Maintainers
2
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orpc/shared - npm Package Compare versions

Comparing version 0.0.0-next.b6be6f0 to 0.0.0-next.bc564a6

dist/src/chain.d.ts

46

dist/index.js

@@ -1,5 +0,1 @@

import {
convertToStandardError
} from "./chunk-CCTAECMC.js";
// src/constants.ts

@@ -9,2 +5,22 @@ var ORPC_HANDLER_HEADER = "x-orpc-handler";

// src/error.ts
import { isPlainObject } from "is-what";
function toError(error) {
if (error instanceof Error) {
return error;
}
if (typeof error === "string") {
return new Error(error, { cause: error });
}
if (isPlainObject(error)) {
if ("message" in error && typeof error.message === "string") {
return new Error(error.message, { cause: error });
}
if ("name" in error && typeof error.name === "string") {
return new Error(error.name, { cause: error });
}
}
return new Error("Unknown error", { cause: error });
}
// src/hook.ts

@@ -38,3 +54,3 @@ async function executeWithHooks(options) {

} catch (e) {
state = { status: "error", input: options.input, error: convertToStandardError(e), output: void 0 };
state = { status: "error", input: options.input, error: toError(e), output: void 0 };
for (let i = onErrors.length - 1; i >= 0; i--) {

@@ -44,3 +60,3 @@ try {

} catch (e2) {
state = { status: "error", input: options.input, error: convertToStandardError(e2), output: void 0 };
state = { status: "error", input: options.input, error: toError(e2), output: void 0 };
}

@@ -53,3 +69,3 @@ }

} catch (e) {
state = { status: "error", input: options.input, error: convertToStandardError(e), output: void 0 };
state = { status: "error", input: options.input, error: toError(e), output: void 0 };
}

@@ -83,3 +99,3 @@ }

// src/object.ts
import { isPlainObject } from "is-what";
import { isPlainObject as isPlainObject2 } from "is-what";
function set(root, segments, value2) {

@@ -120,3 +136,3 @@ const ref = { root };

});
} else if (isPlainObject(payload)) {
} else if (isPlainObject2(payload)) {
for (const key in payload) {

@@ -158,5 +174,5 @@ findDeepMatches(check, payload[key], [...segments, key], maps, values);

// src/value.ts
function value(value2) {
function value(value2, ...args) {
if (typeof value2 === "function") {
return value2();
return value2(...args);
}

@@ -167,4 +183,4 @@ return value2;

// src/index.ts
import { isPlainObject as isPlainObject2 } from "is-what";
import { guard, mapEntries, mapValues, omit, trim } from "radash";
import { isPlainObject as isPlainObject3 } from "is-what";
import { group, guard, mapEntries, mapValues, omit, trim } from "radash";
export {

@@ -178,4 +194,5 @@ ORPC_HANDLER_HEADER,

get,
group,
guard,
isPlainObject2 as isPlainObject,
isPlainObject3 as isPlainObject,
mapEntries,

@@ -186,2 +203,3 @@ mapValues,

set,
toError,
trim,

@@ -188,0 +206,0 @@ value

@@ -1,65 +0,2 @@

import type { StandardSchemaV1 } from '@standard-schema/spec';
export declare const ORPC_ERROR_CODE_STATUSES: {
readonly BAD_REQUEST: 400;
readonly UNAUTHORIZED: 401;
readonly FORBIDDEN: 403;
readonly NOT_FOUND: 404;
readonly METHOD_NOT_SUPPORTED: 405;
readonly NOT_ACCEPTABLE: 406;
readonly TIMEOUT: 408;
readonly CONFLICT: 409;
readonly PRECONDITION_FAILED: 412;
readonly PAYLOAD_TOO_LARGE: 413;
readonly UNSUPPORTED_MEDIA_TYPE: 415;
readonly UNPROCESSABLE_CONTENT: 422;
readonly TOO_MANY_REQUESTS: 429;
readonly CLIENT_CLOSED_REQUEST: 499;
readonly INTERNAL_SERVER_ERROR: 500;
readonly NOT_IMPLEMENTED: 501;
readonly BAD_GATEWAY: 502;
readonly SERVICE_UNAVAILABLE: 503;
readonly GATEWAY_TIMEOUT: 504;
};
export type ORPCErrorCode = keyof typeof ORPC_ERROR_CODE_STATUSES;
export interface ORPCErrorJSON<TCode extends ORPCErrorCode, TData> {
code: TCode;
status: number;
message: string;
data: TData;
issues?: readonly StandardSchemaV1.Issue[];
}
export type ANY_ORPC_ERROR_JSON = ORPCErrorJSON<any, any>;
export type WELL_ORPC_ERROR_JSON = ORPCErrorJSON<ORPCErrorCode, unknown>;
export declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error {
zz$oe: {
code: TCode;
status?: number;
message?: string;
cause?: unknown;
issues?: readonly StandardSchemaV1.Issue[];
} & (undefined extends TData ? {
data?: TData;
} : {
data: TData;
});
constructor(zz$oe: {
code: TCode;
status?: number;
message?: string;
cause?: unknown;
issues?: readonly StandardSchemaV1.Issue[];
} & (undefined extends TData ? {
data?: TData;
} : {
data: TData;
}));
get code(): TCode;
get status(): number;
get data(): TData;
get issues(): readonly StandardSchemaV1.Issue[] | undefined;
toJSON(): ORPCErrorJSON<TCode, TData>;
static fromJSON(json: unknown): ORPCError<ORPCErrorCode, any> | undefined;
}
export type WELL_ORPC_ERROR = ORPCError<ORPCErrorCode, unknown>;
export declare function convertToStandardError(error: unknown): Error;
export declare function toError(error: unknown): Error;
//# sourceMappingURL=error.d.ts.map

@@ -21,3 +21,3 @@ import type { Arrayable, Promisable } from 'type-fest';

export interface BaseHookMeta<TOutput> {
next: () => Promise<TOutput>;
next(): Promise<TOutput>;
}

@@ -24,0 +24,0 @@ export interface Hooks<TInput, TOutput, TContext, TMeta extends (Record<string, any> & {

@@ -0,2 +1,4 @@

export * from './chain';
export * from './constants';
export * from './error';
export * from './function';

@@ -9,4 +11,4 @@ export * from './hook';

export { isPlainObject } from 'is-what';
export { guard, mapEntries, mapValues, omit, trim } from 'radash';
export { group, guard, mapEntries, mapValues, omit, trim } from 'radash';
export type * from 'type-fest';
//# sourceMappingURL=index.d.ts.map
import type { Promisable } from 'type-fest';
export type Value<T> = T | (() => Promisable<T>);
export declare function value<T extends Value<any>>(value: T): Promise<T extends Value<infer U> ? U : never>;
export type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => Promisable<T>);
export declare function value<T extends Value<any, TArgs>, TArgs extends any[] = []>(value: T, ...args: TArgs): Promise<T extends Value<infer U, any> ? U : never>;
//# sourceMappingURL=value.d.ts.map
{
"name": "@orpc/shared",
"type": "module",
"version": "0.0.0-next.b6be6f0",
"version": "0.0.0-next.bc564a6",
"license": "MIT",

@@ -22,7 +22,2 @@ "homepage": "https://orpc.unnoq.com",

},
"./error": {
"types": "./dist/src/error.d.ts",
"import": "./dist/error.js",
"default": "./dist/error.js"
},
"./🔒/*": {

@@ -44,3 +39,3 @@ "types": "./dist/src/*.d.ts"

"scripts": {
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.error=src/error.ts --format=esm --onSuccess='tsc -b --noCheck'",
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
"build:watch": "pnpm run build --watch",

@@ -47,0 +42,0 @@ "type:check": "tsc -b"

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