@nmtjs/protocol 0.7.7 → 0.8.0
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/dist/common/types.js.map +1 -1
- package/package.json +9 -4
- package/src/common/types.ts +11 -15
package/dist/common/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","names":[],"sources":["src/common/types.ts"],"sourcesContent":["import type { ProtocolServerBlobStream } from '../client/stream.ts'\nimport type {\n ProtocolBlob,\n ProtocolBlobInterface,\n ProtocolBlobMetadata,\n} from './blob.ts'\n\nexport type ProtocolRPC = {\n callId: number\n namespace: string\n procedure: string\n payload: any\n}\n\nexport type ProtocolRPCResponse =\n | {\n callId: number\n error: any\n payload?: never\n }\n | {\n callId: number\n payload: any\n error?: never\n }\n\nexport interface EncodeRPCContext {\n getStream: (id: number) => any\n addStream: (blob: ProtocolBlob) => {\n id: number\n metadata: ProtocolBlobMetadata\n }\n}\n\nexport interface DecodeRPCContext {\n getStream: (id: number) => any\n addStream: (id: number, metadata: ProtocolBlobMetadata) => any\n}\n\nexport interface BaseClientDecoder {\n decode(buffer: ArrayBuffer): any\n decodeRPC(buffer: ArrayBuffer, context: DecodeRPCContext): ProtocolRPCResponse\n}\n\nexport interface BaseClientEncoder {\n encode(data: any): ArrayBuffer\n encodeRPC(rpc: ProtocolRPC, context: EncodeRPCContext): ArrayBuffer\n}\n\nexport type InputType<T> = T extends
|
|
1
|
+
{"mappings":"","names":[],"sources":["src/common/types.ts"],"sourcesContent":["import type { ProtocolServerBlobStream } from '../client/stream.ts'\nimport type {\n ProtocolBlob,\n ProtocolBlobInterface,\n ProtocolBlobMetadata,\n} from './blob.ts'\n\nexport type ProtocolRPC = {\n callId: number\n namespace: string\n procedure: string\n payload: any\n}\n\nexport type ProtocolRPCResponse =\n | {\n callId: number\n error: any\n payload?: never\n }\n | {\n callId: number\n payload: any\n error?: never\n }\n\nexport interface EncodeRPCContext {\n getStream: (id: number) => any\n addStream: (blob: ProtocolBlob) => {\n id: number\n metadata: ProtocolBlobMetadata\n }\n}\n\nexport interface DecodeRPCContext {\n getStream: (id: number) => any\n addStream: (id: number, metadata: ProtocolBlobMetadata) => any\n}\n\nexport interface BaseClientDecoder {\n decode(buffer: ArrayBuffer): any\n decodeRPC(buffer: ArrayBuffer, context: DecodeRPCContext): ProtocolRPCResponse\n}\n\nexport interface BaseClientEncoder {\n encode(data: any): ArrayBuffer\n encodeRPC(rpc: ProtocolRPC, context: EncodeRPCContext): ArrayBuffer\n}\n\nexport type InputType<T> = T extends ProtocolBlobInterface\n ? ProtocolBlob\n : T extends object\n ? { [K in keyof T]: InputType<T[K]> }\n : T\n\nexport type OutputType<T> = T extends ProtocolBlobInterface\n ? ProtocolServerBlobStream\n : T extends object\n ? { [K in keyof T]: OutputType<T[K]> }\n : T\n"],"version":3}
|
package/package.json
CHANGED
|
@@ -16,9 +16,14 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@nmtjs/
|
|
20
|
-
"@nmtjs/core": "0.
|
|
21
|
-
"@nmtjs/
|
|
19
|
+
"@nmtjs/type": "0.8.0",
|
|
20
|
+
"@nmtjs/core": "0.8.0",
|
|
21
|
+
"@nmtjs/common": "0.8.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@nmtjs/common": "0.8.0",
|
|
25
|
+
"@nmtjs/type": "0.8.0",
|
|
26
|
+
"@nmtjs/core": "0.8.0"
|
|
22
27
|
},
|
|
23
28
|
"files": [
|
|
24
29
|
"src",
|
|
@@ -26,7 +31,7 @@
|
|
|
26
31
|
"LICENSE.md",
|
|
27
32
|
"README.md"
|
|
28
33
|
],
|
|
29
|
-
"version": "0.
|
|
34
|
+
"version": "0.8.0",
|
|
30
35
|
"scripts": {
|
|
31
36
|
"build": "neemata-build --root=./src './**/*.ts'",
|
|
32
37
|
"type-check": "tsc --noEmit"
|
package/src/common/types.ts
CHANGED
|
@@ -47,18 +47,14 @@ export interface BaseClientEncoder {
|
|
|
47
47
|
encodeRPC(rpc: ProtocolRPC, context: EncodeRPCContext): ArrayBuffer
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export type InputType<T> = T extends
|
|
51
|
-
?
|
|
52
|
-
: T extends
|
|
53
|
-
?
|
|
54
|
-
: T
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
? ProtocolServerBlobStream
|
|
62
|
-
: T extends object
|
|
63
|
-
? { [K in keyof T]: OutputType<T[K]> }
|
|
64
|
-
: T
|
|
50
|
+
export type InputType<T> = T extends ProtocolBlobInterface
|
|
51
|
+
? ProtocolBlob
|
|
52
|
+
: T extends object
|
|
53
|
+
? { [K in keyof T]: InputType<T[K]> }
|
|
54
|
+
: T
|
|
55
|
+
|
|
56
|
+
export type OutputType<T> = T extends ProtocolBlobInterface
|
|
57
|
+
? ProtocolServerBlobStream
|
|
58
|
+
: T extends object
|
|
59
|
+
? { [K in keyof T]: OutputType<T[K]> }
|
|
60
|
+
: T
|