pulsar-client 1.7.0 → 1.8.0-rc1

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.
Files changed (55) hide show
  1. package/.asf.yaml +8 -1
  2. package/.github/PULL_REQUEST_TEMPLATE.md +65 -0
  3. package/.github/workflows/ci-build-release-napi.yml +195 -0
  4. package/.github/workflows/ci-pr-validation.yml +225 -0
  5. package/README.md +83 -107
  6. package/binding.gyp +28 -44
  7. package/{pulsar-test-service-stop.sh → build-support/dep-version.py} +4 -6
  8. package/build-support/download-release-artifacts.py +74 -0
  9. package/build-support/generate-source-archive.sh +28 -0
  10. package/build-support/install-cpp-client.sh +66 -0
  11. package/{pulsar-test-service-start.sh → build-support/pulsar-test-container-start.sh} +11 -21
  12. package/build-support/pulsar-test-service-start.sh +37 -0
  13. package/build-support/pulsar-test-service-stop.sh +32 -0
  14. package/{.github/workflows/nodejs.yml → build-support/sign-files.sh} +13 -12
  15. package/build-support/stage-release.sh +44 -0
  16. package/dependencies.yaml +28 -0
  17. package/docs/release-process.md +242 -0
  18. package/examples/consumer.js +1 -1
  19. package/examples/consumer_listener.js +1 -1
  20. package/examples/consumer_tls_auth.js +1 -1
  21. package/examples/custom_logger.js +60 -0
  22. package/examples/encryption-consumer.js +1 -1
  23. package/examples/encryption-producer.js +1 -1
  24. package/examples/producer.js +1 -1
  25. package/examples/producer_tls_auth.js +1 -1
  26. package/examples/reader.js +1 -1
  27. package/examples/reader_listener.js +1 -1
  28. package/index.d.ts +7 -0
  29. package/index.js +2 -1
  30. package/package.json +15 -7
  31. package/pkg/build-napi-inside-docker.sh +31 -0
  32. package/pkg/linux_glibc/Dockerfile +33 -0
  33. package/pkg/linux_musl/Dockerfile +32 -0
  34. package/pkg/load_test.js +30 -0
  35. package/pkg/mac/build-cpp-deps-lib.sh +186 -0
  36. package/pkg/mac/build-cpp-lib.sh +51 -0
  37. package/pkg/mac/common.sh +37 -0
  38. package/pkg/windows/download-cpp-client.bat +12 -0
  39. package/pulsar-client-cpp.txt +2 -0
  40. package/src/AuthenticationAthenz.js +1 -1
  41. package/src/AuthenticationOauth2.js +1 -1
  42. package/src/AuthenticationTls.js +1 -1
  43. package/src/AuthenticationToken.js +1 -1
  44. package/src/Consumer.cc +72 -4
  45. package/src/Consumer.h +2 -0
  46. package/src/ConsumerConfig.cc +21 -0
  47. package/src/ProducerConfig.cc +6 -0
  48. package/src/Reader.cc +51 -1
  49. package/src/Reader.h +2 -0
  50. package/src/pulsar-binding.js +8 -0
  51. package/tests/conf/standalone.conf +6 -0
  52. package/tests/end_to_end.test.js +212 -0
  53. package/{docker-tests.sh → tests/run-unit-tests.sh} +10 -13
  54. package/pulsar-version.txt +0 -1
  55. package/run-unit-tests.sh +0 -44
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env bash
1
2
  #
2
3
  # Licensed to the Apache Software Foundation (ASF) under one
3
4
  # or more contributor license agreements. See the NOTICE file
@@ -16,16 +17,16 @@
16
17
  # specific language governing permissions and limitations
17
18
  # under the License.
18
19
  #
19
- name: Node.js
20
- on: [pull_request]
21
- jobs:
22
- build:
23
- name: Build
24
- runs-on: ubuntu-latest
25
- steps:
26
- - name: Check out code into the Node.js module directory
27
- uses: actions/checkout@v2
28
20
 
29
- - name: Test
30
- run: |
31
- ./docker-tests.sh
21
+ set -e
22
+
23
+ FILES=$*
24
+
25
+ for FILE in $FILES
26
+ do
27
+ echo "Signing $FILE"
28
+ gpg --armor --output $FILE.asc --detach-sig $FILE
29
+
30
+ # SHA-512 signature
31
+ shasum -a 512 $FILE > $FILE.sha512
32
+ done
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ set -e -x
22
+
23
+ if [ $# -neq 2 ]; then
24
+ echo "Usage: $0 \$DEST_PATH \$WORKFLOW_ID"
25
+ exit 1
26
+ fi
27
+
28
+ DEST_PATH=$(readlink -f $1)
29
+ WORKFLOW_ID=$2
30
+
31
+ pushd $(dirname "$0")
32
+ PULSAR_NODE_PATH=$(git rev-parse --show-toplevel)
33
+ popd
34
+
35
+ mkdir -p $DEST_PATH
36
+
37
+ cd $PULSAR_NODE_PATH
38
+
39
+ build-support/download-release-artifacts.py $WORKFLOW_ID $DEST_PATH
40
+ build-support/generate-source-archive.sh $DEST_PATH
41
+
42
+ # Sign all files
43
+ cd $DEST_PATH
44
+ find . -type f | xargs $PULSAR_NODE_PATH/build-support/sign-files.sh
@@ -0,0 +1,28 @@
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
+ # Only used for MacOS builds
21
+ boost: 1.80.0
22
+ cmake: 3.24.2
23
+ protobuf: 3.20.0
24
+ zlib: 1.2.13
25
+ zstd: 1.5.2
26
+ snappy: 1.1.9
27
+ openssl: 1.1.1s
28
+ curl: 7.85.0
@@ -0,0 +1,242 @@
1
+ This page contains instructions for Pulsar committers on how to perform a release.
2
+
3
+ ## Making the release
4
+
5
+ The steps for releasing are as follows:
6
+ 1. Check and Add TypeScript Types
7
+ 2. Create the release branch
8
+ 3. Update package version and tag
9
+ 4. Sign and stage the artifacts
10
+ 5. Move master branch to next version
11
+ 6. Write release notes
12
+ 7. Run the vote
13
+ 8. Promote the release
14
+ 9. Update release notes
15
+ 10. Announce the release
16
+
17
+ ## Requirements
18
+ If you haven't already done it, [create and publish the GPG key](https://pulsar.apache.org/contribute/releasing/create-gpg-keys) to sign the release artifacts.
19
+
20
+ ## Steps in detail
21
+
22
+ #### 1. Check and Add TypeScript Types
23
+
24
+ In order to use added features and options in TypeScript code, we need to add their type definitions.
25
+
26
+ Check if there are any Pull Requests with the `types-required` label or not.
27
+ If yes, add their type definitions (e.g. https://github.com/apache/pulsar-client-node/pull/157).
28
+ If no, we can then proceed to next step.
29
+
30
+ #### 2. Create the release branch
31
+
32
+ We are going to create a branch from `master` to `branch-1.X` where the tag will be generated
33
+ and where new fixes will be applied as part of the maintenance for the release.
34
+
35
+ The branch needs only to be created when creating minor releases, and not for patch releases.
36
+
37
+ Eg: When creating `v1.1.0` release, will be creating the branch `branch-1.1`,
38
+ but for `v1.1.1` we would keep using the old `branch-1.1`.
39
+
40
+ In these instructions, I'm referring to an fictitious release `1.X.0`.
41
+ Change the release version in the examples accordingly with the real version.
42
+
43
+ It is recommended to create a fresh clone of the repository to avoid any local files to interfere
44
+ in the process:
45
+
46
+ ```sh
47
+ $ git clone git@github.com:apache/pulsar-client-node.git
48
+ $ cd pulsar-client-node
49
+ $ git checkout -b branch-1.X origin/master
50
+ ```
51
+
52
+ #### 3. Update package version and tag
53
+
54
+ During the release process, we are going to initially create "candidate" tags:
55
+ ```sh
56
+ # Bump to the release version (the suffix "-rc.0" is removed)
57
+ $ npm version patch --no-git-tag-version
58
+ $ git add .
59
+ $ git commit -m 'Release v1.x.0'
60
+
61
+ # Create a "candidate" tag
62
+ $ export GPG_TTY=$(tty)
63
+ $ git tag -u $USER@apache.org v1.X.0-rc.1 -m 'Release v1.X.0-rc.1'
64
+
65
+ # Push both the branch and the tag to GitHub repo
66
+ $ git push origin branch-1.X
67
+ $ git push origin v1.X.0-rc.1
68
+ ```
69
+
70
+ #### 4. Sign and stage the artifacts
71
+ The src artifact need to be signed and uploaded to the dist SVN repository for staging. See [here](https://github.com/apache/pulsar/wiki/Create-GPG-keys-to-sign-release-artifacts) for how to setup gpg.
72
+
73
+ When the build is pushed to the Apache repo, a Github action job will run and build all the binary artifacts.
74
+
75
+ The build will be available at `https://github.com/apache/pulsar-client-node/actions`
76
+
77
+ Once the workflow is completed (ETA ~20 min), the artifacts will be available for download.
78
+
79
+ Record the id of the workflow as `WORKFLOW_ID`.
80
+
81
+ All the artifacts need to be signed and uploaded to the dist SVN repository for staging.
82
+
83
+ Before running the script, make sure that the `user@apache.org` code signing key is the default gpg signing key. One way to ensure this is to create/edit file `~/.gnupg/gpg.conf` and add a line
84
+
85
+ ```sh
86
+ default-key <key fingerprint>
87
+ ```
88
+
89
+ where` <key fingerprint>` should be replaced with the private key fingerprint for the `user@apache.org` key. The key fingerprint can be found in `gpg -K` output.
90
+
91
+ ```sh
92
+ $ svn co https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node pulsar-dist-dev
93
+ $ cd pulsar-dist-dev
94
+
95
+ # '-candidate-1' needs to be incremented in case of multiple iterations in getting
96
+ # to the final release)
97
+ $ svn mkdir pulsar-client-node-1.X.0-candidate-1
98
+
99
+ # Generate token from here: https://github.com/settings/tokens
100
+ $ export GITHUB_TOKEN=${Your github token}
101
+ $ $PULSAR_PATH/build-support/stage-release.sh . $WORKFLOW_ID
102
+
103
+ $ svn add *
104
+ $ svn ci -m 'Staging artifacts and signature for Pulsar Node.js client release 1.X.0-candidate-1'
105
+ ```
106
+
107
+ #### 5. Move master branch to next version
108
+
109
+ We need to move master version to next iteration `X + 1`.
110
+
111
+ ```sh
112
+ $ git checkout master
113
+ $ npm version preminor --preid=rc
114
+ ```
115
+
116
+ Since this needs to be merged in `master`, we need to follow the regular process
117
+ and create a Pull Request on GitHub.
118
+
119
+ #### 6. Write release notes
120
+
121
+ Check the milestone in GitHub associated with the release.
122
+ https://github.com/apache/pulsar-client-node/milestones?closed=1
123
+
124
+ In the release item, add the list of most important changes that happened in the release
125
+ and a link to the associated milestone, with the complete list of all the changes.
126
+ https://github.com/apache/pulsar-client-node/releases
127
+
128
+ #### 7. Run the vote
129
+
130
+ Send an email on the Pulsar Dev mailing list:
131
+
132
+ ```
133
+ To: dev@pulsar.apache.org
134
+ Subject: [VOTE] Pulsar Node.js Client Release 1.X.0 Candidate 1
135
+
136
+ Hi everyone,
137
+ Please review and vote on the release candidate #1 for the version 1.X.0, as follows:
138
+ [ ] +1, Approve the release
139
+ [ ] -1, Do not approve the release (please provide specific comments)
140
+
141
+ This is the first release candidate for Apache Pulsar Node.js client, version 1.X.0.
142
+
143
+ It fixes the following issues:
144
+ https://github.com/apache/pulsar-client-node/milestone/1?closed=1
145
+
146
+ Please download the source files and review this release candidate:
147
+ - Review release notes
148
+ - Download the source package (verify shasum and asc) and follow the README.md to build and run the Pulsar Node.js client.
149
+
150
+ The vote will be open for at least 72 hours. It is adopted by majority approval, with at least 3 PMC affirmative votes.
151
+
152
+ Source files:
153
+ https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-candidate-1/
154
+
155
+ Pulsar's KEYS file containing PGP keys we use to sign the release:
156
+ https://dist.apache.org/repos/dist/dev/pulsar/KEYS
157
+
158
+ SHA-512 checksum:
159
+ 5f6c7e1a096a3ae66eee71c552af89532ed86bf94da3f3d49836c080426ee5dcaabeda440a989d51772d2e67e2dca953eeee9ea83cfbc7c2a0847a0ec04b310f pulsar-client-node-1.X.0.tar.gz
160
+
161
+ The tag to be voted upon:
162
+ v1.X.0-rc.1
163
+ https://github.com/apache/pulsar-client-node/releases/tag/v1.X.0-rc.1
164
+ ```
165
+
166
+ The vote should be open for at least 72 hours (3 days). Votes from Pulsar PMC members
167
+ will be considered binding, while anyone else is encouraged to verify the release and
168
+ vote as well.
169
+
170
+ If the release is approved here, we can then proceed to next step.
171
+
172
+ #### 8. Promote the release
173
+
174
+ Create the final git tag:
175
+ ```sh
176
+ $ git checkout branch-1.X
177
+ $ export GPG_TTY=$(tty)
178
+ $ git tag -u $USER@apache.org v1.X.0 -m 'Release v1.X.0'
179
+ $ git push origin v1.X.0
180
+ ```
181
+
182
+ Publish the release package:
183
+ ```sh
184
+ # Create or verify a user account in the npm registry
185
+ $ npm adduser
186
+
187
+ Username: foobar
188
+ Password: ********
189
+ Email: (this IS public) foobar@apache.org
190
+
191
+ # Publish the package to the npm registry
192
+ $ npm publish
193
+
194
+ # If you don't have permission to publish `pulsar-client` to the npm registry,
195
+ # ask other committers to grant that permission.
196
+ ```
197
+
198
+ Promote the artifacts on the release location (need PMC permissions):
199
+ ```sh
200
+ $ svn mv -m 'Release Pulsar Node.js client 1.X.0' \
201
+ https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-candidate-1 \
202
+ https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/pulsar-client-node-1.X.0
203
+
204
+ # Remove the old releases (if any)
205
+ # We only need the latest release there, older releases are available through the Apache archive
206
+ $ svn rm -m 'Remove the old release' \
207
+ https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/pulsar-client-node-1.Y.0
208
+ ```
209
+
210
+ #### 9. Update release notes
211
+
212
+ Add the release notes there:
213
+ https://github.com/apache/pulsar-client-node/releases
214
+
215
+ #### 10. Announce the release
216
+
217
+ Once the release artifact is available in the npm registry, we need to announce the release.
218
+
219
+ Send an email on these lines:
220
+ ```
221
+ To: dev@pulsar.apache.org, users@pulsar.apache.org, announce@apache.org
222
+ Subject: [ANNOUNCE] Apache Pulsar Node.js client 1.X.0 released
223
+
224
+ The Apache Pulsar team is proud to announce Apache Pulsar Node.js client version 1.X.0.
225
+
226
+ Pulsar is a highly scalable, low latency messaging platform running on
227
+ commodity hardware. It provides simple pub-sub semantics over topics,
228
+ guaranteed at-least-once delivery of messages, automatic cursor management for
229
+ subscribers, and cross-datacenter replication.
230
+
231
+ For Pulsar Node.js client release details and downloads, visit:
232
+ https://www.npmjs.com/package/pulsar-client
233
+
234
+ Release Notes are at:
235
+ https://github.com/apache/pulsar-client-node/releases
236
+
237
+ We would like to thank the contributors that made the release possible.
238
+
239
+ Regards,
240
+
241
+ The Pulsar Team
242
+ ```
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  const auth = new Pulsar.AuthenticationTls({
@@ -0,0 +1,60 @@
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 Pulsar = require('..');
21
+
22
+ (async () => {
23
+ // Create a client
24
+ const client = new Pulsar.Client({
25
+ serviceUrl: 'pulsar://localhost:6650',
26
+ operationTimeoutSeconds: 30,
27
+ });
28
+
29
+ Pulsar.Client.setLogHandler((level, file, line, message) => {
30
+ console.log('[%s][%s:%d] %s', Pulsar.LogLevel.toString(level), file, line, message);
31
+ });
32
+
33
+ // Create a producer
34
+ const producer = await client.createProducer({
35
+ topic: 'persistent://public/default/my-topic',
36
+ sendTimeoutMs: 30000,
37
+ batchingEnabled: true,
38
+ });
39
+
40
+ // Create a consumer
41
+ const consumer = await client.subscribe({
42
+ topic: 'persistent://public/default/my-topic',
43
+ subscription: 'sub1',
44
+ subscriptionType: 'Shared',
45
+ ackTimeoutMs: 10000,
46
+ });
47
+
48
+ const msg = `my-message`;
49
+ await producer.send({
50
+ data: Buffer.from(msg),
51
+ });
52
+
53
+ const receivedMsg = await consumer.receive();
54
+ console.log(receivedMsg.getData().toString());
55
+ await consumer.acknowledge(receivedMsg);
56
+
57
+ await producer.close();
58
+ await consumer.close();
59
+ await client.close();
60
+ })();
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  const auth = new Pulsar.AuthenticationTls({
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
package/index.d.ts CHANGED
@@ -60,6 +60,7 @@ export interface ProducerConfig {
60
60
  publicKeyPath?: string;
61
61
  encryptionKey?: string;
62
62
  cryptoFailureAction?: ProducerCryptoFailureAction;
63
+ chunkingEnabled?: boolean;
63
64
  }
64
65
 
65
66
  export class Producer {
@@ -88,6 +89,8 @@ export interface ConsumerConfig {
88
89
  readCompacted?: boolean;
89
90
  privateKeyPath?: string;
90
91
  cryptoFailureAction?: ConsumerCryptoFailureAction;
92
+ maxPendingChunkedMessage?: number;
93
+ autoAckOldestChunkedMessageOnQueueFull?: number;
91
94
  }
92
95
 
93
96
  export class Consumer {
@@ -98,6 +101,8 @@ export class Consumer {
98
101
  negativeAcknowledgeId(messageId: MessageId): void;
99
102
  acknowledgeCumulative(message: Message): Promise<null>;
100
103
  acknowledgeCumulativeId(messageId: MessageId): Promise<null>;
104
+ seek(messageId: MessageId): Promise<null>;
105
+ seekTimestamp(timestamp: number): Promise<null>;
101
106
  isConnected(): boolean;
102
107
  close(): Promise<null>;
103
108
  unsubscribe(): Promise<null>;
@@ -117,6 +122,8 @@ export class Reader {
117
122
  readNext(timeout?: number): Promise<Message>;
118
123
  hasNext(): boolean;
119
124
  isConnected(): boolean;
125
+ seek(messageId: MessageId): Promise<null>;
126
+ seekTimestamp(timestamp: number): Promise<null>;
120
127
  close(): Promise<null>;
121
128
  }
122
129
 
package/index.js CHANGED
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const PulsarBinding = require('bindings')('Pulsar');
20
+ const PulsarBinding = require('./src/pulsar-binding');
21
21
  const AuthenticationTls = require('./src/AuthenticationTls.js');
22
22
  const AuthenticationAthenz = require('./src/AuthenticationAthenz.js');
23
23
  const AuthenticationToken = require('./src/AuthenticationToken.js');
@@ -28,6 +28,7 @@ const LogLevel = {
28
28
  INFO: 1,
29
29
  WARN: 2,
30
30
  ERROR: 3,
31
+ toString: (level) => Object.keys(LogLevel).find((key) => LogLevel[key] === level),
31
32
  };
32
33
 
33
34
  const Pulsar = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulsar-client",
3
- "version": "1.7.0",
3
+ "version": "1.8.0-rc1",
4
4
  "description": "Pulsar Node.js client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,17 +9,17 @@
9
9
  "example": "examples"
10
10
  },
11
11
  "scripts": {
12
- "install": "node-gyp rebuild",
13
- "clean": "node-gyp clean",
14
- "configure": "node-gyp configure",
12
+ "install": "node-pre-gyp install --fallback-to-build",
13
+ "configure": "node-pre-gyp configure",
14
+ "build": "npm run format && node-pre-gyp build",
15
+ "build:debug": "npm run format && node-pre-gyp rebuild --debug",
16
+ "clean": "node-pre-gyp clean",
15
17
  "lint": "clang-format-lint src/*.cc src/*.h && eslint --ext .js .",
16
18
  "format": "clang-format-lint --fix src/*.cc src/*.h && eslint --fix --ext .js .",
17
19
  "dtslint": "dtslint .",
18
- "build": "npm run format && node-gyp rebuild",
19
- "build:debug": "npm run format && node-gyp rebuild --debug",
20
20
  "license:report": "mkdir -p report && grunt grunt-license-report",
21
21
  "license:addheader": "license-check-and-add",
22
- "test": "jest --verbose"
22
+ "test": "jest --verbose --detectOpenHandles"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -52,9 +52,17 @@
52
52
  "typescript": "^4.1.3"
53
53
  },
54
54
  "dependencies": {
55
+ "@mapbox/node-pre-gyp": "^1.0.9",
55
56
  "bindings": "^1.5.0",
56
57
  "node-addon-api": "^4.3.0"
57
58
  },
59
+ "binary": {
60
+ "module_name": "Pulsar",
61
+ "module_path": "./lib/binding/",
62
+ "host": "https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/",
63
+ "remote_path": "pulsar-client-node-{version}",
64
+ "package_name": "napi-{platform}-{libc}-{arch}.tar.gz"
65
+ },
58
66
  "license-check-and-add-config": {
59
67
  "folder": ".",
60
68
  "license": "license-header.txt",
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ set -e -x
22
+
23
+ cd /pulsar-client-node
24
+
25
+ build-support/install-cpp-client.sh
26
+
27
+ npm install --ignore-scripts
28
+ npx node-pre-gyp configure
29
+ npx node-pre-gyp build
30
+ npx node-pre-gyp package
31
+ node pkg/load_test.js
@@ -0,0 +1,33 @@
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
+ ARG NODE_VERSION
21
+
22
+ FROM node:${NODE_VERSION}-bullseye
23
+
24
+ ARG NODE_VERSION
25
+
26
+ RUN apt-get update -y && \
27
+ apt-get install -y \
28
+ curl \
29
+ g++ \
30
+ make \
31
+ python3
32
+
33
+ CMD ["sh"]