From f16036548fd559ff38fdbed09e25610168f89437 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Wed, 22 Feb 2023 14:55:05 -0700 Subject: [PATCH 1/9] Added getByKeyList to map operations. CLIENT-1818 Added getByKeyList to map operations. Added test cases to verify correctness. --- lib/maps.js | 23 +++++++++++++++++++++++ src/main/map_operations.cc | 25 +++++++++++++++++++++++++ test/maps.js | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/lib/maps.js b/lib/maps.js index 0d43d8fe6..289ed58dc 100644 --- a/lib/maps.js +++ b/lib/maps.js @@ -899,6 +899,29 @@ exports.getByKey = function (bin, key, returnType) { return op } +/** + * @summary Retrieves map items identified by keys list. + * + * @description This operation returns the data specified by + * returnType. + * + * @param {string} bin - The name of the bin, which must contain a Map value. + * @param {any} keys - The map keys. + * @param {number} [returnType] - The {@link module:aerospike/maps.returnType|return type} + * indicating what data of the selected item(s) to return. + * @returns {Object} Operation that can be passed to the {@link Client#operate} command. + * + * @see Instead of passing returnType, you can also use + * {@link module:aerospike/maps~MapOperation#andReturn|MapOperation#andReturn} to + * select what data to return. + */ +exports.getByKeyList = function (bin, keys, returnType) { + const op = new MapOperation(opcodes.MAP_GET_BY_KEY_LIST, bin) + op.keys = keys + op.returnType = returnType + return op +} + /** * @summary Retrieves one or more items identified by a range of keys from the * map. diff --git a/src/main/map_operations.cc b/src/main/map_operations.cc index 0c8504646..c92abd09f 100644 --- a/src/main/map_operations.cc +++ b/src/main/map_operations.cc @@ -661,6 +661,30 @@ bool add_map_get_by_key_op(as_operations *ops, const char *bin, return true; } +bool add_map_get_by_key_list_op(as_operations *ops, const char *bin, + as_cdt_ctx *context, Local obj, + LogInfo *log) +{ + as_list *keys = NULL; + if (get_list_property(&keys, obj, "keys", log) != AS_NODE_PARAM_OK) { + return false; + } + + as_map_return_type return_type; + if (!get_map_return_type(&return_type, obj, log)) { + return false; + } + + if (as_v8_debug_enabled(log)) { + char *keys_str = as_val_tostring(keys); + as_v8_debug(log, "keys=%s, return_type=%i", keys_str, return_type); + cf_free(keys_str); + } + as_operations_map_get_by_key_list(ops, bin, context, keys, return_type); + + return true; +} + bool add_map_get_by_key_range_op(as_operations *ops, const char *bin, as_cdt_ctx *context, Local obj, LogInfo *log) @@ -1003,6 +1027,7 @@ const ops_table_entry ops_table[] = { {"MAP_REMOVE_BY_RANK_RANGE", add_map_remove_by_rank_range_op}, {"MAP_SIZE", add_map_size_op}, {"MAP_GET_BY_KEY", add_map_get_by_key_op}, + {"MAP_GET_BY_KEY_LIST", add_map_get_by_key_list_op}, {"MAP_GET_BY_KEY_RANGE", add_map_get_by_key_range_op}, {"MAP_GET_BY_KEY_REL_INDEX_RANGE", add_map_get_by_key_rel_index_range_op}, {"MAP_GET_BY_VALUE", add_map_get_by_value_op}, diff --git a/test/maps.js b/test/maps.js index 0a7b4bbe1..91a24196e 100644 --- a/test/maps.js +++ b/test/maps.js @@ -944,6 +944,41 @@ describe('client.operate() - CDT Map operations', function () { }) }) + describe('maps.getByKeyList', function () { + it('fetches a map entry identified by key', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(operate(maps.getByKeyList('map', ['b', 'c'], maps.returnType.KEY_VALUE))) + .then(assertResultEql({ map: ['b', 2, 'c', 3] })) + .then(cleanup()) + }) + + it('does not fail if the key does not exist', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(operate(maps.getByKeyList('map', ['z'], maps.returnType.KEY_VALUE))) + .then(assertResultEql({ map: [] })) + .then(cleanup()) + }) + + context('with nested map context', function () { + helper.skipUnlessVersion('>= 4.6.0', this) + + it('fetches a map entry identified by key', function () { + return initState() + .then(createRecord({ list: [{ a: 1, b: 2, c: 3 }, { b: 3 }] })) + .then(operate( + maps + .getByKeyList('list', ['a', 'b']) + .withContext(ctx => ctx.addListIndex(0)) + .andReturn(maps.returnType.KEY_VALUE) + )) + .then(assertResultEql({ list: ['a', 1, 'b', 2] })) + .then(cleanup()) + }) + }) + }) + describe('maps.getByKeyRange', function () { it('fetches map entries identified by key range', function () { return initState() From 319c26449fbf9e13fe586b1a1f9b3d35dc592ff7 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:06:14 -0700 Subject: [PATCH 2/9] Added test case to maps.js CLIENT-1818 Added test case for lists that have present and missing elements. --- test/maps.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/maps.js b/test/maps.js index 91a24196e..c4359816d 100644 --- a/test/maps.js +++ b/test/maps.js @@ -945,7 +945,7 @@ describe('client.operate() - CDT Map operations', function () { }) describe('maps.getByKeyList', function () { - it('fetches a map entry identified by key', function () { + it('fetches a map entry identified by keys', function () { return initState() .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) .then(operate(maps.getByKeyList('map', ['b', 'c'], maps.returnType.KEY_VALUE))) @@ -961,10 +961,18 @@ describe('client.operate() - CDT Map operations', function () { .then(cleanup()) }) + it('does not fail if only some keys exist', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(operate(maps.getByKeyList('map', ['a', 'z'], maps.returnType.KEY_VALUE))) + .then(assertResultEql({ map: ['a', 1] })) + .then(cleanup()) + }) + context('with nested map context', function () { helper.skipUnlessVersion('>= 4.6.0', this) - it('fetches a map entry identified by key', function () { + it('fetches a map entries identified by keys', function () { return initState() .then(createRecord({ list: [{ a: 1, b: 2, c: 3 }, { b: 3 }] })) .then(operate( From 66474d5d04ae039936d8bf25d488e83f2d2f776a Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:06:48 -0700 Subject: [PATCH 3/9] Added getByValueList to map operations. CLIENT-2210 Added getByValueList to map operations. Added test cases to verify correctness. --- lib/maps.js | 24 +++++++++++++++++++++ src/main/map_operations.cc | 26 +++++++++++++++++++++++ test/maps.js | 43 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/lib/maps.js b/lib/maps.js index 0d43d8fe6..d75de74b0 100644 --- a/lib/maps.js +++ b/lib/maps.js @@ -1028,6 +1028,30 @@ exports.getByValue = function (bin, value, returnType) { return op } +/** + * @summary Retrieves map items identified by values from the + * map. + * + * @description This operation returns the data specified by + * returnType. + * + * @param {string} bin - The name of the bin, which must contain a Map value. + * @param {any} values - The map values. + * @param {number} [returnType] - The {@link module:aerospike/maps.returnType|return type} + * indicating what data of the selected item(s) to return. + * @returns {Object} Operation that can be passed to the {@link Client#operate} command. + * + * @see Instead of passing returnType, you can also use + * {@link module:aerospike/maps~MapOperation#andReturn|MapOperation#andReturn} to + * select what data to return. + */ +exports.getByValueList = function (bin, values, returnType) { + const op = new MapOperation(opcodes.MAP_GET_BY_VALUE_LIST, bin) + op.values = values + op.returnType = returnType + return op +} + /** * @summary Retrieves one or more items identified by a range of values from * the map. diff --git a/src/main/map_operations.cc b/src/main/map_operations.cc index 0c8504646..1128e9397 100644 --- a/src/main/map_operations.cc +++ b/src/main/map_operations.cc @@ -772,6 +772,31 @@ bool add_map_get_by_value_op(as_operations *ops, const char *bin, return true; } +bool add_map_get_by_value_list_op(as_operations *ops, const char *bin, + as_cdt_ctx *context, Local obj, + LogInfo *log) +{ + as_list *values = NULL; + if (get_list_property(&values, obj, "values", log) != AS_NODE_PARAM_OK) { + return false; + } + + as_map_return_type return_type; + if (!get_map_return_type(&return_type, obj, log)) { + return false; + } + + if (as_v8_debug_enabled(log)) { + char *values_str = as_val_tostring(values); + as_v8_debug(log, "values=%s, return_type=%i", values_str, return_type); + cf_free(values_str); + } + as_operations_map_get_by_value_list(ops, bin, context, values, + return_type); + + return true; +} + bool add_map_get_by_value_range_op(as_operations *ops, const char *bin, as_cdt_ctx *context, Local obj, LogInfo *log) @@ -1006,6 +1031,7 @@ const ops_table_entry ops_table[] = { {"MAP_GET_BY_KEY_RANGE", add_map_get_by_key_range_op}, {"MAP_GET_BY_KEY_REL_INDEX_RANGE", add_map_get_by_key_rel_index_range_op}, {"MAP_GET_BY_VALUE", add_map_get_by_value_op}, + {"MAP_GET_BY_VALUE_LIST", add_map_get_by_value_list_op}, {"MAP_GET_BY_VALUE_RANGE", add_map_get_by_value_range_op}, {"MAP_GET_BY_VALUE_REL_RANK_RANGE", add_map_get_by_value_rel_rank_range_op}, {"MAP_GET_BY_INDEX", add_map_get_by_index_op}, diff --git a/test/maps.js b/test/maps.js index 0a7b4bbe1..cd5a391f5 100644 --- a/test/maps.js +++ b/test/maps.js @@ -1063,6 +1063,49 @@ describe('client.operate() - CDT Map operations', function () { }) }) + describe('maps.getByValueList', function () { + it('fetches a map keys and values identified by values', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(operate(maps.getByValueList('map', [2, 3], maps.returnType.KEY_VALUE))) + .then(assertResultEql({ map: ['b', 2, 'c', 3] })) + .then(cleanup()) + }) + + it('does not fail if the value does not exist', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(operate(maps.getByValueList('map', [4], maps.returnType.KEY_VALUE))) + .then(assertResultEql({ map: [] })) + .then(cleanup()) + }) + + it('does not fail if only some values exist', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(operate(maps.getByValueList('map', [1, 4], maps.returnType.KEY_VALUE))) + .then(assertResultEql({ map: ['a', 1] })) + .then(cleanup()) + }) + + context('with nested map context', function () { + helper.skipUnlessVersion('>= 4.6.0', this) + + it('fetches a map keys and values identified by values', function () { + return initState() + .then(createRecord({ map: { nested: { a: 1, b: 2, c: 3 } } })) + .then(operate( + maps + .getByValueList('map', [1, 2]) + .withContext(ctx => ctx.addMapKey('nested')) + .andReturn(maps.returnType.KEY_VALUE) + )) + .then(assertResultEql({ map: ['a', 1, 'b', 2] })) + .then(cleanup()) + }) + }) + }) + describe('maps.getByValueRange', function () { it('fetches map entries identified by value range', function () { return initState() From 785c64157d639a747fa6114a095aa7bf58a3e3a2 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Sat, 25 Feb 2023 05:17:39 -0700 Subject: [PATCH 4/9] Added "EXISTS" return type for maps and lists CLIENT-1750 Added "EXISTS" return type to the "Aerospike.maps" and "Aerospike.lists" modules. Added test cases to verify the "EXISTS" return type. --- src/main/enums/lists.cc | 1 + src/main/enums/maps.cc | 1 + test/lists.js | 27 +++++++++++++++++++++++++++ test/maps.js | 18 ++++++++++++++++++ 4 files changed, 47 insertions(+) diff --git a/src/main/enums/lists.cc b/src/main/enums/lists.cc index d983b8cf1..da4f072b7 100644 --- a/src/main/enums/lists.cc +++ b/src/main/enums/lists.cc @@ -57,6 +57,7 @@ Local list_enum_values() set(return_type, "REVERSE_RANK", AS_LIST_RETURN_REVERSE_RANK); set(return_type, "COUNT", AS_LIST_RETURN_COUNT); set(return_type, "VALUE", AS_LIST_RETURN_VALUE); + set(return_type, "EXISTS", AS_LIST_RETURN_EXISTS); set(return_type, "INVERTED", AS_LIST_RETURN_INVERTED); // as_cdt_op_list diff --git a/src/main/enums/maps.cc b/src/main/enums/maps.cc index 6fd103231..195f7ff18 100644 --- a/src/main/enums/maps.cc +++ b/src/main/enums/maps.cc @@ -61,6 +61,7 @@ Local map_enum_values() set(return_type, "KEY", AS_MAP_RETURN_KEY); set(return_type, "VALUE", AS_MAP_RETURN_VALUE); set(return_type, "KEY_VALUE", AS_MAP_RETURN_KEY_VALUE); + set(return_type, "EXISTS", AS_MAP_RETURN_EXISTS); set(return_type, "INVERTED", AS_MAP_RETURN_INVERTED); // as_cdt_op_map diff --git a/test/lists.js b/test/lists.js index 2d0922349..7213d4425 100644 --- a/test/lists.js +++ b/test/lists.js @@ -1103,6 +1103,33 @@ describe('client.operate() - CDT List operations', function () { }) }) + context('returnType=EXISTS', function () { + it('fetches all items with the specified values and returns the indexes', function () { + return initState() + .then(createRecord({ list: [1, 2, 3, 1, 2, 3] })) + .then(operate(lists.getByValueList('list', [1, 3, 5]).andReturn(lists.returnType.EXISTS))) + .then(assertResultEql({ list: true })) + .then(cleanup) + }) + + context('with nested list context', function () { + helper.skipUnlessVersion('>= 4.6.0', this) + + it('fetches all items with the specified values and returns the indexes', function () { + return initState() + .then(createRecord({ list: [['a', 'b', 'c'], [1, 2, 3, 1, 2, 3]] })) + .then(operate( + lists + .getByValueList('list', [7, 5, 4]) + .withContext(ctx => ctx.addListIndex(1)) + .andReturn(lists.returnType.EXISTS) + )) + .then(assertResultEql({ list: false })) + .then(cleanup) + }) + }) + }) + context('invert results', function () { it('fetches all items except with the specified values', function () { return initState() diff --git a/test/maps.js b/test/maps.js index 03c385426..5cae72321 100644 --- a/test/maps.js +++ b/test/maps.js @@ -1501,5 +1501,23 @@ describe('client.operate() - CDT Map operations', function () { .then(assertResultEql({ map: ['a', 1, 'b', 2] })) .then(cleanup()) }) + + it('returns true or false for a single key read', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(orderByKey('map')) + .then(operate(maps.getByKeyList('map', ['a', 'b', 'd'], maps.returnType.EXISTS))) + .then(assertResultEql({ map: true })) + .then(cleanup()) + }) + + it('returns true if any values exisst', function () { + return initState() + .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) + .then(orderByKey('map')) + .then(operate(maps.getByValueList('map', [1, 2 ,4], maps.returnType.EXISTS))) + .then(assertResultEql({ map: true })) + .then(cleanup()) + }) }) }) From 542162301cade368152b851afd41c7a2cd0958a0 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Fri, 3 Mar 2023 22:26:48 -0700 Subject: [PATCH 5/9] Fixed Documentation for batchRemove CLIENT-1819 Corrected parameters to include a list of keys rather than a list of records. --- lib/client.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/client.js b/lib/client.js index f37aa6f0c..482503de6 100644 --- a/lib/client.js +++ b/lib/client.js @@ -674,12 +674,10 @@ Client.prototype.batchApply = function (records, udf, batchPolicy, batchApplyPol * * @description * - * This method allows multi sub-commands for each key in the batch. + * This method removes the specified records from the database. * This method requires server >= 6.0.0. * - * @param {object[]} records - {@link Record} List of batch sub-commands to perform. - * @param {number} records[].type - {@link Record#type} Batch type. - * @param {Key} records[].key - Record Key. + * @param {Key[]} keys - {@link Key} An array of keys, used to locate the records in the cluster. * @param {BatchPolicy} [batchPolicy] - The Batch Policy to use for this operation. * @param {BatchRemovePolicy} [batchRemovePolicy] Remove policy configuration parameters. * @param {batchRecordsCallback} [callback] - The function to call when From 1a63a53997416d6bcc3736a7466bc2964867f5f2 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Fri, 10 Mar 2023 09:38:25 -0700 Subject: [PATCH 6/9] Fixed linting errors CLIENT-1750 --- test/maps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/maps.js b/test/maps.js index 5cae72321..c90c6082d 100644 --- a/test/maps.js +++ b/test/maps.js @@ -1515,7 +1515,7 @@ describe('client.operate() - CDT Map operations', function () { return initState() .then(createRecord({ map: { a: 1, b: 2, c: 3 } })) .then(orderByKey('map')) - .then(operate(maps.getByValueList('map', [1, 2 ,4], maps.returnType.EXISTS))) + .then(operate(maps.getByValueList('map', [1, 2, 4], maps.returnType.EXISTS))) .then(assertResultEql({ map: true })) .then(cleanup()) }) From a7a8ba222b95b413c3bc86a4f931dfe7fa56380e Mon Sep 17 00:00:00 2001 From: Dominic Pelini Date: Sat, 25 Mar 2023 17:19:27 -0700 Subject: [PATCH 7/9] CDT context for map and list expressions CLIENT-2231 List and map expressions can now use CDT contexts to access nested elements. Fixed memory allocation bug in expressions.cc. Added Unit tests for map expressions operations. More Unit tests to come. --- lib/cdt_context.js | 2 +- src/include/operations.h | 3 + src/main/cdt_ctx.cc | 109 ++++++++++ src/main/exp_operations.cc | 4 +- src/main/expressions.cc | 5 +- test/exp_map.js | 433 +++++++++++++++++++++++++------------ 6 files changed, 407 insertions(+), 149 deletions(-) diff --git a/lib/cdt_context.js b/lib/cdt_context.js index 110ff7447..53ba6dbb9 100644 --- a/lib/cdt_context.js +++ b/lib/cdt_context.js @@ -207,7 +207,7 @@ class CdtContext { */ static getContextType (/* CdtContext */ctx, type) { if (ctx != null) { - return ((ctx[0].id & LIST_INDEX) === 0) ? exp.type.MAP : exp.type.LIST + return ((ctx.items[ctx.items.length - 1][0] & LIST_INDEX) === 0) ? exp.type.MAP : exp.type.LIST } return type } diff --git a/src/include/operations.h b/src/include/operations.h index e970cf302..212bb40b8 100644 --- a/src/include/operations.h +++ b/src/include/operations.h @@ -41,6 +41,9 @@ int add_exp_op(as_operations *ops, uint32_t opcode, v8::Local op, int get_optional_cdt_context(as_cdt_ctx *context, bool *has_context, v8::Local obj, const char *prop, const LogInfo *log); +as_cdt_ctx* get_optional_cdt_context_heap(int * rc, + v8::Local obj, const char *prop, + const LogInfo *log); v8::Local scalar_opcode_values(); v8::Local list_opcode_values(); diff --git a/src/main/cdt_ctx.cc b/src/main/cdt_ctx.cc index 120969a1f..ec9cd8214 100644 --- a/src/main/cdt_ctx.cc +++ b/src/main/cdt_ctx.cc @@ -138,3 +138,112 @@ int get_optional_cdt_context(as_cdt_ctx *context, bool *has_context, return AS_NODE_PARAM_OK; } + +as_cdt_ctx* get_optional_cdt_context_heap(int* rc, + Local obj, const char *prop, + const LogInfo *log) +{ + Nan::HandleScope scope; + Local maybe_context_obj = + Nan::Get(obj, Nan::New(prop).ToLocalChecked()).ToLocalChecked(); + if (maybe_context_obj->IsUndefined() || maybe_context_obj->IsNull()) { + as_v8_detail(log, "No CDT context set"); + *rc = AS_NODE_PARAM_OK; + return NULL; + } + else if (!maybe_context_obj->IsObject()) { + as_v8_error(log, "Type error: context should be an Object"); + *rc = AS_NODE_PARAM_ERR; + return NULL; + } + Local items = + Local::Cast(Nan::Get(maybe_context_obj.As(), + Nan::New("items").ToLocalChecked()) + .ToLocalChecked()); + const uint32_t length = items->Length(); + as_cdt_ctx* context = as_cdt_ctx_create(length); + as_v8_detail(log, "Setting CDT context - depth: %d", length); + for (uint32_t i = 0; i < length; i++) { + Local item = + Local::Cast(Nan::Get(items, i).ToLocalChecked()); + Local v8type = Nan::Get(item, 0).ToLocalChecked(); + Local v8value = Nan::Get(item, 1).ToLocalChecked(); + int type = Nan::To(v8type).FromJust(); + int intValue; + as_val *asValue; + switch (type) { + case (AS_CDT_CTX_LIST_INDEX): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_list_index(context, intValue); + as_v8_detail(log, "Adding List Index context - index: %d", + intValue); + break; + case (AS_CDT_CTX_LIST_RANK): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_list_rank(context, intValue); + as_v8_detail(log, "Adding List Rank context - rank: %d", intValue); + break; + case (AS_CDT_CTX_LIST_VALUE): + asval_from_jsvalue(&asValue, v8value, log); + as_cdt_ctx_add_list_value(context, asValue); + as_v8_detail(log, "Adding List Value context"); + break; + case (AS_CDT_CTX_MAP_INDEX): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_map_index(context, intValue); + as_v8_detail(log, "Adding Map Index context - index: %d", intValue); + break; + case (AS_CDT_CTX_MAP_RANK): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_map_rank(context, intValue); + as_v8_detail(log, "Adding Map Rank context - rank: %d", intValue); + break; + case (AS_CDT_CTX_MAP_KEY): + asval_from_jsvalue(&asValue, v8value, log); + as_cdt_ctx_add_map_key(context, asValue); + as_v8_detail(log, "Adding Map Key context"); + break; + case (AS_CDT_CTX_MAP_VALUE): + asval_from_jsvalue(&asValue, v8value, log); + as_cdt_ctx_add_map_value(context, asValue); + as_v8_detail(log, "Adding Map Value context"); + break; + case (AS_CDT_CTX_LIST_INDEX | 0x40): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_list_index_create(context, intValue, (as_list_order) 0, false); + as_v8_detail(log, "Adding List Index context - index: %d", + intValue); + break; + case (AS_CDT_CTX_MAP_KEY | 0x40): + asval_from_jsvalue(&asValue, v8value, log); + as_cdt_ctx_add_map_key_create(context, asValue, (as_map_order) 0); + as_v8_detail(log, "Adding Map Value context"); + break; + case (AS_CDT_CTX_LIST_INDEX | 0x80): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_list_index_create(context, intValue, (as_list_order) 0, true); + as_v8_detail(log, "Adding List Index context - index: %d", + intValue); + break; + case (AS_CDT_CTX_MAP_KEY | 0x80): + asval_from_jsvalue(&asValue, v8value, log); + as_cdt_ctx_add_map_key_create(context, asValue, (as_map_order) 1); + as_v8_detail(log, "Adding Map Value context"); + break; + + case (AS_CDT_CTX_LIST_INDEX | 0xc0): + intValue = Nan::To(v8value).FromJust(); + as_cdt_ctx_add_list_index_create(context, intValue, (as_list_order) 1, false); + as_v8_detail(log, "Adding List Index context - index: %d", + intValue); + break; + case (AS_CDT_CTX_MAP_KEY | 0xc0): + asval_from_jsvalue(&asValue, v8value, log); + as_cdt_ctx_add_map_key_create(context, asValue, (as_map_order) 3); + as_v8_detail(log, "Adding Map Value context"); + break; + } + } + *rc = AS_NODE_PARAM_OK; + return context; +} \ No newline at end of file diff --git a/src/main/exp_operations.cc b/src/main/exp_operations.cc index 91af7a719..7848041cc 100644 --- a/src/main/exp_operations.cc +++ b/src/main/exp_operations.cc @@ -85,7 +85,9 @@ int add_exp_op(as_operations *ops, uint32_t opcode, Local op, entry->op_name, opcode, bin); bool success = (entry->op_function)(ops, bin, exp, flags, log); - + free(bin); + as_exp_destroy(exp); + return success ? AS_NODE_PARAM_OK : AS_NODE_PARAM_ERR; } diff --git a/src/main/expressions.cc b/src/main/expressions.cc index 5b5e541c9..a311b7695 100644 --- a/src/main/expressions.cc +++ b/src/main/expressions.cc @@ -167,9 +167,8 @@ int convert_entry(Local entry_obj, as_exp_entry *entry, } if (Nan::Has(entry_obj, Nan::New("ctx").ToLocalChecked()).FromJust()) { - entry->v.ctx = NULL; - rc = - get_optional_cdt_context(entry->v.ctx, NULL, entry_obj, "ctx", log); + entry->v.ctx = + get_optional_cdt_context_heap(&rc, entry_obj, "ctx", log); return rc; } diff --git a/test/exp_map.js b/test/exp_map.js index f49fd1961..f868d33db 100644 --- a/test/exp_map.js +++ b/test/exp_map.js @@ -23,7 +23,7 @@ const Aerospike = require('../lib/aerospike') const exp = Aerospike.exp const maps = Aerospike.maps const op = Aerospike.operations - +const Context = Aerospike.cdt.Context const helper = require('./test_helper') const keygen = helper.keygen const tempBin = 'ExpVar' @@ -60,187 +60,150 @@ describe('Aerospike.exp_operations', function () { await client.remove(key, passPolicy) } + const orderMap = (bin, order, ctx) => { + const policy = new Aerospike.MapPolicy({ order }) + const setMapPolicy = maps.setPolicy(bin, policy) + if (ctx) setMapPolicy.withContext(ctx) + return client.operate(setMapPolicy) + } + + const orderByKey = (bin, ctx) => orderMap(bin, maps.order.KEY_ORDERED, ctx) + it('builds up a filter expression value', function () { const filter = exp.eq(exp.binInt('intVal'), exp.int(42)) expect(filter).to.be.an('array') }) describe('map expressions', function () { - describe('map size', function () { - it('returns the map size', async function () { - const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27 } }) - - await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(2))) - await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(3))) - }) - }) - describe('map bin putItems expression', function () { - it('evaluates exp_write op to true if temp bin equals to combined maps', async function () { - const key = await createRecord({ map: { c: 1, b: 2, a: 3 }, map2: { f: 1, e: 2, d: 3 } }) - const ops = [ - exp.operations.write('map', - exp.maps.putItems(exp.binMap('map'), exp.binMap('map2')), - 0), - op.read('map') - ] - const result = await client.operate(key, ops, {}) - // console.log(result) - expect(result.bins.map).to.eql({ a: 3, b: 2, c: 1, d: 3, e: 2, f: 1 }) - }) - }) - - describe('getByValue', function () { - it('matches the count of the matched map values', async function () { - const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) - - await testNoMatch(key, exp.eq(exp.maps.getByValue(exp.binMap('tags'), exp.str('green'), maps.returnType.COUNT), exp.int(2))) - await testMatch(key, exp.eq(exp.maps.getByValue(exp.binMap('tags'), exp.str('green'), maps.returnType.COUNT), exp.int(1))) - }) - }) - - describe('getByValueRange', function () { - it('matches the count of the matched range of map values', async function () { - const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) - - await testNoMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('yellow'), exp.str('blue'), maps.returnType.COUNT), exp.int(3))) - const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueRange( - exp.binMap('tags'), - exp.str('yellow'), - exp.str('blue'), - maps.returnType.COUNT), - 0), - op.read('tags') - ] - const result = await client.operate(key, ops, {}) - console.log(result) - - await testMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('yellow'), exp.str('blue'), maps.returnType.COUNT), exp.int(2))) - }) - }) - - describe('getByValueList', function () { - it('matches the count of the matched values', async function () { + describe('clear', function () { + it('removes all items in a map', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueList( - exp.binMap('tags'), - exp.list(['yellow', 'blue']), - maps.returnType.KEY), + exp.operations.write('tags', + exp.maps.clear( + exp.binMap('tags')), 0), op.read('tags') ] const result = await client.operate(key, ops, {}) - console.log(result) - await testNoMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list(['green', 'yellow']), maps.returnType.COUNT), exp.int(3))) - await testMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list(['green', 'yellow']), maps.returnType.COUNT), exp.int(0))) + expect(result.bins).to.eql({ tags: {} }) }) - }) - describe('getByValueRelRankRangeToEnd', function () { - it('selects map items nearest to value and greater by relative rank', async function () { - const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + it('selects item identified by index inside nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueRelRankRangeToEnd( + exp.operations.write('tags', + exp.maps.clear( exp.binMap('tags'), - exp.int(0), - exp.str('yellow'), - maps.returnType.COUNT), + context), 0), op.read('tags') ] const result = await client.operate(key, ops, {}) - console.log(result) - await testNoMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( - exp.binMap('tags'), - exp.int(0), - exp.str('yellow'), - maps.returnType.COUNT), - exp.int(0))) - await testMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( - exp.binMap('tags'), - exp.int(0), - exp.str('yellow'), - maps.returnType.COUNT), - exp.int(1))) + expect(result.bins).to.eql({ tags: { a: 'blue', nested: {} } }) }) }) - describe('getByRelRankRange', function () { - it('selects map items nearest to value and greater by relative rank with a count limit', async function () { + describe('getByIndex', function () { + it('selects item identified by index', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) const ops = [ exp.operations.read(tempBin, - exp.maps.getByValueRelRankRange( + exp.maps.getByIndex( exp.binMap('tags'), exp.int(2), - exp.int(0), - exp.str('yellow'), - maps.returnType.KEY), + exp.type.INT, + maps.returnType.COUNT), 0), op.read('tags') ] - const result = await client.operate(key, ops, {}) - console.log(result) + await client.operate(key, ops, {}) await testNoMatch(key, exp.eq( - exp.maps.getByValueRelRankRange( + exp.maps.getByIndex( exp.binMap('tags'), exp.int(2), - exp.int(0), - exp.str('yellow'), + exp.type.INT, maps.returnType.COUNT), exp.int(0))) await testMatch(key, exp.eq( - exp.maps.getByValueRelRankRange( + exp.maps.getByIndex( exp.binMap('tags'), exp.int(2), - exp.int(0), - exp.str('yellow'), + exp.type.INT, maps.returnType.COUNT), exp.int(1))) }) + + it('selects item identified by index inside nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + orderByKey('tags') + orderByKey('tags', context) + await testNoMatch(key, exp.eq( + exp.maps.getByIndex( + exp.binMap('tags'), + exp.int(3), + exp.type.INT, + maps.returnType.COUNT, + context), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByIndex( + exp.binMap('tags'), + exp.int(4), + exp.type.INT, + maps.returnType.COUNT, + context), + exp.int(1))) + }) }) - describe('getByIndex', function () { - it('selects item identified by index', async function () { + describe('getByIndexRange', function () { + it('selects "count" map items starting at specified index', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) - const ops = [ - exp.operations.read(tempBin, - exp.maps.getByIndex( - exp.binMap('tags'), - exp.int(2), - exp.type.INT, - maps.returnType.COUNT), - 0), - op.read('tags') - ] - const result = await client.operate(key, ops, {}) - console.log(result) + await testNoMatch(key, exp.eq( + exp.maps.getByIndexRange( + exp.binMap('tags'), + exp.int(5), + exp.int(0), + maps.returnType.COUNT), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByIndexRange( + exp.binMap('tags'), + exp.int(5), + exp.int(0), + maps.returnType.COUNT), + exp.int(3))) + }) + it('selects "count" map items starting at specified nested index', async function () { + const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black'} } }) + const context = new Context().addMapKey('nested') + orderByKey('tags') + orderByKey('tags', context) await testNoMatch(key, exp.eq( - exp.maps.getByIndex( + exp.maps.getByIndexRange( exp.binMap('tags'), - exp.int(2), - exp.type.INT, + exp.int(6), + exp.int(0), maps.returnType.COUNT), exp.int(0))) await testMatch(key, exp.eq( - exp.maps.getByIndex( + exp.maps.getByIndexRange( exp.binMap('tags'), - exp.int(2), - exp.type.INT, + exp.int(6), + exp.int(0), maps.returnType.COUNT), - exp.int(1))) + exp.int(4))) }) }) @@ -261,29 +224,45 @@ describe('Aerospike.exp_operations', function () { maps.returnType.COUNT), exp.int(3))) }) - }) - - describe('getByIndexRange', function () { - it('selects "count" map items starting at specified index', async function () { - const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + it('selects map items starting at specified index to the end of the map', async function () { + const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black'} } }) + const context = new Context().addMapKey('nested') + orderByKey('tags') + orderByKey('tags', context) await testNoMatch(key, exp.eq( - exp.maps.getByIndexRange( + exp.maps.getByIndexRangeToEnd( exp.binMap('tags'), - exp.int(5), exp.int(0), maps.returnType.COUNT), exp.int(0))) await testMatch(key, exp.eq( - exp.maps.getByIndexRange( + exp.maps.getByIndexRangeToEnd( exp.binMap('tags'), - exp.int(5), exp.int(0), maps.returnType.COUNT), - exp.int(3))) + exp.int(4))) }) }) + describe('getByKey', function () { + it('matches the count of the matched map values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + await testNoMatch(key, exp.eq(exp.maps.getByKey(exp.binMap('tags'), exp.str('a'), exp.type.AUTO, maps.returnType.COUNT), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.getByKey(exp.binMap('tags'), exp.str('a'), exp.type.AUTO, maps.returnType.COUNT), exp.int(1))) + }) + + it('matches the count of the matched map values of a nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + console.log(exp.maps.getByKey(exp.binMap('tags'), exp.str('d'), exp.type.AUTO, maps.returnType.COUNT, context)) + await testNoMatch(key, exp.eq(exp.maps.getByKey(exp.binMap('tags'), exp.str('d'), exp.type.AUTO, maps.returnType.COUNT, context), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.getByKey(exp.binMap('tags'), exp.str('d'), exp.type.AUTO, maps.returnType.COUNT, context), exp.int(1))) + }) + }) + + + describe('getByRank', function () { it('selects map item identified by rank', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', d: 5, c: 'yellow' } }) @@ -298,8 +277,7 @@ describe('Aerospike.exp_operations', function () { 0), op.read('tags') ] - const result = await client.operate(key, ops, {}) - console.log(result) + await client.operate(key, ops, {}) await testNoMatch(key, exp.eq( exp.maps.getByRank( @@ -318,44 +296,211 @@ describe('Aerospike.exp_operations', function () { }) }) - describe('getByRankRangeToEnd', function () { - it('selects map items starting at specified rank to the last ranked item', async function () { + describe('getByRankRange', function () { + it('selects "count" map items starting at specified rank', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) await testNoMatch(key, exp.eq( - exp.maps.getByRankRangeToEnd( + exp.maps.getByRankRange( exp.binMap('tags'), + exp.int(4), exp.int(0), maps.returnType.COUNT), exp.int(0))) await testMatch(key, exp.eq( - exp.maps.getByRankRangeToEnd( + exp.maps.getByRankRange( exp.binMap('tags'), + exp.int(4), exp.int(0), maps.returnType.COUNT), exp.int(3))) }) }) - describe('getByRankRange', function () { - it('selects "count" map items starting at specified rank', async function () { + describe('getByRankRangeToEnd', function () { + it('selects map items starting at specified rank to the last ranked item', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) await testNoMatch(key, exp.eq( - exp.maps.getByRankRange( + exp.maps.getByRankRangeToEnd( exp.binMap('tags'), - exp.int(4), exp.int(0), maps.returnType.COUNT), exp.int(0))) await testMatch(key, exp.eq( - exp.maps.getByRankRange( + exp.maps.getByRankRangeToEnd( exp.binMap('tags'), - exp.int(4), exp.int(0), maps.returnType.COUNT), exp.int(3))) }) }) + + it('writes map values originating from nested map to a specified map', async function () { + const key = await createRecord({ map: { c: 1, b: 2, a: 3, nested: { g: 4 } }, map2: { f: 1, e: 2, d: 3 } }) + const context = new Context().addMapKey('nested') + const ops = [ + exp.operations.write('map', + exp.maps.putItems(exp.binMap('map'), exp.binMap('map2'), null, context), + 0), + op.read('map') + ] + const result = await client.operate(key, ops, {}) + expect(result.bins.map.nested).to.eql({ d: 3, e: 2, f: 1, g: 4 }) + }) + }) + + describe('getByValue', function () { + it('matches the count of the matched map values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + + await testNoMatch(key, exp.eq(exp.maps.getByValue(exp.binMap('tags'), exp.str('green'), maps.returnType.COUNT), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.getByValue(exp.binMap('tags'), exp.str('green'), maps.returnType.COUNT), exp.int(1))) + }) + + it('matches the count of the matched map values of a nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.getByValue(exp.binMap('tags'), exp.str('orange'), maps.returnType.COUNT, context), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.getByValue(exp.binMap('tags'), exp.str('orange'), maps.returnType.COUNT, context), exp.int(1))) + }) + }) + + describe('getByValueList', function () { + it('matches the count of the matched values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + + const ops = [ + exp.operations.read(tempBin, + exp.maps.getByValueList( + exp.binMap('tags'), + exp.list(['yellow', 'blue']), + maps.returnType.KEY), + 0), + op.read('tags') + ] + await client.operate(key, ops, {}) + + await testNoMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list(['green', 'yellow']), maps.returnType.COUNT), exp.int(3))) + await testMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list(['green', 'yellow']), maps.returnType.COUNT), exp.int(0))) + }) + }) + + describe('getByValueRange', function () { + it('matches the count of the matched range of map values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + + await testNoMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('yellow'), exp.str('blue'), maps.returnType.COUNT), exp.int(3))) + const ops = [ + exp.operations.read(tempBin, + exp.maps.getByValueRange( + exp.binMap('tags'), + exp.str('yellow'), + exp.str('blue'), + maps.returnType.COUNT), + 0), + op.read('tags') + ] + await client.operate(key, ops, {}) + + await testMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('yellow'), exp.str('blue'), maps.returnType.COUNT), exp.int(2))) + }) + }) + + describe('getByValueRelRankRange', function () { + it('selects map items nearest to value and greater by relative rank with a count limit', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + + const ops = [ + exp.operations.read(tempBin, + exp.maps.getByValueRelRankRange( + exp.binMap('tags'), + exp.int(2), + exp.int(0), + exp.str('yellow'), + maps.returnType.KEY), + 0), + op.read('tags') + ] + await client.operate(key, ops, {}) + + await testNoMatch(key, exp.eq( + exp.maps.getByValueRelRankRange( + exp.binMap('tags'), + exp.int(2), + exp.int(0), + exp.str('yellow'), + maps.returnType.COUNT), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByValueRelRankRange( + exp.binMap('tags'), + exp.int(2), + exp.int(0), + exp.str('yellow'), + maps.returnType.COUNT), + exp.int(1))) + }) + }) + + describe('getByValueRelRankRangeToEnd', function () { + it('selects map items nearest to value and greater by relative rank', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + + const ops = [ + exp.operations.read(tempBin, + exp.maps.getByValueRelRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + exp.str('yellow'), + maps.returnType.COUNT), + 0), + op.read('tags') + ] + await client.operate(key, ops, {}) + + await testNoMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + exp.str('yellow'), + maps.returnType.COUNT), + exp.int(0))) + await testMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + exp.str('yellow'), + maps.returnType.COUNT), + exp.int(1))) + }) + }) + + describe('putItems', function () { + it('writes map values to a specified map', async function () { + const key = await createRecord({ map: { c: 1, b: 2, a: 3 }, map2: { f: 1, e: 2, d: 3 } }) + const ops = [ + exp.operations.write('map', + exp.maps.putItems(exp.binMap('map'), exp.binMap('map2')), + 0), + op.read('map') + ] + const result = await client.operate(key, ops, {}) + expect(result.bins.map).to.eql({ a: 3, b: 2, c: 1, d: 3, e: 2, f: 1 }) + }) + + describe('size', function () { + it('returns the map size', async function () { + const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27 } }) + + await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(3))) + }) + + it('returns the map size from a nested map', async function () { + const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27, nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map'), context), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map'), context), exp.int(4))) + }) + }) }) }) From dd9df26b5ac2b31fa48e7886d90fa1cb2c454c80 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Mon, 27 Mar 2023 09:48:00 -0600 Subject: [PATCH 8/9] Added tests cases for list and map expressions CLIENT-2231 Added test cases for using context with list and map expressions Ordered map test cases alphabetically fixed (reveresed) parameter order within the APIDOCS for exp_map.js and exp_list.js Fixed linting errors --- aerospike-client-c | 2 +- lib/exp_lists.js | 186 ++++++++++++++------------- lib/exp_maps.js | 240 +++++++++++++++++----------------- test/exp_list.js | 198 +++++++++++++++++++++++++++- test/exp_map.js | 312 +++++++++++++++++++++++++++++++++------------ 5 files changed, 639 insertions(+), 299 deletions(-) diff --git a/aerospike-client-c b/aerospike-client-c index f7af9db26..cb72cd2b5 160000 --- a/aerospike-client-c +++ b/aerospike-client-c @@ -1 +1 @@ -Subproject commit f7af9db267abe6d61bd6a2b6fc2424d3687e6d7d +Subproject commit cb72cd2b5dafdb337193bae81ca0745e8c0f75d8 diff --git a/lib/exp_lists.js b/lib/exp_lists.js index d520f71a9..6873aa028 100644 --- a/lib/exp_lists.js +++ b/lib/exp_lists.js @@ -84,8 +84,8 @@ module.exports = { /** * Create expression that returns list size. * - * @param {Object} ctx Optional context path for nested CDT. * @param {AerospikeExp} bin List bin or list value expression. + * @param {Object} ctx Optional context path for nested CDT. * @return {AerospikeExp} (integer expression) */ size: (bin, ctx = null) => [ @@ -98,10 +98,10 @@ module.exports = { * Create expression that selects list items identified by value and returns selected * data specified by returnType. * - * @param {Object} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} returnType Return type. + * @param {Object} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValue: (bin, value, returnType, ctx = null) => [ @@ -116,11 +116,11 @@ module.exports = { * Create expression that selects list items identified by value range and returns selected * data specified by returnType. * - * @param {Object} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} begin Begin value expression. - * @param {AerospikeExp} end End value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} end End value expression. + * @param {AerospikeExp} begin Begin value expression. + * @param {AerospikeExp} returnType Return type. + * @param {Object} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValueRange: (bin, begin, end, returnType, ctx = null) => [ @@ -136,10 +136,10 @@ module.exports = { * Create expression that selects list items identified by values and returns selected * data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} value Values list expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Values list expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValueList: (bin, value, returnType, ctx = null) => [ @@ -154,11 +154,11 @@ module.exports = { * Create expression that selects list items nearest to value and greater by relative rank * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} value Values list expression. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Values list expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRelRankRangeToEnd: (bin, value, rank, returnType, ctx = null) => [ @@ -174,12 +174,12 @@ module.exports = { * Create expression that selects list items nearest to value and greater by relative rank with a * count limit and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} bin List bin or list value expression. * @param {AerospikeExp} value Values list expression. * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} count Count integer expression. - * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRelRankRange: (bin, value, rank, count, returnType, ctx = null) => [ @@ -196,11 +196,12 @@ module.exports = { * Create expression that selects list item identified by index * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} valueType expression value type. - * @param {AerospikeExp} idx Index integer expression. + * * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} valueType expression value type. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (valueType expression) */ getByIndex: (bin, index, valueType, returnType, ctx = null) => [ @@ -215,10 +216,10 @@ module.exports = { * Create expression that selects list items starting at specified index to the end of list * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByIndexRangeToEnd: (bin, index, returnType, ctx = null) => [ @@ -233,11 +234,11 @@ module.exports = { * Create expression that selects "count" list items starting at specified index * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByIndexRange: (bin, index, count, returnType, ctx = null) => [ @@ -253,11 +254,11 @@ module.exports = { * Create expression that selects list item identified by rank * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} valueType expression value type. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} valueType expression value type. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (valueType expression) */ getByRank: (bin, rank, valueType, returnType, ctx = null) => [ @@ -272,10 +273,10 @@ module.exports = { * Create expression that selects list items starting at specified rank to the last ranked item * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRankRangeToEnd: (bin, rank, returnType, ctx = null) => [ @@ -290,11 +291,11 @@ module.exports = { * Create expression that selects "count" list items starting at specified rank * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} bin List bin or list value expression. * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} count Count integer expression. - * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRankRange: (bin, rank, count, returnType, ctx = null) => [ @@ -313,10 +314,10 @@ module.exports = { /** * Create expression that appends value to end of list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional list write policy. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Value expression. + * @param {Object} policy Optional list write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ append: (bin, value, policy = null, ctx = null) => [ @@ -329,10 +330,10 @@ module.exports = { /** * Create expression that appends list items to end of list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional list write policy. - * @param {AerospikeExp} value List items expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value List items expression. + * @param {Object} policy Optional list write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ appendItems: (bin, value, policy = null, ctx = null) => [ @@ -345,11 +346,11 @@ module.exports = { /** * Create expression that inserts value to specified index of list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional list write policy. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {Object} policy Optional list write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ insert: (bin, value, idx, policy = null, ctx = null) => [ @@ -363,11 +364,11 @@ module.exports = { /** * Create expression that inserts each input list item starting at specified index of list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional list write policy. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} value List items expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value List items expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {Object} policy Optional list write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ insertItems: (bin, value, idx, policy = null, ctx = null) => [ @@ -381,11 +382,11 @@ module.exports = { /** * Create expression that increments list[index] by value. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional list write policy. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {Object} policy Optional list write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ increment: (bin, value, idx, policy = null, ctx = null) => [ @@ -399,11 +400,12 @@ module.exports = { /** * Create expression that sets item value at specified index in list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional list write policy. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} value Value expression. + * * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {Object} policy Optional list write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ set: (bin, value, idx, policy = null, ctx = null) => [ @@ -417,8 +419,8 @@ module.exports = { /** * Create expression that removes all items in list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ clear: (bin, ctx = null) => [ @@ -429,9 +431,9 @@ module.exports = { /** * Create expression that sorts list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {number} order Sort order flags. * @param {AerospikeExp} bin List bin or list value expression. + * @param {number} order Sort order flags. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ sort: (bin, order, ctx = null) => [ @@ -443,9 +445,9 @@ module.exports = { /** * Create expression that removes list items identified by value. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByValue: (bin, value, ctx = null) => [ @@ -458,9 +460,9 @@ module.exports = { /** * Create expression that removes list items identified by values. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} values Values list expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} values Values list expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByValueList: (bin, values, ctx = null) => [ @@ -475,10 +477,10 @@ module.exports = { * (begin inclusive, end exclusive). If begin is nil, the range is less than end. * If end is infinity, the range is greater than equal to begin. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} begin Begin value expression. - * @param {AerospikeExp} end End value expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} end End value expression. + * @param {AerospikeExp} begin Begin value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByValueRange: (bin, end, begin, ctx = null) => [ @@ -492,10 +494,10 @@ module.exports = { /** * Create expression that removes list items nearest to value and greater by relative rank. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} value Value expression. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByRelRankRangeToEnd: (bin, rank, value, ctx = null) => [ @@ -510,11 +512,11 @@ module.exports = { * Create expression that removes list items nearest to value and greater by relative rank with a * count limit. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} value Value expression. - * @param {AerospikeExp} rank Rank integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByRelRankRange: (bin, count, rank, value, ctx = null) => [ @@ -529,9 +531,9 @@ module.exports = { /** * Create expression that removes list item identified by index. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByIndex: (bin, idx, ctx = null) => [ @@ -544,9 +546,9 @@ module.exports = { /** * Create expression that removes list items starting at specified index to the end of list. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByIndexRangeToEnd: (bin, idx, ctx = null) => [ @@ -559,10 +561,10 @@ module.exports = { /** * Create expression that removes "count" list items starting at specified index. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByIndexRange: (bin, count, idx, ctx = null) => [ @@ -576,9 +578,9 @@ module.exports = { /** * Create expression that removes list item identified by rank. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByRank: (bin, rank, ctx = null) => [ @@ -591,9 +593,9 @@ module.exports = { /** * Create expression that removes list items starting at specified rank to the last ranked item. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByRankRangeToEnd: (bin, rank, ctx = null) => [ @@ -606,10 +608,10 @@ module.exports = { /** * Create expression that removes "count" list items starting at specified rank. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} rank Rank integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin List bin or list value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (list expression) */ removeByRankRange: (bin, count, rank, ctx = null) => [ diff --git a/lib/exp_maps.js b/lib/exp_maps.js index 2d1a443e8..1976a9e4b 100644 --- a/lib/exp_maps.js +++ b/lib/exp_maps.js @@ -74,11 +74,11 @@ module.exports = { /** * Create expression that writes key/val item to map bin. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional map write policy. - * @param {AerospikeExp} key Key expression. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} key Key expression. + * @param {Object} policy Optional map write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ put: (bin, value, key, policy = null, ctx = null) => [ @@ -92,10 +92,10 @@ module.exports = { /** * Create expression that writes each map item to map bin. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional map write policy. - * @param {AerospikeExp} map Source map expression. * @param {AerospikeExp} bin Target map bin or map value expression. + * @param {AerospikeExp} map Source map expression. + * @param {Object} policy Optional map write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ putItems: (bin, map, policy = null, ctx = null) => [ @@ -109,11 +109,14 @@ module.exports = { * Create expression that increments values by incr for all items identified by key. * Valid only for numbers. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {Object} policy Optional map write policy. - * @param {AerospikeExp} key Key expression. - * @param {AerospikeExp} value Increment value number expression. + * * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} value Increment value number expression. + * @param {AerospikeExp} key Key expression. + * @param {Object} policy Optional map write policy. + * @param {AerospikeExp} ctx Optional context path for nested CDT. + * + * * @return {AerospikeExp} (map expression) */ increment: (bin, value, key, policy = null, ctx = null) => [ @@ -127,8 +130,8 @@ module.exports = { /** * Create expression that removes all items in map. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ clear: (bin, ctx = null) => [ @@ -139,9 +142,10 @@ module.exports = { /** * Create expression that removes map item identified by key. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} key Key expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} key Key expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. + * @return {AerospikeExp} (map expression) */ removeByKey: (bin, key, ctx = null) => [ @@ -154,10 +158,11 @@ module.exports = { /** * Create expression that removes map items identified by keys. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} keys List expression of keys to remove. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} keys List expression of keys to remove. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) + * */ removeByKeyList: (bin, keys, ctx = null) => [ ..._mapModify(ctx, null, maps.opcodes.REMOVE_BY_KEY_LIST, 2, 0), @@ -171,10 +176,10 @@ module.exports = { * (begin inclusive, end exclusive). If begin is nil, the range is less than end. * If end is infinity, the range is greater than equal to begin. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} begin Begin value expression. - * @param {AerospikeExp} end End value expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} end End value expression. + * @param {AerospikeExp} begin Begin value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByKeyRange: (bin, end, begin, ctx = null) => [ @@ -188,10 +193,10 @@ module.exports = { /** * Create expression that removes map items nearest to key and greater by index. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} key Key expression. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} key Key expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByKeyRelIndexRangeToEnd: (bin, idx, key, ctx = null) => [ @@ -205,11 +210,11 @@ module.exports = { /** * Create expression that removes map items nearest to key and greater by index with a count limit. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} key Key expression. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} key Key expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByKeyRelIndexRange: (bin, count, idx, key, ctx = null) => [ @@ -224,9 +229,9 @@ module.exports = { /** * Create expression that removes map items identified by value. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByValue: (bin, value, ctx = null) => [ @@ -239,9 +244,9 @@ module.exports = { /** * Create expression that removes map items identified by values. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} values Values list expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} values Values list expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByValueList: (bin, values, ctx = null) => [ @@ -256,10 +261,10 @@ module.exports = { * (begin inclusive, end exclusive). If begin is nil, the range is less than end. * If end is infinity, the range is greater than equal to begin. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} begin Begin value expression. - * @param {AerospikeExp} end End value expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} end End value expression. + * @param {AerospikeExp} begin Begin value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByValueRange: (bin, end, begin, ctx = null) => [ @@ -273,10 +278,10 @@ module.exports = { /** * Create expression that removes map items nearest to value and greater by relative rank. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} value Value expression. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByValueRelRankRangeToEnd: (bin, rank, value, ctx = null) => [ @@ -291,14 +296,14 @@ module.exports = { * Create expression that removes map items nearest to value and greater by relative rank with a * count limit. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} value Value expression. - * @param {AerospikeExp} rank Rank integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ - removeByValueRelRankRange: (bin, count, rank, value, key, ctx = null) => [ + removeByValueRelRankRange: (bin, count, rank, value, ctx = null) => [ ..._mapModify(ctx, null, maps.opcodes.REMOVE_BY_VALUE_REL_RANK_RANGE, 4, 0), ..._int(maps.RETURN_NONE), ...value, @@ -310,9 +315,9 @@ module.exports = { /** * Create expression that removes map item identified by index. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByIndex: (bin, idx, ctx = null) => [ @@ -325,9 +330,9 @@ module.exports = { /** * Create expression that removes map items starting at specified index to the end of map. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByIndexRangeToEnd: (bin, idx, ctx = null) => [ @@ -340,10 +345,10 @@ module.exports = { /** * Create expression that removes "count" map items starting at specified index. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByIndexRange: (bin, count, idx, ctx = null) => [ @@ -357,9 +362,9 @@ module.exports = { /** * Create expression that removes map item identified by rank. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByRank: (bin, rank, ctx = null) => [ @@ -372,9 +377,9 @@ module.exports = { /** * Create expression that removes map items starting at specified rank to the last ranked item. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByRankRangeToEnd: (bin, rank, ctx = null) => [ @@ -387,10 +392,10 @@ module.exports = { /** * Create expression that removes "count" map items starting at specified rank. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} rank Rank integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (map expression) */ removeByRankRange: (bin, count, rank, ctx = null) => [ @@ -408,8 +413,8 @@ module.exports = { /** * Create expression that returns map size. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (integer expression) */ size: (bin, ctx = null) => [ @@ -422,11 +427,11 @@ module.exports = { * Create expression that selects map item identified by key * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} valueType expression value type. - * @param {AerospikeExp} key Key expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} key Key expression. + * @param {AerospikeExp} valueType expression value type. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByKey: (bin, key, valueType, returnType, ctx = null) => [ @@ -443,11 +448,11 @@ module.exports = { * If end is infinity, the range is greater than equal to begin. * Expression returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} begin Begin key expression. - * @param {AerospikeExp} end End key expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} end End key expression. + * @param {AerospikeExp} begin Begin key expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByKeyRange: (bin, end, begin, returnType, ctx = null) => [ @@ -463,10 +468,10 @@ module.exports = { * Create expression that selects map items identified by keys * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} keys Keys list expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} keys Keys list expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByKeyList: (bin, keys, returnType, ctx = null) => [ @@ -481,11 +486,11 @@ module.exports = { * Create expression that selects map items nearest to key and greater by index * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} key Key expression. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} key Key expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByKeyRelIndexRangeToEnd: (bin, idx, key, returnType, ctx = null) => [ @@ -501,12 +506,12 @@ module.exports = { * Create expression that selects map items nearest to key and greater by index with a count limit. * Expression returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} key Key expression. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} key Key expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByKeyRelIndexRange: (bin, count, idx, key, returnType, ctx = null) => [ @@ -523,10 +528,10 @@ module.exports = { * Create expression that selects map items identified by value * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} value Value expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValue: (bin, value, returnType, ctx = null) => [ @@ -543,11 +548,12 @@ module.exports = { * If end is infinity, the range is greater than equal to begin. * Expression returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} begin Begin value expression. - * @param {AerospikeExp} end End value expression. + * * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} end End value expression. + * @param {AerospikeExp} begin Begin value expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValueRange: (bin, end, begin, returnType, ctx = null) => [ @@ -563,10 +569,10 @@ module.exports = { * Create expression that selects map items identified by values * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. + * @param {AerospikeExp} bin Map bin or map value expression. * @param {AerospikeExp} returnType Return type. * @param {AerospikeExp} values Values list expression. - * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValueList: (bin, values, returnType, ctx = null) => [ @@ -581,11 +587,11 @@ module.exports = { * Create expression that selects map items nearest to value and greater by relative rank. * Expression returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} value Value expression. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValueRelRankRangeToEnd: (bin, rank, value, returnType, ctx = null) => [ @@ -601,12 +607,12 @@ module.exports = { * Create expression that selects map items nearest to value and greater by relative rank with a * count limit. Expression returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} value Value expression. - * @param {AerospikeExp} rank Rank integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} value Value expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByValueRelRankRange: (bin, count, rank, value, returnType, ctx = null) => [ @@ -623,11 +629,11 @@ module.exports = { * Create expression that selects map item identified by index * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} valueType expression value type. - * @param {AerospikeExp} idx Index integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} valueType expression value type. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByIndex: (bin, idx, valueType, returnType, ctx = null) => [ @@ -642,10 +648,11 @@ module.exports = { * Create expression that selects map items starting at specified index to the end of map * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} idx Index integer expression. + * * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByIndexRangeToEnd: (bin, idx, returnType, ctx = null) => [ @@ -660,11 +667,11 @@ module.exports = { * Create expression that selects "count" map items starting at specified index * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} idx Index integer expression. - * @param {AerospikeExp} count Count integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} idx Index integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByIndexRange: (bin, count, idx, returnType, ctx = null) => [ @@ -680,11 +687,11 @@ module.exports = { * Create expression that selects map item identified by rank * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} valueType expression value type. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} valueType expression value type. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRank: (bin, rank, valueType, returnType, ctx = null) => [ @@ -699,10 +706,10 @@ module.exports = { * Create expression that selects map items starting at specified rank to the last ranked item * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} rank Rank integer expression. * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRankRangeToEnd: (bin, rank, returnType, ctx = null) => [ @@ -717,11 +724,12 @@ module.exports = { * Create expression that selects "count" map items starting at specified rank * and returns selected data specified by returnType. * - * @param {AerospikeExp} ctx Optional context path for nested CDT. - * @param {AerospikeExp} returnType Return type. - * @param {AerospikeExp} rank Rank integer expression. - * @param {AerospikeExp} count Count integer expression. + * * @param {AerospikeExp} bin Map bin or map value expression. + * @param {AerospikeExp} count Count integer expression. + * @param {AerospikeExp} rank Rank integer expression. + * @param {AerospikeExp} returnType Return type. + * @param {AerospikeExp} ctx Optional context path for nested CDT. * @return {AerospikeExp} (expression) */ getByRankRange: (bin, count, rank, returnType, ctx = null) => [ diff --git a/test/exp_list.js b/test/exp_list.js index 22479c3f5..767179726 100644 --- a/test/exp_list.js +++ b/test/exp_list.js @@ -23,6 +23,7 @@ const Aerospike = require('../lib/aerospike') const exp = Aerospike.exp const op = Aerospike.operations const lists = Aerospike.lists +const Context = Aerospike.cdt.Context const helper = require('./test_helper') const keygen = helper.keygen @@ -64,7 +65,6 @@ describe('Aerospike.exp_operations', function () { const filter = exp.eq(exp.binInt('intVal'), exp.int(42)) expect(filter).to.be.an('array') }) - describe('list expressions', function () { describe('list size', function () { it('matches the size of a list value', async function () { @@ -75,6 +75,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('list size with context', function () { + it('matches the size of a list value within a nested context', async function () { + const key = await createRecord({ tags: ['blue', 'green', ['orange', 'pink', 'white', 'black']] }) + const context = new Context().addListIndex(2) + await testNoMatch(key, exp.eq(exp.lists.size(exp.binList('tags'), context), exp.int(5))) + await testMatch(key, exp.eq(exp.lists.size(exp.binList('tags'), context), exp.int(4))) + }) + }) + describe('getByValue', function () { it('matches the count of the matched list values', async function () { const key = await createRecord({ tags: ['blue', 'green', 'yellow', 'green'] }) @@ -84,6 +93,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByValue with context', function () { + it('matches the count of the matched list values', async function () { + const key = await createRecord({ tags: ['blue', 'green', 'yellow', 'green', ['orange', 'pink', 'white', 'black', 'pink']] }) + const context = new Context().addListIndex(4) + await testNoMatch(key, exp.eq(exp.lists.getByValue(exp.binList('tags'), exp.str('pink'), lists.returnType.COUNT, context), exp.int(1))) + await testMatch(key, exp.eq(exp.lists.getByValue(exp.binList('tags'), exp.str('pink'), lists.returnType.COUNT, context), exp.int(2))) + }) + }) + describe('getByValueRange', function () { it('matches the count of the matched range of list values', async function () { const key = await createRecord({ values: [53, 16, 94, 38, 25, 88, 48] }) @@ -93,6 +111,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByValueRange with context', function () { + it('matches the count of the matched range of list values', async function () { + const key = await createRecord({ values: [53, 16, 94, 38, 25, 88, 48, [1, 92, 94, 96]] }) + const context = new Context().addListIndex(7) + await testNoMatch(key, exp.eq(exp.lists.getByValueRange(exp.binList('values'), exp.int(90), exp.int(99), lists.returnType.COUNT, context), exp.int(1))) + await testMatch(key, exp.eq(exp.lists.getByValueRange(exp.binList('values'), exp.int(90), exp.int(99), lists.returnType.COUNT, context), exp.int(3))) + }) + }) + describe('getByValueList', function () { it('matches the count of the matched values', async function () { const key = await createRecord({ values: [53, 16, 94, 38, 25, 88, 88, 48, 16] }) @@ -102,6 +129,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByValueList with context', function () { + it('matches the count of the matched values', async function () { + const key = await createRecord({ values: [53, 16, 94, 38, 25, 88, 88, 48, 16, [0, 1, 2, 73, 74, 73, 74]] }) + const context = new Context().addListIndex(9) + await testNoMatch(key, exp.eq(exp.lists.getByValueList(exp.binList('values'), exp.list([73, 74]), lists.returnType.COUNT, context), exp.int(2))) + await testMatch(key, exp.eq(exp.lists.getByValueList(exp.binList('values'), exp.list([73, 74]), lists.returnType.COUNT, context), exp.int(4))) + }) + }) + describe('getByRelRankRangeToEnd', function () { it('selects list items nearest to value and greater by relative rank', async function () { const key = await createRecord({ values: [53, 16, 94, 38, 25, 88, 88, 48, 16] }) @@ -111,6 +147,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByRelRankRangeToEnd with context', function () { + it('selects list items nearest to value and greater by relative rank', async function () { + const key = await createRecord({ values: [53, 16, [2, 12, 14, 17]] }) + const context = new Context().addListIndex(2) + await testNoMatch(key, exp.eq(exp.lists.getByRelRankRangeToEnd(exp.binList('values'), exp.int(12), exp.int(1), lists.returnType.VALUE, context), exp.list([16, 53]))) + await testMatch(key, exp.eq(exp.lists.getByRelRankRangeToEnd(exp.binList('values'), exp.int(12), exp.int(1), lists.returnType.VALUE, context), exp.list([14, 17]))) + }) + }) + describe('getByRelRankRange', function () { it('selects list items nearest to value and greater by relative rank with a count limit', async function () { const key = await createRecord({ values: [53, 16, 94, 38, 25, 88, 88, 48, 16] }) @@ -120,6 +165,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByRelRankRange with context', function () { + it('selects list items nearest to value and greater by relative rank with a count limit', async function () { + const key = await createRecord({ values: [53, 16, 94, [30, 40, 45, 20]] }) + const context = new Context().addListIndex(3) + await testNoMatch(key, exp.eq(exp.lists.getByRelRankRange(exp.binList('values'), exp.int(30), exp.int(1), exp.int(3), lists.returnType.VALUE, context), exp.list([94]))) + await testMatch(key, exp.eq(exp.lists.getByRelRankRange(exp.binList('values'), exp.int(30), exp.int(1), exp.int(3), lists.returnType.VALUE, context), exp.list([40, 45]))) + }) + }) + describe('getByIndex', function () { it('selects item identified by index', async function () { const key = await createRecord({ values: ['Singapore', 'Hamburg', 'San Francisco', 'Tokyo'] }) @@ -129,6 +183,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByIndex with context', function () { + it('selects item identified by index within nested context', async function () { + const key = await createRecord({ values: ['Singapore', 'Hamburg', 'San Francisco', 'Tokyo', ['Firth', 'Hickman', 'Palmyra']] }) + const context = new Context().addListIndex(4) + await testNoMatch(key, exp.eq(exp.lists.getByIndex(exp.binList('values'), exp.int(2), exp.type.STR, lists.returnType.VALUE, context), exp.str('San Francisco'))) + await testMatch(key, exp.eq(exp.lists.getByIndex(exp.binList('values'), exp.int(2), exp.type.STR, lists.returnType.VALUE, context), exp.str('Palmyra'))) + }) + }) + describe('getByIndexRangeToEnd', function () { it('selects list items starting at specified index to the end of the list', async function () { const key = await createRecord({ values: ['Singapore', 'Hamburg', 'San Francisco', 'Tokyo'] }) @@ -138,6 +201,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByIndexRangeToEnd with context', function () { + it('selects list items starting at specified index to the end of the list', async function () { + const key = await createRecord({ values: ['Singapore', 'Hamburg', 'San Francisco', 'Tokyo', ['Firth', 'Hickman', 'Palmyra']] }) + const context = new Context().addListIndex(4) + await testNoMatch(key, exp.eq(exp.lists.getByIndexRangeToEnd(exp.binList('values'), exp.int(1), lists.returnType.VALUE, context), exp.list(['Hamburg', 'San Francisco', 'Tokyo']))) + await testMatch(key, exp.eq(exp.lists.getByIndexRangeToEnd(exp.binList('values'), exp.int(1), lists.returnType.VALUE, context), exp.list(['Hickman', 'Palmyra']))) + }) + }) + describe('getByIndexRange', function () { it('selects "count" list items starting at specified index', async function () { const key = await createRecord({ values: ['Singapore', 'Hamburg', 'San Francisco', 'Tokyo'] }) @@ -147,6 +219,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByIndexRange with context', function () { + it('selects "count" list items starting at specified index', async function () { + const key = await createRecord({ values: ['Singapore', 'Hamburg', 'San Francisco', 'Tokyo', ['Firth', 'Hickman', 'Palmyra']] }) + const context = new Context().addListIndex(4) + await testNoMatch(key, exp.eq(exp.lists.getByIndexRange(exp.binList('values'), exp.int(0), exp.int(2), lists.returnType.VALUE, context), exp.list(['Singapore', 'Hamburg']))) + await testMatch(key, exp.eq(exp.lists.getByIndexRange(exp.binList('values'), exp.int(0), exp.int(2), lists.returnType.VALUE, context), exp.list(['Firth', 'Hickman']))) + }) + }) + describe('getByRank', function () { it('selects list item identified by rank', async function () { const key = await createRecord({ values: [83, 39, 49, 20, 42, 41, 98] }) @@ -156,6 +237,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByRank with context', function () { + it('selects list item identified by rank', async function () { + const key = await createRecord({ values: [83, [0, 4, 2, 8], 40] }) + const context = new Context().addListIndex(1) + await testNoMatch(key, exp.eq(exp.lists.getByRank(exp.binList('values'), exp.int(2), exp.type.INT, lists.returnType.VALUE, context), exp.int(40))) + await testMatch(key, exp.eq(exp.lists.getByRank(exp.binList('values'), exp.int(2), exp.type.INT, lists.returnType.VALUE, context), exp.int(4))) + }) + }) + describe('getByRankRangeToEnd', function () { it('selects list items starting at specified rank to the last ranked item', async function () { const key = await createRecord({ values: [83, 39, 49, 20, 42, 41, 98] }) @@ -165,6 +255,15 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByRankRangeToEnd with context', function () { + it('selects list items starting at specified rank to the last ranked item', async function () { + const key = await createRecord({ values: [83, [0, 4, 2, 8]] }) + const context = new Context().addListIndex(1) + await testNoMatch(key, exp.eq(exp.lists.getByRankRangeToEnd(exp.binList('values'), exp.int(1), lists.returnType.VALUE, context), exp.list([0, 2, 4, 8]))) + await testMatch(key, exp.eq(exp.lists.getByRankRangeToEnd(exp.binList('values'), exp.int(1), lists.returnType.VALUE, context), exp.list([2, 4, 8]))) + }) + }) + describe('getByRankRange', function () { it('selects "count" list items starting at specified rank', async function () { const key = await createRecord({ values: [83, 39, 49, 20, 42, 41, 98] }) @@ -174,8 +273,17 @@ describe('Aerospike.exp_operations', function () { }) }) + describe('getByRankRange with context', function () { + it('selects "count" list items starting at specified rank', async function () { + const key = await createRecord({ values: [83, [0, 4, 2, 8]] }) + const context = new Context().addListIndex(1) + await testNoMatch(key, exp.eq(exp.lists.getByRankRange(exp.binList('values'), exp.int(1), exp.int(4), lists.returnType.VALUE, context), exp.list([83, [0, 4, 2, 8]]))) + await testMatch(key, exp.eq(exp.lists.getByRankRange(exp.binList('values'), exp.int(1), exp.int(4), lists.returnType.VALUE, context), exp.list([2, 4, 8]))) + }) + }) + describe('list bin append expression', function () { - it('evaluates exp list append to true if exp op read temp bin equals to appended list', async function () { + it('appends integer value to list', async function () { const key = await createRecord({ list: [2, 3, 4, 5], intVal: 6 }) const ops = [ exp.operations.read(tempBin, @@ -188,9 +296,25 @@ describe('Aerospike.exp_operations', function () { expect(result.bins.list).to.eql([2, 3, 4, 5]) expect(result.bins.ExpVar).to.eql([2, 3, 4, 5, 6]) }) + + it('appends integer value to a list within a nested context', async function () { + const key = await createRecord({ list: [2, 3, 4, 5, [4]], intVal: 6 }) + const context = new Context().addListIndex(4) + const ops = [ + exp.operations.read(tempBin, + exp.lists.append(exp.binList('list'), exp.binInt('intVal'), null, context), + 0), + op.read('list') + ] + const result = await client.operate(key, ops, {}) + // console.log(result) + expect(result.bins.list).to.eql([2, 3, 4, 5, [4]]) + expect(result.bins.ExpVar).to.eql([2, 3, 4, 5, [4, 6]]) + }) }) + describe('list bin appendItems expression', function () { - it('evaluates exp list appendItems to true if exp op read temp bin equals to appended list', async function () { + it('appends list to itself', async function () { const key = await createRecord({ list: [2, 3, 4, 5] }) const ops = [ exp.operations.read(tempBin, @@ -203,10 +327,25 @@ describe('Aerospike.exp_operations', function () { expect(result.bins.list).to.eql([2, 3, 4, 5]) expect(result.bins.ExpVar).to.eql([2, 3, 4, 5, 2, 3, 4, 5]) }) + + it('appends list to a list within a nested context', async function () { + const key = await createRecord({ list: [2, 3, 4, 5, [80, 90, 100]] }) + const context = new Context().addListIndex(4) + const ops = [ + exp.operations.read(tempBin, + exp.lists.appendItems(exp.binList('list'), exp.binList('list'), null, context), + 0), + op.read('list') + ] + const result = await client.operate(key, ops, {}) + // console.log(result) + expect(result.bins.list).to.eql([2, 3, 4, 5, [80, 90, 100]]) + expect(result.bins.ExpVar).to.eql([2, 3, 4, 5, [80, 90, 100, 2, 3, 4, 5, [80, 90, 100]]]) + }) }) }) describe('list bin insert expression', function () { - it('evaluates exp list insert to true if exp op read temp bin equals to inserted list', async function () { + it('inserts value at specified index', async function () { const key = await createRecord({ list: [2, 3, 4, 5], intVal: 6 }) const ops = [ exp.operations.read(tempBin, @@ -219,9 +358,24 @@ describe('Aerospike.exp_operations', function () { expect(result.bins.list).to.eql([2, 3, 4, 5]) expect(result.bins.ExpVar).to.eql([2, 3, 6, 4, 5]) }) + + it('inserts value at specified index within a nested context', async function () { + const key = await createRecord({ list: [2, 3, 4, 5, [4, 1, 9]], intVal: 7 }) + const context = new Context().addListIndex(4) + const ops = [ + exp.operations.read(tempBin, + exp.lists.insert(exp.binList('list'), exp.binInt('intVal'), exp.int(2), null, context), + 0), + op.read('list') + ] + const result = await client.operate(key, ops, {}) + // console.log(result) + expect(result.bins.list).to.eql([2, 3, 4, 5, [4, 1, 9]]) + expect(result.bins.ExpVar).to.eql([2, 3, 4, 5, [4, 1, 7, 9]]) + }) }) describe('list bin insertItems expression', function () { - it('evaluates exp list appendItems to true if exp op read temp bin equals to appended list', async function () { + it('inserts values at specified index', async function () { const key = await createRecord({ list: [2, 3, 4, 5] }) const ops = [ exp.operations.read(tempBin, @@ -234,9 +388,25 @@ describe('Aerospike.exp_operations', function () { expect(result.bins.list).to.eql([2, 3, 4, 5]) expect(result.bins.ExpVar).to.eql([2, 2, 3, 4, 5, 3, 4, 5]) }) + + it('inserts values at specified index within a nested context', async function () { + const key = await createRecord({ list: [2, 3, [9, 9]] }) + const context = new Context().addListIndex(2) + const ops = [ + exp.operations.read(tempBin, + exp.lists.insertItems(exp.binList('list'), exp.binList('list'), exp.int(1), null, context), + 0), + op.read('list') + ] + const result = await client.operate(key, ops, {}) + // console.log(result) + expect(result.bins.list).to.eql([2, 3, [9, 9]]) + expect(result.bins.ExpVar).to.eql([2, 3, [9, 2, 3, [9, 9], 9]]) + }) }) + describe('list bin sort expression', function () { - it('evaluates exp list sort to true if exp op read temp bin equals to sorted list', async function () { + it('sorts specified list', async function () { const key = await createRecord({ list: [2, 3, 4, 5] }) const ops = [ exp.operations.write('list', @@ -252,5 +422,21 @@ describe('Aerospike.exp_operations', function () { expect(result.bins.ExpVar).to.eql([5, 5, 4, 4, 3, 3, 2, 2]) expect(result.bins.list).to.eql([2, 2, 3, 4, 5, 3, 4, 5]) }) + + it('sorts specified nested list', async function () { + const key = await createRecord({ list: [2, 3, 4, 5, [9, 100]] }) + const context = new Context().addListIndex(4) + const ops = [ + exp.operations.read(tempBin, + exp.lists.sort(exp.binList('list'), 1, context), + 0), + op.read('list') + ] + const result = await client.operate(key, ops, {}) + console.log(result.bins.ExpVar) + // console.log(result) + expect(result.bins.ExpVar).to.eql([2, 3, 4, 5, [100, 9]]) + expect(result.bins.list).to.eql([2, 3, 4, 5, [9, 100]]) + }) }) }) diff --git a/test/exp_map.js b/test/exp_map.js index f868d33db..09956b849 100644 --- a/test/exp_map.js +++ b/test/exp_map.js @@ -149,16 +149,16 @@ describe('Aerospike.exp_operations', function () { await testNoMatch(key, exp.eq( exp.maps.getByIndex( exp.binMap('tags'), - exp.int(3), - exp.type.INT, + exp.int(2), + exp.type.AUTO, maps.returnType.COUNT, context), exp.int(0))) await testMatch(key, exp.eq( exp.maps.getByIndex( exp.binMap('tags'), - exp.int(4), - exp.type.INT, + exp.int(3), + exp.type.AUTO, maps.returnType.COUNT, context), exp.int(1))) @@ -186,7 +186,7 @@ describe('Aerospike.exp_operations', function () { }) it('selects "count" map items starting at specified nested index', async function () { - const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black'} } }) + const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) const context = new Context().addMapKey('nested') orderByKey('tags') orderByKey('tags', context) @@ -195,14 +195,16 @@ describe('Aerospike.exp_operations', function () { exp.binMap('tags'), exp.int(6), exp.int(0), - maps.returnType.COUNT), + maps.returnType.COUNT, + context), exp.int(0))) await testMatch(key, exp.eq( exp.maps.getByIndexRange( exp.binMap('tags'), exp.int(6), exp.int(0), - maps.returnType.COUNT), + maps.returnType.COUNT, + context), exp.int(4))) }) }) @@ -226,7 +228,7 @@ describe('Aerospike.exp_operations', function () { }) it('selects map items starting at specified index to the end of the map', async function () { - const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black'} } }) + const key = await createRecord({ tags: { a: 'blue', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) const context = new Context().addMapKey('nested') orderByKey('tags') orderByKey('tags', context) @@ -234,13 +236,15 @@ describe('Aerospike.exp_operations', function () { exp.maps.getByIndexRangeToEnd( exp.binMap('tags'), exp.int(0), - maps.returnType.COUNT), + maps.returnType.COUNT, + context), exp.int(0))) await testMatch(key, exp.eq( exp.maps.getByIndexRangeToEnd( exp.binMap('tags'), exp.int(0), - maps.returnType.COUNT), + maps.returnType.COUNT, + context), exp.int(4))) }) }) @@ -255,14 +259,56 @@ describe('Aerospike.exp_operations', function () { it('matches the count of the matched map values of a nested map', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) const context = new Context().addMapKey('nested') - console.log(exp.maps.getByKey(exp.binMap('tags'), exp.str('d'), exp.type.AUTO, maps.returnType.COUNT, context)) await testNoMatch(key, exp.eq(exp.maps.getByKey(exp.binMap('tags'), exp.str('d'), exp.type.AUTO, maps.returnType.COUNT, context), exp.int(2))) await testMatch(key, exp.eq(exp.maps.getByKey(exp.binMap('tags'), exp.str('d'), exp.type.AUTO, maps.returnType.COUNT, context), exp.int(1))) }) }) - + describe('getByKeyRange', function () { + it('matches the count of the matched map values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) + await testNoMatch(key, exp.eq(exp.maps.getByKeyRange(exp.binMap('tags'), exp.str('c'), exp.str('a'), maps.returnType.COUNT), exp.int(3))) + await testMatch(key, exp.eq(exp.maps.getByKeyRange(exp.binMap('tags'), exp.str('c'), exp.str('a'), maps.returnType.COUNT), exp.int(2))) + }) + it('matches the count of the matched map values of a nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.getByKeyRange(exp.binMap('tags'), exp.str('g'), exp.str('d'), maps.returnType.COUNT, context), exp.int(4))) + await testMatch(key, exp.eq(exp.maps.getByKeyRange(exp.binMap('tags'), exp.str('g'), exp.str('d'), maps.returnType.COUNT, context), exp.int(3))) + }) + }) + + describe('getByKeyRelIndexRange', function () { + it('matches the count of the matched map values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', d: 'yellow' } }) + await testNoMatch(key, exp.eq(exp.maps.getByKeyRelIndexRange(exp.binMap('tags'), exp.int(3), exp.int(0), exp.str('b'), maps.returnType.COUNT), exp.int(1))) + await testMatch(key, exp.eq(exp.maps.getByKeyRelIndexRange(exp.binMap('tags'), exp.int(3), exp.int(0), exp.str('b'), maps.returnType.COUNT), exp.int(2))) + }) + + it('matches the count of the matched map values of a nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', g: 'white', h: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.getByKeyRelIndexRange(exp.binMap('tags'), exp.int(3), exp.int(0), exp.str('g'), maps.returnType.COUNT, context), exp.int(1))) + await testMatch(key, exp.eq(exp.maps.getByKeyRelIndexRange(exp.binMap('tags'), exp.int(3), exp.int(0), exp.str('g'), maps.returnType.COUNT, context), exp.int(2))) + }) + }) + /* + describe('getByKeyRelIndexRangeToEnd', function () { + it('matches the count of the matched map values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', d: 'yellow' } }) + await testNoMatch(key, exp.eq(exp.maps.getByKeyRelIndexRangeToEnd(exp.binMap('tags'), exp.int(0), exp.str('b'), maps.returnType.COUNT), exp.int(1))) + await testMatch(key, exp.eq(exp.maps.getByKeyRelIndexRangeToEnd(exp.binMap('tags'), exp.int(0), exp.str('b'), maps.returnType.COUNT), exp.int(2))) + }) + + it('matches the count of the matched map values of a nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', g: 'white', h: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.getByKeyRelIndexRangeToEnd(exp.binMap('tags'), exp.int(0), exp.str('e'), maps.returnType.COUNT, context), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.getByKeyRelIndexRangeToEnd(exp.binMap('tags'), exp.int(0), exp.str('e'), maps.returnType.COUNT, context), exp.int(3))) + }) + }) +*/ describe('getByRank', function () { it('selects map item identified by rank', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', d: 5, c: 'yellow' } }) @@ -294,6 +340,39 @@ describe('Aerospike.exp_operations', function () { maps.returnType.COUNT), exp.int(1))) }) + + it('selects map item identified by rank within a nested map', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', d: 5, c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + const ops = [ + exp.operations.read(tempBin, + exp.maps.getByRank( + exp.binMap('tags'), + exp.int(0), + exp.type.INT, + maps.returnType.COUNT), + 0), + op.read('tags') + ] + await client.operate(key, ops, {}) + + await testNoMatch(key, exp.eq( + exp.maps.getByRank( + exp.binMap('tags'), + exp.int(0), + exp.type.INT, + maps.returnType.COUNT, + context), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByRank( + exp.binMap('tags'), + exp.int(0), + exp.type.INT, + maps.returnType.COUNT, + context), + exp.int(1))) + }) }) describe('getByRankRange', function () { @@ -315,6 +394,27 @@ describe('Aerospike.exp_operations', function () { maps.returnType.COUNT), exp.int(3))) }) + + it('selects "count" map items starting at specified rank in nested context', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq( + exp.maps.getByRankRange( + exp.binMap('tags'), + exp.int(5), + exp.int(0), + maps.returnType.COUNT, + context), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByRankRange( + exp.binMap('tags'), + exp.int(5), + exp.int(0), + maps.returnType.COUNT, + context), + exp.int(4))) + }) }) describe('getByRankRangeToEnd', function () { @@ -334,19 +434,25 @@ describe('Aerospike.exp_operations', function () { maps.returnType.COUNT), exp.int(3))) }) - }) - it('writes map values originating from nested map to a specified map', async function () { - const key = await createRecord({ map: { c: 1, b: 2, a: 3, nested: { g: 4 } }, map2: { f: 1, e: 2, d: 3 } }) - const context = new Context().addMapKey('nested') - const ops = [ - exp.operations.write('map', - exp.maps.putItems(exp.binMap('map'), exp.binMap('map2'), null, context), - 0), - op.read('map') - ] - const result = await client.operate(key, ops, {}) - expect(result.bins.map.nested).to.eql({ d: 3, e: 2, f: 1, g: 4 }) + it('selects map items starting at specified rank to the last ranked item in a nested context', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq( + exp.maps.getByRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + maps.returnType.COUNT, + context), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + maps.returnType.COUNT, + context), + exp.int(4))) + }) }) }) @@ -366,64 +472,47 @@ describe('Aerospike.exp_operations', function () { }) }) + /* describe('getByValueList', function () { it('matches the count of the matched values', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) - const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueList( - exp.binMap('tags'), - exp.list(['yellow', 'blue']), - maps.returnType.KEY), - 0), - op.read('tags') - ] - await client.operate(key, ops, {}) + await testNoMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list([exp.str('green'), exp.str('yellow')]), maps.returnType.COUNT), exp.int(3))) + await testMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list([exp.str('green'), exp.str('yellow')]), maps.returnType.COUNT), exp.int(2))) + }) + + it('matches the count of the matched values', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') - await testNoMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list(['green', 'yellow']), maps.returnType.COUNT), exp.int(3))) - await testMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list(['green', 'yellow']), maps.returnType.COUNT), exp.int(0))) + await testNoMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list([exp.str('orange'), exp.str('white')]), maps.returnType.COUNT, context), exp.int(3))) + await testMatch(key, exp.eq(exp.maps.getByValueList(exp.binMap('tags'), exp.list([exp.str('orange'), exp.str('white')]), maps.returnType.COUNT, context), exp.int(2))) }) }) +*/ describe('getByValueRange', function () { it('matches the count of the matched range of map values', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) await testNoMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('yellow'), exp.str('blue'), maps.returnType.COUNT), exp.int(3))) - const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueRange( - exp.binMap('tags'), - exp.str('yellow'), - exp.str('blue'), - maps.returnType.COUNT), - 0), - op.read('tags') - ] - await client.operate(key, ops, {}) await testMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('yellow'), exp.str('blue'), maps.returnType.COUNT), exp.int(2))) }) + + it('matches the count of the matched range of map values in a nested context', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('white'), exp.str('black'), maps.returnType.COUNT, context), exp.int(4))) + + await testMatch(key, exp.eq(exp.maps.getByValueRange(exp.binMap('tags'), exp.str('white'), exp.str('black'), maps.returnType.COUNT, context), exp.int(3))) + }) }) describe('getByValueRelRankRange', function () { it('selects map items nearest to value and greater by relative rank with a count limit', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) - const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueRelRankRange( - exp.binMap('tags'), - exp.int(2), - exp.int(0), - exp.str('yellow'), - maps.returnType.KEY), - 0), - op.read('tags') - ] - await client.operate(key, ops, {}) - await testNoMatch(key, exp.eq( exp.maps.getByValueRelRankRange( exp.binMap('tags'), @@ -441,24 +530,35 @@ describe('Aerospike.exp_operations', function () { maps.returnType.COUNT), exp.int(1))) }) + + it('selects map items nearest to value and greater by relative rank with a count limit in a nested context', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq( + exp.maps.getByValueRelRankRange( + exp.binMap('tags'), + exp.int(2), + exp.int(0), + exp.str('pink'), + maps.returnType.COUNT, + context), + exp.int(0))) + await testMatch(key, exp.eq( + exp.maps.getByValueRelRankRange( + exp.binMap('tags'), + exp.int(2), + exp.int(0), + exp.str('pink'), + maps.returnType.COUNT, + context), + exp.int(2))) + }) }) describe('getByValueRelRankRangeToEnd', function () { it('selects map items nearest to value and greater by relative rank', async function () { const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow' } }) - const ops = [ - exp.operations.read(tempBin, - exp.maps.getByValueRelRankRangeToEnd( - exp.binMap('tags'), - exp.int(0), - exp.str('yellow'), - maps.returnType.COUNT), - 0), - op.read('tags') - ] - await client.operate(key, ops, {}) - await testNoMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( exp.binMap('tags'), exp.int(0), @@ -472,6 +572,25 @@ describe('Aerospike.exp_operations', function () { maps.returnType.COUNT), exp.int(1))) }) + + it('selects map items nearest to value and greater by relative rank in a nested context', async function () { + const key = await createRecord({ tags: { a: 'blue', b: 'green', c: 'yellow', nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + exp.str('orange'), + maps.returnType.COUNT, + context), + exp.int(0))) + await testMatch(key, exp.eq(exp.maps.getByValueRelRankRangeToEnd( + exp.binMap('tags'), + exp.int(0), + exp.str('orange'), + maps.returnType.COUNT, + context), + exp.int(3))) + }) }) describe('putItems', function () { @@ -487,20 +606,45 @@ describe('Aerospike.exp_operations', function () { expect(result.bins.map).to.eql({ a: 3, b: 2, c: 1, d: 3, e: 2, f: 1 }) }) - describe('size', function () { - it('returns the map size', async function () { - const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27 } }) + it('writes map values from exp.map expression to specified map', async function () { + const key = await createRecord({ map: { c: 1, b: 2, a: 3 } }) + const ops = [ + exp.operations.write('map', + exp.maps.putItems(exp.binMap('map'), exp.map({ f: 1, e: 2, d: 3 })), + 0), + op.read('map') + ] + const result = await client.operate(key, ops, {}) + expect(result.bins.map).to.eql({ a: 3, b: 2, c: 1, d: 3, e: 2, f: 1 }) + }) + + it('writes map values originating from nested map to a specified map', async function () { + const key = await createRecord({ map: { c: 1, b: 2, a: 3, nested: { g: 4 } }, map2: { f: 1, e: 2, d: 3 } }) + const context = new Context().addMapKey('nested') + const ops = [ + exp.operations.write('map', + exp.maps.putItems(exp.binMap('map'), exp.binMap('map2'), null, context), + 0), + op.read('map') + ] + const result = await client.operate(key, ops, {}) + expect(result.bins.map.nested).to.eql({ d: 3, e: 2, f: 1, g: 4 }) + }) + }) + + describe('size', function () { + it('returns the map size', async function () { + const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27 } }) - await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(2))) - await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(3))) - }) + await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map')), exp.int(3))) + }) - it('returns the map size from a nested map', async function () { - const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27, nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) - const context = new Context().addMapKey('nested') - await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map'), context), exp.int(2))) - await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map'), context), exp.int(4))) - }) + it('returns the map size from a nested map', async function () { + const key = await createRecord({ map: { john: 42, malcom: 73, susan: 27, nested: { d: 'orange', e: 'pink', f: 'white', g: 'black' } } }) + const context = new Context().addMapKey('nested') + await testNoMatch(key, exp.eq(exp.maps.size(exp.binMap('map'), context), exp.int(2))) + await testMatch(key, exp.eq(exp.maps.size(exp.binMap('map'), context), exp.int(4))) }) }) }) From a4a9f3d7c7fa30d8e9a410115496ac220b2f8227 Mon Sep 17 00:00:00 2001 From: Dominic Pelini <111786059+DomPeliniAerospike@users.noreply.github.com> Date: Mon, 27 Mar 2023 11:37:38 -0600 Subject: [PATCH 9/9] Updated C Client and Node packages Updated C Client Updated dependencies with "npm update" --- aerospike-client-c | 2 +- package-lock.json | 228 ++++++++++++++++++++++++++------------------- package.json | 2 +- 3 files changed, 132 insertions(+), 100 deletions(-) diff --git a/aerospike-client-c b/aerospike-client-c index cb72cd2b5..f7af9db26 160000 --- a/aerospike-client-c +++ b/aerospike-client-c @@ -1 +1 @@ -Subproject commit cb72cd2b5dafdb337193bae81ca0745e8c0f75d8 +Subproject commit f7af9db267abe6d61bd6a2b6fc2424d3687e6d7d diff --git a/package-lock.json b/package-lock.json index 1e8e5a489..a5279b242 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aerospike", - "version": "5.2.2", + "version": "5.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aerospike", - "version": "5.2.2", + "version": "5.3.0", "cpu": [ "x64", "arm64" @@ -72,30 +72,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz", - "integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.0.tgz", + "integrity": "sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.20.12", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz", - "integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.3.tgz", + "integrity": "sha512-qIJONzoa/qiHghnm0l1n4i/6IIziDpzqc36FBs4pzMhDUraHqponwJLiAKm1hGLP3OSB/TVNz6rMwVGpwxxySw==", "dev": true, "dependencies": { - "@ampproject/remapping": "^2.1.0", + "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", + "@babel/generator": "^7.21.3", "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-module-transforms": "^7.20.11", - "@babel/helpers": "^7.20.7", - "@babel/parser": "^7.20.7", + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helpers": "^7.21.0", + "@babel/parser": "^7.21.3", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.12", - "@babel/types": "^7.20.7", + "@babel/traverse": "^7.21.3", + "@babel/types": "^7.21.3", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -120,13 +120,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.14.tgz", - "integrity": "sha512-AEmuXHdcD3A52HHXxaTmYlb8q/xMEhoRP67B3T4Oq7lbmSoqroMZzjnGj3+i1io3pdnF8iBYVu4Ilj+c4hBxYg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.3.tgz", + "integrity": "sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==", "dev": true, "dependencies": { - "@babel/types": "^7.20.7", + "@babel/types": "^7.21.3", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { @@ -200,13 +201,13 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "dev": true, "dependencies": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -237,9 +238,9 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.20.11", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz", - "integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==", + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", @@ -248,8 +249,8 @@ "@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.10", - "@babel/types": "^7.20.7" + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" }, "engines": { "node": ">=6.9.0" @@ -298,23 +299,23 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz", - "integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", + "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", "dev": true, "dependencies": { "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.13", - "@babel/types": "^7.20.7" + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -335,9 +336,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.20.15", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.15.tgz", - "integrity": "sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.3.tgz", + "integrity": "sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -361,19 +362,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.13.tgz", - "integrity": "sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.3.tgz", + "integrity": "sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", + "@babel/generator": "^7.21.3", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", + "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.20.13", - "@babel/types": "^7.20.7", + "@babel/parser": "^7.21.3", + "@babel/types": "^7.21.3", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -382,9 +383,9 @@ } }, "node_modules/@babel/types": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", - "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.3.tgz", + "integrity": "sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.19.4", @@ -665,12 +666,12 @@ } }, "node_modules/agentkeepalive": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", - "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz", + "integrity": "sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==", "dependencies": { "debug": "^4.1.0", - "depd": "^1.1.2", + "depd": "^2.0.0", "humanize-ms": "^1.2.1" }, "engines": { @@ -801,6 +802,19 @@ "node": ">=0.6.10" } }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-includes": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", @@ -1038,9 +1052,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001456", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001456.tgz", - "integrity": "sha512-XFHJY5dUgmpMV25UqaD4kVq2LsiaU5rS8fb0f17pCoXQiQslzmFgnfOxfvo1bTpTqf7dwG/N/05CnLCnOEKmzA==", + "version": "1.0.30001470", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001470.tgz", + "integrity": "sha512-065uNwY6QtHCBOExzbV6m236DDhYCCtPmQUCoQtwkVqzud8v5QPidoMr6CoMkC2nfp6nksjttqWQRRh75LqUmA==", "dev": true, "funding": [ { @@ -1320,11 +1334,11 @@ "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" }, "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "engines": { - "node": ">= 0.6" + "node": ">= 0.8" } }, "node_modules/detect-libc": { @@ -1366,9 +1380,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.301", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.301.tgz", - "integrity": "sha512-bz00ASIIDjcgszZKuEA1JEFhbDjqUNbQ/PEhNEl1wbixzYpeTp2H2QWjsQvAL2T1wJBdOwCF5hE896BoMwYKrA==", + "version": "1.4.340", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.340.tgz", + "integrity": "sha512-zx8hqumOqltKsv/MF50yvdAlPF9S/4PXbyfzJS6ZGhbddGkRegdwImmfSVqCkEziYzrIGZ/TlrzBND4FysfkDg==", "dev": true }, "node_modules/emoji-regex": { @@ -1420,18 +1434,18 @@ } }, "node_modules/es-abstract": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.1.tgz", - "integrity": "sha512-QudMsPOz86xYz/1dG1OuGBKOELjCh99IIWHLzy5znUB6j8xG2yMA7bfTV86VSqKF+Y/H08vQPR+9jyXpuC6hfg==", + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", + "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==", "dev": true, "dependencies": { + "array-buffer-byte-length": "^1.0.0", "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.3", + "get-intrinsic": "^1.2.0", "get-symbol-description": "^1.0.0", "globalthis": "^1.0.3", "gopd": "^1.0.1", @@ -1439,8 +1453,8 @@ "has-property-descriptors": "^1.0.0", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", - "internal-slot": "^1.0.4", - "is-array-buffer": "^3.0.1", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", @@ -1448,11 +1462,12 @@ "is-string": "^1.0.7", "is-typed-array": "^1.1.10", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.2", + "object-inspect": "^1.12.3", "object-keys": "^1.1.1", "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.4.3", "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", "string.prototype.trimend": "^1.0.6", "string.prototype.trimstart": "^1.0.6", "typed-array-length": "^1.0.4", @@ -2105,9 +2120,9 @@ } }, "node_modules/esquery": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz", - "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -2545,9 +2560,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "node_modules/growl": { "version": "1.10.5", @@ -2844,13 +2859,13 @@ "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" }, "node_modules/is-array-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz", - "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", + "get-intrinsic": "^1.2.0", "is-typed-array": "^1.1.10" }, "funding": { @@ -4995,9 +5010,9 @@ } }, "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -5357,9 +5372,9 @@ } }, "node_modules/spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "dev": true, "dependencies": { "spdx-expression-parse": "^3.0.0", @@ -5383,9 +5398,9 @@ } }, "node_modules/spdx-license-ids": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", - "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", + "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", "dev": true }, "node_modules/sprintf-js": { @@ -5519,6 +5534,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/string.prototype.trim": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", + "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/string.prototype.trimend": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", @@ -5664,9 +5696,9 @@ } }, "node_modules/tar/node_modules/minipass": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.0.3.tgz", - "integrity": "sha512-OW2r4sQ0sI+z5ckEt5c1Tri4xTgZwYDxpE54eqWlQloQRoWtXjqt9udJ5Z4dSv7wK+nfFI7FRXyCpBSft+gpFw==", + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", + "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==", "engines": { "node": ">=8" } @@ -5758,13 +5790,13 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/tsconfig-paths": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", - "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", - "json5": "^1.0.1", + "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } diff --git a/package.json b/package.json index 02cdd13e6..080aa4732 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aerospike", - "version": "5.2.2", + "version": "5.3.0", "description": "Aerospike Client Library", "keywords": [ "aerospike",