@nats-io/transport-node 3.0.0-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/LICENSE +201 -0
- package/README.md +47 -0
- package/index.js +17 -0
- package/lib/connect.d.ts +2 -0
- package/lib/connect.js +30 -0
- package/lib/connect.js.map +1 -0
- package/lib/mod.d.ts +2 -0
- package/lib/mod.js +35 -0
- package/lib/mod.js.map +1 -0
- package/lib/nats-base-client.d.ts +1 -0
- package/lib/nats-base-client.js +32 -0
- package/lib/nats-base-client.js.map +1 -0
- package/lib/node_transport.d.ts +52 -0
- package/lib/node_transport.js +463 -0
- package/lib/node_transport.js.map +1 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2013-2018 The NATS Authors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# NATS Node Transport - A [NATS](http://nats.io) client for [Node.Js](https://nodejs.org/en/)
|
|
2
|
+
|
|
3
|
+
A Node.js transport for the [NATS messaging system](https://nats.io).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
This module implements a Node.js native TCP transport for NATS. This library
|
|
12
|
+
re-exports [NATS core](../core/README.md) library which implements all basic
|
|
13
|
+
NATS client functionality. This library is compatible with
|
|
14
|
+
[Bun](https://bun.sh/).
|
|
15
|
+
|
|
16
|
+
# Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @nats-io/transport-node
|
|
20
|
+
# or
|
|
21
|
+
bun install @nats-io/transport-node
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
You can then import the `connect` function to connect using the node transport
|
|
25
|
+
like this:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { connect } from "@nats-io/transport-node";
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To use [NATS JetStream](../jetstream/README.md), [NATS KV](../kv/README.md),
|
|
32
|
+
[NATS Object Store](../obj/README.md), or the
|
|
33
|
+
[NATS Services](../services/README.md) functionality you'll need to install the
|
|
34
|
+
desired modules as described in each of the modules README files.
|
|
35
|
+
|
|
36
|
+
This module simply exports a
|
|
37
|
+
[`connect()` function](../core/README.md#connecting-to-a-nats-server) that
|
|
38
|
+
returns a `NatsConnection` supported by a Nodejs TCP socket. This library
|
|
39
|
+
re-exports all the public APIs for the [core](../core/README.md) module. Please
|
|
40
|
+
visit the core module for examples on how to use a connection or refer to the
|
|
41
|
+
[JSDoc documentation](https://nats-io.github.io/nats.deno).
|
|
42
|
+
|
|
43
|
+
## Supported Node Versions
|
|
44
|
+
|
|
45
|
+
Our support policy for Nodejs versions follows
|
|
46
|
+
[Nodejs release support](https://github.com/nodejs/Release). We will support and
|
|
47
|
+
build node-nats on even-numbered Nodejs versions that are current or in LTS.
|
package/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2013-2020 The NATS Authors
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
"use strict";
|
|
16
|
+
|
|
17
|
+
module.exports = require("./lib/mod");
|
package/lib/connect.d.ts
ADDED
package/lib/connect.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connect = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020-2024 The NATS Authors
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const node_transport_1 = require("./node_transport");
|
|
19
|
+
const nats_base_client_1 = require("./nats-base-client");
|
|
20
|
+
function connect(opts = {}) {
|
|
21
|
+
(0, nats_base_client_1.setTransportFactory)({
|
|
22
|
+
factory: () => {
|
|
23
|
+
return new node_transport_1.NodeTransport();
|
|
24
|
+
},
|
|
25
|
+
dnsResolveFn: node_transport_1.nodeResolveHost,
|
|
26
|
+
});
|
|
27
|
+
return nats_base_client_1.NatsConnectionImpl.connect(opts);
|
|
28
|
+
}
|
|
29
|
+
exports.connect = connect;
|
|
30
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,qDAAkE;AAClE,yDAO4B;AAE5B,SAAgB,OAAO,CAAC,OAA0B,EAAE;IAClD,IAAA,sCAAmB,EAAC;QAClB,OAAO,EAAE,GAAc,EAAE;YACvB,OAAO,IAAI,8BAAa,EAAE,CAAC;QAC7B,CAAC;QACD,YAAY,EAAE,gCAAe;KACV,CAAC,CAAC;IACvB,OAAO,qCAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AARD,0BAQC"}
|
package/lib/mod.d.ts
ADDED
package/lib/mod.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.connect = void 0;
|
|
18
|
+
/*
|
|
19
|
+
* Copyright 2020-2024 The NATS Authors
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
* you may not use this file except in compliance with the License.
|
|
22
|
+
* You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
* See the License for the specific language governing permissions and
|
|
30
|
+
* limitations under the License.
|
|
31
|
+
*/
|
|
32
|
+
var connect_1 = require("./connect");
|
|
33
|
+
Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connect_1.connect; } });
|
|
34
|
+
__exportStar(require("./nats-base-client"), exports);
|
|
35
|
+
//# sourceMappingURL=mod.js.map
|
package/lib/mod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,qDAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@nats-io/nats-core/internal";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*
|
|
18
|
+
* Copyright 2020-2024 The NATS Authors
|
|
19
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License.
|
|
21
|
+
* You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
__exportStar(require("@nats-io/nats-core/internal"), exports);
|
|
32
|
+
//# sourceMappingURL=nats-base-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nats-base-client.js","sourceRoot":"","sources":["../src/nats-base-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,8DAA4C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { Deferred, ServerInfo, Transport } from "./nats-base-client";
|
|
5
|
+
import type { ConnectionOptions } from "./nats-base-client";
|
|
6
|
+
import { Socket } from "net";
|
|
7
|
+
import { TlsOptions, TLSSocket } from "tls";
|
|
8
|
+
export declare const VERSION: any;
|
|
9
|
+
export declare class NodeTransport implements Transport {
|
|
10
|
+
socket: Socket;
|
|
11
|
+
version: string;
|
|
12
|
+
lang: string;
|
|
13
|
+
yields: Uint8Array[];
|
|
14
|
+
signal: Deferred<void>;
|
|
15
|
+
closedNotification: Deferred<void | Error>;
|
|
16
|
+
options: ConnectionOptions;
|
|
17
|
+
connected: boolean;
|
|
18
|
+
tlsName: string;
|
|
19
|
+
done: boolean;
|
|
20
|
+
closeError?: Error;
|
|
21
|
+
constructor();
|
|
22
|
+
connect(hp: {
|
|
23
|
+
hostname: string;
|
|
24
|
+
port: number;
|
|
25
|
+
tlsName: string;
|
|
26
|
+
}, options: ConnectionOptions): Promise<void>;
|
|
27
|
+
dial(hp: {
|
|
28
|
+
hostname: string;
|
|
29
|
+
port: number;
|
|
30
|
+
}): Promise<Socket>;
|
|
31
|
+
get isClosed(): boolean;
|
|
32
|
+
close(err?: Error): Promise<void>;
|
|
33
|
+
peekInfo(): Promise<ServerInfo>;
|
|
34
|
+
loadFile(fn: string): Promise<Buffer | void>;
|
|
35
|
+
loadClientCerts(): Promise<TlsOptions | void>;
|
|
36
|
+
tlsFirst(hp: {
|
|
37
|
+
hostname: string;
|
|
38
|
+
port: number;
|
|
39
|
+
}): Promise<TLSSocket>;
|
|
40
|
+
startTLS(): Promise<TLSSocket>;
|
|
41
|
+
setupHandlers(): void;
|
|
42
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Uint8Array>;
|
|
43
|
+
iterate(): AsyncIterableIterator<Uint8Array>;
|
|
44
|
+
discard(): void;
|
|
45
|
+
disconnect(): void;
|
|
46
|
+
isEncrypted(): boolean;
|
|
47
|
+
_send(frame: Uint8Array): Promise<void>;
|
|
48
|
+
send(frame: Uint8Array): void;
|
|
49
|
+
private _closed;
|
|
50
|
+
closed(): Promise<void | Error>;
|
|
51
|
+
}
|
|
52
|
+
export declare function nodeResolveHost(s: string): Promise<string[]>;
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeResolveHost = exports.NodeTransport = exports.VERSION = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020-2024 The NATS Authors
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const nats_base_client_1 = require("./nats-base-client");
|
|
19
|
+
const net_1 = require("net");
|
|
20
|
+
const tls_1 = require("tls");
|
|
21
|
+
const { resolve } = require("path");
|
|
22
|
+
const { readFile, existsSync } = require("fs");
|
|
23
|
+
const dns = require("dns");
|
|
24
|
+
const { version } = require("./version");
|
|
25
|
+
exports.VERSION = version;
|
|
26
|
+
const LANG = "nats.js";
|
|
27
|
+
class NodeTransport {
|
|
28
|
+
socket;
|
|
29
|
+
version;
|
|
30
|
+
lang;
|
|
31
|
+
yields = [];
|
|
32
|
+
signal = (0, nats_base_client_1.deferred)();
|
|
33
|
+
closedNotification = (0, nats_base_client_1.deferred)();
|
|
34
|
+
options;
|
|
35
|
+
connected = false;
|
|
36
|
+
tlsName = "";
|
|
37
|
+
done = false;
|
|
38
|
+
closeError;
|
|
39
|
+
constructor() {
|
|
40
|
+
this.lang = LANG;
|
|
41
|
+
this.version = exports.VERSION;
|
|
42
|
+
}
|
|
43
|
+
async connect(hp, options) {
|
|
44
|
+
this.tlsName = hp.tlsName;
|
|
45
|
+
this.options = options;
|
|
46
|
+
const { tls } = this.options;
|
|
47
|
+
const { handshakeFirst } = tls || {};
|
|
48
|
+
try {
|
|
49
|
+
if (handshakeFirst === true) {
|
|
50
|
+
this.socket = await this.tlsFirst(hp);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.socket = await this.dial(hp);
|
|
54
|
+
}
|
|
55
|
+
const info = await this.peekInfo();
|
|
56
|
+
(0, nats_base_client_1.checkOptions)(info, options);
|
|
57
|
+
const { tls_required: tlsRequired, tls_available: tlsAvailable } = info;
|
|
58
|
+
const desired = tlsAvailable === true && options.tls !== null;
|
|
59
|
+
if (!handshakeFirst && (tlsRequired || desired)) {
|
|
60
|
+
this.socket = await this.startTLS();
|
|
61
|
+
}
|
|
62
|
+
//@ts-ignore: this is possibly a TlsSocket
|
|
63
|
+
if (tlsRequired && this.socket.encrypted !== true) {
|
|
64
|
+
throw new nats_base_client_1.NatsError("tls", nats_base_client_1.ErrorCode.ServerOptionNotAvailable);
|
|
65
|
+
}
|
|
66
|
+
this.connected = true;
|
|
67
|
+
this.setupHandlers();
|
|
68
|
+
this.signal.resolve();
|
|
69
|
+
return Promise.resolve();
|
|
70
|
+
}
|
|
71
|
+
catch (ex) {
|
|
72
|
+
let err = ex;
|
|
73
|
+
if (!err) {
|
|
74
|
+
// this seems to be possible in Kubernetes
|
|
75
|
+
// where an error is thrown, but it is undefined
|
|
76
|
+
// when something like istio-init is booting up
|
|
77
|
+
err = nats_base_client_1.NatsError.errorForCode(nats_base_client_1.ErrorCode.ConnectionRefused, new Error("node provided an undefined error!"));
|
|
78
|
+
}
|
|
79
|
+
const { code } = err;
|
|
80
|
+
const perr = code === "ECONNREFUSED"
|
|
81
|
+
? nats_base_client_1.NatsError.errorForCode(nats_base_client_1.ErrorCode.ConnectionRefused, err)
|
|
82
|
+
: err;
|
|
83
|
+
if (this.socket) {
|
|
84
|
+
this.socket.destroy();
|
|
85
|
+
}
|
|
86
|
+
throw perr;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
dial(hp) {
|
|
90
|
+
const d = (0, nats_base_client_1.deferred)();
|
|
91
|
+
let dialError;
|
|
92
|
+
const socket = (0, net_1.createConnection)(hp.port, hp.hostname, () => {
|
|
93
|
+
d.resolve(socket);
|
|
94
|
+
socket.removeAllListeners();
|
|
95
|
+
});
|
|
96
|
+
socket.on("error", (err) => {
|
|
97
|
+
dialError = err;
|
|
98
|
+
});
|
|
99
|
+
socket.on("close", () => {
|
|
100
|
+
socket.removeAllListeners();
|
|
101
|
+
d.reject(dialError);
|
|
102
|
+
});
|
|
103
|
+
socket.setNoDelay(true);
|
|
104
|
+
return d;
|
|
105
|
+
}
|
|
106
|
+
get isClosed() {
|
|
107
|
+
return this.done;
|
|
108
|
+
}
|
|
109
|
+
close(err) {
|
|
110
|
+
return this._closed(err, false);
|
|
111
|
+
}
|
|
112
|
+
peekInfo() {
|
|
113
|
+
const d = (0, nats_base_client_1.deferred)();
|
|
114
|
+
let peekError;
|
|
115
|
+
this.socket.on("data", (frame) => {
|
|
116
|
+
this.yields.push(frame);
|
|
117
|
+
const t = nats_base_client_1.DataBuffer.concat(...this.yields);
|
|
118
|
+
const pm = (0, nats_base_client_1.extractProtocolMessage)(t);
|
|
119
|
+
if (pm !== "") {
|
|
120
|
+
try {
|
|
121
|
+
const m = nats_base_client_1.INFO.exec(pm);
|
|
122
|
+
if (!m) {
|
|
123
|
+
throw new Error("unexpected response from server");
|
|
124
|
+
}
|
|
125
|
+
const info = JSON.parse(m[1]);
|
|
126
|
+
d.resolve(info);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
d.reject(err);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
this.socket.removeAllListeners();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
this.socket.on("error", (err) => {
|
|
137
|
+
peekError = err;
|
|
138
|
+
});
|
|
139
|
+
this.socket.on("close", () => {
|
|
140
|
+
this.socket.removeAllListeners();
|
|
141
|
+
d.reject(peekError);
|
|
142
|
+
});
|
|
143
|
+
return d;
|
|
144
|
+
}
|
|
145
|
+
loadFile(fn) {
|
|
146
|
+
if (!fn) {
|
|
147
|
+
return Promise.resolve();
|
|
148
|
+
}
|
|
149
|
+
const d = (0, nats_base_client_1.deferred)();
|
|
150
|
+
try {
|
|
151
|
+
fn = resolve(fn);
|
|
152
|
+
if (!existsSync(fn)) {
|
|
153
|
+
d.reject(new Error(`${fn} doesn't exist`));
|
|
154
|
+
}
|
|
155
|
+
readFile(fn, (err, data) => {
|
|
156
|
+
if (err) {
|
|
157
|
+
return d.reject(err);
|
|
158
|
+
}
|
|
159
|
+
d.resolve(data);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
d.reject(err);
|
|
164
|
+
}
|
|
165
|
+
return d;
|
|
166
|
+
}
|
|
167
|
+
async loadClientCerts() {
|
|
168
|
+
const tlsOpts = {};
|
|
169
|
+
const { certFile, cert, caFile, ca, keyFile, key } = this.options.tls;
|
|
170
|
+
try {
|
|
171
|
+
if (certFile) {
|
|
172
|
+
const data = await this.loadFile(certFile);
|
|
173
|
+
if (data) {
|
|
174
|
+
tlsOpts.cert = data;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else if (cert) {
|
|
178
|
+
tlsOpts.cert = cert;
|
|
179
|
+
}
|
|
180
|
+
if (keyFile) {
|
|
181
|
+
const data = await this.loadFile(keyFile);
|
|
182
|
+
if (data) {
|
|
183
|
+
tlsOpts.key = data;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else if (key) {
|
|
187
|
+
tlsOpts.key = key;
|
|
188
|
+
}
|
|
189
|
+
if (caFile) {
|
|
190
|
+
const data = await this.loadFile(caFile);
|
|
191
|
+
if (data) {
|
|
192
|
+
tlsOpts.ca = [data];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (ca) {
|
|
196
|
+
tlsOpts.ca = ca;
|
|
197
|
+
}
|
|
198
|
+
return Promise.resolve(tlsOpts);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
return Promise.reject(err);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async tlsFirst(hp) {
|
|
205
|
+
let tlsError;
|
|
206
|
+
let tlsOpts = {
|
|
207
|
+
servername: this.tlsName,
|
|
208
|
+
rejectUnauthorized: true,
|
|
209
|
+
};
|
|
210
|
+
if (this.socket) {
|
|
211
|
+
tlsOpts.socket = this.socket;
|
|
212
|
+
}
|
|
213
|
+
if (typeof this.options.tls === "object") {
|
|
214
|
+
try {
|
|
215
|
+
const certOpts = await this.loadClientCerts() || {};
|
|
216
|
+
tlsOpts = (0, nats_base_client_1.extend)(tlsOpts, this.options.tls, certOpts);
|
|
217
|
+
}
|
|
218
|
+
catch (err) {
|
|
219
|
+
return Promise.reject(new nats_base_client_1.NatsError(err.message, nats_base_client_1.ErrorCode.Tls, err));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const d = (0, nats_base_client_1.deferred)();
|
|
223
|
+
try {
|
|
224
|
+
const tlsSocket = (0, tls_1.connect)(hp.port, hp.hostname, tlsOpts, () => {
|
|
225
|
+
tlsSocket.removeAllListeners();
|
|
226
|
+
d.resolve(tlsSocket);
|
|
227
|
+
});
|
|
228
|
+
tlsSocket.on("error", (err) => {
|
|
229
|
+
tlsError = err;
|
|
230
|
+
});
|
|
231
|
+
tlsSocket.on("secureConnect", () => {
|
|
232
|
+
// socket won't be authorized, if the user disabled it
|
|
233
|
+
if (tlsOpts.rejectUnauthorized === false) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (!tlsSocket.authorized) {
|
|
237
|
+
throw tlsSocket.authorizationError;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
tlsSocket.on("close", () => {
|
|
241
|
+
d.reject(tlsError);
|
|
242
|
+
tlsSocket.removeAllListeners();
|
|
243
|
+
});
|
|
244
|
+
tlsSocket.setNoDelay(true);
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
// tls throws errors on bad certs see nats.js#310
|
|
248
|
+
d.reject(nats_base_client_1.NatsError.errorForCode(nats_base_client_1.ErrorCode.Tls, err));
|
|
249
|
+
}
|
|
250
|
+
return d;
|
|
251
|
+
}
|
|
252
|
+
async startTLS() {
|
|
253
|
+
let tlsError;
|
|
254
|
+
let tlsOpts = {
|
|
255
|
+
socket: this.socket,
|
|
256
|
+
servername: this.tlsName,
|
|
257
|
+
rejectUnauthorized: true,
|
|
258
|
+
};
|
|
259
|
+
if (typeof this.options.tls === "object") {
|
|
260
|
+
try {
|
|
261
|
+
const certOpts = await this.loadClientCerts() || {};
|
|
262
|
+
tlsOpts = (0, nats_base_client_1.extend)(tlsOpts, this.options.tls, certOpts);
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
return Promise.reject(new nats_base_client_1.NatsError(err.message, nats_base_client_1.ErrorCode.Tls, err));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const d = (0, nats_base_client_1.deferred)();
|
|
269
|
+
try {
|
|
270
|
+
const tlsSocket = (0, tls_1.connect)(tlsOpts, () => {
|
|
271
|
+
tlsSocket.removeAllListeners();
|
|
272
|
+
d.resolve(tlsSocket);
|
|
273
|
+
});
|
|
274
|
+
tlsSocket.on("error", (err) => {
|
|
275
|
+
tlsError = err;
|
|
276
|
+
});
|
|
277
|
+
tlsSocket.on("secureConnect", () => {
|
|
278
|
+
// socket won't be authorized, if the user disabled it
|
|
279
|
+
if (tlsOpts.rejectUnauthorized === false) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!tlsSocket.authorized) {
|
|
283
|
+
throw tlsSocket.authorizationError;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
tlsSocket.on("close", () => {
|
|
287
|
+
d.reject(tlsError);
|
|
288
|
+
tlsSocket.removeAllListeners();
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
// tls throws errors on bad certs see nats.js#310
|
|
293
|
+
d.reject(nats_base_client_1.NatsError.errorForCode(nats_base_client_1.ErrorCode.Tls, err));
|
|
294
|
+
}
|
|
295
|
+
return d;
|
|
296
|
+
}
|
|
297
|
+
setupHandlers() {
|
|
298
|
+
let connError;
|
|
299
|
+
this.socket.on("data", (frame) => {
|
|
300
|
+
this.yields.push(frame);
|
|
301
|
+
return this.signal.resolve();
|
|
302
|
+
});
|
|
303
|
+
this.socket.on("error", (err) => {
|
|
304
|
+
connError = err;
|
|
305
|
+
});
|
|
306
|
+
this.socket.on("end", () => {
|
|
307
|
+
if (this.socket?.destroyed) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
this.socket?.write(new Uint8Array(0), () => {
|
|
311
|
+
this.socket?.end();
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
this.socket.on("close", () => {
|
|
315
|
+
this._closed(connError, false);
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
[Symbol.asyncIterator]() {
|
|
319
|
+
return this.iterate();
|
|
320
|
+
}
|
|
321
|
+
async *iterate() {
|
|
322
|
+
const debug = this.options.debug;
|
|
323
|
+
while (true) {
|
|
324
|
+
if (this.yields.length === 0) {
|
|
325
|
+
await this.signal;
|
|
326
|
+
}
|
|
327
|
+
const yields = this.yields;
|
|
328
|
+
this.yields = [];
|
|
329
|
+
for (let i = 0; i < yields.length; i++) {
|
|
330
|
+
if (debug) {
|
|
331
|
+
console.info(`> ${(0, nats_base_client_1.render)(yields[i])}`);
|
|
332
|
+
}
|
|
333
|
+
yield yields[i];
|
|
334
|
+
}
|
|
335
|
+
// yielding could have paused and microtask
|
|
336
|
+
// could have added messages. Prevent allocations
|
|
337
|
+
// if possible
|
|
338
|
+
if (this.done) {
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
else if (this.yields.length === 0) {
|
|
342
|
+
yields.length = 0;
|
|
343
|
+
this.yields = yields;
|
|
344
|
+
this.signal = (0, nats_base_client_1.deferred)();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
discard() {
|
|
349
|
+
// ignored - this is not required, as there's no throttling
|
|
350
|
+
}
|
|
351
|
+
disconnect() {
|
|
352
|
+
this._closed(undefined, true).then().catch();
|
|
353
|
+
}
|
|
354
|
+
isEncrypted() {
|
|
355
|
+
return this.socket instanceof tls_1.TLSSocket;
|
|
356
|
+
}
|
|
357
|
+
_send(frame) {
|
|
358
|
+
if (this.isClosed || this.socket === undefined) {
|
|
359
|
+
return Promise.resolve();
|
|
360
|
+
}
|
|
361
|
+
if (this.options.debug) {
|
|
362
|
+
console.info(`< ${(0, nats_base_client_1.render)(frame)}`);
|
|
363
|
+
}
|
|
364
|
+
const d = (0, nats_base_client_1.deferred)();
|
|
365
|
+
try {
|
|
366
|
+
this.socket.write(frame, (err) => {
|
|
367
|
+
if (err) {
|
|
368
|
+
if (this.options.debug) {
|
|
369
|
+
console.error(`!!! ${(0, nats_base_client_1.render)(frame)}: ${err}`);
|
|
370
|
+
}
|
|
371
|
+
return d.reject(err);
|
|
372
|
+
}
|
|
373
|
+
return d.resolve();
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
catch (err) {
|
|
377
|
+
if (this.options.debug) {
|
|
378
|
+
console.error(`!!! ${(0, nats_base_client_1.render)(frame)}: ${err}`);
|
|
379
|
+
}
|
|
380
|
+
d.reject(err);
|
|
381
|
+
}
|
|
382
|
+
return d;
|
|
383
|
+
}
|
|
384
|
+
send(frame) {
|
|
385
|
+
const p = this._send(frame);
|
|
386
|
+
p.catch((_err) => {
|
|
387
|
+
// we ignore write errors because client will
|
|
388
|
+
// fail on a read or when the heartbeat timer
|
|
389
|
+
// detects a stale connection
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
async _closed(err, internal = true) {
|
|
393
|
+
// if this connection didn't succeed, then ignore it.
|
|
394
|
+
if (!this.connected)
|
|
395
|
+
return;
|
|
396
|
+
if (this.done)
|
|
397
|
+
return;
|
|
398
|
+
this.closeError = err;
|
|
399
|
+
// only try to flush the outbound buffer if we got no error and
|
|
400
|
+
// the close is internal, if the transport closed, we are done.
|
|
401
|
+
if (!err && this.socket && internal) {
|
|
402
|
+
try {
|
|
403
|
+
await this._send(new TextEncoder().encode(""));
|
|
404
|
+
}
|
|
405
|
+
catch (err) {
|
|
406
|
+
if (this.options.debug) {
|
|
407
|
+
console.log("transport close terminated with an error", err);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
if (this.socket) {
|
|
413
|
+
this.socket.removeAllListeners();
|
|
414
|
+
this.socket.destroy();
|
|
415
|
+
this.socket = undefined;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
catch (err) {
|
|
419
|
+
console.log(err);
|
|
420
|
+
}
|
|
421
|
+
this.done = true;
|
|
422
|
+
this.closedNotification.resolve(this.closeError);
|
|
423
|
+
}
|
|
424
|
+
closed() {
|
|
425
|
+
return this.closedNotification;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
exports.NodeTransport = NodeTransport;
|
|
429
|
+
async function nodeResolveHost(s) {
|
|
430
|
+
const a = (0, nats_base_client_1.deferred)();
|
|
431
|
+
const aaaa = (0, nats_base_client_1.deferred)();
|
|
432
|
+
dns.resolve4(s, (err, records) => {
|
|
433
|
+
if (err) {
|
|
434
|
+
a.resolve(err);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
a.resolve(records);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
dns.resolve6(s, (err, records) => {
|
|
441
|
+
if (err) {
|
|
442
|
+
aaaa.resolve(err);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
aaaa.resolve(records);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
const ips = [];
|
|
449
|
+
const da = await a;
|
|
450
|
+
if (Array.isArray(da)) {
|
|
451
|
+
ips.push(...da);
|
|
452
|
+
}
|
|
453
|
+
const daaaa = await aaaa;
|
|
454
|
+
if (Array.isArray(daaaa)) {
|
|
455
|
+
ips.push(...daaaa);
|
|
456
|
+
}
|
|
457
|
+
if (ips.length === 0) {
|
|
458
|
+
ips.push(s);
|
|
459
|
+
}
|
|
460
|
+
return ips;
|
|
461
|
+
}
|
|
462
|
+
exports.nodeResolveHost = nodeResolveHost;
|
|
463
|
+
//# sourceMappingURL=node_transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_transport.js","sourceRoot":"","sources":["../src/node_transport.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,yDAa4B;AAG5B,6BAA+C;AAC/C,6BAAmE;AACnE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACpC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3B,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAC5B,QAAA,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,IAAI,GAAG,SAAS,CAAC;AAEvB,MAAa,aAAa;IACxB,MAAM,CAAU;IAChB,OAAO,CAAS;IAChB,IAAI,CAAS;IACb,MAAM,GAAiB,EAAE,CAAC;IAC1B,MAAM,GAAmB,IAAA,2BAAQ,GAAQ,CAAC;IAC1C,kBAAkB,GAA2B,IAAA,2BAAQ,GAAE,CAAC;IACxD,OAAO,CAAqB;IAC5B,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,GAAG,EAAE,CAAC;IACb,IAAI,GAAG,KAAK,CAAC;IACb,UAAU,CAAS;IAEnB;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,eAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,OAAO,CACX,EAAuD,EACvD,OAA0B;QAE1B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,EAAE,cAAc,EAAE,GAAG,GAAG,IAA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ACnB,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC;IACzB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAjCD,0CAiCC"}
|
package/lib/version.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version = "3.0.0-10";
|
package/lib/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAC1B,QAAA,OAAO,GAAG,UAAU,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nats-io/transport-node",
|
|
3
|
+
"version": "3.0.0-10",
|
|
4
|
+
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nats",
|
|
7
|
+
"messaging",
|
|
8
|
+
"pubsub",
|
|
9
|
+
"publish",
|
|
10
|
+
"subscribe",
|
|
11
|
+
"queue",
|
|
12
|
+
"distributed",
|
|
13
|
+
"queueing"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://nats.io",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/nats-io/nats.js/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/nats-io/nats.js"
|
|
23
|
+
},
|
|
24
|
+
"private": false,
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "The NATS Authors"
|
|
27
|
+
},
|
|
28
|
+
"contributors": [],
|
|
29
|
+
"main": "index.js",
|
|
30
|
+
"types": "lib/mod.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"lib/",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"real-clean": "npm run clean && shx rm -Rf ./node_modules",
|
|
39
|
+
"clean": "shx rm -Rf ./lib/*",
|
|
40
|
+
"fmt": "deno fmt src/ examples/ test/ ",
|
|
41
|
+
"prepack": "npm run check-package && npm run build",
|
|
42
|
+
"test": "npm run check-package && npm run build && NODE_EXTRA_CA_CERTS=test/certs/ca.pem; node --test",
|
|
43
|
+
"debug-test": "node ../node_modules/.bin/ava --verbose -T 6500000 --match",
|
|
44
|
+
"setup": "curl -fsSL https://deno.land/x/install/install.sh | sh",
|
|
45
|
+
"setup_win": "choco install deno",
|
|
46
|
+
"cover:html": "/nyc report --reporter=html && open coverage/index.html",
|
|
47
|
+
"coveralls": "shx mkdir -p ./coverage && nyc report --reporter=text-lcov > ./coverage/lcov.info",
|
|
48
|
+
"check-package": "cd .. && deno run --allow-all bin/check-bundle-version.ts --module transport-node",
|
|
49
|
+
"postversion": "git push && git push --tags",
|
|
50
|
+
"bump-qualifier": "npm version prerelease --no-commit-hooks --no-git-tag-version",
|
|
51
|
+
"bump-release": "npm version patch --no-commit-hooks --no-git-tag-version"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">= 18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@nats-io/nats-core": "~3.0.0-23",
|
|
58
|
+
"@nats-io/nkeys": "^1.2.0-4",
|
|
59
|
+
"@nats-io/nuid": "^2.0.1-2"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^20.12.12",
|
|
63
|
+
"minimist": "^1.2.8",
|
|
64
|
+
"nats-jwt": "^0.0.9",
|
|
65
|
+
"shx": "^0.3.3",
|
|
66
|
+
"typescript": "5.4.5",
|
|
67
|
+
"@nats-io/jetstream": "^3.0.0-3",
|
|
68
|
+
"@nats-io/kv": "^3.0.0-2",
|
|
69
|
+
"@nats-io/obj": "^3.0.0-1"
|
|
70
|
+
}
|
|
71
|
+
}
|