Skip to content

Commit

Permalink
Merge pull request #563 from aerospike/Nodejs-Release-5.6.0
Browse files Browse the repository at this point in the history
Nodejs-Release-5.6.0
  • Loading branch information
DomPeliniAerospike authored Jun 22, 2023
2 parents 9469b89 + 7062467 commit 2a9720d
Show file tree
Hide file tree
Showing 39 changed files with 1,032 additions and 432 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- 20.x
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- run: ./scripts/build-c-client.sh
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macOS-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
needs: setup
runs-on: macos-latest # https://github.com/actions/virtual-environments
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- run: ./scripts/build-package.sh 1
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
# Changelog

All notable changes to this project will be documented in this file.
## [5.6.0]

* **New Features**
* [CLIENT-1803] - Added support for creation of a secondary index on elements within a Collection Data Type.
* [CLIENT-1990] - Added support for Collection Data Type (CDT) Context Base64 serialization.
* [CLIENT-2085] - Added support for rack aware queries and scans.
* [CLIENT-2347] - Added the 'replica' property to the QueryPolicy and ScanPolicy Classes.
* [CLIENT-2348] - Added filter support for secondary indices on elements within a Collection Data Type.

* **Improvements**
* [CLIENT-1823] - Changed the example and parameters in the API Documentation for Client.batchApply.
* [CLIENT-2345] - Improved Client.indexRemove unit test by verifying deletion with a query.
* [CLIENT-2373] - Modified Query.where() to replace the current filter rather than add a filter to Query.filters.
* [CLIENT-2376] - Removed dynamic linking to OpenSSL.

* **Updates**
* The typescript description file 'index.d.ts' has not been updated. The next release will update 'index.d.ts' and restore typescript support.

## [5.5.0]

* **Breaking Changes**
* [CLIENT-2343] - Dropped support for Node.js 14

* **New Features**
* [CLIENT-2108] - Added pagination support for queries and scans.
* [CLIENT-2108] - Added pagination support for queries and scans. Requires Aerospike Server version 6.0 or above.
* [CLIENT-2224] - Added support for rack aware reads when the replication factor is three.
* [CLIENT-2303] - Added support for Amazon Linux 2023.
* [CLIENT-2342] - Added support for Node.js 20
Expand Down
61 changes: 45 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,43 +197,72 @@ Before starting with the Aerospike Nodejs Client, verify that you have the follo
- Xcode 5 or greater.


**Openssl Library**
**OpenSSL Library**
OpenSSL is needed to build the Aerospike C Client. If downloading from NPM at version 5.6.0 or later, you will not need to
have OpenSSL installed to use the Aerospike Nodejs Client. If you are using version 5.5.0 and below, you will need to do
some additional linking to use the client, which is specified below.

The below example shows how to install the Openssl library.
We recommend using brew to install OpenSSL:

```bash
brew install openssl
unlink /usr/local/opt/openssl
# Change the below linking based on openssl version and installation path
ln -s /usr/local/Cellar/openssl@x/y.z/ /usr/local/opt/openssl
```

If you are looking upgrade switch from openssl@1 or an older version of openssl@3, add these variables to your .bashrc, .profile, or .zshrc file.
For a Mac using ARM architecture, OpenSSL should be linked as shown below:

```bash
# When building from source before version 5.6 with openssl@3
sudo ln -s /opt/homebrew/opt/openssl@3/ /usr/local/opt/openssl;
# link here if before version 5.6.0
sudo ln -s /opt/homebrew/opt/openssl@3/ /usr/local/opt/openssl@3;

# When building from source with [email protected]
sudo ln -s /opt/homebrew/opt/[email protected]/ /usr/local/opt/openssl;
# link here if before version 5.6.0 with [email protected]
sudo ln -s /opt/homebrew/opt/[email protected]/ /usr/local/opt/[email protected];
```

For a Mac using X86 architecture, OpenSSL should be linked as shown below:

```bash
# When building from source before version 5.6 with [email protected]
sudo ln -s /opt/homebrew/opt/[email protected]/ /usr/local/opt/openssl;
# link here if before version 5.6.0 with [email protected]
sudo ln -s /opt/homebrew/opt/[email protected]/ /usr/local/opt/[email protected];
```

Before version 5.6.0, you may need to some add some variables to your profile for OpenSSL to be found.

```bash
export PATH="/usr/local/bin/:/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export EXT_CFLAGS="-I/usr/local/opt/openssl/include"
```

Afterwards, source the file that was changed and confirm the desired openssl version is installed
```bash
# Make sure to source the changes to your shell profile
source ~/.bashrc
source ~/.profile
source ~/.zshrc
openssl version
```
For 4x client support, install openssl@1.1 version.

For 4x client support, install OpenSSL@1.1 version.

**LIBUV Library**

The example below shows how to install the LIBUV library.
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
have Libuv installed to use the Aerospike Nodejs Client. If you are using version 5.5.0 and below, you will need to do
some additional linking to use the client, which is specified below.

We recommend using brew to install Libuv:

```bash
brew install libuv
unlink /usr/local/opt/libuv
# Change the below linking based on libuv version and installation path
ln -s /usr/local/Cellar/libuv/1.44.1_1/ /usr/local/opt/libuv
```

For a Mac using ARM architecture, Libuv should be linked as shown below:

```bash
# When building from source before version 5.6
sudo ln -s /opt/homebrew/opt/libuv/ /usr/local/opt/libuv;
```

### Git Repository Installations
Expand Down
6 changes: 2 additions & 4 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@
['OS=="linux"',{
'libraries': [
'../aerospike-client-c/target/Linux-<(build_arch)/lib/libaerospike.a',
'-lz',
'-lssl'
'-lz'
],
'defines': [
'AS_USE_LIBUV'
Expand All @@ -168,8 +167,7 @@
['OS=="mac"',{
'libraries': [
'../aerospike-client-c/target/Darwin-<(build_arch)/lib/libaerospike.a',
'-lz',
'-lssl'
'-lz'
],
'defines': [
'AS_USE_LIBUV'
Expand Down
29 changes: 29 additions & 0 deletions lib/cdt_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const MAP_RANK = 0x21
const MAP_KEY = 0x22
/** @private **/
const MAP_VALUE = 0x23
/** @private **/
const int32Max = 2147483647
/** @private **/
const int32Min = -2147483648

/**
* @summary Nested CDT context type.
Expand Down Expand Up @@ -63,6 +67,11 @@ class CdtContext {
* @return {CdtContext} Updated CDT context, so calls can be chained.
*/
addListIndex (index) {
if (int32Max < index) {
throw new Error('index overflow, largest supported integer is ' + int32Max)
} else if (int32Min > index) {
throw new Error('index underflow, smallest supported integer is ' + int32Min)
}
return this.add(LIST_INDEX, index)
}

Expand All @@ -82,6 +91,11 @@ class CdtContext {
* @return {CdtContext} Updated CDT context, so calls can be chained.
*/
addListIndexCreate (index, order, pad) {
if (int32Max < index) {
throw new Error('index overflow, largest supported integer is' + int32Max)
} else if (int32Min > index) {
throw new Error('index underflow, smallest supported integer is' + int32Min)
}
if (order) {
return this.add(LIST_INDEX | 0xc0, index)
} else {
Expand All @@ -106,6 +120,11 @@ class CdtContext {
* @return {CdtContext} Updated CDT context, so calls can be chained.
*/
addListRank (rank) {
if (int32Max < rank) {
throw new Error('rank overflow, largest supported integer is' + int32Max)
} else if (int32Min > rank) {
throw new Error('rank underflow, smallest supported integer is' + int32Min)
}
return this.add(LIST_RANK, rank)
}

Expand Down Expand Up @@ -135,6 +154,11 @@ class CdtContext {
* @return {CdtContext} Updated CDT context, so calls can be chained.
*/
addMapIndex (index) {
if (int32Max < index) {
throw new Error('index overflow, largest supported integer is' + int32Max)
} else if (int32Min > index) {
throw new Error('index underflow, smallest supported integer is' + int32Min)
}
return this.add(MAP_INDEX, index)
}

Expand All @@ -151,6 +175,11 @@ class CdtContext {
* @return {CdtContext} Updated CDT context, so calls can be chained.
*/
addMapRank (rank) {
if (int32Max < rank) {
throw new Error('rank overflow, largest supported integer is' + int32Max)
} else if (int32Min > rank) {
throw new Error('rank underflow, smallest supported integer is' + int32Min)
}
return this.add(MAP_RANK, rank)
}

Expand Down
Loading

0 comments on commit 2a9720d

Please sign in to comment.