aerospike 5.9.0 → 5.11.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 (81) hide show
  1. package/README.md +6 -2
  2. package/examples/typescript.ts +23 -0
  3. package/lib/binding/node-v108-darwin-arm64/aerospike.node +0 -0
  4. package/lib/binding/node-v108-darwin-x64/aerospike.node +0 -0
  5. package/lib/binding/node-v108-win32-x64/aerospike.dll +0 -0
  6. package/lib/binding/node-v108-win32-x64/aerospike.node +0 -0
  7. package/lib/binding/node-v115-darwin-arm64/aerospike.node +0 -0
  8. package/lib/binding/node-v115-darwin-x64/aerospike.node +0 -0
  9. package/lib/binding/node-v115-win32-x64/aerospike.dll +0 -0
  10. package/lib/binding/node-v115-win32-x64/aerospike.node +0 -0
  11. package/lib/binding/node-v120-darwin-arm64/aerospike.node +0 -0
  12. package/lib/binding/node-v120-darwin-x64/aerospike.node +0 -0
  13. package/lib/binding/node-v120-win32-x64/aerospike.dll +0 -0
  14. package/lib/binding/node-v120-win32-x64/aerospike.node +0 -0
  15. package/lib/binding/node-v120-win32-x64/event_core.dll +0 -0
  16. package/lib/binding/node-v120-win32-x64/getopt.dll +0 -0
  17. package/lib/binding/node-v120-win32-x64/libeay32.dll +0 -0
  18. package/lib/binding/node-v120-win32-x64/pthreadVC2.dll +0 -0
  19. package/lib/binding/node-v120-win32-x64/ssleay32.dll +0 -0
  20. package/lib/binding/node-v120-win32-x64/zlib.dll +0 -0
  21. package/lib/binding/openssl@1/node-v108-linux-arm64/aerospike.node +0 -0
  22. package/lib/binding/openssl@1/node-v108-linux-x64/aerospike.node +0 -0
  23. package/lib/binding/openssl@1/node-v115-linux-arm64/aerospike.node +0 -0
  24. package/lib/binding/openssl@1/node-v115-linux-x64/aerospike.node +0 -0
  25. package/lib/binding/openssl@1/node-v120-linux-arm64/aerospike.node +0 -0
  26. package/lib/binding/openssl@1/node-v120-linux-x64/aerospike.node +0 -0
  27. package/lib/binding/openssl@3/node-v108-linux-arm64/aerospike.node +0 -0
  28. package/lib/binding/openssl@3/node-v108-linux-x64/aerospike.node +0 -0
  29. package/lib/binding/openssl@3/node-v115-linux-arm64/aerospike.node +0 -0
  30. package/lib/binding/openssl@3/node-v115-linux-x64/aerospike.node +0 -0
  31. package/lib/binding/openssl@3/node-v120-linux-arm64/aerospike.node +0 -0
  32. package/lib/binding/openssl@3/node-v120-linux-x64/aerospike.node +0 -0
  33. package/lib/client.js +1 -1
  34. package/lib/lists.js +55 -0
  35. package/lib/policies/batch_write_policy.js +8 -0
  36. package/lib/policy.js +2 -1
  37. package/lib/status.js +31 -0
  38. package/lib/typedefs.js +2 -0
  39. package/package.json +12 -12
  40. package/scripts/build-package.ps1 +16 -0
  41. package/scripts/build-package.sh +1 -0
  42. package/scripts/prebuiltBinding.js +19 -3
  43. package/src/include/enums.h +1 -0
  44. package/src/main/client.cc +1 -1
  45. package/src/main/config.cc +20 -0
  46. package/src/main/enums/exp_enum.cc +1 -0
  47. package/src/main/enums/ttl.cc +1 -0
  48. package/src/main/list_operations.cc +25 -1
  49. package/src/main/policy.cc +10 -0
  50. package/src/main/util/conversions_batch.cc +1 -0
  51. package/test/admin.js +12 -9
  52. package/test/batch_apply.js +2 -1
  53. package/test/batch_exists.js +2 -1
  54. package/test/batch_get.js +2 -1
  55. package/test/batch_read.js +12 -11
  56. package/test/batch_remove.js +2 -1
  57. package/test/batch_select.js +2 -1
  58. package/test/batch_write.js +68 -11
  59. package/test/client.js +8 -7
  60. package/test/config.js +2 -1
  61. package/test/enterprise.js +2 -2
  62. package/test/error.js +5 -4
  63. package/test/exists.js +5 -4
  64. package/test/exp.js +11 -0
  65. package/test/exp_map.js +0 -2
  66. package/test/index.js +4 -4
  67. package/test/index_job.js +3 -2
  68. package/test/info.js +8 -7
  69. package/test/key.js +37 -36
  70. package/test/lists.js +64 -0
  71. package/test/maps.js +54 -46
  72. package/test/operate.js +3 -2
  73. package/test/policy.js +11 -10
  74. package/test/put.js +1 -1
  75. package/test/query.js +231 -169
  76. package/test/remove.js +3 -3
  77. package/test/scan.js +9 -8
  78. package/test/stats.js +3 -2
  79. package/test/test_helper.js +0 -2
  80. package/typings/index.d.ts +25 -23
  81. package/scripts/build-c-client.sh-cclient-output.log +0 -365
package/README.md CHANGED
@@ -18,7 +18,7 @@ It supports the following operating systems:
18
18
  - Amazon Linux 2023
19
19
  - Ubuntu 20.04/22.04 (Focal Fossa, Jammy Jellyfish)
20
20
  - Many Linux distributions compatible with one of the above OS releases.
21
- - macOS 12/13
21
+ - macOS 12/13/14
22
22
 
23
23
  The client is compatible with arm64, aarch64, and x86_64 architectures.
24
24
 
@@ -71,7 +71,7 @@ record using the Aerospike database.
71
71
  ```js
72
72
  const Aerospike = require('aerospike')
73
73
 
74
- // INSERT HOSTNAME AND PORT NUMBER OF AEROPSIKE SERVER NODE HERE!
74
+ // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
75
75
  const config = {
76
76
  hosts: '192.168.33.10:3000',
77
77
  }
@@ -188,6 +188,10 @@ To install library prerequisites using `apt`:
188
188
  sudo apt install g++ libssl libssl-dev zlib1g-dev
189
189
  ```
190
190
 
191
+ ### Windows
192
+
193
+ See our [Windows README.md](https://github.com/aerospike/aerospike-client-nodejs/blob/master/README_WINDOWS.md) for details on how to build and install on windows.
194
+
191
195
  ### macOS
192
196
 
193
197
  Before starting with the Aerospike Nodejs Client, verify that you have the following prerequisites:
@@ -0,0 +1,23 @@
1
+ import * as Aerospike from 'aerospike';
2
+
3
+ (async function () {
4
+ let client = null;
5
+ try {
6
+ client = await Aerospike.connect();
7
+ const key = new Aerospike.Key('test', 'test', 'abcd');
8
+ const bins = {
9
+ name: 'Norma',
10
+ age: 31
11
+ };
12
+
13
+ await client.put(key, bins);
14
+ const record = await client.get(key);
15
+ console.info('Record:', record);
16
+ await client.remove(key);
17
+ } catch (error) {
18
+ console.error('Error:', error);
19
+ process.exit(1);
20
+ } finally {
21
+ if (client) client.close();
22
+ }
23
+ })();
package/lib/client.js CHANGED
@@ -1471,7 +1471,7 @@ Client.prototype.batchWrite = function (records, policy, callback) {
1471
1471
  * const Aerospike = require('aerospike')
1472
1472
  * var path = require('path');
1473
1473
  *
1474
- * // INSERT HOSTNAME AND PORT NUMBER OF AEROPSIKE SERVER NODE HERE!
1474
+ * // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
1475
1475
  * const config = {
1476
1476
  * hosts: '192.168.33.10:3000',
1477
1477
  * // Timeouts disabled, latency dependent on server location. Configure as needed.
package/lib/lists.js CHANGED
@@ -1079,6 +1079,61 @@ exports.clear = function (bin) {
1079
1079
  return new ListOperation(opcodes.LIST_CLEAR, bin)
1080
1080
  }
1081
1081
 
1082
+ /**
1083
+ * @summary Creates list create operation.
1084
+ *
1085
+ *
1086
+ * @param {string} bin - bin name.
1087
+ * @param {number} order - list order.
1088
+ * @parm {boolean} pad - If true, the context is allowed to be beyond list boundaries. In that case, nil
1089
+ * list entries will be inserted to satisfy the context position.
1090
+ * @param {boolean} persistIndex - If true, persist list index. A list index improves lookup performance,
1091
+ * but requires more storage. A list index can be created for a top-level ordered list only. Nested and
1092
+ * unordered list indexes are not supported.
1093
+ * @param {number} ctx - optional path to nested list. If not defined, the top-level list is used.
1094
+ *
1095
+ * @returns {Object} Operation that can be passed to the {@link Client#operate} command.
1096
+ *
1097
+ * @example
1098
+ *
1099
+ * const Aerospike = require('aerospike')
1100
+ * const lists = Aerospike.lists
1101
+ * const key = new Aerospike.Key('test', 'demo', 'listKey')
1102
+ *
1103
+ * // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
1104
+ * var config = {
1105
+ * hosts: '192.168.33.10:3000',
1106
+ * // Timeouts disabled, latency dependent on server location. Configure as needed.
1107
+ * policies: {
1108
+ * operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0})
1109
+ * }
1110
+ * }
1111
+ *
1112
+ * Aerospike.connect(config).then(async client => {
1113
+ * let ops = [
1114
+ * lists.create('list', lists.order.ORDERED, false, true)
1115
+ * ]
1116
+ * let result = await client.operate(key, ops)
1117
+ * console.log(result.bins) // => { list: null }
1118
+ * let record = await client.get(key)
1119
+ * console.log(record.bins) // => { list: [] }
1120
+ *
1121
+ * await client.remove(key)
1122
+ * client.close()
1123
+ * })
1124
+ */
1125
+ exports.create = function (bin, order, pad = false, persistIndex = false, ctx) {
1126
+ const op = new ListOperation(opcodes.LIST_CREATE, bin)
1127
+ op.order = order
1128
+ op.pad = pad
1129
+ op.persistIndex = persistIndex
1130
+ if (ctx === undefined) {
1131
+ return op
1132
+ }
1133
+
1134
+ return op.withContext(ctx)
1135
+ }
1136
+
1082
1137
  /**
1083
1138
  * @summary Sets the list element at the specified index to a new value.
1084
1139
  * @description This operation returns no result.
@@ -36,6 +36,14 @@ class BatchWritePolicy {
36
36
  *
37
37
  */
38
38
  this.filterExpression = props.filterExpression
39
+
40
+ /**
41
+ * The time-to-live (expiration) of the record in seconds.
42
+ *
43
+ * @type number
44
+ */
45
+ this.ttl = props.ttl
46
+
39
47
  /**
40
48
  * Specifies the behavior for the key.
41
49
  *
package/lib/policy.js CHANGED
@@ -60,7 +60,7 @@ const AdminPolicy = require('./policies/admin_policy')
60
60
  * * {@link WritePolicy} - Applies to {@link Client#put}.
61
61
  * * {@link BatchPolicy} - Applies to {@link Client#batchRead} as well as the
62
62
  * deprecated {@link Client#batchExists}, {@link Client#batchGet}, and {@link
63
- * Client#batchSelect} operations.
63
+ * Client#batchSelect} operations. Also used when providing batchParentWrite policy to a client configuration.
64
64
  * * {@link BatchApplyPolicy} - Applies to {@link Client#batchApply}.
65
65
  * * {@link BatchReadPolicy} - Applies to {@link Client#batchRead}.
66
66
  * * {@link BatchRemovePolicy} - Applies to {@link Client#batchRemove}.
@@ -443,6 +443,7 @@ function policyClass (type) {
443
443
  case 'batchRead': return BatchReadPolicy
444
444
  case 'batchRemove': return BatchRemovePolicy
445
445
  case 'batchWrite': return BatchWritePolicy
446
+ case 'batchParentWrite': return BatchPolicy
446
447
  case 'batchApply': return BatchApplyPolicy
447
448
  case 'commandQueue': return CommandQueuePolicy
448
449
  case 'hll': return HLLPolicy
package/lib/status.js CHANGED
@@ -24,6 +24,37 @@ const as = require('bindings')('aerospike.node')
24
24
  * @description Database operation error codes.
25
25
  */
26
26
 
27
+ /**
28
+ * One or more keys failed in a batch.
29
+ * @const {number}
30
+ */
31
+ exports.BATCH_FAILED = exports.AEROSPIKE_BATCH_FAILED = as.status.AEROSPIKE_BATCH_FAILED
32
+
33
+ /**
34
+ * No response received from server.
35
+ * @const {number}
36
+ */
37
+ exports.NO_RESPONSE = exports.AEROSPIKE_NO_RESPONSE = as.status.AEROSPIKE_NO_RESPONSE
38
+
39
+ /**
40
+ * Max errors limit reached.
41
+ * @const {number}
42
+ */
43
+ exports.MAX_ERROR_RATE = exports.AEROSPIKE_MAX_ERROR_RATE = as.status.AEROSPIKE_MAX_ERROR_RATE
44
+
45
+ /**
46
+ * Abort split batch retry and use normal node retry instead.
47
+ * Used internally and should not be returned to user.
48
+ * @const {number}
49
+ */
50
+ exports.USE_NORMAL_RETRY = exports.AEROSPIKE_USE_NORMAL_RETRY = as.status.AEROSPIKE_USE_NORMAL_RETRY
51
+
52
+ /**
53
+ * Max retries limit reached.
54
+ * @const {number}
55
+ */
56
+ exports.ERR_MAX_RETRIES_EXCEEDED = exports.AEROSPIKE_ERR_MAX_RETRIES_EXCEEDED = as.status.AEROSPIKE_ERR_MAX_RETRIES_EXCEEDED
57
+
27
58
  /**
28
59
  * Async command delay queue is full.
29
60
  * @const {number}
package/lib/typedefs.js CHANGED
@@ -229,6 +229,8 @@
229
229
  *
230
230
  * @property {ApplyPolicy} apply - Default apply policy
231
231
  * @property {BatchPolicy} batch - Default batch policy
232
+ * @property {BatchPolicy} batchWrite - Default write policy used in batch operate commands. Contains a {@link BatchWritePolicy}.
233
+ * @property {BatchPolicy} batchParentWrite - Default parent policy used in batch write commands. Contains a {@link BatchPolicy}.
232
234
  * @property {InfoPolicy} info - Default info policy
233
235
  * @property {OperatePolicy} operate - Default operate policy
234
236
  * @property {ReadPolicy} read - Default read policy
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aerospike",
3
- "version": "5.9.0",
3
+ "version": "5.11.0",
4
4
  "description": "Aerospike Client Library",
5
5
  "keywords": [
6
6
  "aerospike",
@@ -42,6 +42,7 @@
42
42
  "install": "npm-run-all removeExtraBinaries build",
43
43
  "build": "node-pre-gyp install --fallback-to-build",
44
44
  "test": "mocha",
45
+ "test-dry-run": "mocha --dry-run",
45
46
  "test-noserver": "GLOBAL_CLIENT=false mocha -g '#noserver'",
46
47
  "lint": "standard",
47
48
  "posttest": "npm run lint",
@@ -58,26 +59,25 @@
58
59
  "@mapbox/node-pre-gyp": "^1.0.11",
59
60
  "bindings": "^1.5.0",
60
61
  "minimatch": "^3.1.2",
61
- "nan": "^2.17.0",
62
- "node-gyp": "^8.4.1"
62
+ "nan": "^2.18.0",
63
+ "node-gyp": "^10.0.1",
64
+ "npm-run-all": "^4.1.5"
63
65
  },
64
66
  "devDependencies": {
65
- "@types/node": "^17.0.45",
67
+ "@types/node": "^20.11.18",
66
68
  "chai": "^4.3.7",
67
69
  "choma": "^1.2.1",
68
70
  "codecov": "^3.8.3",
69
71
  "deep-eql": "^4.1.3",
70
- "dirty-chai": "^2.0.1",
71
- "husky": "^7.0.4",
72
- "mocha": "^9.2.2",
72
+ "husky": "^9.0.11",
73
+ "mocha": "^10.3.0",
73
74
  "mocha-clean": "^1.0.0",
74
- "npm-run-all": "^4.1.5",
75
75
  "nyc": "^15.1.0",
76
76
  "p-throttle": "^3.1.0",
77
- "semver": "^7.5.4",
78
- "standard": "^16.0.4",
79
- "tmp": "^0.1.0",
80
- "yargs": "^15.4.1"
77
+ "semver": "^7.6.0",
78
+ "standard": "^17.1.0",
79
+ "tmp": "^0.2.1",
80
+ "yargs": "^17.7.2"
81
81
  },
82
82
  "standard": {
83
83
  "ignore": [
@@ -36,7 +36,23 @@ function build_nodejs_client {
36
36
 
37
37
  build_nodejs_client v18
38
38
  Copy-Item -Recurse build\release\* lib\binding\node-v108-win32-x64
39
+ Remove-Item .\lib\binding\node-v108-win32-x64\obj
40
+ Remove-Item .\lib\binding\node-v108-win32-x64\aerospike.pdb
41
+ Remove-Item .\lib\binding\node-v108-win32-x64\aerospike.ipdb
42
+ Remove-Item .\lib\binding\node-v108-win32-x64\aerospike.iobj
43
+
39
44
  build_nodejs_client v20
40
45
  Copy-Item -Recurse build\release\* lib\binding\node-v115-win32-x64
46
+ Remove-Item -Recurse .\lib\binding\node-v115-win32-x64\obj
47
+ Remove-Item .\lib\binding\node-v115-win32-x64\aerospike.pdb
48
+ Remove-Item .\lib\binding\node-v115-win32-x64\aerospike.ipdb
49
+ Remove-Item .\lib\binding\node-v115-win32-x64\aerospike.iobj
50
+
51
+ build_nodejs_client v21
52
+ Copy-Item -Recurse build\release\* lib\binding\node-v120-win32-x64
53
+ Remove-Item -Recurse .\lib\binding\node-v120-win32-x64\obj
54
+ Remove-Item .\lib\binding\node-v120-win32-x64\aerospike.pdb
55
+ Remove-Item .\lib\binding\node-v120-win32-x64\aerospike.ipdb
56
+ Remove-Item .\lib\binding\node-v120-win32-x64\aerospike.iobj
41
57
 
42
58
  nvm use v18.12.1
@@ -56,6 +56,7 @@ rm -rf ${AEROSPIKE_NODEJS_RELEASE_HOME}/node-*-${OS_FLAVOR}-*
56
56
 
57
57
  build_nodejs_client v18
58
58
  build_nodejs_client v20
59
+ build_nodejs_client v21
59
60
 
60
61
  nvm use v20
61
62
 
@@ -11,40 +11,56 @@ const rm = util.promisify(fs.rm)
11
11
  const arch = await os.arch()
12
12
 
13
13
  if (platform === 'darwin') {
14
+ rm('lib/binding/node-v120-win32-x64', { recursive: true, force: true })
14
15
  rm('lib/binding/node-v115-win32-x64', { recursive: true, force: true })
15
16
  rm('lib/binding/node-v108-win32-x64', { recursive: true, force: true })
16
17
  if (arch === 'x64') {
18
+ rm('lib/binding/node-v120-darwin-arm64', { recursive: true, force: true })
17
19
  rm('lib/binding/node-v115-darwin-arm64', { recursive: true, force: true })
18
20
  rm('lib/binding/node-v108-darwin-arm64', { recursive: true, force: true })
19
21
  } else {
22
+ rm('lib/binding/node-v120-darwin-x64', { recursive: true, force: true })
20
23
  rm('lib/binding/node-v115-darwin-x64', { recursive: true, force: true })
21
24
  rm('lib/binding/node-v108-darwin-x64', { recursive: true, force: true })
22
25
  }
23
26
  await rm('lib/binding/openssl@3', { recursive: true, force: true })
24
27
  await rm('lib/binding/openssl@1', { recursive: true, force: true })
25
28
  } else if (platform === 'win32') {
29
+ rm('lib/binding/node-v120-darwin-arm64', { recursive: true, force: true })
26
30
  rm('lib/binding/node-v115-darwin-arm64', { recursive: true, force: true })
27
31
  rm('lib/binding/node-v108-darwin-arm64', { recursive: true, force: true })
32
+ rm('lib/binding/node-v120-darwin-x64', { recursive: true, force: true })
28
33
  rm('lib/binding/node-v115-darwin-x64', { recursive: true, force: true })
29
34
  rm('lib/binding/node-v108-darwin-x64', { recursive: true, force: true })
30
35
  await rm('lib/binding/openssl@3', { recursive: true, force: true })
31
36
  await rm('lib/binding/openssl@1', { recursive: true, force: true })
32
37
  } else {
38
+ rm('lib/binding/node-v120-win32-x64', { recursive: true, force: true })
33
39
  rm('lib/binding/node-v115-win32-x64', { recursive: true, force: true })
34
40
  rm('lib/binding/node-v108-win32-x64', { recursive: true, force: true })
41
+ rm('lib/binding/node-v120-darwin-arm64', { recursive: true, force: true })
35
42
  rm('lib/binding/node-v115-darwin-arm64', { recursive: true, force: true })
36
43
  rm('lib/binding/node-v108-darwin-arm64', { recursive: true, force: true })
44
+ rm('lib/binding/node-v120-darwin-x64', { recursive: true, force: true })
37
45
  rm('lib/binding/node-v115-darwin-x64', { recursive: true, force: true })
38
46
  rm('lib/binding/node-v108-darwin-x64', { recursive: true, force: true })
39
47
 
40
- const output = await exec('openssl version')
41
- const version = output.stdout
42
- const openssl = version.split(' ')[1].slice(0, 1)
48
+ const output = await exec("ldd --version | awk 'NR==1{print $NF}'")
49
+ const version = Number(output.stdout)
50
+
51
+ let openssl
52
+ if (version < 2.33) {
53
+ openssl = '1'
54
+ } else {
55
+ openssl = '3'
56
+ }
43
57
 
44
58
  if (arch === 'x64') {
59
+ await rename('lib/binding/openssl@' + openssl + '/node-v120-linux-x64', 'lib/binding/node-v120-linux-x64')
45
60
  await rename('lib/binding/openssl@' + openssl + '/node-v115-linux-x64', 'lib/binding/node-v115-linux-x64')
46
61
  await rename('lib/binding/openssl@' + openssl + '/node-v108-linux-x64', 'lib/binding/node-v108-linux-x64')
47
62
  } else {
63
+ await rename('lib/binding/openssl@' + openssl + '/node-v120-linux-arm64', 'lib/binding/node-v120-linux-arm64')
48
64
  await rename('lib/binding/openssl@' + openssl + '/node-v115-linux-arm64', 'lib/binding/node-v115-linux-arm64')
49
65
  await rename('lib/binding/openssl@' + openssl + '/node-v108-linux-arm64', 'lib/binding/node-v108-linux-arm64')
50
66
  }
@@ -21,6 +21,7 @@
21
21
  #define TTL_NAMESPACE_DEFAULT 0
22
22
  #define TTL_NEVER_EXPIRE -1
23
23
  #define TTL_DONT_UPDATE -2
24
+ #define TTL_CLIENT_DEFAULT -3
24
25
 
25
26
  v8::Local<v8::Object> auth_mode_enum_values();
26
27
  v8::Local<v8::Object> bitwise_enum_values();
@@ -108,7 +108,7 @@ NAN_METHOD(AerospikeClient::Connect)
108
108
  }
109
109
 
110
110
  /**
111
- * Close the connections to the Aeropsike cluster.
111
+ * Close the connections to the Aerospike cluster.
112
112
  */
113
113
  NAN_METHOD(AerospikeClient::Close)
114
114
  {
@@ -257,6 +257,26 @@ int config_from_jsobject(as_config *config, Local<Object> configObj,
257
257
  }
258
258
  }
259
259
 
260
+ policy_val = Nan::Get(policies_obj, Nan::New("batchWrite").ToLocalChecked())
261
+ .ToLocalChecked();
262
+ if (policy_val->IsObject()) {
263
+ if ((rc = batchwrite_policy_from_jsobject(&policies->batch_write,
264
+ policy_val.As<Object>(),
265
+ log)) != AS_NODE_PARAM_OK) {
266
+ goto Cleanup;
267
+ }
268
+ }
269
+
270
+ policy_val = Nan::Get(policies_obj, Nan::New("batchParentWrite").ToLocalChecked())
271
+ .ToLocalChecked();
272
+ if (policy_val->IsObject()) {
273
+ if ((rc = batchpolicy_from_jsobject(&policies->batch_parent_write,
274
+ policy_val.As<Object>(),
275
+ log)) != AS_NODE_PARAM_OK) {
276
+ goto Cleanup;
277
+ }
278
+ }
279
+
260
280
  policy_val = Nan::Get(policies_obj, Nan::New("info").ToLocalChecked())
261
281
  .ToLocalChecked();
262
282
  if (policy_val->IsObject()) {
@@ -128,6 +128,7 @@ Local<Object> exp_opcode_values()
128
128
 
129
129
  Local<Object> exp_type = Nan::New<Object>();
130
130
  set(exp_type, "NIL", as_exp_type::AS_EXP_TYPE_NIL);
131
+ set(exp_type, "BOOL", as_exp_type::AS_EXP_TYPE_BOOL);
131
132
  set(exp_type, "INT", as_exp_type::AS_EXP_TYPE_INT);
132
133
  set(exp_type, "STR", as_exp_type::AS_EXP_TYPE_STR);
133
134
  set(exp_type, "LIST", as_exp_type::AS_EXP_TYPE_LIST);
@@ -31,5 +31,6 @@ Local<Object> ttl_enum_values()
31
31
  set(obj, "NAMESPACE_DEFAULT", TTL_NAMESPACE_DEFAULT);
32
32
  set(obj, "NEVER_EXPIRE", TTL_NEVER_EXPIRE);
33
33
  set(obj, "DONT_UPDATE", TTL_DONT_UPDATE);
34
+ set(obj, "CLIENT_DEFAULT", TTL_CLIENT_DEFAULT);
34
35
  return scope.Escape(obj);
35
36
  }
@@ -1032,6 +1032,29 @@ bool add_list_increment_op(as_operations *ops, const char *bin,
1032
1032
  return true;
1033
1033
  }
1034
1034
 
1035
+ bool add_list_create_op(as_operations *ops, const char *bin,
1036
+ as_cdt_ctx *context, Local<Object> op, LogInfo *log)
1037
+ {
1038
+ as_list_order order;
1039
+ if (get_uint32_property((uint32_t*)&order, op, "order", log) != AS_NODE_PARAM_OK) {
1040
+ return false;
1041
+ }
1042
+
1043
+ bool pad;
1044
+ if (get_bool_property(&pad, op, "pad", log) != AS_NODE_PARAM_OK) {
1045
+ return false;
1046
+ }
1047
+
1048
+ bool persist_index;
1049
+ if (get_bool_property(&persist_index, op, "persistIndex", log) != AS_NODE_PARAM_OK) {
1050
+ return false;
1051
+ }
1052
+
1053
+ as_v8_debug(log, "order=%i, pad=%s, persist_index=%s", order, pad ? "true" : "false", persist_index ? "true" : "false");
1054
+ as_operations_list_create_all(ops, bin, context, order, pad, persist_index);
1055
+ return true;
1056
+ }
1057
+
1035
1058
  bool add_list_size_op(as_operations *ops, const char *bin, as_cdt_ctx *context,
1036
1059
  Local<Object> obj, LogInfo *log)
1037
1060
  {
@@ -1084,7 +1107,8 @@ const ops_table_entry ops_table[] = {
1084
1107
  {"LIST_GET_BY_RANK", add_list_get_by_rank_op},
1085
1108
  {"LIST_GET_BY_RANK_RANGE", add_list_get_by_rank_range_op},
1086
1109
  {"LIST_INCREMENT", add_list_increment_op},
1087
- {"LIST_SIZE", add_list_size_op}};
1110
+ {"LIST_SIZE", add_list_size_op},
1111
+ {"LIST_CREATE", add_list_create_op}};
1088
1112
 
1089
1113
  int add_list_op(as_operations *ops, uint32_t opcode, Local<Object> op,
1090
1114
  LogInfo *log)
@@ -436,6 +436,11 @@ int batchwrite_policy_from_jsobject(as_policy_batch_write *policy,
436
436
  AS_NODE_PARAM_OK) {
437
437
  return rc;
438
438
  }
439
+ if ((rc = get_optional_uint32_property((uint32_t *)&policy->ttl,
440
+ NULL, obj, "ttl", log)) !=
441
+ AS_NODE_PARAM_OK) {
442
+ return rc;
443
+ }
439
444
  if ((rc = get_optional_uint32_property((uint32_t *)&policy->gen, NULL, obj,
440
445
  "gen", log)) != AS_NODE_PARAM_OK) {
441
446
  return rc;
@@ -445,6 +450,11 @@ int batchwrite_policy_from_jsobject(as_policy_batch_write *policy,
445
450
  AS_NODE_PARAM_OK) {
446
451
  return rc;
447
452
  }
453
+ if ((rc = get_optional_uint32_property((uint32_t *)&policy->ttl, NULL, obj,
454
+ "ttl", log)) !=
455
+ AS_NODE_PARAM_OK) {
456
+ return rc;
457
+ }
448
458
  if ((rc = get_optional_bool_property(&policy->durable_delete, NULL, obj,
449
459
  "durableDelete", log)) !=
450
460
  AS_NODE_PARAM_OK) {
@@ -204,6 +204,7 @@ int batch_write_record_from_jsobject(as_batch_records *batch_records,
204
204
  Local<Array> ops = maybeOps.As<Array>();
205
205
  as_v8_debug(log, "Adding operations to batch write record");
206
206
  record->ops = as_operations_new(ops->Length());
207
+ record->ops->ttl = AS_RECORD_CLIENT_DEFAULT_TTL;
207
208
  if (operations_from_jsarray(record->ops, ops, (LogInfo *)log) !=
208
209
  AS_NODE_PARAM_OK) {
209
210
  as_v8_error(
package/test/admin.js CHANGED
@@ -20,7 +20,6 @@
20
20
 
21
21
  const Aerospike = require('../lib/aerospike')
22
22
  const helper = require('./test_helper')
23
- const options = require('./util/options')
24
23
 
25
24
  function getRandomInt (max) {
26
25
  return Math.floor(Math.random() * max)
@@ -440,7 +439,7 @@ context('admin commands', async function () {
440
439
  // Should fail, assert failure if error is not returned.
441
440
  expect(1).to.equal(2)
442
441
  } catch (error) {
443
- expect(error).to.exist().and.have.property('code', Aerospike.status.INVALID_ROLE)
442
+ expect(error).to.exist.and.have.property('code', Aerospike.status.INVALID_ROLE)
444
443
  }
445
444
  })
446
445
 
@@ -452,7 +451,7 @@ context('admin commands', async function () {
452
451
  // Should fail, assert failure if error is not returned.
453
452
  expect(1).to.equal(2)
454
453
  } catch (error) {
455
- expect(error).to.exist().and.have.property('code', Aerospike.status.INVALID_ROLE)
454
+ expect(error).to.exist.and.have.property('code', Aerospike.status.INVALID_ROLE)
456
455
  }
457
456
  })
458
457
  })
@@ -460,24 +459,28 @@ context('admin commands', async function () {
460
459
  describe('Client#changePassword()', function () {
461
460
  it('Changes password for user', async function () {
462
461
  client.changePassword(username1, 'password350', null)
462
+ await wait(waitMs + 30000)
463
463
  const config = {
464
- hosts: options.host + ':' + options.port,
464
+ hosts: helper.config.hosts,
465
465
  user: username1,
466
466
  password: 'password350'
467
467
  }
468
468
  const dummyClient = await Aerospike.connect(config)
469
- dummyClient.close()
469
+ return dummyClient.close()
470
470
  })
471
471
 
472
472
  it('With policy', async function () {
473
473
  client.changePassword(username2, 'password250', policy)
474
+ await wait(waitMs + 3000)
475
+
474
476
  const config = {
475
- hosts: options.host + ':' + options.port,
477
+ hosts: helper.config.hosts,
476
478
  user: username2,
477
479
  password: 'password250'
478
480
  }
481
+
479
482
  const dummyClient = await Aerospike.connect(config)
480
- dummyClient.close()
483
+ return dummyClient.close()
481
484
  })
482
485
  })
483
486
 
@@ -490,7 +493,7 @@ context('admin commands', async function () {
490
493
  // Should fail, assert failure if error is not returned.
491
494
  expect(1).to.equal(2)
492
495
  } catch (error) {
493
- expect(error).to.exist().and.have.property('code', Aerospike.status.INVALID_USER)
496
+ expect(error).to.exist.and.have.property('code', Aerospike.status.INVALID_USER)
494
497
  }
495
498
  })
496
499
  it('With policy', async function () {
@@ -501,7 +504,7 @@ context('admin commands', async function () {
501
504
  // Should fail, assert failure if error is not returned.
502
505
  expect(1).to.equal(2)
503
506
  } catch (error) {
504
- expect(error).to.exist().and.have.property('code', Aerospike.status.INVALID_USER)
507
+ expect(error).to.exist.and.have.property('code', Aerospike.status.INVALID_USER)
505
508
  }
506
509
  })
507
510
  })