1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | exports.ChannelImplementation = void 0;
|
20 | const channel_credentials_1 = require("./channel-credentials");
|
21 | const internal_channel_1 = require("./internal-channel");
|
22 | class ChannelImplementation {
|
23 | constructor(target, credentials, options) {
|
24 | if (typeof target !== 'string') {
|
25 | throw new TypeError('Channel target must be a string');
|
26 | }
|
27 | if (!(credentials instanceof channel_credentials_1.ChannelCredentials)) {
|
28 | throw new TypeError('Channel credentials must be a ChannelCredentials object');
|
29 | }
|
30 | if (options) {
|
31 | if (typeof options !== 'object') {
|
32 | throw new TypeError('Channel options must be an object');
|
33 | }
|
34 | }
|
35 | this.internalChannel = new internal_channel_1.InternalChannel(target, credentials, options);
|
36 | }
|
37 | close() {
|
38 | this.internalChannel.close();
|
39 | }
|
40 | getTarget() {
|
41 | return this.internalChannel.getTarget();
|
42 | }
|
43 | getConnectivityState(tryToConnect) {
|
44 | return this.internalChannel.getConnectivityState(tryToConnect);
|
45 | }
|
46 | watchConnectivityState(currentState, deadline, callback) {
|
47 | this.internalChannel.watchConnectivityState(currentState, deadline, callback);
|
48 | }
|
49 | |
50 |
|
51 |
|
52 |
|
53 |
|
54 | getChannelzRef() {
|
55 | return this.internalChannel.getChannelzRef();
|
56 | }
|
57 | createCall(method, deadline, host, parentCall, propagateFlags) {
|
58 | if (typeof method !== 'string') {
|
59 | throw new TypeError('Channel#createCall: method must be a string');
|
60 | }
|
61 | if (!(typeof deadline === 'number' || deadline instanceof Date)) {
|
62 | throw new TypeError('Channel#createCall: deadline must be a number or Date');
|
63 | }
|
64 | return this.internalChannel.createCall(method, deadline, host, parentCall, propagateFlags);
|
65 | }
|
66 | }
|
67 | exports.ChannelImplementation = ChannelImplementation;
|
68 |
|
\ | No newline at end of file |