aerospike 5.0.0 → 5.0.1

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 (37) hide show
  1. package/binding.gyp +2 -3
  2. package/examples/put_test.js +72 -0
  3. package/lib/binding/node-v102-darwin-x64/aerospike.node +0 -0
  4. package/lib/binding/node-v102-linux-x64/aerospike.node +0 -0
  5. package/lib/binding/node-v102-win32-x64/aerospike.node +0 -0
  6. package/lib/binding/node-v108-darwin-x64/aerospike.node +0 -0
  7. package/lib/binding/node-v108-linux-x64/aerospike.node +0 -0
  8. package/lib/binding/node-v108-win32-x64/aerospike.node +0 -0
  9. package/lib/binding/node-v64-darwin-x64/aerospike.node +0 -0
  10. package/lib/binding/node-v64-linux-x64/aerospike.node +0 -0
  11. package/lib/binding/node-v64-win32-x64/aerospike.node +0 -0
  12. package/lib/binding/node-v72-darwin-x64/aerospike.node +0 -0
  13. package/lib/binding/node-v72-linux-x64/aerospike.node +0 -0
  14. package/lib/binding/node-v72-win32-x64/aerospike.node +0 -0
  15. package/lib/binding/node-v83-darwin-x64/aerospike.node +0 -0
  16. package/lib/binding/node-v83-linux-x64/aerospike.node +0 -0
  17. package/lib/binding/node-v83-win32-x64/aerospike.node +0 -0
  18. package/lib/binding/node-v93-darwin-x64/aerospike.node +0 -0
  19. package/lib/binding/node-v93-linux-x64/aerospike.node +0 -0
  20. package/lib/binding/node-v93-win32-x64/aerospike.node +0 -0
  21. package/lib/client.js +12 -5
  22. package/lib/record.js +5 -0
  23. package/package.json +3 -2
  24. package/scripts/build-commands.sh +57 -35
  25. package/scripts/build-package.sh +1 -1
  26. package/scripts/build-package.sh-cclient-output.log +482 -462
  27. package/test/remove_bin.js +48 -0
  28. package/typings/index.d.ts +1549 -0
  29. package/CHANGELOG.md +0 -730
  30. package/benchmarks/.npmignore +0 -1
  31. package/benchmarks/package-lock.json +0 -4554
  32. package/examples/.npmignore +0 -1
  33. package/examples/package-lock.json +0 -173
  34. package/lib/.DS_Store +0 -0
  35. package/scripts/build-c-client.sh-cclient-output.log +0 -485
  36. package/scripts/build-c-client.sh-libuv-output.log +0 -115
  37. package/scripts/build-package.sh-libuv-output.log +0 -118
package/binding.gyp CHANGED
@@ -138,7 +138,6 @@
138
138
  'conditions': [
139
139
  ['OS=="linux"',{
140
140
  'libraries': [
141
- '../libuv-v1.8.0/.libs/libuv.a',
142
141
  '../aerospike-client-c/target/Linux-x86_64/lib/libaerospike.a',
143
142
  '-lz',
144
143
  '-lssl'
@@ -156,9 +155,9 @@
156
155
  }],
157
156
  ['OS=="mac"',{
158
157
  'libraries': [
159
- '../libuv-v1.8.0/.libs/libuv.a',
160
158
  '../aerospike-client-c/target/Darwin-x86_64/lib/libaerospike.a',
161
- '-lz'
159
+ '-lz',
160
+ '-lssl'
162
161
  ],
163
162
  'defines': [
164
163
  'AS_USE_LIBUV'
@@ -0,0 +1,72 @@
1
+ const Aerospike = require('aerospike')
2
+
3
+ const config = {
4
+ hosts: '172.17.0.3:3000',
5
+ log: {
6
+ level: Aerospike.log.DEBUG,
7
+ file: process.stdout.fd
8
+ }
9
+ }
10
+ const key = new Aerospike.Key('test', 'demo', 'demo')
11
+
12
+ // process.on('uncaughtException', (err, origin) => {
13
+ // fs.writeSync(
14
+ // process.stderr.fd,
15
+ // `Caught exception: ${err}\n` +
16
+ // `Exception origin: ${origin}`
17
+ // );
18
+ // });
19
+
20
+ console.log('Connect')
21
+ Aerospike.connect(config)
22
+ .then(client => {
23
+ const bins = {
24
+ i: 123,
25
+ s: 'hello',
26
+ b: Buffer.from('world'),
27
+ d: new Aerospike.Double(3.1415),
28
+ g: new Aerospike.GeoJSON({ type: 'Point', coordinates: [103.913, 1.308] }),
29
+ l: [1, 'a', { x: 'y' }],
30
+ m: { foo: 4, bar: 7 }
31
+ }
32
+ const meta = { ttl: 0 }
33
+ const policy = new Aerospike.WritePolicy({
34
+ exists: Aerospike.policy.exists.CREATE_OR_REPLACE,
35
+ timeout: 20000
36
+ })
37
+
38
+ console.log('Put')
39
+ return client.put(key, bins, meta, policy)
40
+ .then(() => {
41
+ const ops = [
42
+ Aerospike.operations.incr('i', 1),
43
+ Aerospike.operations.read('i'),
44
+ Aerospike.lists.append('l', 'z'),
45
+ Aerospike.maps.removeByKey('m', 'bar')
46
+ ]
47
+
48
+ console.log('Operate')
49
+ return client.operate(key, ops)
50
+ })
51
+ .then(result => {
52
+ console.log(result.bins) // => { c: 4, i: 124, m: null }
53
+
54
+ return client.get(key)
55
+ })
56
+ .then(record => {
57
+ console.log(record.bins) // => { i: 124,
58
+ // s: 'hello',
59
+ // b: <Buffer 77 6f 72 6c 64>,
60
+ // d: 3.1415,
61
+ // g: '{"type":"Point","coordinates":[103.913,1.308]}',
62
+ // l: [ 1, 'a', { x: 'y' }, 'z' ],
63
+ // m: { foo: 4 } }
64
+ })
65
+ .then(() => client.close())
66
+ .catch(error => {
67
+ console.log('Error')
68
+ client.close()
69
+ return Promise.reject(error)
70
+ })
71
+ })
72
+ .catch(error => console.log(error))
package/lib/client.js CHANGED
@@ -346,8 +346,9 @@ Client.prototype.batchGet = function (keys, policy, callback) {
346
346
  * This method allows different namespaces/bins to be requested for each key in
347
347
  * the batch. This method requires server >= 3.6.0.
348
348
  *
349
- * @param {object[]} records - List of keys and bins to retrieve.
350
- * @param {Key} records[].key - Key to retrieve.
349
+ * @param {object[]} records - {@link Record} List of keys and bins to retrieve.
350
+ * @param {type} records[].type - {@link Record#type} Batch type.
351
+ * @param {Key} records[].key - Record Key.
351
352
  * @param {string[]} [records[].bins] - List of bins to retrieve.
352
353
  * @param {boolean} [records[].readAllBins] - Whether to retrieve all bins or
353
354
  * just the meta data of the record. If true, ignore <code>bins</code> and read
@@ -404,7 +405,9 @@ Client.prototype.batchRead = function (records, policy, callback) {
404
405
  * This method allows different sub-commands for each key in the batch.
405
406
  * This method requires server >= 6.0.0.
406
407
  *
407
- * @param {object[]} records - List of batch sub-commands to perform.
408
+ * @param {object[]} records - {@link Record} List of batch sub-commands to perform.
409
+ * @param {type} records[].type - {@link Record#type} Batch type.
410
+ * @param {Key} records[].key - Record Key.
408
411
  * @param {BatchPolicy} [policy] - The Batch Policy to use for this operation.
409
412
  * @param {batchRecordsCallback} [callback] - The function to call when
410
413
  * the operation completes, with the results of the batch operation.
@@ -479,7 +482,9 @@ Client.prototype.batchWrite = function (records, policy, callback) {
479
482
  * This method allows multiple sub-commands for each key in the batch.
480
483
  * This method requires server >= 6.0.0.
481
484
  *
482
- * @param {object[]} records - List of batch sub-commands to perform.
485
+ * @param {object[]} records - {@link Record} List of batch sub-commands to perform.
486
+ * @param {type} records[].type - {@link Record#type} Batch type.
487
+ * @param {Key} records[].key - Record Key.
483
488
  * @param {object[]} udf - Server UDF module/function and argList to apply.
484
489
  * @param {BatchPolicy} [batchPolicy] - The Batch Policy to use for this operation.
485
490
  * @param {BatchApplyPolicy} [batchApplyPolicy] UDF policy configuration parameters.
@@ -566,7 +571,9 @@ Client.prototype.batchApply = function (records, udf, batchPolicy, batchApplyPol
566
571
  * This method allows multi sub-commands for each key in the batch.
567
572
  * This method requires server >= 6.0.0.
568
573
  *
569
- * @param {object[]} records - List of batch sub-commands to perform.
574
+ * @param {object[]} records - {@link Record} List of batch sub-commands to perform.
575
+ * @param {type} records[].type - {@link Record#type} Batch type.
576
+ * @param {Key} records[].key - Record Key.
570
577
  * @param {BatchPolicy} [batchPolicy] - The Batch Policy to use for this operation.
571
578
  * @param {BatchRemovePolicy} [batchRemovePolicy] Remove policy configuration parameters.
572
579
  * @param {batchRecordsCallback} [callback] - The function to call when
package/lib/record.js CHANGED
@@ -17,6 +17,11 @@
17
17
  'use strict'
18
18
 
19
19
  /**
20
+ * @class Record
21
+ * @classdesc Aerospike Record
22
+ *
23
+ * @summary Construct a new Aerospike Record instance.
24
+ *
20
25
  * A record with the Aerospike database consists of one or more record "bins"
21
26
  * (name-value pairs) and meta-data, incl. time-to-live and generation; a
22
27
  * record is uniquely identified by it's key within a given namespace.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aerospike",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Aerospike Client Library",
5
5
  "keywords": [
6
6
  "aerospike",
@@ -92,6 +92,7 @@
92
92
  "lib/",
93
93
  "scripts/",
94
94
  "src/",
95
- "test/"
95
+ "test/",
96
+ "typings/"
96
97
  ]
97
98
  }
@@ -33,21 +33,27 @@ LIBUV_DIR=libuv-v${LIBUV_VERSION}
33
33
  LIBUV_TAR=${LIBUV_DIR}.tar.gz
34
34
  LIBUV_URL=http://dist.libuv.org/dist/v1.8.0/${LIBUV_TAR}
35
35
  LIBUV_ABS_DIR=${CWD}/${LIBUV_DIR}
36
+ LIBUV_BUILD=0
36
37
 
37
38
  if [[ "$OSTYPE" == "linux-gnu"* ]]; then
38
39
  AEROSPIKE_LIB_HOME=${AEROSPIKE_C_HOME}/target/Linux-x86_64
39
40
  AEROSPIKE_LIBRARY=${AEROSPIKE_LIB_HOME}/lib/libaerospike.a
40
41
  AEROSPIKE_INCLUDE=${AEROSPIKE_LIB_HOME}/include
41
42
  LIBUV_LIBRARY_DIR=${LIBUV_DIR}/.libs
43
+ LIBUV_INCLUDE_DIR=${CWD}/${LIBUV_DIR}/include
42
44
  LIBUV_LIBRARY=${CWD}/${LIBUV_LIBRARY_DIR}/libuv.a
43
45
  OS_FLAVOR=linux
44
46
  elif [[ "$OSTYPE" == "darwin"* ]]; then
45
- # Mac OSX
47
+ # Mac OSX
46
48
  AEROSPIKE_LIB_HOME=${AEROSPIKE_C_HOME}/target/Darwin-x86_64
47
49
  AEROSPIKE_LIBRARY=${AEROSPIKE_LIB_HOME}/lib/libaerospike.a
48
50
  AEROSPIKE_INCLUDE=${AEROSPIKE_LIB_HOME}/include
49
- LIBUV_LIBRARY_DIR=${LIBUV_DIR}/.libs
50
- LIBUV_LIBRARY=${CWD}/${LIBUV_LIBRARY_DIR}/libuv.a
51
+
52
+ LIBUV_DIR=/usr/local/opt/libuv
53
+ LIBUV_ABS_DIR=${LIBUV_DIR}
54
+ LIBUV_LIBRARY_DIR=${LIBUV_DIR}/lib
55
+ LIBUV_INCLUDE_DIR=${LIBUV_DIR}/include
56
+ LIBUV_LIBRARY=${LIBUV_LIBRARY_DIR}/libuv.a
51
57
  OS_FLAVOR=darwin
52
58
  else
53
59
  # Unknown.
@@ -77,29 +83,34 @@ configure_nvm() {
77
83
  }
78
84
 
79
85
  download_libuv() {
80
- if [ ! -f ${LIBUV_TAR} ]; then
81
- echo Download ${LIBUV_URL}
82
- wget ${LIBUV_URL}
83
- fi
86
+ if [[ "$OSTYPE" != "darwin"* ]]; then
87
+ if [ ! -f ${LIBUV_TAR} ]; then
88
+ echo Download ${LIBUV_URL}
89
+ wget ${LIBUV_URL}
90
+ fi
84
91
 
85
- if [ ! -d ${LIBUV_DIR} ]; then
86
- echo Extract ${LIBUV_TAR}
87
- tar xf ${LIBUV_TAR}
92
+ if [ ! -d ${LIBUV_DIR} ]; then
93
+ echo Extract ${LIBUV_TAR}
94
+ tar xf ${LIBUV_TAR}
95
+ fi
88
96
  fi
89
97
  }
90
98
 
91
99
  rebuild_libuv() {
92
- # if [ ! -f ${LIBUV_LIBRARY} ]; then
93
- echo Make ${LIBUV_DIR}
94
- cd ${LIBUV_DIR}
95
- sh autogen.sh
96
- ./configure -q
97
- make clean
98
- make V=1 LIBUV_VERSIONBOSE=1 CFLAGS="-w -fPIC" 2>&1 | tee ${CWD}/${0}-libuv-output.log
99
- # make V=1 LIBUV_VERSIONBOSE=1 CFLAGS="-w -fPIC -DDEBUG" 2>&1 | tee ${CWD}/${0}-libuv-output.log
100
- # make V=1 LIBUV_VERSIONBOSE=1 install
101
- cd ..
102
- # fi
100
+ echo "rebuild_libuv"
101
+ if [ $LIBUV_BUILD -eq 1 ]; then
102
+ if [ ! -f ${LIBUV_LIBRARY} ]; then
103
+ echo "Make ${LIBUV_ABS_DIR}"
104
+ cd ${LIBUV_ABS_DIR}
105
+ sh autogen.sh
106
+ ./configure -q
107
+ make clean
108
+ make V=1 LIBUV_VERSIONBOSE=1 CFLAGS="-w -fPIC" 2>&1 | tee ${CWD}/${0}-libuv-output.log
109
+ # make V=1 LIBUV_VERSIONBOSE=1 CFLAGS="-w -fPIC -DDEBUG" 2>&1 | tee ${CWD}/${0}-libuv-output.log
110
+ # make V=1 LIBUV_VERSIONBOSE=1 install
111
+ cd ..
112
+ fi
113
+ fi
103
114
  }
104
115
 
105
116
  check_libuv() {
@@ -107,12 +118,20 @@ check_libuv() {
107
118
  cd ${CWD}
108
119
 
109
120
  printf "\n" >&1
110
- printf "CHECK\n" >&1
111
121
 
112
- if [ -f ${LIBUV_LIBRARY} ]; then
113
- printf " [✓] %s\n" "${LIBUV_LIBRARY}" >&1
122
+ if [ $LIBUV_BUILD -eq 1 ]; then
123
+ if [ -f ${LIBUV_LIBRARY} ]; then
124
+ printf " [✓] %s\n" "${LIBUV_LIBRARY}" >&1
125
+ else
126
+ printf " [✗] %s\n" "${LIBUV_LIBRARY}" >&1
127
+ FAILED=1
128
+ fi
129
+ fi
130
+
131
+ if [ -f ${LIBUV_INCLUDE_DIR}/uv.h ]; then
132
+ printf " [✓] %s\n" "${LIBUV_INCLUDE_DIR}/uv.h" >&1
114
133
  else
115
- printf " [✗] %s\n" "${LIBUV_LIBRARY}" >&1
134
+ printf " [✗] %s\n" "${LIBUV_INCLUDE_DIR}/uv.h" >&1
116
135
  FAILED=1
117
136
  fi
118
137
 
@@ -132,19 +151,11 @@ rebuild_c_client() {
132
151
  # fi
133
152
  }
134
153
 
135
- perform_check() {
154
+ check_aerospike() {
136
155
 
137
156
  cd ${CWD}
138
-
157
+
139
158
  printf "\n" >&1
140
- printf "CHECK\n" >&1
141
-
142
- if [ -f ${LIBUV_LIBRARY} ]; then
143
- printf " [✓] %s\n" "${LIBUV_LIBRARY}" >&1
144
- else
145
- printf " [✗] %s\n" "${LIBUV_LIBRARY}" >&1
146
- FAILED=1
147
- fi
148
159
 
149
160
  if [ -f ${AEROSPIKE_LIBRARY} ]; then
150
161
  printf " [✓] %s\n" "${AEROSPIKE_LIBRARY}" >&1
@@ -166,3 +177,14 @@ perform_check() {
166
177
  exit 1
167
178
  fi
168
179
  }
180
+
181
+ perform_check() {
182
+
183
+ cd ${CWD}
184
+
185
+ printf "\n" >&1
186
+ printf "CHECK\n" >&1
187
+
188
+ check_libuv
189
+ check_aerospike
190
+ }
@@ -61,6 +61,6 @@ build_nodejs_client v16.14.0
61
61
  build_nodejs_client v17.8.0
62
62
  build_nodejs_client v18.0.0
63
63
 
64
- nvm use v16.14.0
64
+ nvm use v18.0.0
65
65
 
66
66
  cd ${CWD}