osra 0.5.5 → 0.5.6

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.
@@ -8,15 +8,29 @@ export type PullContext = {
8
8
  } | {
9
9
  type: 'cancel';
10
10
  reason?: Capable;
11
+ } | {
12
+ type: 'credit';
13
+ n: number;
11
14
  };
12
15
  type ChunkMessage<T = unknown> = Promise<ReadableStreamReadResult<T>>;
13
- type Msg = PullContext | ChunkMessage;
16
+ type PushMessage = {
17
+ type: 'chunk';
18
+ value: Capable;
19
+ } | {
20
+ type: 'end';
21
+ } | {
22
+ type: 'error';
23
+ error: Capable;
24
+ };
25
+ type Msg = PullContext | PushMessage | ChunkMessage;
14
26
  export type BoxedReadableStream<T extends ReadableStream = ReadableStream> = BoxBaseType<typeof type> & {
15
27
  port: BoxedMessagePort<Msg>;
28
+ credit?: true;
16
29
  } & {
17
30
  [UnderlyingType]: T;
18
31
  };
19
32
  export declare const isType: (value: unknown) => value is ReadableStream;
33
+ export declare const MAX_CREDIT_WINDOW = 64;
20
34
  export declare const box: <T extends ReadableStream, T2 extends RevivableContext>(value: T, context: T2) => BoxedReadableStream<T>;
21
35
  export declare const revive: <T extends BoxedReadableStream, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
22
36
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osra",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Easy communication between workers",
5
5
  "files": [
6
6
  "build"