Skip to content

Commit

Permalink
Merge pull request #482 from aerospike/stage
Browse files Browse the repository at this point in the history
ClientNodeJs Stage to main merge
  • Loading branch information
rpandian-spike authored Jul 6, 2022
2 parents 10b2693 + f48b274 commit cf566c2
Show file tree
Hide file tree
Showing 32 changed files with 2,599 additions and 2,449 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Aerospike Node.js Client Tests
name: Aerospike Node.js Linux Client Tests

on:
push:
Expand Down
76 changes: 50 additions & 26 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,54 @@ on:
- maint/4.x

jobs:
setup:
runs-on: ubuntu-latest
# setup:
# runs-on: ubuntu-latest
# steps:
# - name: Set up Aerospike Database
# uses: reugn/github-action-aerospike@v1

build:
runs-on: windows-latest
strategy:
matrix:
node-version: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
- 10.x
- 12.x
- 14.x
- 16.x
- 17.x
- 18.x
continue-on-error: true
name: Node ${{ matrix.node-version }} tester
steps:
- name: Set up Aerospike Database
uses: reugn/github-action-aerospike@v1
# build:
# needs: setup
# runs-on: windows-latest # https://github.com/actions/virtual-environments
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: Use Node.js 16.x
# uses: actions/setup-node@v2
# with:
# node-version: 16.x
# cache: 'npm'
# - run: ./scripts/build-package.ps1 1
# test:
# needs: build
# runs-on: macos-latest
# steps:
# - run: npm test
# env:
# AEROSPIKE_HOSTS: "127.0.0.1:3000"
# OPTIONS: "--timeout 30000"
# - run: npm run codecov
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Windows SDK
uses: GuillaumeFalourd/[email protected]
with:
sdk-version: 17763
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Update node-gyp
run: |
$WhereNode = Get-Command node | Select-Object -ExpandProperty Definition
$NodeDirPath = Split-Path $WhereNode -Parent
[Version]$npmVersion = npm --version
if ($npmVersion -lt [Version]"7.0") {
$NodeModulesPath = $NodeDirPath + "\node_modules\npm\node_modules\npm-lifecycle"
} else {
$NodeModulesPath = $NodeDirPath + "\node_modules\npm\node_modules\@npmcli\run-script"
}
cd $NodeModulesPath
npm install [email protected]
- name: Install nodejs Client
shell: pwsh
run: npm install --unsafe-perm --build-from-source
# - name: Test nodejs client
# run: npm test
# env:
# AEROSPIKE_HOSTS: "127.0.0.1:3000"
# OPTIONS: "--timeout 30000 --set demp ${{ matrix.node }}"
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'aerospike-client-c-output/lib/aerospike.lib'
],
'action': [
'powershell', 'scripts/build-c-client.ps1',
'pwsh', 'scripts/build-c-client.ps1',
'-Configuration', "$(ConfigurationName)",
'-NodeLibFile', "<(node_root_dir)/<(target_arch)/node.lib"
]
Expand Down
70 changes: 41 additions & 29 deletions lib/aerospike.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
const as = require('bindings')('aerospike.node')
const AerospikeError = require('./error')
const EventLoop = require('./event_loop')
const utils = require('./utils')

/**
* @module aerospike
Expand Down Expand Up @@ -54,7 +53,6 @@ exp.type = as.exp.type
/**
* @summary POSIX regex compilation flags.
*
* @readonly
* @enum {number}
*
*/
Expand Down Expand Up @@ -156,26 +154,26 @@ exp.operations = require('./exp_operations')
* @summary {@link module:aerospike/policy|aerospike/policy} module
* @static
*/
const policy = exports.policy = require('./policy')
exports.policy = require('./policy')

// short-cuts to the policy classes defined under the policy module
exports.BasePolicy = policy.BasePolicy
exports.ApplyPolicy = policy.ApplyPolicy
exports.BatchPolicy = policy.BatchPolicy
exports.OperatePolicy = policy.OperatePolicy
exports.QueryPolicy = policy.QueryPolicy
exports.ReadPolicy = policy.ReadPolicy
exports.RemovePolicy = policy.RemovePolicy
exports.ScanPolicy = policy.ScanPolicy
exports.WritePolicy = policy.WritePolicy
exports.BatchApplyPolicy = policy.BatchApplyPolicy
exports.BatchReadPolicy = policy.BatchReadPolicy
exports.BatchRemovePolicy = policy.BatchRemovePolicy
exports.BatchWritePolicy = policy.BatchWritePolicy
exports.CommandQueuePolicy = policy.CommandQueuePolicy
exports.InfoPolicy = policy.InfoPolicy
exports.ListPolicy = policy.ListPolicy
exports.MapPolicy = policy.MapPolicy
exports.BasePolicy = require('./policy').BasePolicy
exports.ApplyPolicy = require('./policy').ApplyPolicy
exports.BatchPolicy = require('./policy').BatchPolicy
exports.OperatePolicy = require('./policy').OperatePolicy
exports.QueryPolicy = require('./policy').QueryPolicy
exports.ReadPolicy = require('./policy').ReadPolicy
exports.RemovePolicy = require('./policy').RemovePolicy
exports.ScanPolicy = require('./policy').ScanPolicy
exports.WritePolicy = require('./policy').WritePolicy
exports.BatchApplyPolicy = require('./policy').BatchApplyPolicy
exports.BatchReadPolicy = require('./policy').BatchReadPolicy
exports.BatchRemovePolicy = require('./policy').BatchRemovePolicy
exports.BatchWritePolicy = require('./policy').BatchWritePolicy
exports.CommandQueuePolicy = require('./policy').CommandQueuePolicy
exports.InfoPolicy = require('./policy').InfoPolicy
exports.ListPolicy = require('./policy').ListPolicy
exports.MapPolicy = require('./policy').MapPolicy

/**
* The {@link module:aerospike/status|status} module contains a list of the
Expand Down Expand Up @@ -272,7 +270,6 @@ exports.Record = require('./record')
* Linux as well. External authentication can be used on macOS or Windows but
* it will _not_ be secure!
*
* @readonly
* @enum {number}
*
* @property {number} INTERNAL - Use internal authentication only. Hashed
Expand All @@ -287,6 +284,9 @@ exports.Record = require('./record')
* clear password on node login whether or not TLS is enabled. This mode
* should only be used for testing purposes because it is not secure
* authentication.
* @property {number} AUTH_PKI - Use PKI authentication.
* Authentication and authorization is based on a certificate. No user name or
* password needs to be configured. Requires mTLS and a client certificate.
*
* @example <caption>Using external authentication mode, e.g. to use LDAP authentication</caption>
*
Expand All @@ -298,6 +298,24 @@ exports.Record = require('./record')
* authMode: Aerospike.auth.EXTERNAL
* }
*
*
* @example <caption>Using PKI authentication mode</caption>
*
* const Aerospike = require('aerospike')
*
* const config = {
* hosts: [
* { addr: 'bob-cluster-a', port: process.env.PORT}
* ],
* tls: {
* cafile: process.env.CAFILE,
* keyfile: process.env.KEYFILE,
* certfile: process.env.CERT,
* }
* authMode: Aerospike.auth.AUTH_PKI,
* }
*
*
* Aerospike.connect(config).then(async (client) => {
* const info = await client.infoAny().then(Aerospike.info.parse)
* console.info(info)
Expand All @@ -309,7 +327,6 @@ exports.auth = as.auth
/**
* @summary Enumeration of UDF types.
*
* @readonly
* @enum {number}
*
* @property {number} LUA - Lua (only supported UDF type at the moment)
Expand All @@ -319,7 +336,6 @@ exports.language = as.language
/**
* @summary Enumeration of log levels
*
* @readonly
* @enum {number}
*
* @property {number} OFF - Turn off logging
Expand Down Expand Up @@ -359,7 +375,6 @@ exports.log = as.log
* @description Instead of specifying a TTL in seconds, you can set the TTL
* to one of these special values when creating or updating a record.
*
* @readonly
* @enum {number}
*
* @property {number} NAMESPACE_DEFAULT - Use the default TTL value for the
Expand Down Expand Up @@ -404,7 +419,6 @@ exports.ttl = as.ttl
/**
* @summary Enumeration of job status codes.
*
* @readonly
* @enum {number}
*
* @property {number} UNDEF - The job status is undefined. This is likely due to the
Expand All @@ -419,7 +433,6 @@ exports.jobStatus = as.jobStatus
/**
* @summary Enumeration of SI data types.
*
* @readonly
* @enum {number}
*
* @property {number} STRING - Values contained in the SI are strings.
Expand All @@ -433,7 +446,6 @@ exports.indexDataType = as.indexDataType
/**
* @summary Enumeration of SI types.
*
* @readonly
* @enum {number}
*
* @property {number} DEFAULT - Default SI type for bins
Expand All @@ -456,8 +468,8 @@ exports.indexType = as.indexType
// Functions
// ========================================================================

exports.print = utils.print
exports.releaseEventLoop = EventLoop.releaseEventLoop
exports.print = require('./utils').print
exports.releaseEventLoop = require('./event_loop').releaseEventLoop

const Client = exports.Client

Expand Down
49 changes: 25 additions & 24 deletions lib/batch_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,28 @@ const batchType = as.batchTypes
// ========================================================================
// Constants
// ========================================================================

/**
* An instance of class Record that is used in a batch for read operations.
* @const {number}
*/
exports.BATCH_READ = batchType.BATCH_READ

/**
* An instance of class Record that is used in a batch for write operations.
* @const {number}
*/
exports.BATCH_WRITE = batchType.BATCH_WRITE

/**
* An instance of class Record that is used in a batch for applying record.
* @const {number}
*/
exports.BATCH_APPLY = batchType.BATCH_APPLY

/**
* An instance of class Record that is used in a batch for removal operations.
* @const {number}
*/
exports.BATCH_REMOVE = batchType.BATCH_REMOVE
module.exports = {
/**
* An instance of class Record that is used in a batch for read operations.
* @const {number}
*/
BATCH_READ: batchType.BATCH_READ,

/**
* An instance of class Record that is used in a batch for write operations.
* @const {number}
*/
BATCH_WRITE: batchType.BATCH_WRITE,

/**
* An instance of class Record that is used in a batch for applying record.
* @const {number}
*/
BATCH_APPLY: batchType.BATCH_APPLY,

/**
* An instance of class Record that is used in a batch for removal operations.
* @const {number}
*/
BATCH_REMOVE: batchType.BATCH_REMOVE
}
10 changes: 5 additions & 5 deletions lib/bitwise.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ exports.resize = function (bin, size, flags = 0) {
*
* @param {string} bin - The name of the bin. The bin must contain a byte value.
* @param {number} offset - Offset in bytes.
* @param {buffer} value - Bytes to insert.
* @param {Buffer} value - Bytes to insert.
* @returns {BitwiseOperation} Operation that can be passed to the {@link Client#operate} command.
*/
exports.insert = function (bin, byteOffset, value) {
Expand Down Expand Up @@ -190,7 +190,7 @@ exports.remove = function (bin, byteOffset, byteSize) {
* @param {string} bin - The name of the bin. The bin must contain a byte value.
* @param {number} bitOffset - Offset in bits.
* @param {number} bitSize - Number of bits to set.
* @param {number | buffer} value - Value to set.
* @param {number | Buffer} value - Value to set.
* @returns {BitwiseOperation} Operation that can be passed to the {@link Client#operate} command.
*
* @throws TypeError unless value is an integer or a Buffer.
Expand Down Expand Up @@ -220,7 +220,7 @@ exports.set = function (bin, bitOffset, bitSize, value) {
* @param {string} bin - The name of the bin. The bin must contain a byte value.
* @param {number} bitOffset - Offset in bits.
* @param {number} bitSize - Number of bits.
* @param {buffer} value - Value.
* @param {Buffer} value - Value.
* @returns {BitwiseOperation} Operation that can be passed to the {@link Client#operate} command.
*/
exports.or = function (bin, bitOffset, bitSize, value) {
Expand All @@ -239,7 +239,7 @@ exports.or = function (bin, bitOffset, bitSize, value) {
* @param {string} bin - The name of the bin. The bin must contain a byte value.
* @param {number} bitOffset - Offset in bits.
* @param {number} bitSize - Number of bits.
* @param {buffer} value - Value.
* @param {Buffer} value - Value.
* @returns {BitwiseOperation} Operation that can be passed to the {@link Client#operate} command.
*/
exports.xor = function (bin, bitOffset, bitSize, value) {
Expand All @@ -258,7 +258,7 @@ exports.xor = function (bin, bitOffset, bitSize, value) {
* @param {string} bin - The name of the bin. The bin must contain a byte value.
* @param {number} bitOffset - Offset in bits.
* @param {number} bitSize - Number of bits.
* @param {buffer} value - Value.
* @param {Buffer} value - Value.
* @returns {BitwiseOperation} Operation that can be passed to the {@link Client#operate} command.
*/
exports.and = function (bin, bitOffset, bitSize, value) {
Expand Down
4 changes: 2 additions & 2 deletions lib/cdt_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class CdtContext {
* Retrieve expression type list/map from ctx or from type.
*
* @param {CdtContext} ctx, ctx value object.
* @param {exp.type} type, default expression type.
* @return {exp.type} expression type.
* @param {number} type, {@link exp.type} default expression type.
* @return {number} {@link exp.type} expression type.
*/
static getContextType (/* CdtContext */ctx, type) {
if (ctx != null) {
Expand Down
Loading

0 comments on commit cf566c2

Please sign in to comment.