aerospike 6.2.0 → 6.3.0

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 (166) hide show
  1. package/README.md +50 -120
  2. package/aerospike-client-c.ini +1 -1
  3. package/aerospike-client-c.sha256 +1 -1
  4. package/binding.gyp +7 -3
  5. package/examples/README.md +3 -0
  6. package/examples/connect.js +52 -0
  7. package/examples/dynamicConfig.js +64 -0
  8. package/examples/example_config/config.yml +13 -0
  9. package/examples/metrics.js +129 -0
  10. package/examples/package-lock.json +22 -13
  11. package/examples/run.js +3 -0
  12. package/lib/binding/node-v115-darwin-arm64/aerospike.node +0 -0
  13. package/lib/binding/node-v115-darwin-x64/aerospike.node +0 -0
  14. package/lib/binding/{glibc@2.35/node-v115-linux-arm64 → node-v115-linux-arm64}/aerospike.node +0 -0
  15. package/lib/binding/{glibc@2.35/node-v115-linux-x64 → node-v115-linux-x64}/aerospike.node +0 -0
  16. package/lib/binding/node-v115-win32-x64/aerospike.dll +0 -0
  17. package/lib/binding/node-v115-win32-x64/aerospike.node +0 -0
  18. package/lib/binding/node-v115-win32-x64/libcrypto-3-x64.dll +0 -0
  19. package/lib/binding/node-v115-win32-x64/libcrypto.lib +0 -0
  20. package/lib/binding/node-v115-win32-x64/libssl-3-x64.dll +0 -0
  21. package/lib/binding/node-v115-win32-x64/libssl.lib +0 -0
  22. package/lib/binding/node-v115-win32-x64/lua.dll +0 -0
  23. package/lib/binding/node-v127-darwin-arm64/aerospike.node +0 -0
  24. package/lib/binding/node-v127-darwin-x64/aerospike.node +0 -0
  25. package/lib/binding/{glibc@2.35/node-v127-linux-arm64 → node-v127-linux-arm64}/aerospike.node +0 -0
  26. package/lib/binding/{glibc@2.35/node-v127-linux-x64 → node-v127-linux-x64}/aerospike.node +0 -0
  27. package/lib/binding/node-v127-win32-x64/aerospike.dll +0 -0
  28. package/lib/binding/node-v127-win32-x64/aerospike.node +0 -0
  29. package/lib/binding/node-v127-win32-x64/libcrypto-3-x64.dll +0 -0
  30. package/lib/binding/node-v127-win32-x64/libcrypto.lib +0 -0
  31. package/lib/binding/node-v127-win32-x64/libssl-3-x64.dll +0 -0
  32. package/lib/binding/node-v127-win32-x64/libssl.lib +0 -0
  33. package/lib/binding/node-v127-win32-x64/lua.dll +0 -0
  34. package/lib/binding/node-v137-darwin-arm64/aerospike.node +0 -0
  35. package/lib/binding/node-v137-darwin-x64/aerospike.node +0 -0
  36. package/lib/binding/{glibc@2.31/node-v115-linux-arm64 → node-v137-linux-arm64}/aerospike.node +0 -0
  37. package/lib/binding/{glibc@2.31/node-v115-linux-x64 → node-v137-linux-x64}/aerospike.node +0 -0
  38. package/lib/binding/node-v137-win32-x64/aerospike.dll +0 -0
  39. package/lib/binding/node-v137-win32-x64/aerospike.node +0 -0
  40. package/lib/binding/node-v137-win32-x64/libcrypto-3-x64.dll +0 -0
  41. package/lib/binding/node-v137-win32-x64/libcrypto.lib +0 -0
  42. package/lib/binding/node-v137-win32-x64/libssl-3-x64.dll +0 -0
  43. package/lib/binding/node-v137-win32-x64/libssl.lib +0 -0
  44. package/lib/binding/node-v137-win32-x64/lua.dll +0 -0
  45. package/lib/client.js +180 -41
  46. package/lib/commands/index.js +2 -0
  47. package/lib/config.js +4 -0
  48. package/lib/policies/metrics_policy.js +3 -1
  49. package/lib/query.js +18 -0
  50. package/lib/status.js +5 -0
  51. package/package.json +6 -5
  52. package/scripts/Invoke-MsBuild.psm1 +20 -20
  53. package/scripts/build-c-client.ps1 +89 -3
  54. package/scripts/build-package.ps1 +7 -7
  55. package/scripts/parseReleaseNotes.js +125 -0
  56. package/scripts/prebuiltBinding.js +34 -50
  57. package/src/include/client.h +2 -0
  58. package/src/include/conversions.h +8 -5
  59. package/src/include/log.h +6 -0
  60. package/src/include/policy.h +1 -1
  61. package/src/include/query.h +5 -4
  62. package/src/main/async.cc +4 -2
  63. package/src/main/client.cc +14 -3
  64. package/src/main/commands/change_password.cc +7 -10
  65. package/src/main/commands/disable_metrics.cc +11 -1
  66. package/src/main/commands/enable_metrics.cc +100 -26
  67. package/src/main/commands/index_create.cc +68 -26
  68. package/src/main/commands/privilege_grant.cc +11 -8
  69. package/src/main/commands/privilege_revoke.cc +11 -9
  70. package/src/main/commands/query_apply.cc +4 -2
  71. package/src/main/commands/query_async.cc +4 -2
  72. package/src/main/commands/query_background.cc +3 -2
  73. package/src/main/commands/query_foreach.cc +3 -2
  74. package/src/main/commands/query_pages.cc +4 -2
  75. package/src/main/commands/query_role.cc +4 -2
  76. package/src/main/commands/query_roles.cc +7 -5
  77. package/src/main/commands/query_user.cc +4 -2
  78. package/src/main/commands/query_users.cc +4 -2
  79. package/src/main/commands/role_create.cc +20 -17
  80. package/src/main/commands/role_drop.cc +7 -3
  81. package/src/main/commands/role_grant.cc +13 -9
  82. package/src/main/commands/role_revoke.cc +13 -9
  83. package/src/main/commands/role_set_quotas.cc +8 -5
  84. package/src/main/commands/role_set_whitelist.cc +13 -9
  85. package/src/main/commands/set_password.cc +114 -0
  86. package/src/main/commands/user_create.cc +13 -10
  87. package/src/main/commands/user_create_pki.cc +108 -0
  88. package/src/main/commands/user_drop.cc +7 -4
  89. package/src/main/config.cc +50 -6
  90. package/src/main/enums/policy_enum.cc +1 -0
  91. package/src/main/enums/status.cc +1 -0
  92. package/src/main/policy.cc +42 -4
  93. package/src/main/query.cc +222 -98
  94. package/src/main/stats.cc +8 -0
  95. package/src/main/util/conversions.cc +296 -94
  96. package/ts-test/package-lock.json +1 -1
  97. package/ts-test/tests/admin.ts +1046 -49
  98. package/ts-test/tests/batch_apply.ts +1 -1
  99. package/ts-test/tests/batch_get.ts +2 -2
  100. package/ts-test/tests/batch_read.ts +3 -92
  101. package/ts-test/tests/batch_write.ts +1 -1
  102. package/ts-test/tests/config.ts +7 -0
  103. package/ts-test/tests/config_pki.ts +61 -0
  104. package/ts-test/tests/dyn_config.yml +8 -0
  105. package/ts-test/tests/dyn_config_edit.yml +8 -0
  106. package/ts-test/tests/dyn_config_metrics_disabled.yml +10 -0
  107. package/ts-test/tests/dyn_config_permissions.yml +11 -0
  108. package/ts-test/tests/dyn_config_send_key_true.yml +15 -0
  109. package/ts-test/tests/dynamic_config.ts +656 -0
  110. package/ts-test/tests/get.ts +0 -40
  111. package/ts-test/tests/index_on_exp.ts +221 -0
  112. package/ts-test/tests/metrics.ts +2868 -202
  113. package/ts-test/tests/metrics_cluster_name.ts +1 -1
  114. package/ts-test/tests/metrics_key_busy.ts +134 -0
  115. package/ts-test/tests/metrics_node_close.ts +145 -102
  116. package/ts-test/tests/mrt_api.ts +1 -2
  117. package/ts-test/tests/operate.ts +0 -38
  118. package/ts-test/tests/policy.ts +13 -1
  119. package/ts-test/tests/query.ts +122 -431
  120. package/ts-test/tests/query_blob_filter.ts +254 -0
  121. package/ts-test/tests/query_blob_filter_exp.ts +204 -0
  122. package/ts-test/tests/query_geojson_filter.ts +599 -0
  123. package/ts-test/tests/query_geojson_filter_exp.ts +369 -0
  124. package/ts-test/tests/query_numeric_filter.ts +383 -0
  125. package/ts-test/tests/query_numeric_filter_exp.ts +295 -0
  126. package/ts-test/tests/query_string_filter.ts +353 -0
  127. package/ts-test/tests/query_string_filter_exp.ts +263 -0
  128. package/ts-test/tests/replica_random.ts +93 -0
  129. package/ts-test/tests/status.ts +6 -0
  130. package/ts-test/tests/test_helper.ts +64 -23
  131. package/ts-test/tests/util/options.ts +17 -2
  132. package/typings/index.d.ts +1296 -444
  133. package/lib/binding/glibc@2.31/node-v108-linux-arm64/aerospike.node +0 -0
  134. package/lib/binding/glibc@2.31/node-v108-linux-x64/aerospike.node +0 -0
  135. package/lib/binding/glibc@2.31/node-v127-linux-arm64/aerospike.node +0 -0
  136. package/lib/binding/glibc@2.31/node-v127-linux-x64/aerospike.node +0 -0
  137. package/lib/binding/glibc@2.31/node-v131-linux-arm64/aerospike.node +0 -0
  138. package/lib/binding/glibc@2.31/node-v131-linux-x64/aerospike.node +0 -0
  139. package/lib/binding/glibc@2.35/node-v108-linux-arm64/aerospike.node +0 -0
  140. package/lib/binding/glibc@2.35/node-v108-linux-x64/aerospike.node +0 -0
  141. package/lib/binding/glibc@2.35/node-v131-linux-arm64/aerospike.node +0 -0
  142. package/lib/binding/glibc@2.35/node-v131-linux-x64/aerospike.node +0 -0
  143. package/lib/binding/node-v108-darwin-arm64/aerospike.node +0 -0
  144. package/lib/binding/node-v108-darwin-x64/aerospike.node +0 -0
  145. package/lib/binding/node-v108-win32-x64/aerospike.dll +0 -0
  146. package/lib/binding/node-v108-win32-x64/aerospike.node +0 -0
  147. package/lib/binding/node-v108-win32-x64/libeay32.dll +0 -0
  148. package/lib/binding/node-v108-win32-x64/ssleay32.dll +0 -0
  149. package/lib/binding/node-v115-win32-x64/libeay32.dll +0 -0
  150. package/lib/binding/node-v115-win32-x64/ssleay32.dll +0 -0
  151. package/lib/binding/node-v127-win32-x64/libeay32.dll +0 -0
  152. package/lib/binding/node-v127-win32-x64/ssleay32.dll +0 -0
  153. package/lib/binding/node-v131-darwin-arm64/aerospike.node +0 -0
  154. package/lib/binding/node-v131-darwin-x64/aerospike.node +0 -0
  155. package/lib/binding/node-v131-win32-x64/aerospike.dll +0 -0
  156. package/lib/binding/node-v131-win32-x64/aerospike.node +0 -0
  157. package/lib/binding/node-v131-win32-x64/event_core.dll +0 -0
  158. package/lib/binding/node-v131-win32-x64/getopt.dll +0 -0
  159. package/lib/binding/node-v131-win32-x64/libeay32.dll +0 -0
  160. package/lib/binding/node-v131-win32-x64/pthreadVC2.dll +0 -0
  161. package/lib/binding/node-v131-win32-x64/ssleay32.dll +0 -0
  162. package/lib/binding/node-v131-win32-x64/zlib.dll +0 -0
  163. /package/lib/binding/{node-v108-win32-x64 → node-v137-win32-x64}/event_core.dll +0 -0
  164. /package/lib/binding/{node-v108-win32-x64 → node-v137-win32-x64}/getopt.dll +0 -0
  165. /package/lib/binding/{node-v108-win32-x64 → node-v137-win32-x64}/pthreadVC2.dll +0 -0
  166. /package/lib/binding/{node-v108-win32-x64 → node-v137-win32-x64}/zlib.dll +0 -0
package/README.md CHANGED
@@ -11,14 +11,14 @@
11
11
 
12
12
  The Aerospike Node.js client is a Node.js add-on module, written using V8.
13
13
 
14
- The client is compatible with Node.js 23, Node.js 22, (LTS), Node.js 20 (LTS),and 18 (LTS).
14
+ The client is compatible with Node.js 24 (LTS), Node.js 22 (LTS), and Node.js 20 (LTS).
15
15
  It supports the following operating systems:
16
16
  - RHEL 8/9
17
17
  - Debian 11
18
18
  - Amazon Linux 2023
19
- - Ubuntu 20.04/22.04/24.04 (Focal Fossa, Jammy Jellyfish, Noble Numbat)
19
+ - Ubuntu 22.04/24.04 (Focal Fossa, Jammy Jellyfish, Noble Numbat)
20
20
  - Many Linux distributions compatible with one of the above OS releases.
21
- - macOS 12/13/14
21
+ - macOS 13/14/15
22
22
 
23
23
  The client is compatible with arm64, aarch64, and x86_64 architectures.
24
24
 
@@ -46,21 +46,16 @@ by requiring the module by name.
46
46
 
47
47
  ### npm Registry Installations
48
48
 
49
- To install `aerospike` as a dependency of your project, in your project directory run:
49
+ To install `aerospike` as a dependency in your project:
50
50
 
51
51
  ```bash
52
52
  npm install aerospike
53
53
  ```
54
54
 
55
- To add `aerospike` as a dependency in _package.json_, run:
55
+ To import the module in your application:
56
56
 
57
57
  ```bash
58
- npm install aerospike --save-dev
59
- ```
60
-
61
- To require the module in your application:
62
- ```bash
63
- const Aerospike = require('aerospike')
58
+ import Aerospike from 'aerospike';
64
59
  ```
65
60
 
66
61
  ## Usage
@@ -69,67 +64,39 @@ The following is very simple example how to create, update, read and remove a
69
64
  record using the Aerospike database.
70
65
 
71
66
  ```js
72
- const Aerospike = require('aerospike')
67
+ import Aerospike from 'aerospike';
68
+
69
+
70
+
71
+ const main = async () => {
72
+
73
+ let client
74
+
75
+ try {
76
+
77
+ client = await Aerospike.connect({hosts: '127.0.0.1:3000'});
78
+
79
+ const key = new Aerospike.Key('test', 'dataset', 123);
80
+
81
+ await client.put(key, {foo: "bar", baz: "qux"}, [], null);
82
+
83
+ const record = await client.get(key);
84
+
85
+ console.info("Record created\nRecord: %o\n", record.bins);
86
+
87
+ } catch (e) {
88
+
89
+ console.error(e)
90
+
91
+ } finally {
92
+
93
+ client && client.close();
94
+
95
+ }
73
96
 
74
- // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
75
- const config = {
76
- hosts: '192.168.33.10:3000',
77
97
  }
78
98
 
79
- const key = new Aerospike.Key('test', 'demo', 'demo')
80
-
81
- Aerospike.connect(config)
82
- .then(client => {
83
- const bins = {
84
- i: 123,
85
- s: 'hello',
86
- b: Buffer.from('world'),
87
- d: new Aerospike.Double(3.1415),
88
- g: Aerospike.GeoJSON.Point(103.913, 1.308),
89
- l: [1, 'a', {x: 'y'}],
90
- m: {foo: 4, bar: 7}
91
- }
92
- const meta = { ttl: 10000 }
93
- const policy = new Aerospike.WritePolicy({
94
- exists: Aerospike.policy.exists.CREATE_OR_REPLACE,
95
- // Timeouts disabled, latency dependent on server location. Configure as needed.
96
- socketTimeout : 0,
97
- totalTimeout : 0
98
- })
99
-
100
- return client.put(key, bins, meta, policy)
101
- .then(() => {
102
- const ops = [
103
- Aerospike.operations.incr('i', 1),
104
- Aerospike.operations.read('i'),
105
- Aerospike.lists.append('l', 'z'),
106
- Aerospike.maps.removeByKey('m', 'bar')
107
- ]
108
-
109
- return client.operate(key, ops)
110
- })
111
- .then(result => {
112
- console.log(result.bins) // => { i: 124, l: 4, m: null }
113
-
114
- return client.get(key)
115
- })
116
- .then(record => {
117
- console.log(record.bins) // => { i: 124,
118
- // s: 'hello',
119
- // b: <Buffer 77 6f 72 6c 64>,
120
- // d: 3.1415,
121
- // g: '{"type":"Point","coordinates":[103.913,1.308]}',
122
- // l: [ 1, 'a', { x: 'y' }, 'z' ],
123
- // m: { foo: 4 } }
124
- })
125
- .then(() => client.close())
126
- })
127
- .catch(error => {
128
- console.error('Error: %s [%i]', error.message, error.code)
129
- if (error.client) {
130
- error.client.close()
131
- }
132
- })
99
+ main();
133
100
  ```
134
101
  ## Prerequisites
135
102
 
@@ -222,44 +189,6 @@ We recommend using brew to install OpenSSL:
222
189
  brew install openssl
223
190
  ```
224
191
 
225
- For a Mac using ARM architecture, OpenSSL should be linked as shown below:
226
-
227
- ```bash
228
- # When building from source before version 5.6 with openssl@3
229
- sudo ln -s /opt/homebrew/opt/openssl@3/ /usr/local/opt/openssl;
230
- # link here if before version 5.6.0
231
- sudo ln -s /opt/homebrew/opt/openssl@3/ /usr/local/opt/openssl@3;
232
-
233
- # When building from source with openssl@1.1
234
- sudo ln -s /opt/homebrew/opt/openssl@1.1/ /usr/local/opt/openssl;
235
- # link here if before version 5.6.0 with openssl@1.1
236
- sudo ln -s /opt/homebrew/opt/openssl@1.1/ /usr/local/opt/openssl@1.1;
237
- ```
238
-
239
- For a Mac using X86 architecture, OpenSSL should be linked as shown below:
240
-
241
- ```bash
242
- # When building from source before version 5.6 with openssl@1.1
243
- sudo ln -s /opt/homebrew/opt/openssl@1.1/ /usr/local/opt/openssl;
244
- # link here if before version 5.6.0 with openssl@1.1
245
- sudo ln -s /opt/homebrew/opt/openssl@1.1/ /usr/local/opt/openssl@1.1;
246
- ```
247
-
248
- Before version 5.6.0, you may need to some add some variables to your profile for OpenSSL to be found.
249
-
250
- ```bash
251
- export PATH="/usr/local/bin/:/usr/local/opt/openssl/bin:$PATH"
252
- export LDFLAGS="-L/usr/local/opt/openssl/lib"
253
- export CPPFLAGS="-I/usr/local/opt/openssl/include"
254
- export EXT_CFLAGS="-I/usr/local/opt/openssl/include"
255
- # Make sure to source the changes to your shell profile
256
- source ~/.bashrc
257
- source ~/.profile
258
- source ~/.zshrc
259
- ```
260
-
261
- For 4x client support, install OpenSSL&#64;1.1 version.
262
-
263
192
  **LIBUV Library**
264
193
 
265
194
  Libuv is needed to build the Aerospike C Client. If downloading from NPM at version 5.6.0 or later, you will not need to
@@ -274,11 +203,6 @@ brew install libuv
274
203
 
275
204
  For a Mac using ARM architecture, Libuv should be linked as shown below:
276
205
 
277
- ```bash
278
- # When building from source before version 5.6
279
- sudo ln -s /opt/homebrew/opt/libuv/ /usr/local/opt/libuv;
280
- ```
281
-
282
206
  ### Git Repository Installations
283
207
 
284
208
  When using a cloned repository, install `aerospike` as a dependency of your application. Instead of referencing the module by name, you reference it by path.
@@ -296,24 +220,24 @@ Run the following commands to build the C client:
296
220
  ./scripts/build-c-client.sh
297
221
  ```
298
222
 
299
- #### Building and installing Node.js client
223
+ #### Building and installing the C++ addon for the Node.js client
300
224
 
301
- To install the module as a dependency of your application, run the following in the application directory:
225
+ To build and install the module as a dependency of your application:
302
226
 
303
227
  ```bash
304
228
  npm install --unsafe-perm --build-from-source
305
229
  ```
306
230
 
307
- To require it in the application:
231
+ To import the module in your application:
308
232
 
309
233
  ```bash
310
- const Aerospike = require('aerospike')
234
+ import Aerospike from 'aerospike';
311
235
  ```
312
236
 
313
237
  ## Documentation
314
238
 
315
239
  Access the client API documentation at:
316
- [https://docs.aerospike.com/apidocs/nodejs](https://docs.aerospike.com/apidocs/nodejs).
240
+ [https://docs.aerospike.com/apidocs/nodejs](https://docs.aerospike.com/apidocs/nodejs/).
317
241
  This documentation is built from the client's source using [JSDocs
318
242
  v4](https://www.npmjs.com/package/jsdoc) for every release.
319
243
 
@@ -340,8 +264,8 @@ second and third version number, are always backwards compatible.
340
264
 
341
265
  ## Tests
342
266
 
343
- The client includes a comprehensive test suite using
344
- [Mocha](http://mochajs.org). The tests can be found in the repository under test directory.
267
+ The client includes a comprehensive typescript test suite using
268
+ [Mocha](http://mochajs.org). The tests can be found in the repository under ts-test directory.
345
269
 
346
270
  Before running the tests, you need to update the dependencies:
347
271
 
@@ -355,6 +279,12 @@ To run a specific tests, use:
355
279
 
356
280
  npm test --testfile=filename.js
357
281
 
282
+ Various options can be provided, such as host, port, and password information
283
+
284
+ npm run test --testfile=metrics.js -- -h localhost --port 3000 -t 60000 -U superuser -P superuser
285
+
286
+ To see the options, see `ts-test/test/util/options.ts` for a full list.
287
+
358
288
  Note: make sure your server has TTL enabled for the `test` namespace ([Namespace Retention Configuration](https://docs.aerospike.com/server/operations/configure/namespace/retention)) to allow all tests to run correctly.
359
289
 
360
290
  To run the tests and also report on test coverage:
@@ -372,4 +302,4 @@ License, Version 2, as stated in the LICENSE file.
372
302
 
373
303
  Individual files may be made available under their own specific license, all
374
304
  compatible with Apache License, Version 2. Refer to individual files for
375
- details.
305
+ details.
@@ -1,3 +1,3 @@
1
1
 
2
2
  # Version number of the dependencies package for C client (Windows only)
3
- AEROSPIKE_C_DEPS_VERSION=1.0.2
3
+ AEROSPIKE_C_DEPS_VERSION=1.0.3
@@ -1 +1 @@
1
- BB7AEB63571E63FD6C9CD042DC1810743DF9C8F122C91EAFB705C2E08B87733A aerospike-client-c-dependencies.1.0.2.zip
1
+ 4804B9B02688FEEE73C95ACAE87DCC839831155EE1E101B5126E7CD317644CFB aerospike-client-c-dependencies.1.0.3.zip
package/binding.gyp CHANGED
@@ -55,7 +55,7 @@
55
55
  '-NodeLibFile', "<(node_root_dir)/<(target_arch)/node.lib"
56
56
  ]
57
57
  }
58
- ]
58
+ ],
59
59
  }],
60
60
  ]
61
61
  },
@@ -129,10 +129,12 @@
129
129
  'src/main/commands/scan_background.cc',
130
130
  'src/main/commands/scan_pages.cc',
131
131
  'src/main/commands/select_async.cc',
132
+ 'src/main/commands/set_password.cc',
132
133
  'src/main/commands/transaction_abort.cc',
133
134
  'src/main/commands/transaction_commit.cc',
134
135
  'src/main/commands/truncate.cc',
135
136
  'src/main/commands/user_create.cc',
137
+ 'src/main/commands/user_create_pki.cc',
136
138
  'src/main/commands/user_drop.cc',
137
139
  'src/main/commands/udf_register.cc',
138
140
  'src/main/commands/udf_remove.cc',
@@ -180,7 +182,8 @@
180
182
  ['OS=="linux"',{
181
183
  'libraries': [
182
184
  '../aerospike-client-c/target/Linux-<(build_arch)/lib/libaerospike.a',
183
- '-lz'
185
+ '-lz',
186
+ '-lyaml'
184
187
  ],
185
188
  'defines': [
186
189
  'AS_USE_LIBUV'
@@ -196,7 +199,8 @@
196
199
  ['OS=="mac"',{
197
200
  'libraries': [
198
201
  '../aerospike-client-c/target/Darwin-<(build_arch)/lib/libaerospike.a',
199
- '-lz'
202
+ '-lz',
203
+ '-lyaml'
200
204
  ],
201
205
  'defines': [
202
206
  'AS_USE_LIBUV'
@@ -64,7 +64,10 @@ The following are the included examples:
64
64
  performing aggregation using UDFs
65
65
  - scan - Run a scan on an entire namespace or set
66
66
  - sindex - Manage secondary indexes (create/remove index)
67
+ - Connect- Connect to aerospike
67
68
  - udf - Manage User-Defined Functions (create/remove module)
69
+ - metrics - Enable metrics with custom settings.
70
+ - dynamicConfig - Connect with a dynamic configuration.
68
71
  - **Complex Examples**
69
72
  - geospatialMonteCarlo - Performs a Monte Carlo simulation to approximate PI
70
73
  using Aerospike's geospatial indexing and query functionality
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ // *****************************************************************************
3
+ // Copyright 2025 Aerospike, Inc.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License")
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ // *****************************************************************************
17
+ //
18
+ const Aerospike = require('aerospike')
19
+ const shared = require('./shared')
20
+
21
+ shared.runner()
22
+
23
+ async function connect (client, argv) {
24
+ const config = {
25
+ hosts: [
26
+ { addr: argv.hosts, port: argv.port }
27
+ ]
28
+ }
29
+ if (argv.user) {
30
+ config.user = argv.user
31
+ }
32
+
33
+ if (argv.password) {
34
+ config.password = argv.password
35
+ }
36
+ let cli = null
37
+ try {
38
+ cli = await Aerospike.connect(config)
39
+ console.log('Connected!')
40
+ } catch (error) {
41
+ console.log('Failed with: ' + error)
42
+ } finally {
43
+ if (client) {
44
+ await cli.close()
45
+ }
46
+ }
47
+ }
48
+
49
+ exports.command = 'connect'
50
+ exports.describe = 'Connect to the database'
51
+ exports.handler = shared.run(connect)
52
+ exports.builder = {}
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ // *****************************************************************************
3
+ // Copyright 2025 Aerospike, Inc.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License")
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ // *****************************************************************************
17
+ //
18
+ const Aerospike = require('aerospike')
19
+ const shared = require('./shared')
20
+
21
+ shared.runner()
22
+
23
+ async function dynamicConfig (client, argv) {
24
+ const config = {
25
+ hosts: [
26
+ { addr: argv.hosts, port: argv.port }
27
+ ],
28
+ configProvider: {
29
+ path: argv.dcp,
30
+ interval: 1
31
+ }
32
+ }
33
+ if (argv.user) {
34
+ config.user = argv.user
35
+ }
36
+
37
+ if (argv.password) {
38
+ config.password = argv.password
39
+ }
40
+ let cli = null
41
+ try {
42
+ console.log('Connecting...')
43
+ cli = await Aerospike.connect(config)
44
+ console.log('Connected!')
45
+ } catch (error) {
46
+ console.log('Failed with: ' + error)
47
+ } finally {
48
+ if (client) {
49
+ await cli.close()
50
+ }
51
+ }
52
+ }
53
+
54
+ exports.command = 'dynamicConfig'
55
+ exports.describe = 'Dynamic Config'
56
+ exports.handler = shared.run(dynamicConfig)
57
+ exports.builder = {
58
+ dynamic_config_path: {
59
+ alias: 'dcp',
60
+ describe: 'Path of dynamic config',
61
+ type: 'string',
62
+ default: './example_config/config.yml'
63
+ }
64
+ }
@@ -0,0 +1,13 @@
1
+ metadata:
2
+ app_name: configurationExample
3
+ generation: 2
4
+ version: 0.0.1
5
+ static:
6
+ client:
7
+ config_interval: 2
8
+ dynamic:
9
+ write:
10
+ send_key: false
11
+ static:
12
+ client:
13
+ config_interval: 1
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ // *****************************************************************************
3
+ // Copyright 2013-2024 Aerospike, Inc.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License")
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ // *****************************************************************************
17
+
18
+ const Aerospike = require('aerospike')
19
+ const shared = require('./shared')
20
+
21
+ shared.runner()
22
+
23
+ async function metrics (client, argv) {
24
+ const policy = {}
25
+ if (argv.customListeners) {
26
+ const listeners = new Aerospike.MetricsListeners(
27
+ {
28
+ enableListener,
29
+ disableListener,
30
+ nodeCloseListener,
31
+ snapshotListener
32
+ }
33
+ )
34
+ policy.metricsListeners = listeners
35
+ }
36
+ if (argv.reportDir) {
37
+ policy.reportDir = argv.reportDir
38
+ }
39
+ if (argv.reportSizeLimit) {
40
+ policy.reportSizeLimit = argv.reportSizeLimit
41
+ }
42
+ if (argv.interval) {
43
+ policy.interval = argv.interval
44
+ }
45
+ if (argv.latencyColumns) {
46
+ policy.latencyColumns = argv.latencyColumns
47
+ }
48
+ if (argv.latencyShift) {
49
+ policy.latencyShift = argv.latencyShift
50
+ }
51
+ if (argv.labels) {
52
+ policy.labels = argv.labels
53
+ }
54
+ if (argv.appId) {
55
+ policy.appId = argv.appId
56
+ }
57
+ console.log('Enabling Metrics with the following policy:')
58
+ console.log(policy)
59
+ await client.enableMetrics(policy)
60
+ await new Promise(resolve => setTimeout(resolve, 5000))
61
+ await client.disableMetrics()
62
+ await new Promise(resolve => setTimeout(resolve, 0)) // Let the event loop cycle and allows disable listener to fire.
63
+ }
64
+
65
+ function enableListener () {
66
+ console.log('Enable listener called.')
67
+ }
68
+
69
+ function snapshotListener (cluster) {
70
+ console.log('Snapshot listener called')
71
+ console.log(cluster)
72
+ }
73
+
74
+ function nodeCloseListener (node) {
75
+ console.log('Node Close listener called')
76
+ console.log(node)
77
+ }
78
+
79
+ function disableListener (cluster) {
80
+ console.log('Disabled listener called')
81
+ console.log(cluster)
82
+ }
83
+
84
+ exports.command = 'metrics'
85
+ exports.describe = 'Enable Client metrics'
86
+ exports.handler = shared.run(metrics)
87
+ exports.builder = {
88
+ customListeners: {
89
+ describe: 'Use custom listener callbacks defined with nodejs functions',
90
+ type: 'boolean',
91
+ default: false
92
+ },
93
+ reportDir: {
94
+ describe: 'Directory in which metrics reports will be placed',
95
+ type: 'string',
96
+ default: '.'
97
+ },
98
+ reportSizeLimit: {
99
+ describe: 'Metrics file size soft limit in bytes for listeners that write logs.',
100
+ type: 'number',
101
+ default: 1000000
102
+ },
103
+ interval: {
104
+ describe: 'Number of cluster tend iterations between metrics notification events.',
105
+ type: 'number',
106
+ default: 2
107
+ },
108
+ latencyColumns: {
109
+ describe: 'Number of elapsed time range buckets in latency histograms.',
110
+ type: 'number',
111
+ default: 7
112
+ },
113
+ latencyShift: {
114
+ describe: 'Power of 2 multiple between each range bucket in latency histograms starting at column 3.',
115
+ type: 'number',
116
+ default: 1
117
+ },
118
+ labels: {
119
+ describe: 'List of name/value labels that is applied when exporting metrics.',
120
+ type: 'array',
121
+ default: []
122
+ },
123
+ appId: {
124
+ describe: 'Application identifier that is applied when exporting metrics.',
125
+ type: 'string',
126
+ default: '.'
127
+ }
128
+
129
+ }
@@ -15,7 +15,8 @@
15
15
  }
16
16
  },
17
17
  "..": {
18
- "version": "5.6.0",
18
+ "name": "aerospike",
19
+ "version": "6.2.0",
19
20
  "cpu": [
20
21
  "x64",
21
22
  "arm64"
@@ -28,28 +29,36 @@
28
29
  "win32"
29
30
  ],
30
31
  "dependencies": {
31
- "@mapbox/node-pre-gyp": "^1.0.11",
32
+ "ansi-colors": "^4.1.3",
32
33
  "bindings": "^1.5.0",
33
34
  "minimatch": "^3.1.2",
34
- "nan": "^2.17.0",
35
- "node-gyp": "^8.4.1"
35
+ "nan": "^2.22.0",
36
+ "node-gyp": "^10.1.0",
37
+ "npm-run-all": "^4.1.5"
36
38
  },
37
39
  "devDependencies": {
38
- "@types/node": "^17.0.45",
39
- "chai": "^4.3.7",
40
+ "@eslint/js": "^9.12.0",
41
+ "@mapbox/node-pre-gyp": "^1.0.11",
42
+ "@types/node": "^22.7.4",
43
+ "chai": "^4.4.1",
40
44
  "choma": "^1.2.1",
41
45
  "codecov": "^3.8.3",
42
46
  "deep-eql": "^4.1.3",
43
- "dirty-chai": "^2.0.1",
44
- "husky": "^7.0.4",
45
- "mocha": "^9.2.2",
47
+ "eslint": "^8.57.1",
48
+ "globals": "^15.11.0",
49
+ "husky": "^9.0.11",
50
+ "mocha": "^10.4.0",
46
51
  "mocha-clean": "^1.0.0",
47
52
  "nyc": "^15.1.0",
48
53
  "p-throttle": "^3.1.0",
49
- "semver": "^7.5.4",
50
- "standard": "^16.0.4",
51
- "tmp": "^0.1.0",
52
- "yargs": "^15.4.1"
54
+ "semver": "^7.6.0",
55
+ "standard": "^17.1.0",
56
+ "tmp": "^0.2.3",
57
+ "typedoc": "^0.26.7",
58
+ "typedoc-plugin-rename-defaults": "^0.7.1",
59
+ "typescript": "^5.6.2",
60
+ "typescript-eslint": "^8.8.1",
61
+ "yargs": "^17.7.2"
53
62
  },
54
63
  "engines": {
55
64
  "node": ">=4"
package/examples/run.js CHANGED
@@ -24,10 +24,13 @@ const commands = [
24
24
  'append',
25
25
  'apply',
26
26
  'batch',
27
+ 'connect',
28
+ 'dynamicConfig',
27
29
  'exists',
28
30
  'geospatialMonteCarlo',
29
31
  'get',
30
32
  'info',
33
+ 'metrics',
31
34
  'mrtAbort',
32
35
  'mrtCommit',
33
36
  'operate',