@nmtjs/protocol 0.15.0-beta.1 → 0.15.0-beta.10
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/client/format.d.ts +26 -0
- package/dist/client/format.js +3 -0
- package/dist/client/format.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/protocol.d.ts +114 -0
- package/dist/client/protocol.js +25 -0
- package/dist/client/protocol.js.map +1 -0
- package/dist/client/stream.d.ts +49 -0
- package/dist/client/stream.js +190 -0
- package/dist/client/stream.js.map +1 -0
- package/dist/client/versions/v1.d.ts +108 -0
- package/dist/client/versions/v1.js +128 -0
- package/dist/client/versions/v1.js.map +1 -0
- package/dist/common/binary.d.ts +20 -0
- package/dist/common/binary.js +40 -0
- package/dist/common/binary.js.map +1 -0
- package/dist/common/blob.d.ts +29 -0
- package/dist/common/blob.js +67 -0
- package/dist/common/blob.js.map +1 -0
- package/dist/common/constants.d.ts +2 -0
- package/dist/common/constants.js +2 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/enums.d.ts +51 -0
- package/dist/common/enums.js +59 -0
- package/dist/common/enums.js.map +1 -0
- package/dist/common/index.d.ts +6 -0
- package/dist/common/index.js +7 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/types.d.ts +14 -0
- package/dist/common/types.js +2 -0
- package/dist/common/types.js.map +1 -0
- package/dist/common/utils.d.ts +2 -0
- package/dist/common/utils.js +7 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/server/format.d.ts +32 -0
- package/dist/server/format.js +63 -0
- package/dist/server/format.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +9 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/protocol.d.ts +102 -0
- package/dist/server/protocol.js +25 -0
- package/dist/server/protocol.js.map +1 -0
- package/dist/server/stream.d.ts +15 -0
- package/dist/server/stream.js +42 -0
- package/dist/server/stream.js.map +1 -0
- package/dist/server/types.d.ts +34 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/utils.d.ts +12 -0
- package/dist/server/utils.js +16 -0
- package/dist/server/utils.js.map +1 -0
- package/dist/server/versions/v1.d.ts +77 -0
- package/dist/server/versions/v1.js +119 -0
- package/dist/server/versions/v1.js.map +1 -0
- package/package.json +11 -10
- package/src/client/format.ts +49 -0
- package/src/client/index.ts +8 -0
- package/src/client/protocol.ts +107 -0
- package/src/client/stream.ts +222 -0
- package/src/client/versions/v1.ts +205 -0
- package/src/common/binary.ts +70 -0
- package/src/common/blob.ts +99 -0
- package/src/common/constants.ts +2 -0
- package/src/common/enums.ts +62 -0
- package/src/common/index.ts +6 -0
- package/src/common/types.ts +18 -0
- package/src/common/utils.ts +12 -0
- package/src/server/format.ts +113 -0
- package/src/server/index.ts +10 -0
- package/src/server/protocol.ts +97 -0
- package/src/server/stream.ts +51 -0
- package/src/server/types.ts +42 -0
- package/src/server/utils.ts +22 -0
- package/src/server/versions/v1.ts +198 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { decodeNumber, decodeText, encodeNumber, encodeText, } from "../../common/binary.js";
|
|
2
|
+
import { ClientMessageType, MessageByteLength, ProtocolVersion, ServerMessageType, } from "../../common/enums.js";
|
|
3
|
+
import { ProtocolVersionInterface } from "../protocol.js";
|
|
4
|
+
export class ProtocolVersion1 extends ProtocolVersionInterface {
|
|
5
|
+
version = ProtocolVersion.v1;
|
|
6
|
+
decodeMessage(context, buffer) {
|
|
7
|
+
const messageType = decodeNumber(buffer, 'Uint8');
|
|
8
|
+
const payload = buffer.subarray(MessageByteLength.MessageType);
|
|
9
|
+
switch (messageType) {
|
|
10
|
+
// case ServerMessageType.Event: {
|
|
11
|
+
// const { event, data } = context.decoder.decode(payload)
|
|
12
|
+
// return { type: messageType, event, data }
|
|
13
|
+
// }
|
|
14
|
+
case ServerMessageType.RpcResponse: {
|
|
15
|
+
const callId = decodeNumber(payload, 'Uint32');
|
|
16
|
+
const isError = decodeNumber(payload, 'Uint8', MessageByteLength.CallId);
|
|
17
|
+
const dataPayload = payload.subarray(MessageByteLength.CallId + MessageByteLength.MessageError);
|
|
18
|
+
if (isError) {
|
|
19
|
+
const error = context.decoder.decode(dataPayload);
|
|
20
|
+
return { type: messageType, callId, error };
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const result = context.decoder.decodeRPC(dataPayload, {
|
|
24
|
+
addStream: (streamId, metadata) => {
|
|
25
|
+
return context.addServerStream(streamId, metadata);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return { type: messageType, callId, result };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
case ServerMessageType.RpcStreamResponse: {
|
|
32
|
+
const callId = decodeNumber(payload, 'Uint32');
|
|
33
|
+
const errorPayload = payload.subarray(MessageByteLength.CallId);
|
|
34
|
+
const error = errorPayload.byteLength > 0
|
|
35
|
+
? context.decoder.decode(errorPayload)
|
|
36
|
+
: undefined;
|
|
37
|
+
return { type: messageType, callId, error };
|
|
38
|
+
}
|
|
39
|
+
case ServerMessageType.RpcStreamChunk: {
|
|
40
|
+
const callId = decodeNumber(payload, 'Uint32');
|
|
41
|
+
const chunk = payload.subarray(MessageByteLength.CallId);
|
|
42
|
+
return { type: messageType, callId, chunk };
|
|
43
|
+
}
|
|
44
|
+
case ServerMessageType.RpcStreamEnd: {
|
|
45
|
+
const callId = decodeNumber(payload, 'Uint32');
|
|
46
|
+
return { type: messageType, callId };
|
|
47
|
+
}
|
|
48
|
+
case ServerMessageType.RpcStreamAbort: {
|
|
49
|
+
const callId = decodeNumber(payload, 'Uint32');
|
|
50
|
+
const reasonPayload = payload.subarray(MessageByteLength.CallId);
|
|
51
|
+
const reason = reasonPayload.byteLength > 0 ? decodeText(reasonPayload) : undefined;
|
|
52
|
+
return { type: messageType, callId, reason };
|
|
53
|
+
}
|
|
54
|
+
case ServerMessageType.ClientStreamPull: {
|
|
55
|
+
const streamId = decodeNumber(payload, 'Uint32');
|
|
56
|
+
const size = decodeNumber(payload, 'Uint32', MessageByteLength.StreamId);
|
|
57
|
+
return { type: messageType, streamId, size };
|
|
58
|
+
}
|
|
59
|
+
case ServerMessageType.ClientStreamAbort: {
|
|
60
|
+
const streamId = decodeNumber(payload, 'Uint32');
|
|
61
|
+
const reasonPayload = payload.subarray(MessageByteLength.StreamId);
|
|
62
|
+
const reason = reasonPayload.byteLength > 0 ? decodeText(reasonPayload) : undefined;
|
|
63
|
+
return { type: messageType, streamId, reason };
|
|
64
|
+
}
|
|
65
|
+
case ServerMessageType.ServerStreamPush: {
|
|
66
|
+
const streamId = decodeNumber(payload, 'Uint32');
|
|
67
|
+
const chunk = payload.subarray(MessageByteLength.StreamId);
|
|
68
|
+
return { type: messageType, streamId, chunk };
|
|
69
|
+
}
|
|
70
|
+
case ServerMessageType.ServerStreamEnd: {
|
|
71
|
+
const streamId = decodeNumber(payload, 'Uint32');
|
|
72
|
+
const reasonPayload = payload.subarray(MessageByteLength.StreamId);
|
|
73
|
+
const reason = reasonPayload.byteLength > 0 ? decodeText(reasonPayload) : undefined;
|
|
74
|
+
return { type: messageType, streamId, reason };
|
|
75
|
+
}
|
|
76
|
+
case ServerMessageType.ServerStreamAbort: {
|
|
77
|
+
const streamId = decodeNumber(payload, 'Uint32');
|
|
78
|
+
const reasonPayload = payload.subarray(MessageByteLength.StreamId);
|
|
79
|
+
const reason = reasonPayload.byteLength > 0 ? decodeText(reasonPayload) : undefined;
|
|
80
|
+
return { type: messageType, streamId, reason };
|
|
81
|
+
}
|
|
82
|
+
default:
|
|
83
|
+
throw new Error(`Unsupported message type: ${messageType}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
encodeMessage(context, messageType, payload) {
|
|
87
|
+
switch (messageType) {
|
|
88
|
+
case ClientMessageType.Rpc: {
|
|
89
|
+
const { callId, procedure, payload: rpcPayload, } = payload;
|
|
90
|
+
const procedureBuffer = encodeText(procedure);
|
|
91
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(callId, 'Uint32'), encodeNumber(procedureBuffer.byteLength, 'Uint16'), procedureBuffer, context.encoder.encodeRPC(rpcPayload, {
|
|
92
|
+
addStream: (blob) => context.addClientStream(blob),
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
case ClientMessageType.RpcAbort: {
|
|
96
|
+
const { callId, reason } = payload;
|
|
97
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(callId, 'Uint32'), reason ? encodeText(reason) : new Uint8Array(0));
|
|
98
|
+
}
|
|
99
|
+
case ClientMessageType.RpcPull: {
|
|
100
|
+
const { callId } = payload;
|
|
101
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(callId, 'Uint32'));
|
|
102
|
+
}
|
|
103
|
+
case ClientMessageType.ClientStreamPush: {
|
|
104
|
+
const { streamId, chunk } = payload;
|
|
105
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(streamId, 'Uint32'), chunk);
|
|
106
|
+
}
|
|
107
|
+
case ClientMessageType.ClientStreamEnd: {
|
|
108
|
+
const { streamId } = payload;
|
|
109
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(streamId, 'Uint32'));
|
|
110
|
+
}
|
|
111
|
+
case ClientMessageType.ClientStreamAbort: {
|
|
112
|
+
const { streamId, reason } = payload;
|
|
113
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(streamId, 'Uint32'), reason ? encodeText(reason) : new Uint8Array(0));
|
|
114
|
+
}
|
|
115
|
+
case ClientMessageType.ServerStreamPull: {
|
|
116
|
+
const { streamId, size } = payload;
|
|
117
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(streamId, 'Uint32'), encodeNumber(size, 'Uint32'));
|
|
118
|
+
}
|
|
119
|
+
case ClientMessageType.ServerStreamAbort: {
|
|
120
|
+
const { streamId, reason } = payload;
|
|
121
|
+
return this.encode(encodeNumber(messageType, 'Uint8'), encodeNumber(streamId, 'Uint32'), reason ? encodeText(reason) : new Uint8Array(0));
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
throw new Error(`Unsupported message type: ${messageType}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=v1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v1.js","sourceRoot":"","sources":["../../../src/client/versions/v1.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,GACX,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,MAAM,OAAO,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,GAAG,eAAe,CAAC,EAAE,CAAA;IAE5B,aAAa,CAAC,OAAuB,EAAE,MAAkB;QACvD,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA;QAC9D,QAAQ,WAAW,EAAE,CAAC;YACpB,kCAAkC;YAClC,4DAA4D;YAC5D,8CAA8C;YAC9C,IAAI;YACJ,KAAK,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;gBACnC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;gBAC9C,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;gBACxE,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAClC,iBAAiB,CAAC,MAAM,GAAG,iBAAiB,CAAC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AQ,EAAE,QAAQ,CAAC,EAChC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAC7B,CAAA;YACH,CAAC;YACD,KAAK,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC;gBACzC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GACxB,OAAwE,CAAA;gBAC1E,OAAO,IAAI,CAAC,MAAM,CAChB,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,EAClC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAChC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAChD,CAAA;YACH,CAAC;YAED;gBACE,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAA;QAC/D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const utf8decoder: TextDecoder;
|
|
2
|
+
export type BinaryTypes = {
|
|
3
|
+
Int8: number;
|
|
4
|
+
Int16: number;
|
|
5
|
+
Int32: number;
|
|
6
|
+
Uint8: number;
|
|
7
|
+
Uint16: number;
|
|
8
|
+
Uint32: number;
|
|
9
|
+
Float32: number;
|
|
10
|
+
Float64: number;
|
|
11
|
+
BigInt64: bigint;
|
|
12
|
+
BigUint64: bigint;
|
|
13
|
+
};
|
|
14
|
+
export declare const encodeNumber: <T extends keyof BinaryTypes>(value: BinaryTypes[T], type: T, littleEndian?: boolean) => ArrayBuffer;
|
|
15
|
+
export declare const decodeNumber: <T extends keyof BinaryTypes>(buffer: ArrayBuffer | ArrayBufferView, type: T, offset?: number, littleEndian?: boolean) => BinaryTypes[T];
|
|
16
|
+
export declare const encodeText: (text: string) => Uint8Array<ArrayBuffer>;
|
|
17
|
+
export declare const decodeText: (buffer: Parameters<typeof utf8decoder.decode>[0]) => string;
|
|
18
|
+
export declare const concat: (...buffers: (ArrayBuffer | ArrayBufferView)[]) => Uint8Array<ArrayBuffer>;
|
|
19
|
+
export declare const UTF8Transform: () => TransformStream<string, Uint8Array<ArrayBufferLike>>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// TODO: get rid of lib DOM somehow...
|
|
2
|
+
/// <reference lib="dom" />
|
|
3
|
+
const utf8decoder = new TextDecoder();
|
|
4
|
+
const utf8encoder = new TextEncoder();
|
|
5
|
+
export const encodeNumber = (value, type, littleEndian = true) => {
|
|
6
|
+
const bytesNeeded = globalThis[`${type}Array`].BYTES_PER_ELEMENT;
|
|
7
|
+
const ab = new ArrayBuffer(bytesNeeded);
|
|
8
|
+
const dv = new DataView(ab);
|
|
9
|
+
dv[`set${type}`](0, value, littleEndian);
|
|
10
|
+
return ab;
|
|
11
|
+
};
|
|
12
|
+
export const decodeNumber = (buffer, type, offset = 0, littleEndian = true) => {
|
|
13
|
+
const ab = buffer instanceof ArrayBuffer ? buffer : buffer.buffer;
|
|
14
|
+
const baseOffset = buffer instanceof ArrayBuffer ? 0 : buffer.byteOffset;
|
|
15
|
+
const view = new DataView(ab);
|
|
16
|
+
return view[`get${type}`](baseOffset + offset, littleEndian);
|
|
17
|
+
};
|
|
18
|
+
export const encodeText = (text) => utf8encoder.encode(text);
|
|
19
|
+
export const decodeText = (buffer) => utf8decoder.decode(buffer);
|
|
20
|
+
export const concat = (...buffers) => {
|
|
21
|
+
let totalLength = 0;
|
|
22
|
+
for (const buffer of buffers)
|
|
23
|
+
totalLength += buffer.byteLength;
|
|
24
|
+
const view = new Uint8Array(totalLength);
|
|
25
|
+
let offset = 0;
|
|
26
|
+
for (const buffer of buffers) {
|
|
27
|
+
const chunk = buffer instanceof ArrayBuffer
|
|
28
|
+
? new Uint8Array(buffer)
|
|
29
|
+
: new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
30
|
+
view.set(chunk, offset);
|
|
31
|
+
offset += chunk.byteLength;
|
|
32
|
+
}
|
|
33
|
+
return view;
|
|
34
|
+
};
|
|
35
|
+
export const UTF8Transform = () => new TransformStream({
|
|
36
|
+
transform(chunk, controller) {
|
|
37
|
+
controller.enqueue(encodeText(chunk));
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../../src/common/binary.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,2BAA2B;AAE3B,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;AACrC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;AAerC,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAqB,EACrB,IAAO,EACP,YAAY,GAAG,IAAI,EACnB,EAAE;IACF,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,iBAAiB,CAAA;IAChE,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,CAAA;IACvC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC3B,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAc,EAAE,YAAY,CAAC,CAAA;IACjD,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAqC,EACrC,IAAO,EACP,MAAM,GAAG,CAAC,EACV,YAAY,GAAG,IAAI,EACH,EAAE;IAClB,MAAM,EAAE,GAAG,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;IACjE,MAAM,UAAU,GAAG,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAA;IACxE,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC7B,O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,0 +1,29 @@
|
|
|
1
|
+
import { kBlobKey } from './constants.ts';
|
|
2
|
+
export type ProtocolBlobMetadata = {
|
|
3
|
+
type: string;
|
|
4
|
+
size?: number | undefined;
|
|
5
|
+
filename?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export interface ProtocolBlobInterface {
|
|
8
|
+
readonly metadata: ProtocolBlobMetadata;
|
|
9
|
+
readonly [kBlobKey]: any;
|
|
10
|
+
}
|
|
11
|
+
export declare class ProtocolBlob implements ProtocolBlobInterface {
|
|
12
|
+
[kBlobKey]: true;
|
|
13
|
+
readonly source: any;
|
|
14
|
+
readonly metadata: ProtocolBlobMetadata;
|
|
15
|
+
readonly encode?: () => unknown;
|
|
16
|
+
readonly toJSON?: () => unknown;
|
|
17
|
+
constructor({ source, encode, size, type, filename, }: {
|
|
18
|
+
source: any;
|
|
19
|
+
encode?: () => unknown;
|
|
20
|
+
size?: number;
|
|
21
|
+
type?: string;
|
|
22
|
+
filename?: string;
|
|
23
|
+
});
|
|
24
|
+
static from(_source: any, _metadata?: {
|
|
25
|
+
size?: number;
|
|
26
|
+
type?: string;
|
|
27
|
+
filename?: string;
|
|
28
|
+
}, _encode?: () => unknown): ProtocolBlob;
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { kBlobKey } from "./constants.js";
|
|
2
|
+
export class ProtocolBlob {
|
|
3
|
+
[kBlobKey] = true;
|
|
4
|
+
source;
|
|
5
|
+
metadata;
|
|
6
|
+
encode;
|
|
7
|
+
toJSON;
|
|
8
|
+
constructor({ source, encode, size, type = 'application/octet-stream', filename, }) {
|
|
9
|
+
if (typeof size !== 'undefined' && size <= 0)
|
|
10
|
+
throw new Error('Blob size is invalid');
|
|
11
|
+
this.encode = encode;
|
|
12
|
+
this.source = source;
|
|
13
|
+
this.metadata = { size, type, filename };
|
|
14
|
+
if (encode) {
|
|
15
|
+
Object.defineProperty(this, 'toJSON', {
|
|
16
|
+
configurable: false,
|
|
17
|
+
enumerable: false,
|
|
18
|
+
writable: false,
|
|
19
|
+
value: encode,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static from(_source, _metadata = {}, _encode) {
|
|
24
|
+
let source;
|
|
25
|
+
const metadata = { ..._metadata };
|
|
26
|
+
if (_source instanceof globalThis.ReadableStream) {
|
|
27
|
+
source = _source;
|
|
28
|
+
}
|
|
29
|
+
else if ('File' in globalThis && _source instanceof globalThis.File) {
|
|
30
|
+
source = _source.stream();
|
|
31
|
+
metadata.size ??= _source.size;
|
|
32
|
+
metadata.filename ??= _source.name;
|
|
33
|
+
}
|
|
34
|
+
else if (_source instanceof globalThis.Blob) {
|
|
35
|
+
source = _source.stream();
|
|
36
|
+
metadata.size ??= _source.size;
|
|
37
|
+
metadata.type ??= _source.type;
|
|
38
|
+
}
|
|
39
|
+
else if (typeof _source === 'string') {
|
|
40
|
+
const blob = new Blob([_source]);
|
|
41
|
+
source = blob.stream();
|
|
42
|
+
metadata.size ??= blob.size;
|
|
43
|
+
metadata.type ??= 'text/plain';
|
|
44
|
+
}
|
|
45
|
+
else if (globalThis.ArrayBuffer.isView(_source)) {
|
|
46
|
+
const blob = new Blob([_source]);
|
|
47
|
+
source = blob.stream();
|
|
48
|
+
metadata.size ??= blob.size;
|
|
49
|
+
}
|
|
50
|
+
else if (_source instanceof globalThis.ArrayBuffer) {
|
|
51
|
+
const blob = new Blob([_source]);
|
|
52
|
+
source = blob.stream();
|
|
53
|
+
metadata.size ??= blob.size;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
source = _source;
|
|
57
|
+
}
|
|
58
|
+
return new ProtocolBlob({
|
|
59
|
+
source,
|
|
60
|
+
encode: _encode,
|
|
61
|
+
size: metadata.size,
|
|
62
|
+
type: metadata.type,
|
|
63
|
+
filename: metadata.filename,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=blob.js.map
|
|
@@ -0,0 +1 @@
|
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M;YACN,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;SAC5B,CAAC,CAAA;IACJ,CAAC;CAMF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAkB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare enum ProtocolVersion {
|
|
2
|
+
v1 = 1
|
|
3
|
+
}
|
|
4
|
+
export declare enum ClientMessageType {
|
|
5
|
+
Rpc = 10,
|
|
6
|
+
RpcAbort = 11,
|
|
7
|
+
RpcPull = 12,
|
|
8
|
+
ClientStreamPush = 20,
|
|
9
|
+
ClientStreamEnd = 21,
|
|
10
|
+
ClientStreamAbort = 22,
|
|
11
|
+
ServerStreamAbort = 33,
|
|
12
|
+
ServerStreamPull = 34
|
|
13
|
+
}
|
|
14
|
+
export declare enum ServerMessageType {
|
|
15
|
+
RpcResponse = 10,
|
|
16
|
+
RpcStreamResponse = 11,
|
|
17
|
+
RpcStreamChunk = 12,
|
|
18
|
+
RpcStreamEnd = 13,
|
|
19
|
+
RpcStreamAbort = 14,
|
|
20
|
+
ServerStreamPush = 20,
|
|
21
|
+
ServerStreamEnd = 21,
|
|
22
|
+
ServerStreamAbort = 22,
|
|
23
|
+
ClientStreamAbort = 33,
|
|
24
|
+
ClientStreamPull = 34
|
|
25
|
+
}
|
|
26
|
+
export declare enum ConnectionType {
|
|
27
|
+
Bidirectional = "Bidirectional",
|
|
28
|
+
Unidirectional = "Unidirectional"
|
|
29
|
+
}
|
|
30
|
+
export declare enum ErrorCode {
|
|
31
|
+
ValidationError = "ValidationError",
|
|
32
|
+
BadRequest = "BadRequest",
|
|
33
|
+
NotFound = "NotFound",
|
|
34
|
+
Forbidden = "Forbidden",
|
|
35
|
+
Unauthorized = "Unauthorized",
|
|
36
|
+
InternalServerError = "InternalServerError",
|
|
37
|
+
NotAcceptable = "NotAcceptable",
|
|
38
|
+
RequestTimeout = "RequestTimeout",
|
|
39
|
+
GatewayTimeout = "GatewayTimeout",
|
|
40
|
+
ServiceUnavailable = "ServiceUnavailable",
|
|
41
|
+
ClientRequestError = "ClientRequestError",
|
|
42
|
+
ConnectionError = "ConnectionError"
|
|
43
|
+
}
|
|
44
|
+
export declare enum MessageByteLength {
|
|
45
|
+
MessageType = 1,
|
|
46
|
+
MessageError = 1,
|
|
47
|
+
ProcedureLength = 2,
|
|
48
|
+
CallId = 4,
|
|
49
|
+
StreamId = 4,
|
|
50
|
+
ChunkSize = 4
|
|
51
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export var ProtocolVersion;
|
|
2
|
+
(function (ProtocolVersion) {
|
|
3
|
+
ProtocolVersion[ProtocolVersion["v1"] = 1] = "v1";
|
|
4
|
+
})(ProtocolVersion || (ProtocolVersion = {}));
|
|
5
|
+
export var ClientMessageType;
|
|
6
|
+
(function (ClientMessageType) {
|
|
7
|
+
ClientMessageType[ClientMessageType["Rpc"] = 10] = "Rpc";
|
|
8
|
+
ClientMessageType[ClientMessageType["RpcAbort"] = 11] = "RpcAbort";
|
|
9
|
+
ClientMessageType[ClientMessageType["RpcPull"] = 12] = "RpcPull";
|
|
10
|
+
ClientMessageType[ClientMessageType["ClientStreamPush"] = 20] = "ClientStreamPush";
|
|
11
|
+
ClientMessageType[ClientMessageType["ClientStreamEnd"] = 21] = "ClientStreamEnd";
|
|
12
|
+
ClientMessageType[ClientMessageType["ClientStreamAbort"] = 22] = "ClientStreamAbort";
|
|
13
|
+
ClientMessageType[ClientMessageType["ServerStreamAbort"] = 33] = "ServerStreamAbort";
|
|
14
|
+
ClientMessageType[ClientMessageType["ServerStreamPull"] = 34] = "ServerStreamPull";
|
|
15
|
+
})(ClientMessageType || (ClientMessageType = {}));
|
|
16
|
+
export var ServerMessageType;
|
|
17
|
+
(function (ServerMessageType) {
|
|
18
|
+
// Event = 1,
|
|
19
|
+
ServerMessageType[ServerMessageType["RpcResponse"] = 10] = "RpcResponse";
|
|
20
|
+
ServerMessageType[ServerMessageType["RpcStreamResponse"] = 11] = "RpcStreamResponse";
|
|
21
|
+
ServerMessageType[ServerMessageType["RpcStreamChunk"] = 12] = "RpcStreamChunk";
|
|
22
|
+
ServerMessageType[ServerMessageType["RpcStreamEnd"] = 13] = "RpcStreamEnd";
|
|
23
|
+
ServerMessageType[ServerMessageType["RpcStreamAbort"] = 14] = "RpcStreamAbort";
|
|
24
|
+
ServerMessageType[ServerMessageType["ServerStreamPush"] = 20] = "ServerStreamPush";
|
|
25
|
+
ServerMessageType[ServerMessageType["ServerStreamEnd"] = 21] = "ServerStreamEnd";
|
|
26
|
+
ServerMessageType[ServerMessageType["ServerStreamAbort"] = 22] = "ServerStreamAbort";
|
|
27
|
+
ServerMessageType[ServerMessageType["ClientStreamAbort"] = 33] = "ClientStreamAbort";
|
|
28
|
+
ServerMessageType[ServerMessageType["ClientStreamPull"] = 34] = "ClientStreamPull";
|
|
29
|
+
})(ServerMessageType || (ServerMessageType = {}));
|
|
30
|
+
export var ConnectionType;
|
|
31
|
+
(function (ConnectionType) {
|
|
32
|
+
ConnectionType["Bidirectional"] = "Bidirectional";
|
|
33
|
+
ConnectionType["Unidirectional"] = "Unidirectional";
|
|
34
|
+
})(ConnectionType || (ConnectionType = {}));
|
|
35
|
+
export var ErrorCode;
|
|
36
|
+
(function (ErrorCode) {
|
|
37
|
+
ErrorCode["ValidationError"] = "ValidationError";
|
|
38
|
+
ErrorCode["BadRequest"] = "BadRequest";
|
|
39
|
+
ErrorCode["NotFound"] = "NotFound";
|
|
40
|
+
ErrorCode["Forbidden"] = "Forbidden";
|
|
41
|
+
ErrorCode["Unauthorized"] = "Unauthorized";
|
|
42
|
+
ErrorCode["InternalServerError"] = "InternalServerError";
|
|
43
|
+
ErrorCode["NotAcceptable"] = "NotAcceptable";
|
|
44
|
+
ErrorCode["RequestTimeout"] = "RequestTimeout";
|
|
45
|
+
ErrorCode["GatewayTimeout"] = "GatewayTimeout";
|
|
46
|
+
ErrorCode["ServiceUnavailable"] = "ServiceUnavailable";
|
|
47
|
+
ErrorCode["ClientRequestError"] = "ClientRequestError";
|
|
48
|
+
ErrorCode["ConnectionError"] = "ConnectionError";
|
|
49
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
50
|
+
export var MessageByteLength;
|
|
51
|
+
(function (MessageByteLength) {
|
|
52
|
+
MessageByteLength[MessageByteLength["MessageType"] = 1] = "MessageType";
|
|
53
|
+
MessageByteLength[MessageByteLength["MessageError"] = 1] = "MessageError";
|
|
54
|
+
MessageByteLength[MessageByteLength["ProcedureLength"] = 2] = "ProcedureLength";
|
|
55
|
+
MessageByteLength[MessageByteLength["CallId"] = 4] = "CallId";
|
|
56
|
+
MessageByteLength[MessageByteLength["StreamId"] = 4] = "StreamId";
|
|
57
|
+
MessageByteLength[MessageByteLength["ChunkSize"] = 4] = "ChunkSize";
|
|
58
|
+
})(MessageByteLength || (MessageByteLength = {}));
|
|
59
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/common/enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,iDAAM,CAAA;AACR,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B;AAED,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,wDAAQ,CAAA;IACR,kEAAa,CAAA;IACb,gEAAY,CAAA;IAEZ,kFAAqB,CAAA;IACrB,gFAAoB,CAAA;IACpB,oFAAsB,CAAA;IAEtB,oFAAsB,CAAA;IACtB,kFAAqB,CAAA;AACvB,CAAC,EAXW,iBAAiB,K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B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ProtocolBlobMetadata } from './blob.ts';
|
|
2
|
+
type Stream = any;
|
|
3
|
+
export interface BaseProtocolError {
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
data?: any;
|
|
7
|
+
}
|
|
8
|
+
export type ProtocolRPCPayload = unknown;
|
|
9
|
+
export type ProtocolRPCResponse = unknown;
|
|
10
|
+
export type EncodeRPCStreams = Record<number, ProtocolBlobMetadata>;
|
|
11
|
+
export interface DecodeRPCContext<T = Stream> {
|
|
12
|
+
addStream: (id: number, metadata: ProtocolBlobMetadata) => T;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAU,EACE,EAAE;IACd,OAAO,CACL,KAAK;QACL,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;QAC1D,QAAQ,IAAI,KAAK,CAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Pattern } from '@nmtjs/common';
|
|
2
|
+
import type { DecodeRPCContext, EncodeRPCStreams, ProtocolRPCPayload } from '../common/types.ts';
|
|
3
|
+
import type { ProtocolClientStream } from './stream.ts';
|
|
4
|
+
export interface BaseServerDecoder {
|
|
5
|
+
accept: Pattern[];
|
|
6
|
+
decode(buffer: ArrayBufferView): unknown;
|
|
7
|
+
decodeRPC(buffer: ArrayBufferView, context: DecodeRPCContext<() => ProtocolClientStream>): ProtocolRPCPayload;
|
|
8
|
+
}
|
|
9
|
+
export interface BaseServerEncoder {
|
|
10
|
+
contentType: string;
|
|
11
|
+
encode(data: unknown): ArrayBufferView;
|
|
12
|
+
encodeRPC(data: unknown, streams: EncodeRPCStreams): ArrayBufferView;
|
|
13
|
+
encodeBlob(streamId: number): unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare abstract class BaseServerFormat implements BaseServerDecoder, BaseServerEncoder {
|
|
16
|
+
abstract accept: Pattern[];
|
|
17
|
+
abstract contentType: string;
|
|
18
|
+
abstract encode(data: unknown): ArrayBufferView;
|
|
19
|
+
abstract encodeRPC(data: unknown, streams: EncodeRPCStreams): ArrayBufferView;
|
|
20
|
+
abstract encodeBlob(streamId: number): unknown;
|
|
21
|
+
abstract decode(buffer: ArrayBufferView): any;
|
|
22
|
+
abstract decodeRPC(buffer: ArrayBufferView, context: DecodeRPCContext<() => ProtocolClientStream>): ProtocolRPCPayload;
|
|
23
|
+
}
|
|
24
|
+
export declare const parseContentTypes: (types: string) => string[];
|
|
25
|
+
export declare class ProtocolFormats {
|
|
26
|
+
decoders: Map<Pattern, BaseServerDecoder>;
|
|
27
|
+
encoders: Map<Pattern, BaseServerEncoder>;
|
|
28
|
+
constructor(formats: BaseServerFormat[]);
|
|
29
|
+
supportsDecoder(contentType: string, throwIfUnsupported?: boolean): BaseServerDecoder | null;
|
|
30
|
+
supportsEncoder(contentType: string, throwIfUnsupported?: boolean): BaseServerEncoder | null;
|
|
31
|
+
private supports;
|
|
32
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { match } from '@nmtjs/common';
|
|
2
|
+
export class BaseServerFormat {
|
|
3
|
+
}
|
|
4
|
+
export const parseContentTypes = (types) => {
|
|
5
|
+
const normalized = types.trim();
|
|
6
|
+
if (normalized === '*/*')
|
|
7
|
+
return ['*/*'];
|
|
8
|
+
return normalized
|
|
9
|
+
.split(',')
|
|
10
|
+
.map((t) => t.trim())
|
|
11
|
+
.map((t) => {
|
|
12
|
+
const [rawType, ...rest] = t.split(';');
|
|
13
|
+
const params = new Map(rest.map((p) => p
|
|
14
|
+
.trim()
|
|
15
|
+
.split('=')
|
|
16
|
+
.slice(0, 2)
|
|
17
|
+
.map((part) => part.trim())));
|
|
18
|
+
return {
|
|
19
|
+
type: rawType.trim(),
|
|
20
|
+
q: params.has('q') ? Number.parseFloat(params.get('q')) : 1,
|
|
21
|
+
};
|
|
22
|
+
})
|
|
23
|
+
.sort((a, b) => {
|
|
24
|
+
if (a.type === '*/*')
|
|
25
|
+
return 1;
|
|
26
|
+
if (b.type === '*/*')
|
|
27
|
+
return -1;
|
|
28
|
+
return b.q - a.q;
|
|
29
|
+
})
|
|
30
|
+
.map((t) => t.type);
|
|
31
|
+
};
|
|
32
|
+
export class ProtocolFormats {
|
|
33
|
+
decoders = new Map();
|
|
34
|
+
encoders = new Map();
|
|
35
|
+
constructor(formats) {
|
|
36
|
+
for (const format of formats) {
|
|
37
|
+
this.encoders.set(format.contentType, format);
|
|
38
|
+
for (const acceptType of format.accept) {
|
|
39
|
+
this.decoders.set(acceptType, format);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
supportsDecoder(contentType, throwIfUnsupported = false) {
|
|
44
|
+
return this.supports(this.decoders, contentType, throwIfUnsupported);
|
|
45
|
+
}
|
|
46
|
+
supportsEncoder(contentType, throwIfUnsupported = false) {
|
|
47
|
+
return this.supports(this.encoders, contentType, throwIfUnsupported);
|
|
48
|
+
}
|
|
49
|
+
supports(formats, contentType, throwIfUnsupported = false) {
|
|
50
|
+
// TODO: Use node:utils.MIMEType (not implemented yet in Deno and Bun yet)
|
|
51
|
+
const types = parseContentTypes(contentType);
|
|
52
|
+
for (const type of types) {
|
|
53
|
+
for (const [pattern, format] of formats) {
|
|
54
|
+
if (type === '*/*' || match(type, pattern))
|
|
55
|
+
return format;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (throwIfUnsupported)
|
|
59
|
+
throw new Error(`No supported format found: ${contentType}`);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/server/format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAyBrC,MAAM,OAAgB,gBAAgB;CAcrC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC/B,IAAI,UAAU,KAAK,KAAK;QAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACxC,OAAO,UAAU;SACd,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACvC,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,CAAC;aACE,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,CAAC;aACV,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CACR,CACxB,CAAA;QACD,OAAO;YACL,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;YACpB,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,C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,KAAK;QAE1B,0EAA0E;QAC1E,MAAM,KAAK,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAA;QAE5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;gBACxC,IAAI,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;oBAAE,OAAO,MAAM,CAAA;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,kBAAkB;YACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,WAAW,EAAE,CAAC,CAAA;QAE9D,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './format.ts';
|
|
2
|
+
export * from './protocol.ts';
|
|
3
|
+
export * from './stream.ts';
|
|
4
|
+
export * from './types.ts';
|
|
5
|
+
export * from './utils.ts';
|
|
6
|
+
import { ProtocolVersion1 } from './versions/v1.ts';
|
|
7
|
+
export declare const versions: {
|
|
8
|
+
1: ProtocolVersion1;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./format.js";
|
|
2
|
+
export * from "./protocol.js";
|
|
3
|
+
export * from "./stream.js";
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export * from "./utils.js";
|
|
6
|
+
import { ProtocolVersion } from "../common/enums.js";
|
|
7
|
+
import { ProtocolVersion1 } from "./versions/v1.js";
|
|
8
|
+
export const versions = { [ProtocolVersion.v1]: new ProtocolVersion1() };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,IAAI,gBAAgB,EAAE,EAAE,CAAA"}
|