pulsar-client 1.8.1-rc.1 → 1.8.1-rc.2

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/GenCertFile.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. 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,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ const Client = require('./src/Client.js');
21
+
22
+ Client.genCertFile();
@@ -112,7 +112,7 @@ where` <key fingerprint>` should be replaced with the private key fingerprint fo
112
112
  $ svn co https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node pulsar-dist-dev
113
113
  $ cd pulsar-dist-dev
114
114
 
115
- # '-candidate-1' needs to be incremented in case of multiple iterations in getting
115
+ # '-rc.1' needs to be incremented in case of multiple iterations in getting
116
116
  # to the final release)
117
117
  $ svn mkdir pulsar-client-node-1.X.0-rc.1
118
118
  $ cd pulsar-client-node-1.X.0-rc.1
@@ -139,13 +139,23 @@ and create a Pull Request on GitHub.
139
139
 
140
140
  #### 6. Publish the release candidate to the npm
141
141
 
142
- Set the npm version for the release candidate
142
+ If you don't have permission to publish `pulsar-client` to the npm registry, ask other committers to grant that permission.
143
+
143
144
  ```sh
144
- npm version 1.8.0-rc.1 --no-git-tag-version
145
- ```
145
+ # Set the npm version for the release candidate
146
+ npm version 1.x.0-rc.1 --no-git-tag-version
147
+
148
+ # Create or verify a user account in the npm registry
149
+ $ npm adduser
150
+
151
+ Username: foobar
152
+ Password: ********
153
+ Email: (this IS public) foobar@apache.org
146
154
 
147
- You can use `npm pack` and test the package before publishing.
148
- If there are no problems, then use `npm publish` to publish to the npm.
155
+ # Publish the rc version package to the npm registry
156
+ # We use the `rc` tag to distinguish the release candidate from the official release.
157
+ $ npm publish --tag rc
158
+ ```
149
159
 
150
160
  #### 7. Run the vote
151
161
 
@@ -179,7 +189,7 @@ Pulsar's KEYS file containing PGP keys we use to sign the release:
179
189
  https://dist.apache.org/repos/dist/dev/pulsar/KEYS
180
190
 
181
191
  SHA-512 checksum:
182
- 5f6c7e1a096a3ae66eee71c552af89532ed86bf94da3f3d49836c080426ee5dcaabeda440a989d51772d2e67e2dca953eeee9ea83cfbc7c2a0847a0ec04b310f pulsar-client-node-1.X.0.tar.gz
192
+ 5f6c7e1a096a3ae66eee71c552af89532ed86bf94da3f3d49836c080426ee5dcaabeda440a989d51772d2e67e2dca953eeee9ea83cfbc7c2a0847a0ec04b310f apache-pulsar-client-node-1.X.0.tar.gz
183
193
 
184
194
  The tag to be voted upon:
185
195
  v1.X.0-rc.1
@@ -208,18 +218,9 @@ $ git push origin v1.X.0
208
218
 
209
219
  Publish the release package:
210
220
  ```sh
211
- # Create or verify a user account in the npm registry
212
- $ npm adduser
213
-
214
- Username: foobar
215
- Password: ********
216
- Email: (this IS public) foobar@apache.org
217
-
218
- # Publish the package to the npm registry
221
+ # You can use `npm pack` and test the package before publishing.
222
+ # If there are no problems, then use `npm publish` to publish to the npm.
219
223
  $ npm publish
220
-
221
- # If you don't have permission to publish `pulsar-client` to the npm registry,
222
- # ask other committers to grant that permission.
223
224
  ```
224
225
 
225
226
  Promote the artifacts on the release location (need PMC permissions):
package/index.js CHANGED
@@ -22,6 +22,7 @@ const AuthenticationTls = require('./src/AuthenticationTls.js');
22
22
  const AuthenticationAthenz = require('./src/AuthenticationAthenz.js');
23
23
  const AuthenticationToken = require('./src/AuthenticationToken.js');
24
24
  const AuthenticationOauth2 = require('./src/AuthenticationOauth2.js');
25
+ const Client = require('./src/Client.js');
25
26
 
26
27
  const LogLevel = {
27
28
  DEBUG: 0,
@@ -32,7 +33,7 @@ const LogLevel = {
32
33
  };
33
34
 
34
35
  const Pulsar = {
35
- Client: PulsarBinding.Client,
36
+ Client,
36
37
  Message: PulsarBinding.Message,
37
38
  MessageId: PulsarBinding.MessageId,
38
39
  AuthenticationTls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulsar-client",
3
- "version": "1.8.1-rc.1",
3
+ "version": "1.8.1-rc.2",
4
4
  "description": "Pulsar Node.js client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "example": "examples"
10
10
  },
11
11
  "scripts": {
12
- "install": "node-pre-gyp install --fallback-to-build",
12
+ "install": "node-pre-gyp install --fallback-to-build && node GenCertFile.js",
13
13
  "configure": "node-pre-gyp configure",
14
14
  "build": "npm run format && node-pre-gyp build",
15
15
  "build:debug": "npm run format && node-pre-gyp rebuild --debug",
package/src/Client.js ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. 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,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ const fs = require('fs');
20
+ const tls = require('tls');
21
+ const os = require('os');
22
+ const PulsarBinding = require('./pulsar-binding');
23
+
24
+ const certsFilePath = `${__dirname}/cert.pem`;
25
+
26
+ class Client {
27
+ constructor(params) {
28
+ if (!params.tlsTrustCertsFilePath) {
29
+ // eslint-disable-next-line no-param-reassign
30
+ params.tlsTrustCertsFilePath = certsFilePath;
31
+ }
32
+ this.client = new PulsarBinding.Client(params);
33
+ }
34
+
35
+ createProducer(params) {
36
+ return this.client.createProducer(params);
37
+ }
38
+
39
+ subscribe(params) {
40
+ return this.client.subscribe(params);
41
+ }
42
+
43
+ createReader(params) {
44
+ return this.client.createReader(params);
45
+ }
46
+
47
+ close() {
48
+ this.client.close();
49
+ }
50
+
51
+ static setLogHandler(params) {
52
+ PulsarBinding.Client.setLogHandler(params);
53
+ }
54
+
55
+ static genCertFile() {
56
+ fs.rmSync(certsFilePath, { force: true });
57
+ const fd = fs.openSync(certsFilePath, 'a');
58
+ try {
59
+ tls.rootCertificates.forEach((cert) => {
60
+ fs.appendFileSync(fd, cert + os.EOL);
61
+ });
62
+ } finally {
63
+ fs.closeSync(fd);
64
+ }
65
+ }
66
+ }
67
+
68
+ module.exports = Client;