osra 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/connections/bidirectional.d.ts +1 -1
- package/build/connections/index.d.ts +1 -0
- package/build/connections/relay.d.ts +11 -0
- package/build/index.js +364 -304
- package/build/index.js.map +1 -1
- package/build/revivables/index.d.ts +2 -1
- package/build/revivables/writable-stream.d.ts +29 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import * as promise from './promise';
|
|
|
10
10
|
import * as func from './function';
|
|
11
11
|
import * as messagePort from './message-port';
|
|
12
12
|
import * as readableStream from './readable-stream';
|
|
13
|
+
import * as writableStream from './writable-stream';
|
|
13
14
|
import * as abortSignal from './abort-signal';
|
|
14
15
|
import * as response from './response';
|
|
15
16
|
import * as request from './request';
|
|
@@ -33,7 +34,7 @@ export type RevivableModule<T extends string = string, T2 = any, T3 extends BoxB
|
|
|
33
34
|
readonly init?: (context: RevivableContext<any>) => void;
|
|
34
35
|
readonly Messages?: T4;
|
|
35
36
|
};
|
|
36
|
-
export declare const defaultRevivableModules: readonly [typeof transfer, typeof identity, typeof arrayBuffer, typeof date, typeof headers, typeof error, typeof typedArray, typeof blob, typeof promise, typeof func, typeof messagePort, typeof readableStream, typeof abortSignal, typeof response, typeof request, typeof map, typeof set, typeof bigInt, typeof symbol, typeof event, typeof eventTarget, {
|
|
37
|
+
export declare const defaultRevivableModules: readonly [typeof transfer, typeof identity, typeof arrayBuffer, typeof date, typeof headers, typeof error, typeof typedArray, typeof blob, typeof promise, typeof func, typeof messagePort, typeof readableStream, typeof writableStream, typeof abortSignal, typeof response, typeof request, typeof map, typeof set, typeof bigInt, typeof symbol, typeof event, typeof eventTarget, {
|
|
37
38
|
readonly type: 'clonable';
|
|
38
39
|
readonly capableOnly: true;
|
|
39
40
|
readonly isType: (value: unknown) => value is import("./fallbacks").Clonable;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RevivableContext, BoxBase as BoxBaseType } from './utils';
|
|
2
|
+
import type { UnderlyingType } from '.';
|
|
3
|
+
import type { Capable } from '../types';
|
|
4
|
+
import { BoxedMessagePort } from './message-port';
|
|
5
|
+
export declare const type: 'writableStream';
|
|
6
|
+
export type WriteContext = {
|
|
7
|
+
type: 'write';
|
|
8
|
+
chunk: Capable;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'close';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'abort';
|
|
13
|
+
reason: Capable;
|
|
14
|
+
};
|
|
15
|
+
export type WriteAck = {
|
|
16
|
+
type: 'ack';
|
|
17
|
+
} | {
|
|
18
|
+
type: 'err';
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
export type Msg = WriteContext | WriteAck;
|
|
22
|
+
export type BoxedWritableStream<T extends WritableStream = WritableStream> = BoxBaseType<typeof type> & {
|
|
23
|
+
port: BoxedMessagePort<Msg>;
|
|
24
|
+
} & {
|
|
25
|
+
[UnderlyingType]: T;
|
|
26
|
+
};
|
|
27
|
+
export declare const isType: (value: unknown) => value is WritableStream;
|
|
28
|
+
export declare const box: <T extends WritableStream, T2 extends RevivableContext>(value: T, context: T2) => BoxedWritableStream<T>;
|
|
29
|
+
export declare const revive: <T extends BoxedWritableStream, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
|