@nmtjs/protocol 0.15.2 → 0.16.0-beta.1

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.
@@ -1,15 +1,13 @@
1
1
  import type { ProtocolBlob } from '../common/blob.ts';
2
2
  import type { DecodeRPCContext } from '../common/types.ts';
3
- import type { ProtocolClientBlobStream, ProtocolServerBlobStream } from './stream.ts';
3
+ import type { ProtocolClientBlobStream, ProtocolServerBlobConsumer } from './stream.ts';
4
4
  export interface EncodeRPCContext<T = any> {
5
5
  addStream: (blob: ProtocolBlob) => T;
6
6
  }
7
7
  export type ProtocolRPCEncode = ArrayBufferView;
8
8
  export interface BaseClientDecoder {
9
9
  decode(buffer: ArrayBufferView): unknown;
10
- decodeRPC(buffer: ArrayBufferView, context: DecodeRPCContext<(options?: {
11
- signal?: AbortSignal;
12
- }) => ProtocolServerBlobStream>): unknown;
10
+ decodeRPC(buffer: ArrayBufferView, context: DecodeRPCContext<ProtocolServerBlobConsumer>): unknown;
13
11
  }
14
12
  export interface BaseClientEncoder {
15
13
  encode(data: unknown): ArrayBufferView;
@@ -20,7 +18,5 @@ export declare abstract class BaseClientFormat implements BaseClientDecoder, Bas
20
18
  abstract encode(data: unknown): ArrayBufferView;
21
19
  abstract encodeRPC(data: unknown, context: EncodeRPCContext): ProtocolRPCEncode;
22
20
  abstract decode(buffer: ArrayBufferView): unknown;
23
- abstract decodeRPC(buffer: ArrayBufferView, context: DecodeRPCContext<(options?: {
24
- signal?: AbortSignal;
25
- }) => ProtocolServerBlobStream>): unknown;
21
+ abstract decodeRPC(buffer: ArrayBufferView, context: DecodeRPCContext<ProtocolServerBlobConsumer>): unknown;
26
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/client/format.ts"],"names":[],"mappings":"AA+BA,MAAM,OAAgB,gBAAgB;CAiBrC"}
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/client/format.ts"],"names":[],"mappings":"AA6BA,MAAM,OAAgB,gBAAgB;CAerC"}
@@ -2,14 +2,12 @@ import type { ProtocolBlob, ProtocolBlobMetadata } from '../common/blob.ts';
2
2
  import type { ClientMessageType, ProtocolVersion, ServerMessageType } from '../common/enums.ts';
3
3
  import type { BaseProtocolError, EncodeRPCStreams } from '../common/types.ts';
4
4
  import type { BaseClientDecoder, BaseClientEncoder } from './format.ts';
5
- import type { ProtocolClientBlobStream, ProtocolServerBlobStream } from './stream.ts';
5
+ import type { ProtocolClientBlobStream, ProtocolServerBlobConsumer } from './stream.ts';
6
6
  export type MessageContext = {
7
7
  decoder: BaseClientDecoder;
8
8
  encoder: BaseClientEncoder;
9
9
  addClientStream: (blob: ProtocolBlob) => ProtocolClientBlobStream;
10
- addServerStream: (streamId: number, metadata: ProtocolBlobMetadata) => (options?: {
11
- signal?: AbortSignal;
12
- }) => ProtocolServerBlobStream;
10
+ addServerStream: (streamId: number, metadata: ProtocolBlobMetadata) => ProtocolServerBlobConsumer;
13
11
  transport: {
14
12
  send: (buffer: ArrayBufferView) => void;
15
13
  };
@@ -47,3 +47,6 @@ export declare class ProtocolServerBlobStream extends ProtocolServerStreamInterf
47
47
  */
48
48
  slice(): Blob;
49
49
  }
50
+ export type ProtocolServerBlobConsumer = ((options?: {
51
+ signal?: AbortSignal;
52
+ }) => ProtocolServerBlobStream) & ProtocolBlobInterface;
package/package.json CHANGED
@@ -21,18 +21,18 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "hookable": "6.1.0",
24
- "@nmtjs/common": "0.15.2",
25
- "@nmtjs/contract": "0.15.2",
26
- "@nmtjs/type": "0.15.2"
24
+ "@nmtjs/type": "0.16.0-beta.1",
25
+ "@nmtjs/common": "0.16.0-beta.1",
26
+ "@nmtjs/contract": "0.16.0-beta.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@nmtjs/core": "0.15.2"
29
+ "@nmtjs/core": "0.16.0-beta.1"
30
30
  },
31
31
  "peerDependencies": {
32
- "@nmtjs/core": "0.15.2",
33
- "@nmtjs/type": "0.15.2",
34
- "@nmtjs/contract": "0.15.2",
35
- "@nmtjs/common": "0.15.2"
32
+ "@nmtjs/common": "0.16.0-beta.1",
33
+ "@nmtjs/contract": "0.16.0-beta.1",
34
+ "@nmtjs/core": "0.16.0-beta.1",
35
+ "@nmtjs/type": "0.16.0-beta.1"
36
36
  },
37
37
  "files": [
38
38
  "dist",
@@ -40,7 +40,7 @@
40
40
  "LICENSE.md",
41
41
  "README.md"
42
42
  ],
43
- "version": "0.15.2",
43
+ "version": "0.16.0-beta.1",
44
44
  "scripts": {
45
45
  "clean-build": "rm -rf ./dist"
46
46
  }
@@ -2,7 +2,7 @@ import type { ProtocolBlob } from '../common/blob.ts'
2
2
  import type { DecodeRPCContext } from '../common/types.ts'
3
3
  import type {
4
4
  ProtocolClientBlobStream,
5
- ProtocolServerBlobStream,
5
+ ProtocolServerBlobConsumer,
6
6
  } from './stream.ts'
7
7
 
8
8
  export interface EncodeRPCContext<T = any> {
@@ -15,9 +15,7 @@ export interface BaseClientDecoder {
15
15
  decode(buffer: ArrayBufferView): unknown
16
16
  decodeRPC(
17
17
  buffer: ArrayBufferView,
18
- context: DecodeRPCContext<
19
- (options?: { signal?: AbortSignal }) => ProtocolServerBlobStream
20
- >,
18
+ context: DecodeRPCContext<ProtocolServerBlobConsumer>,
21
19
  ): unknown
22
20
  }
23
21
 
@@ -42,8 +40,6 @@ export abstract class BaseClientFormat
42
40
  abstract decode(buffer: ArrayBufferView): unknown
43
41
  abstract decodeRPC(
44
42
  buffer: ArrayBufferView,
45
- context: DecodeRPCContext<
46
- (options?: { signal?: AbortSignal }) => ProtocolServerBlobStream
47
- >,
43
+ context: DecodeRPCContext<ProtocolServerBlobConsumer>,
48
44
  ): unknown
49
45
  }
@@ -8,7 +8,7 @@ import type { BaseProtocolError, EncodeRPCStreams } from '../common/types.ts'
8
8
  import type { BaseClientDecoder, BaseClientEncoder } from './format.ts'
9
9
  import type {
10
10
  ProtocolClientBlobStream,
11
- ProtocolServerBlobStream,
11
+ ProtocolServerBlobConsumer,
12
12
  } from './stream.ts'
13
13
  import { concat } from '../common/binary.ts'
14
14
 
@@ -19,7 +19,7 @@ export type MessageContext = {
19
19
  addServerStream: (
20
20
  streamId: number,
21
21
  metadata: ProtocolBlobMetadata,
22
- ) => (options?: { signal?: AbortSignal }) => ProtocolServerBlobStream
22
+ ) => ProtocolServerBlobConsumer
23
23
  transport: { send: (buffer: ArrayBufferView) => void }
24
24
  streamId: () => number
25
25
  }
@@ -209,3 +209,8 @@ export class ProtocolServerBlobStream
209
209
  throw new Error('Unable to slice')
210
210
  }
211
211
  }
212
+
213
+ export type ProtocolServerBlobConsumer = ((options?: {
214
+ signal?: AbortSignal
215
+ }) => ProtocolServerBlobStream) &
216
+ ProtocolBlobInterface