@orpc/standard-server
Advanced tools
Comparing version 0.0.0-next.7e41bc4 to 0.0.0-next.ac2a918
@@ -154,6 +154,4 @@ // src/event-source/errors.ts | ||
// src/event-source/meta.ts | ||
import { isTypescriptObject } from "@orpc/shared"; | ||
var EVENT_SOURCE_META_SYMBOL = Symbol("ORPC_EVENT_SOURCE_META"); | ||
function isEventMetaContainer(value) { | ||
return !!value && (typeof value === "object" || typeof value === "function"); | ||
} | ||
function withEventMeta(container, meta) { | ||
@@ -176,3 +174,3 @@ if (meta.id !== void 0) { | ||
function getEventMeta(container) { | ||
return isEventMetaContainer(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0; | ||
return isTypescriptObject(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0; | ||
} | ||
@@ -182,25 +180,2 @@ | ||
import { contentDisposition, parse } from "@tinyhttp/content-disposition"; | ||
function once(fn) { | ||
let cached; | ||
return () => { | ||
if (cached) { | ||
return cached.result; | ||
} | ||
const result = fn(); | ||
cached = { result }; | ||
return result; | ||
}; | ||
} | ||
function parseEmptyableJSON(text) { | ||
if (!text) { | ||
return void 0; | ||
} | ||
return JSON.parse(text); | ||
} | ||
function isAsyncIteratorObject(maybe) { | ||
if (!maybe || typeof maybe !== "object") { | ||
return false; | ||
} | ||
return Symbol.asyncIterator in maybe && typeof maybe[Symbol.asyncIterator] === "function"; | ||
} | ||
export { | ||
@@ -221,9 +196,5 @@ ErrorEvent, | ||
getEventMeta, | ||
isAsyncIteratorObject, | ||
isEventMetaContainer, | ||
once, | ||
parse as parseContentDisposition, | ||
parseEmptyableJSON, | ||
withEventMeta | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import type { JsonValue } from 'type-fest'; | ||
export declare class EventEncoderError extends TypeError { | ||
@@ -8,6 +7,6 @@ } | ||
message?: string; | ||
data?: undefined | JsonValue; | ||
data?: unknown; | ||
} | ||
export declare class ErrorEvent extends Error { | ||
data: undefined | JsonValue; | ||
data: unknown; | ||
constructor(options?: ErrorEventOptions); | ||
@@ -14,0 +13,0 @@ } |
import type { EventMessage } from './types'; | ||
export type EventMeta = Partial<Pick<EventMessage, 'retry' | 'id'>>; | ||
export declare function isEventMetaContainer(value: unknown): value is Record<PropertyKey, unknown>; | ||
export declare function withEventMeta<T extends object>(container: T, meta: EventMeta): T; | ||
export declare function getEventMeta(container: unknown): EventMeta | undefined; | ||
//# sourceMappingURL=meta.d.ts.map |
@@ -1,7 +0,5 @@ | ||
import type { JsonValue } from 'type-fest'; | ||
export type { JsonValue }; | ||
export interface StandardHeaders { | ||
[key: string]: string | string[] | undefined; | ||
} | ||
export type StandardBody = undefined | JsonValue | Blob | URLSearchParams | FormData | AsyncIterator<JsonValue | void, JsonValue | void, undefined>; | ||
export type StandardBody = undefined | unknown | Blob | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined>; | ||
export interface StandardRequest { | ||
@@ -8,0 +6,0 @@ /** |
@@ -1,6 +0,2 @@ | ||
import type { JsonValue } from 'type-fest'; | ||
export declare function once<T extends () => any>(fn: T): () => ReturnType<T>; | ||
export declare function parseEmptyableJSON(text: string): JsonValue | undefined; | ||
export declare function isAsyncIteratorObject(maybe: unknown): maybe is AsyncIteratorObject<any, any, any>; | ||
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition'; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "@orpc/standard-server", | ||
"type": "module", | ||
"version": "0.0.0-next.7e41bc4", | ||
"version": "0.0.0-next.ac2a918", | ||
"license": "MIT", | ||
@@ -32,3 +32,3 @@ "homepage": "https://unnoq.com", | ||
"@tinyhttp/content-disposition": "^2.2.2", | ||
"type-fest": "^4.34.1" | ||
"@orpc/shared": "0.0.0-next.ac2a918" | ||
}, | ||
@@ -35,0 +35,0 @@ "scripts": { |
10332
271
+ Added@orpc/shared@0.0.0-next.ac2a918(transitive)
+ Addedradash@12.1.0(transitive)
- Removedtype-fest@^4.34.1