🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@orpc/shared

Package Overview
Dependencies
Maintainers
1
Versions
1102
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
2.0.0-beta.11
to
2.0.0-beta.12
+5
-5
dist/index.d.mts

@@ -1,6 +0,6 @@

import { Promisable } from 'type-fest';
export { IsEqual, PartialDeep, Promisable, Writable } from 'type-fest';
import { Arrayable, Promisable } from 'type-fest';
export { Arrayable, IsEqual, PartialDeep, Promisable, Writable } from 'type-fest';
import { Tracer, TraceAPI, ContextAPI, PropagationAPI, SpanOptions, Context, Span, AttributeValue, Exception } from '@opentelemetry/api';
import { AsyncIteratorClass } from '@standardserver/shared';
export { AbortError, AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sleep, stringifyJSON, toArray } from '@standardserver/shared';
export { AbortError, AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sequential, sleep, stringifyJSON, toArray } from '@standardserver/shared';

@@ -17,3 +17,3 @@ type MaybeOptionalOptions<TOptions> = object extends TOptions ? [options?: TOptions] : [options: TOptions];

*/
declare function loadBytes(source: Pick<Blob, 'arrayBuffer' | 'bytes'>): Promise<Uint8Array<ArrayBuffer>>;
declare function loadBytes(source: Pick<Blob, 'arrayBuffer' | 'bytes'>): ReturnType<Blob['bytes']>;
/**

@@ -24,3 +24,3 @@ * Normalize text or binary-like inputs to either:

*/
declare function toStringOrBytes(source: string | ArrayBuffer | Blob | Exclude<ConstructorParameters<typeof Blob>[0], undefined>[0][] | Pick<Uint8Array<ArrayBuffer>, 'buffer' | 'byteOffset' | 'byteLength'>): Promise<string | Uint8Array<ArrayBuffer>>;
declare function toStringOrBytes(source: Arrayable<string | ArrayBuffer | Pick<Uint8Array<ArrayBuffer>, 'buffer' | 'byteOffset' | 'byteLength'>>): string | Awaited<ReturnType<Blob['bytes']>>;

@@ -27,0 +27,0 @@ declare function isDeepEqual(a: unknown, b: unknown): boolean;

@@ -1,6 +0,6 @@

import { Promisable } from 'type-fest';
export { IsEqual, PartialDeep, Promisable, Writable } from 'type-fest';
import { Arrayable, Promisable } from 'type-fest';
export { Arrayable, IsEqual, PartialDeep, Promisable, Writable } from 'type-fest';
import { Tracer, TraceAPI, ContextAPI, PropagationAPI, SpanOptions, Context, Span, AttributeValue, Exception } from '@opentelemetry/api';
import { AsyncIteratorClass } from '@standardserver/shared';
export { AbortError, AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sleep, stringifyJSON, toArray } from '@standardserver/shared';
export { AbortError, AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sequential, sleep, stringifyJSON, toArray } from '@standardserver/shared';

@@ -17,3 +17,3 @@ type MaybeOptionalOptions<TOptions> = object extends TOptions ? [options?: TOptions] : [options: TOptions];

*/
declare function loadBytes(source: Pick<Blob, 'arrayBuffer' | 'bytes'>): Promise<Uint8Array<ArrayBuffer>>;
declare function loadBytes(source: Pick<Blob, 'arrayBuffer' | 'bytes'>): ReturnType<Blob['bytes']>;
/**

@@ -24,3 +24,3 @@ * Normalize text or binary-like inputs to either:

*/
declare function toStringOrBytes(source: string | ArrayBuffer | Blob | Exclude<ConstructorParameters<typeof Blob>[0], undefined>[0][] | Pick<Uint8Array<ArrayBuffer>, 'buffer' | 'byteOffset' | 'byteLength'>): Promise<string | Uint8Array<ArrayBuffer>>;
declare function toStringOrBytes(source: Arrayable<string | ArrayBuffer | Pick<Uint8Array<ArrayBuffer>, 'buffer' | 'byteOffset' | 'byteLength'>>): string | Awaited<ReturnType<Blob['bytes']>>;

@@ -27,0 +27,0 @@ declare function isDeepEqual(a: unknown, b: unknown): boolean;

import { AbortError, AsyncIteratorClass, isTypescriptObject, getOrBind } from '@standardserver/shared';
export { AbortError, AsyncIteratorClass, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sleep, stringifyJSON, toArray } from '@standardserver/shared';
export { AbortError, AsyncIteratorClass, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sequential, sleep, stringifyJSON, toArray } from '@standardserver/shared';

@@ -19,3 +19,3 @@ function resolveMaybeOptionalOptions(rest) {

}
async function toStringOrBytes(source) {
function toStringOrBytes(source) {
if (typeof source === "string") {

@@ -27,7 +27,4 @@ return source;

}
if (source instanceof Blob) {
return loadBytes(source);
}
if (Array.isArray(source)) {
return loadBytes(new Blob(source));
return concatBytes(source);
}

@@ -39,2 +36,25 @@ if (source instanceof Uint8Array) {

}
function toBytes(item) {
if (typeof item === "string") {
return new TextEncoder().encode(item);
}
if (item instanceof ArrayBuffer) {
return new Uint8Array(item);
}
if (item instanceof Uint8Array) {
return item;
}
return new Uint8Array(item.buffer, item.byteOffset, item.byteLength);
}
function concatBytes(items) {
const chunks = items.map(toBytes);
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const chunk of chunks) {
result.set(chunk, offset);
offset += chunk.byteLength;
}
return result;
}

@@ -41,0 +61,0 @@ function isDeepEqual(a, b) {

{
"name": "@orpc/shared",
"type": "module",
"version": "2.0.0-beta.11",
"version": "2.0.0-beta.12",
"license": "MIT",

@@ -6,0 +6,0 @@ "homepage": "https://orpc.dev",

@@ -53,2 +53,3 @@ <h1 align="center">oRPC - Typesafe APIs Made Simple 🪄</h1>

- [@orpc/bun](https://www.npmjs.com/package/@orpc/bun): Adapters for [Bun's Redis](https://bun.sh/).
- [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare): Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/).

@@ -55,0 +56,0 @@ **Observability**