@nmtjs/http-client 0.14.1 → 0.14.3
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/index.d.ts +4 -4
- package/dist/index.js +6 -4
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientMessageType } from '@nmtjs/protocol';
|
|
2
|
-
import type { BaseProtocol, ProtocolBaseClientCallOptions, ProtocolBaseTransformer, ProtocolClientCall, ProtocolSendMetadata
|
|
3
|
-
import {
|
|
2
|
+
import type { BaseProtocol, ProtocolBaseClientCallOptions, ProtocolBaseTransformer, ProtocolClientCall, ProtocolSendMetadata } from '@nmtjs/protocol/client';
|
|
3
|
+
import { ProtocolTransport, ProtocolTransportStatus } from '@nmtjs/protocol/client';
|
|
4
4
|
export type HttpClientTransportOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* The origin of the server
|
|
@@ -9,10 +9,10 @@ export type HttpClientTransportOptions = {
|
|
|
9
9
|
origin: string;
|
|
10
10
|
debug?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare class HttpClientTransport extends
|
|
12
|
+
export declare class HttpClientTransport extends ProtocolTransport<HttpClientTransportOptions> {
|
|
13
13
|
#private;
|
|
14
14
|
protected readonly protocol: BaseProtocol;
|
|
15
|
-
|
|
15
|
+
protected readonly options: HttpClientTransportOptions;
|
|
16
16
|
status: ProtocolTransportStatus;
|
|
17
17
|
constructor(protocol: BaseProtocol, options: HttpClientTransportOptions);
|
|
18
18
|
call(procedure: string, payload: any, options: ProtocolBaseClientCallOptions, transformer: ProtocolBaseTransformer): Promise<ProtocolClientCall>;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientError } from '@nmtjs/client';
|
|
2
2
|
import { ErrorCode, ProtocolBlob } from '@nmtjs/protocol';
|
|
3
|
-
import {
|
|
4
|
-
export class HttpClientTransport extends
|
|
3
|
+
import { ProtocolServerBlobStream, ProtocolTransport, ProtocolTransportStatus, } from '@nmtjs/protocol/client';
|
|
4
|
+
export class HttpClientTransport extends ProtocolTransport {
|
|
5
5
|
protocol;
|
|
6
6
|
options;
|
|
7
7
|
#auth = null;
|
|
@@ -25,7 +25,9 @@ export class HttpClientTransport extends EventEmitter {
|
|
|
25
25
|
method: 'POST',
|
|
26
26
|
headers,
|
|
27
27
|
credentials: 'include',
|
|
28
|
-
body: isBlob
|
|
28
|
+
body: isBlob
|
|
29
|
+
? payload.source
|
|
30
|
+
: this.protocol.format.encode(transformer.encodeRPC(procedure, payload)),
|
|
29
31
|
signal: call.signal,
|
|
30
32
|
// @ts-expect-error
|
|
31
33
|
duplex: 'half',
|
|
@@ -37,7 +39,7 @@ export class HttpClientTransport extends EventEmitter {
|
|
|
37
39
|
if (isBlob) {
|
|
38
40
|
const contentLength = response.headers.get('content-length');
|
|
39
41
|
const size = contentLength
|
|
40
|
-
? Number.parseInt(contentLength) || undefined
|
|
42
|
+
? Number.parseInt(contentLength, 10) || undefined
|
|
41
43
|
: undefined;
|
|
42
44
|
const type = response.headers.get('content-type') || 'application/octet-stream';
|
|
43
45
|
const stream = new ProtocolServerBlobStream(-1, { size, type });
|
package/package.json
CHANGED
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@nmtjs/client": "0.14.
|
|
13
|
-
"@nmtjs/protocol": "0.14.
|
|
14
|
-
"@nmtjs/common": "0.14.
|
|
12
|
+
"@nmtjs/client": "0.14.3",
|
|
13
|
+
"@nmtjs/protocol": "0.14.3",
|
|
14
|
+
"@nmtjs/common": "0.14.3"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@nmtjs/client": "0.14.
|
|
18
|
-
"@nmtjs/common": "0.14.
|
|
19
|
-
"@nmtjs/protocol": "0.14.
|
|
17
|
+
"@nmtjs/client": "0.14.3",
|
|
18
|
+
"@nmtjs/common": "0.14.3",
|
|
19
|
+
"@nmtjs/protocol": "0.14.3"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
23
|
"LICENSE.md",
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
|
-
"version": "0.14.
|
|
26
|
+
"version": "0.14.3",
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc",
|
|
29
29
|
"type-check": "tsc --noEmit"
|