@valkey/valkey-glide-darwin-arm64 1.2.1 → 1.3.0-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-ts/src/BaseClient.d.ts +44 -55
- package/build-ts/src/BaseClient.js +151 -170
- package/build-ts/src/BaseClient.js.map +1 -1
- package/build-ts/src/Commands.d.ts +30 -12
- package/build-ts/src/Commands.js +27 -17
- package/build-ts/src/Commands.js.map +1 -1
- package/build-ts/src/GlideClient.d.ts +2 -0
- package/build-ts/src/GlideClient.js +2 -0
- package/build-ts/src/GlideClient.js.map +1 -1
- package/build-ts/src/GlideClusterClient.d.ts +4 -1
- package/build-ts/src/GlideClusterClient.js +50 -3
- package/build-ts/src/GlideClusterClient.js.map +1 -1
- package/build-ts/src/ProtobufMessage.js +7 -0
- package/build-ts/src/ProtobufMessage.js.map +1 -1
- package/build-ts/src/Transaction.d.ts +7 -31
- package/build-ts/src/Transaction.js +6 -32
- package/build-ts/src/Transaction.js.map +1 -1
- package/build-ts/src/server-modules/GlideJson.d.ts +518 -12
- package/build-ts/src/server-modules/GlideJson.js +629 -13
- package/build-ts/src/server-modules/GlideJson.js.map +1 -1
- package/node_modules/glide-rs/glide-rs.darwin-arm64.node +0 -0
- package/npm/glide/index.ts +2 -0
- package/package.json +6 -3
- package/rust-client/node_modules/mingo/dist/cjs/index.js +5 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/_predicates.js +8 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/slice.js +0 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/setField.js +4 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/bucketAuto.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/util.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/index.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/_predicates.js +8 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/slice.js +0 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/setField.js +4 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/bucketAuto.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/util.js +1 -1
- package/rust-client/node_modules/mingo/package.json +1 -1
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.GlideJson = void 0;
|
|
15
|
+
exports.JsonBatch = exports.GlideJson = void 0;
|
|
16
16
|
const GlideClient_1 = require("../GlideClient");
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
@@ -74,7 +74,7 @@ class GlideJson {
|
|
|
74
74
|
* ```typescript
|
|
75
75
|
* const value = {a: 1.0, b:2};
|
|
76
76
|
* const jsonStr = JSON.stringify(value);
|
|
77
|
-
* const result = await GlideJson.set("doc", "$", jsonStr);
|
|
77
|
+
* const result = await GlideJson.set(client, "doc", "$", jsonStr);
|
|
78
78
|
* console.log(result); // 'OK' - Indicates successful setting of the value at path '$' in the key stored at `doc`.
|
|
79
79
|
*
|
|
80
80
|
* const jsonGetStr = await GlideJson.get(client, "doc", {path: "$"}); // Returns the value at path '$' in the JSON document stored at `doc` as JSON string.
|
|
@@ -211,7 +211,7 @@ class GlideJson {
|
|
|
211
211
|
* await GlideJson.set(client, "doc", "$", '[[], ["a"], ["a", "b"]]');
|
|
212
212
|
* const result = await GlideJson.arrinsert(client, "doc", "$[*]", 0, ['"c"', '{"key": "value"}', "true", "null", '["bar"]']);
|
|
213
213
|
* console.log(result); // Output: [5, 6, 7]
|
|
214
|
-
* const doc = await
|
|
214
|
+
* const doc = await GlideJson.get(client, "doc");
|
|
215
215
|
* console.log(doc); // Output: '[["c",{"key":"value"},true,null,["bar"]],["c",{"key":"value"},true,null,["bar"],"a"],["c",{"key":"value"},true,null,["bar"],"a","b"]]'
|
|
216
216
|
* ```
|
|
217
217
|
* @example
|
|
@@ -219,7 +219,7 @@ class GlideJson {
|
|
|
219
219
|
* await GlideJson.set(client, "doc", "$", '[[], ["a"], ["a", "b"]]');
|
|
220
220
|
* const result = await GlideJson.arrinsert(client, "doc", ".", 0, ['"c"'])
|
|
221
221
|
* console.log(result); // Output: 4
|
|
222
|
-
* const doc = await
|
|
222
|
+
* const doc = await GlideJson.get(client, "doc");
|
|
223
223
|
* console.log(doc); // Output: '[\"c\",[],[\"a\"],[\"a\",\"b\"]]'
|
|
224
224
|
* ```
|
|
225
225
|
*/
|
|
@@ -442,7 +442,7 @@ class GlideJson {
|
|
|
442
442
|
* ```typescript
|
|
443
443
|
* const value = {bool: true, nested: {bool: false, nested: {bool: 10}}};
|
|
444
444
|
* const jsonStr = JSON.stringify(value);
|
|
445
|
-
* const resultSet = await GlideJson.set("doc", "$", jsonStr);
|
|
445
|
+
* const resultSet = await GlideJson.set(client, "doc", "$", jsonStr);
|
|
446
446
|
* // Output: 'OK'
|
|
447
447
|
*
|
|
448
448
|
* const resultToggle = await.GlideJson.toggle(client, "doc", {path: "$.bool"});
|
|
@@ -624,13 +624,13 @@ class GlideJson {
|
|
|
624
624
|
/**
|
|
625
625
|
* Retrieve the JSON value at the specified `path` within the JSON document stored at `key`.
|
|
626
626
|
* The returning result is in the Valkey or Redis OSS Serialization Protocol (RESP).
|
|
627
|
-
* JSON null is mapped to the RESP Null Bulk String.
|
|
628
|
-
* JSON Booleans are mapped to RESP Simple string.
|
|
629
|
-
* JSON integers are mapped to RESP Integers.
|
|
630
|
-
* JSON doubles are mapped to RESP Bulk Strings.
|
|
631
|
-
* JSON strings are mapped to RESP Bulk Strings.
|
|
632
|
-
* JSON arrays are represented as RESP arrays, where the first element is the simple string [, followed by the array's elements.
|
|
633
|
-
* JSON objects are represented as RESP object, where the first element is the simple string {, followed by key-value pairs, each of which is a RESP bulk string.
|
|
627
|
+
* - JSON null is mapped to the RESP Null Bulk String.
|
|
628
|
+
* - JSON Booleans are mapped to RESP Simple string.
|
|
629
|
+
* - JSON integers are mapped to RESP Integers.
|
|
630
|
+
* - JSON doubles are mapped to RESP Bulk Strings.
|
|
631
|
+
* - JSON strings are mapped to RESP Bulk Strings.
|
|
632
|
+
* - JSON arrays are represented as RESP arrays, where the first element is the simple string [, followed by the array's elements.
|
|
633
|
+
* - JSON objects are represented as RESP object, where the first element is the simple string {, followed by key-value pairs, each of which is a RESP bulk string.
|
|
634
634
|
*
|
|
635
635
|
* @param client - The client to execute the command.
|
|
636
636
|
* @param key - The key of the JSON document.
|
|
@@ -847,7 +847,7 @@ class GlideJson {
|
|
|
847
847
|
* ```typescript
|
|
848
848
|
* console.log(await GlideJson.set(client, "doc", "$", '[1, 2.3, "foo", true, null, {}, [], {a:1, b:2}, [1, 2, 3]]'));
|
|
849
849
|
* // Output: 'OK' - Indicates successful setting of the value at path '$' in the key stored at `doc`.
|
|
850
|
-
* console.log(await GlideJson.
|
|
850
|
+
* console.log(await GlideJson.debugFields(client, "doc", {path: "$[*]"});
|
|
851
851
|
* // Output: [1, 1, 1, 1, 1, 0, 0, 2, 3]
|
|
852
852
|
* ```
|
|
853
853
|
*/
|
|
@@ -1009,4 +1009,620 @@ class GlideJson {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
1011
|
exports.GlideJson = GlideJson;
|
|
1012
|
+
/**
|
|
1013
|
+
* Transaction implementation for JSON module. Transactions allow the execution of a group of
|
|
1014
|
+
* commands in a single step. See {@link Transaction} and {@link ClusterTransaction}.
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* ```typescript
|
|
1018
|
+
* const transaction = new Transaction();
|
|
1019
|
+
* JsonBatch.set(transaction, "doc", ".", '{"a": 1.0, "b": 2}');
|
|
1020
|
+
* JsonBatch.get(transaction, "doc");
|
|
1021
|
+
* const result = await client.exec(transaction);
|
|
1022
|
+
*
|
|
1023
|
+
* console.log(result[0]); // Output: 'OK' - result of JsonBatch.set()
|
|
1024
|
+
* console.log(result[1]); // Output: '{"a": 1.0, "b": 2}' - result of JsonBatch.get()
|
|
1025
|
+
* ```
|
|
1026
|
+
*/
|
|
1027
|
+
class JsonBatch {
|
|
1028
|
+
/**
|
|
1029
|
+
* Sets the JSON value at the specified `path` stored at `key`.
|
|
1030
|
+
*
|
|
1031
|
+
* @param transaction - A transaction to add commands to.
|
|
1032
|
+
* @param key - The key of the JSON document.
|
|
1033
|
+
* @param path - Represents the path within the JSON document where the value will be set.
|
|
1034
|
+
* The key will be modified only if `value` is added as the last child in the specified `path`, or if the specified `path` acts as the parent of a new child being added.
|
|
1035
|
+
* @param value - The value to set at the specific path, in JSON formatted bytes or str.
|
|
1036
|
+
* @param options - (Optional) Additional parameters:
|
|
1037
|
+
* - (Optional) `conditionalChange` - Set the value only if the given condition is met (within the key or path).
|
|
1038
|
+
* Equivalent to [`XX` | `NX`] in the module API.
|
|
1039
|
+
*
|
|
1040
|
+
* Command Response - If the value is successfully set, returns `"OK"`.
|
|
1041
|
+
* If `value` isn't set because of `conditionalChange`, returns `null`.
|
|
1042
|
+
*/
|
|
1043
|
+
static set(transaction, key, path, value, options) {
|
|
1044
|
+
const args = ["JSON.SET", key, path, value];
|
|
1045
|
+
if ((options === null || options === void 0 ? void 0 : options.conditionalChange) !== undefined) {
|
|
1046
|
+
args.push(options.conditionalChange);
|
|
1047
|
+
}
|
|
1048
|
+
return transaction.customCommand(args);
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Retrieves the JSON value at the specified `paths` stored at `key`.
|
|
1052
|
+
*
|
|
1053
|
+
* @param transaction - A transaction to add commands to.
|
|
1054
|
+
* @param key - The key of the JSON document.
|
|
1055
|
+
* @param options - (Optional) Additional parameters:
|
|
1056
|
+
* - (Optional) Options for formatting the byte representation of the JSON data. See {@link JsonGetOptions}.
|
|
1057
|
+
*
|
|
1058
|
+
* Command Response -
|
|
1059
|
+
* - If one path is given:
|
|
1060
|
+
* - For JSONPath (path starts with `$`):
|
|
1061
|
+
* - Returns a stringified JSON list of bytes replies for every possible path,
|
|
1062
|
+
* or a byte string representation of an empty array, if path doesn't exist.
|
|
1063
|
+
* If `key` doesn't exist, returns `null`.
|
|
1064
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1065
|
+
* Returns a byte string representation of the value in `path`.
|
|
1066
|
+
* If `path` doesn't exist, an error is raised.
|
|
1067
|
+
* If `key` doesn't exist, returns `null`.
|
|
1068
|
+
* - If multiple paths are given:
|
|
1069
|
+
* Returns a stringified JSON object in bytes, in which each path is a key, and it's corresponding value, is the value as if the path was executed in the command as a single path.
|
|
1070
|
+
* In case of multiple paths, and `paths` are a mix of both JSONPath and legacy path, the command behaves as if all are JSONPath paths.
|
|
1071
|
+
*/
|
|
1072
|
+
static get(transaction, key, options) {
|
|
1073
|
+
const args = ["JSON.GET", key];
|
|
1074
|
+
if (options) {
|
|
1075
|
+
const optionArgs = _jsonGetOptionsToArgs(options);
|
|
1076
|
+
args.push(...optionArgs);
|
|
1077
|
+
}
|
|
1078
|
+
return transaction.customCommand(args);
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Retrieves the JSON values at the specified `path` stored at multiple `keys`.
|
|
1082
|
+
*
|
|
1083
|
+
* @remarks When in cluster mode, all keys in the transaction must be mapped to the same slot.
|
|
1084
|
+
*
|
|
1085
|
+
* @param client - The client to execute the command.
|
|
1086
|
+
* @param keys - The keys of the JSON documents.
|
|
1087
|
+
* @param path - The path within the JSON documents.
|
|
1088
|
+
*
|
|
1089
|
+
* Command Response -
|
|
1090
|
+
* - For JSONPath (path starts with `$`):
|
|
1091
|
+
* Returns a stringified JSON list replies for every possible path, or a string representation
|
|
1092
|
+
* of an empty array, if path doesn't exist.
|
|
1093
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1094
|
+
* Returns a string representation of the value in `path`. If `path` doesn't exist,
|
|
1095
|
+
* the corresponding array element will be `null`.
|
|
1096
|
+
* - If a `key` doesn't exist, the corresponding array element will be `null`.
|
|
1097
|
+
*/
|
|
1098
|
+
static mget(transaction, keys, path) {
|
|
1099
|
+
const args = ["JSON.MGET", ...keys, path];
|
|
1100
|
+
return transaction.customCommand(args);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Inserts one or more values into the array at the specified `path` within the JSON
|
|
1104
|
+
* document stored at `key`, before the given `index`.
|
|
1105
|
+
*
|
|
1106
|
+
* @param transaction - A transaction to add commands to.
|
|
1107
|
+
* @param key - The key of the JSON document.
|
|
1108
|
+
* @param path - The path within the JSON document.
|
|
1109
|
+
* @param index - The array index before which values are inserted.
|
|
1110
|
+
* @param values - The JSON values to be inserted into the array.
|
|
1111
|
+
* JSON string values must be wrapped with quotes. For example, to insert `"foo"`, pass `"\"foo\""`.
|
|
1112
|
+
*
|
|
1113
|
+
* Command Response -
|
|
1114
|
+
* - For JSONPath (path starts with `$`):
|
|
1115
|
+
* Returns an array with a list of integers for every possible path,
|
|
1116
|
+
* indicating the new length of the array, or `null` for JSON values matching
|
|
1117
|
+
* the path that are not an array. If `path` does not exist, an empty array
|
|
1118
|
+
* will be returned.
|
|
1119
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1120
|
+
* Returns an integer representing the new length of the array. If multiple paths are
|
|
1121
|
+
* matched, returns the length of the first modified array. If `path` doesn't
|
|
1122
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
1123
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
1124
|
+
*/
|
|
1125
|
+
static arrinsert(transaction, key, path, index, values) {
|
|
1126
|
+
const args = ["JSON.ARRINSERT", key, path, index.toString(), ...values];
|
|
1127
|
+
return transaction.customCommand(args);
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Pops an element from the array located at `path` in the JSON document stored at `key`.
|
|
1131
|
+
*
|
|
1132
|
+
* @param transaction - A transaction to add commands to.
|
|
1133
|
+
* @param key - The key of the JSON document.
|
|
1134
|
+
* @param options - (Optional) See {@link JsonArrPopOptions}.
|
|
1135
|
+
*
|
|
1136
|
+
* Command Response -
|
|
1137
|
+
* - For JSONPath (path starts with `$`):
|
|
1138
|
+
* Returns an array with a strings for every possible path, representing the popped JSON
|
|
1139
|
+
* values, or `null` for JSON values matching the path that are not an array
|
|
1140
|
+
* or an empty array.
|
|
1141
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1142
|
+
* Returns a string representing the popped JSON value, or `null` if the
|
|
1143
|
+
* array at `path` is empty. If multiple paths are matched, the value from
|
|
1144
|
+
* the first matching array that is not empty is returned. If `path` doesn't
|
|
1145
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
1146
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
1147
|
+
*/
|
|
1148
|
+
static arrpop(transaction, key, options) {
|
|
1149
|
+
const args = ["JSON.ARRPOP", key];
|
|
1150
|
+
if (options === null || options === void 0 ? void 0 : options.path)
|
|
1151
|
+
args.push(options === null || options === void 0 ? void 0 : options.path);
|
|
1152
|
+
if (options && "index" in options && options.index)
|
|
1153
|
+
args.push(options === null || options === void 0 ? void 0 : options.index.toString());
|
|
1154
|
+
return transaction.customCommand(args);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Retrieves the length of the array at the specified `path` within the JSON document stored at `key`.
|
|
1158
|
+
*
|
|
1159
|
+
* @param transaction - A transaction to add commands to.
|
|
1160
|
+
* @param key - The key of the JSON document.
|
|
1161
|
+
* @param options - (Optional) Additional parameters:
|
|
1162
|
+
* - (Optional) `path`: The path within the JSON document. Defaults to the root (`"."`) if not specified.
|
|
1163
|
+
*
|
|
1164
|
+
* Command Response -
|
|
1165
|
+
* - For JSONPath (path starts with `$`):
|
|
1166
|
+
* Returns an array with a list of integers for every possible path,
|
|
1167
|
+
* indicating the length of the array, or `null` for JSON values matching
|
|
1168
|
+
* the path that are not an array. If `path` does not exist, an empty array
|
|
1169
|
+
* will be returned.
|
|
1170
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1171
|
+
* Returns an integer representing the length of the array. If multiple paths are
|
|
1172
|
+
* matched, returns the length of the first matching array. If `path` doesn't
|
|
1173
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
1174
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
1175
|
+
*/
|
|
1176
|
+
static arrlen(transaction, key, options) {
|
|
1177
|
+
const args = ["JSON.ARRLEN", key];
|
|
1178
|
+
if (options === null || options === void 0 ? void 0 : options.path)
|
|
1179
|
+
args.push(options === null || options === void 0 ? void 0 : options.path);
|
|
1180
|
+
return transaction.customCommand(args);
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Trims an array at the specified `path` within the JSON document stored at `key` so that it becomes a subarray [start, end], both inclusive.
|
|
1184
|
+
* If `start` < 0, it is treated as 0.
|
|
1185
|
+
* If `end` >= size (size of the array), it is treated as size-1.
|
|
1186
|
+
* If `start` >= size or `start` > `end`, the array is emptied and 0 is returned.
|
|
1187
|
+
*
|
|
1188
|
+
* @param transaction - A transaction to add commands to.
|
|
1189
|
+
* @param key - The key of the JSON document.
|
|
1190
|
+
* @param path - The path within the JSON document.
|
|
1191
|
+
* @param start - The start index, inclusive.
|
|
1192
|
+
* @param end - The end index, inclusive.
|
|
1193
|
+
*
|
|
1194
|
+
* Command Response -
|
|
1195
|
+
* - For JSONPath (`path` starts with `$`):
|
|
1196
|
+
* - Returns a list of integer replies for every possible path, indicating the new length of the array,
|
|
1197
|
+
* or `null` for JSON values matching the path that are not an array.
|
|
1198
|
+
* - If the array is empty, its corresponding return value is 0.
|
|
1199
|
+
* - If `path` doesn't exist, an empty array will be returned.
|
|
1200
|
+
* - If an index argument is out of bounds, an error is raised.
|
|
1201
|
+
* - For legacy path (`path` doesn't start with `$`):
|
|
1202
|
+
* - Returns an integer representing the new length of the array.
|
|
1203
|
+
* - If the array is empty, its corresponding return value is 0.
|
|
1204
|
+
* - If multiple paths match, the length of the first trimmed array match is returned.
|
|
1205
|
+
* - If `path` doesn't exist, or the value at `path` is not an array, an error is raised.
|
|
1206
|
+
* - If an index argument is out of bounds, an error is raised.
|
|
1207
|
+
*/
|
|
1208
|
+
static arrtrim(transaction, key, path, start, end) {
|
|
1209
|
+
const args = [
|
|
1210
|
+
"JSON.ARRTRIM",
|
|
1211
|
+
key,
|
|
1212
|
+
path,
|
|
1213
|
+
start.toString(),
|
|
1214
|
+
end.toString(),
|
|
1215
|
+
];
|
|
1216
|
+
return transaction.customCommand(args);
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Searches for the first occurrence of a `scalar` JSON value in the arrays at the `path`.
|
|
1220
|
+
* Out of range errors are treated by rounding the index to the array's `start` and `end.
|
|
1221
|
+
* If `start` > `end`, return `-1` (not found).
|
|
1222
|
+
*
|
|
1223
|
+
* @param transaction - A transaction to add commands to.
|
|
1224
|
+
* @param key - The key of the JSON document.
|
|
1225
|
+
* @param path - The path within the JSON document.
|
|
1226
|
+
* @param scalar - The scalar value to search for.
|
|
1227
|
+
* @param options - (Optional) Additional parameters:
|
|
1228
|
+
* - (Optional) `start`: The start index, inclusive. Default to 0 if not provided.
|
|
1229
|
+
* - (Optional) `end`: The end index, exclusive. Default to 0 if not provided.
|
|
1230
|
+
* 0 or -1 means the last element is included.
|
|
1231
|
+
* Command Response -
|
|
1232
|
+
* - For JSONPath (path starts with `$`):
|
|
1233
|
+
* Returns an array with a list of integers for every possible path,
|
|
1234
|
+
* indicating the index of the matching element. The value is `-1` if not found.
|
|
1235
|
+
* If a value is not an array, its corresponding return value is `null`.
|
|
1236
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1237
|
+
* Returns an integer representing the index of matching element, or `-1` if
|
|
1238
|
+
* not found. If the value at the `path` is not an array, an error is raised.
|
|
1239
|
+
*/
|
|
1240
|
+
static arrindex(transaction, key, path, scalar, options) {
|
|
1241
|
+
const args = ["JSON.ARRINDEX", key, path];
|
|
1242
|
+
if (typeof scalar === `number`) {
|
|
1243
|
+
args.push(scalar.toString());
|
|
1244
|
+
}
|
|
1245
|
+
else if (typeof scalar === `boolean`) {
|
|
1246
|
+
args.push(scalar ? `true` : `false`);
|
|
1247
|
+
}
|
|
1248
|
+
else if (scalar !== null) {
|
|
1249
|
+
args.push(scalar);
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
args.push(`null`);
|
|
1253
|
+
}
|
|
1254
|
+
if ((options === null || options === void 0 ? void 0 : options.start) !== undefined)
|
|
1255
|
+
args.push(options === null || options === void 0 ? void 0 : options.start.toString());
|
|
1256
|
+
if ((options === null || options === void 0 ? void 0 : options.end) !== undefined)
|
|
1257
|
+
args.push(options === null || options === void 0 ? void 0 : options.end.toString());
|
|
1258
|
+
return transaction.customCommand(args);
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Toggles a Boolean value stored at the specified `path` within the JSON document stored at `key`.
|
|
1262
|
+
*
|
|
1263
|
+
* @param transaction - A transaction to add commands to.
|
|
1264
|
+
* @param key - The key of the JSON document.
|
|
1265
|
+
* @param options - (Optional) Additional parameters:
|
|
1266
|
+
* - (Optional) `path`: The path within the JSON document. Defaults to the root (`"."`) if not specified.
|
|
1267
|
+
*
|
|
1268
|
+
* Command Response - For JSONPath (`path` starts with `$`), returns a list of boolean replies for every possible path, with the toggled boolean value,
|
|
1269
|
+
* or `null` for JSON values matching the path that are not boolean.
|
|
1270
|
+
* - For legacy path (`path` doesn't starts with `$`), returns the value of the toggled boolean in `path`.
|
|
1271
|
+
* - Note that when sending legacy path syntax, If `path` doesn't exist or the value at `path` isn't a boolean, an error is raised.
|
|
1272
|
+
*/
|
|
1273
|
+
static toggle(transaction, key, options) {
|
|
1274
|
+
const args = ["JSON.TOGGLE", key];
|
|
1275
|
+
if (options) {
|
|
1276
|
+
args.push(options.path);
|
|
1277
|
+
}
|
|
1278
|
+
return transaction.customCommand(args);
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Deletes the JSON value at the specified `path` within the JSON document stored at `key`.
|
|
1282
|
+
*
|
|
1283
|
+
* @param transaction - A transaction to add commands to.
|
|
1284
|
+
* @param key - The key of the JSON document.
|
|
1285
|
+
* @param options - (Optional) Additional parameters:
|
|
1286
|
+
* - (Optional) `path`: If `null`, deletes the entire JSON document at `key`.
|
|
1287
|
+
*
|
|
1288
|
+
* Command Response - The number of elements removed. If `key` or `path` doesn't exist, returns 0.
|
|
1289
|
+
*/
|
|
1290
|
+
static del(transaction, key, options) {
|
|
1291
|
+
const args = ["JSON.DEL", key];
|
|
1292
|
+
if (options) {
|
|
1293
|
+
args.push(options.path);
|
|
1294
|
+
}
|
|
1295
|
+
return transaction.customCommand(args);
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Deletes the JSON value at the specified `path` within the JSON document stored at `key`. This command is
|
|
1299
|
+
* an alias of {@link del}.
|
|
1300
|
+
*
|
|
1301
|
+
* @param transaction - A transaction to add commands to.
|
|
1302
|
+
* @param key - The key of the JSON document.
|
|
1303
|
+
* @param options - (Optional) Additional parameters:
|
|
1304
|
+
* - (Optional) `path`: If `null`, deletes the entire JSON document at `key`.
|
|
1305
|
+
*
|
|
1306
|
+
* Command Response - The number of elements removed. If `key` or `path` doesn't exist, returns 0.
|
|
1307
|
+
*/
|
|
1308
|
+
static forget(transaction, key, options) {
|
|
1309
|
+
const args = ["JSON.FORGET", key];
|
|
1310
|
+
if (options) {
|
|
1311
|
+
args.push(options.path);
|
|
1312
|
+
}
|
|
1313
|
+
return transaction.customCommand(args);
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Reports the type of values at the given path.
|
|
1317
|
+
*
|
|
1318
|
+
* @param transaction - A transaction to add commands to.
|
|
1319
|
+
* @param key - The key of the JSON document.
|
|
1320
|
+
* @param options - (Optional) Additional parameters:
|
|
1321
|
+
* - (Optional) `path`: Defaults to root (`"."`) if not provided.
|
|
1322
|
+
*
|
|
1323
|
+
* Command Response -
|
|
1324
|
+
* - For JSONPath (path starts with `$`):
|
|
1325
|
+
* - Returns an array of strings that represents the type of value at each path.
|
|
1326
|
+
* The type is one of "null", "boolean", "string", "number", "integer", "object" and "array".
|
|
1327
|
+
* - If a path does not exist, its corresponding return value is `null`.
|
|
1328
|
+
* - Empty array if the document key does not exist.
|
|
1329
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1330
|
+
* - String that represents the type of the value.
|
|
1331
|
+
* - `null` if the document key does not exist.
|
|
1332
|
+
* - `null` if the JSON path is invalid or does not exist.
|
|
1333
|
+
*/
|
|
1334
|
+
static type(transaction, key, options) {
|
|
1335
|
+
const args = ["JSON.TYPE", key];
|
|
1336
|
+
if (options) {
|
|
1337
|
+
args.push(options.path);
|
|
1338
|
+
}
|
|
1339
|
+
return transaction.customCommand(args);
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Clears arrays or objects at the specified JSON path in the document stored at `key`.
|
|
1343
|
+
* Numeric values are set to `0`, boolean values are set to `false`, and string values are converted to empty strings.
|
|
1344
|
+
*
|
|
1345
|
+
* @param transaction - A transaction to add commands to.
|
|
1346
|
+
* @param key - The key of the JSON document.
|
|
1347
|
+
* @param options - (Optional) Additional parameters:
|
|
1348
|
+
* - (Optional) `path`: The JSON path to the arrays or objects to be cleared. Defaults to root if not provided.
|
|
1349
|
+
*
|
|
1350
|
+
* Command Response - The number of containers cleared, numeric values zeroed, and booleans toggled to `false`,
|
|
1351
|
+
* and string values converted to empty strings.
|
|
1352
|
+
* If `path` doesn't exist, or the value at `path` is already empty (e.g., an empty array, object, or string), `0` is returned.
|
|
1353
|
+
* If `key doesn't exist, an error is raised.
|
|
1354
|
+
*/
|
|
1355
|
+
static clear(transaction, key, options) {
|
|
1356
|
+
const args = ["JSON.CLEAR", key];
|
|
1357
|
+
if (options) {
|
|
1358
|
+
args.push(options.path);
|
|
1359
|
+
}
|
|
1360
|
+
return transaction.customCommand(args);
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Retrieve the JSON value at the specified `path` within the JSON document stored at `key`.
|
|
1364
|
+
* The returning result is in the Valkey or Redis OSS Serialization Protocol (RESP).
|
|
1365
|
+
* - JSON null is mapped to the RESP Null Bulk String.
|
|
1366
|
+
* - JSON Booleans are mapped to RESP Simple string.
|
|
1367
|
+
* - JSON integers are mapped to RESP Integers.
|
|
1368
|
+
* - JSON doubles are mapped to RESP Bulk Strings.
|
|
1369
|
+
* - JSON strings are mapped to RESP Bulk Strings.
|
|
1370
|
+
* - JSON arrays are represented as RESP arrays, where the first element is the simple string [, followed by the array's elements.
|
|
1371
|
+
* - JSON objects are represented as RESP object, where the first element is the simple string {, followed by key-value pairs, each of which is a RESP bulk string.
|
|
1372
|
+
*
|
|
1373
|
+
* @param transaction - A transaction to add commands to.
|
|
1374
|
+
* @param key - The key of the JSON document.
|
|
1375
|
+
* @param options - (Optional) Additional parameters:
|
|
1376
|
+
* - (Optional) `path`: The path within the JSON document, defaults to root (`"."`) if not provided.
|
|
1377
|
+
*
|
|
1378
|
+
* Command Response -
|
|
1379
|
+
* - For JSONPath (path starts with `$`):
|
|
1380
|
+
* - Returns an array of replies for every possible path, indicating the RESP form of the JSON value.
|
|
1381
|
+
* If `path` doesn't exist, returns an empty array.
|
|
1382
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1383
|
+
* - Returns a single reply for the JSON value at the specified `path`, in its RESP form.
|
|
1384
|
+
* If multiple paths match, the value of the first JSON value match is returned. If `path` doesn't exist, an error is raised.
|
|
1385
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1386
|
+
*/
|
|
1387
|
+
static resp(transaction, key, options) {
|
|
1388
|
+
const args = ["JSON.RESP", key];
|
|
1389
|
+
if (options) {
|
|
1390
|
+
args.push(options.path);
|
|
1391
|
+
}
|
|
1392
|
+
return transaction.customCommand(args);
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Returns the length of the JSON string value stored at the specified `path` within
|
|
1396
|
+
* the JSON document stored at `key`.
|
|
1397
|
+
*
|
|
1398
|
+
* @param transaction - A transaction to add commands to.
|
|
1399
|
+
* @param key - The key of the JSON document.
|
|
1400
|
+
* @param options - (Optional) Additional parameters:
|
|
1401
|
+
* - (Optional) `path`: The path within the JSON document, Defaults to root (`"."`) if not provided.
|
|
1402
|
+
*
|
|
1403
|
+
* Command Response -
|
|
1404
|
+
* - For JSONPath (path starts with `$`):
|
|
1405
|
+
* - Returns a list of integer replies for every possible path, indicating the length of
|
|
1406
|
+
* the JSON string value, or <code>null</code> for JSON values matching the path that
|
|
1407
|
+
* are not string.
|
|
1408
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1409
|
+
* - Returns the length of the JSON value at `path` or `null` if `key` doesn't exist.
|
|
1410
|
+
* - If multiple paths match, the length of the first matched string is returned.
|
|
1411
|
+
* - If the JSON value at`path` is not a string or if `path` doesn't exist, an error is raised.
|
|
1412
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1413
|
+
*/
|
|
1414
|
+
static strlen(transaction, key, options) {
|
|
1415
|
+
const args = ["JSON.STRLEN", key];
|
|
1416
|
+
if (options) {
|
|
1417
|
+
args.push(options.path);
|
|
1418
|
+
}
|
|
1419
|
+
return transaction.customCommand(args);
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Appends the specified `value` to the string stored at the specified `path` within the JSON document stored at `key`.
|
|
1423
|
+
*
|
|
1424
|
+
* @param transaction - A transaction to add commands to.
|
|
1425
|
+
* @param key - The key of the JSON document.
|
|
1426
|
+
* @param value - The value to append to the string. Must be wrapped with single quotes. For example, to append "foo", pass '"foo"'.
|
|
1427
|
+
* @param options - (Optional) Additional parameters:
|
|
1428
|
+
* - (Optional) `path`: The path within the JSON document, defaults to root (`"."`) if not provided.
|
|
1429
|
+
*
|
|
1430
|
+
* Command Response -
|
|
1431
|
+
* - For JSONPath (path starts with `$`):
|
|
1432
|
+
* - Returns a list of integer replies for every possible path, indicating the length of the resulting string after appending `value`,
|
|
1433
|
+
* or None for JSON values matching the path that are not string.
|
|
1434
|
+
* - If `key` doesn't exist, an error is raised.
|
|
1435
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1436
|
+
* - Returns the length of the resulting string after appending `value` to the string at `path`.
|
|
1437
|
+
* - If multiple paths match, the length of the last updated string is returned.
|
|
1438
|
+
* - If the JSON value at `path` is not a string of if `path` doesn't exist, an error is raised.
|
|
1439
|
+
* - If `key` doesn't exist, an error is raised.
|
|
1440
|
+
*/
|
|
1441
|
+
static strappend(transaction, key, value, options) {
|
|
1442
|
+
const args = ["JSON.STRAPPEND", key];
|
|
1443
|
+
if (options) {
|
|
1444
|
+
args.push(options.path);
|
|
1445
|
+
}
|
|
1446
|
+
args.push(value);
|
|
1447
|
+
return transaction.customCommand(args);
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Appends one or more `values` to the JSON array at the specified `path` within the JSON
|
|
1451
|
+
* document stored at `key`.
|
|
1452
|
+
*
|
|
1453
|
+
* @param transaction - A transaction to add commands to.
|
|
1454
|
+
* @param key - The key of the JSON document.
|
|
1455
|
+
* @param path - The path within the JSON document.
|
|
1456
|
+
* @param values - The JSON values to be appended to the array.
|
|
1457
|
+
* JSON string values must be wrapped with quotes. For example, to append `"foo"`, pass `"\"foo\""`.
|
|
1458
|
+
*
|
|
1459
|
+
* Command Response -
|
|
1460
|
+
* - For JSONPath (path starts with `$`):
|
|
1461
|
+
* Returns an array with a list of integers for every possible path,
|
|
1462
|
+
* indicating the new length of the array, or `null` for JSON values matching
|
|
1463
|
+
* the path that are not an array. If `path` does not exist, an empty array
|
|
1464
|
+
* will be returned.
|
|
1465
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1466
|
+
* Returns an integer representing the new length of the array. If multiple paths are
|
|
1467
|
+
* matched, returns the length of the first modified array. If `path` doesn't
|
|
1468
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
1469
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
1470
|
+
*/
|
|
1471
|
+
static arrappend(transaction, key, path, values) {
|
|
1472
|
+
const args = ["JSON.ARRAPPEND", key, path, ...values];
|
|
1473
|
+
return transaction.customCommand(args);
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Reports memory usage in bytes of a JSON object at the specified `path` within the JSON document stored at `key`.
|
|
1477
|
+
*
|
|
1478
|
+
* @param transaction - A transaction to add commands to.
|
|
1479
|
+
* @param key - The key of the JSON document.
|
|
1480
|
+
* @param value - The value to append to the string. Must be wrapped with single quotes. For example, to append "foo", pass '"foo"'.
|
|
1481
|
+
* @param options - (Optional) Additional parameters:
|
|
1482
|
+
* - (Optional) `path`: The path within the JSON document, returns total memory usage if no path is given.
|
|
1483
|
+
*
|
|
1484
|
+
* Command Response -
|
|
1485
|
+
* - For JSONPath (path starts with `$`):
|
|
1486
|
+
* - Returns an array of numbers for every possible path, indicating the memory usage.
|
|
1487
|
+
* If `path` does not exist, an empty array will be returned.
|
|
1488
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1489
|
+
* - Returns an integer representing the memory usage. If multiple paths are matched,
|
|
1490
|
+
* returns the data of the first matching object. If `path` doesn't exist, an error is raised.
|
|
1491
|
+
* - If `key` doesn't exist, returns `null`.
|
|
1492
|
+
*/
|
|
1493
|
+
static debugMemory(transaction, key, options) {
|
|
1494
|
+
const args = ["JSON.DEBUG", "MEMORY", key];
|
|
1495
|
+
if (options) {
|
|
1496
|
+
args.push(options.path);
|
|
1497
|
+
}
|
|
1498
|
+
return transaction.customCommand(args);
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Reports the number of fields at the specified `path` within the JSON document stored at `key`.
|
|
1502
|
+
*
|
|
1503
|
+
* @param transaction - A transaction to add commands to.
|
|
1504
|
+
* @param key - The key of the JSON document.
|
|
1505
|
+
* @param value - The value to append to the string. Must be wrapped with single quotes. For example, to append "foo", pass '"foo"'.
|
|
1506
|
+
* @param options - (Optional) Additional parameters:
|
|
1507
|
+
* - (Optional) `path`: The path within the JSON document, returns total number of fields if no path is given.
|
|
1508
|
+
*
|
|
1509
|
+
* Command Response -
|
|
1510
|
+
* - For JSONPath (path starts with `$`):
|
|
1511
|
+
* - Returns an array of numbers for every possible path, indicating the number of fields.
|
|
1512
|
+
* If `path` does not exist, an empty array will be returned.
|
|
1513
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1514
|
+
* - Returns an integer representing the memory usage. If multiple paths are matched,
|
|
1515
|
+
* returns the data of the first matching object. If `path` doesn't exist, an error is raised.
|
|
1516
|
+
* - If `key` doesn't exist, returns `null`.
|
|
1517
|
+
*/
|
|
1518
|
+
static debugFields(transaction, key, options) {
|
|
1519
|
+
const args = ["JSON.DEBUG", "FIELDS", key];
|
|
1520
|
+
if (options) {
|
|
1521
|
+
args.push(options.path);
|
|
1522
|
+
}
|
|
1523
|
+
return transaction.customCommand(args);
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Increments or decrements the JSON value(s) at the specified `path` by `number` within the JSON document stored at `key`.
|
|
1527
|
+
*
|
|
1528
|
+
* @param transaction - A transaction to add commands to.
|
|
1529
|
+
* @param key - The key of the JSON document.
|
|
1530
|
+
* @param path - The path within the JSON document.
|
|
1531
|
+
* @param num - The number to increment or decrement by.
|
|
1532
|
+
*
|
|
1533
|
+
* Command Response -
|
|
1534
|
+
* - For JSONPath (path starts with `$`):
|
|
1535
|
+
* - Returns a string representation of an array of strings, indicating the new values after incrementing for each matched `path`.
|
|
1536
|
+
* If a value is not a number, its corresponding return value will be `null`.
|
|
1537
|
+
* If `path` doesn't exist, a byte string representation of an empty array will be returned.
|
|
1538
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1539
|
+
* - Returns a string representation of the resulting value after the increment or decrement.
|
|
1540
|
+
* If multiple paths match, the result of the last updated value is returned.
|
|
1541
|
+
* If the value at the `path` is not a number or `path` doesn't exist, an error is raised.
|
|
1542
|
+
* - If `key` does not exist, an error is raised.
|
|
1543
|
+
* - If the result is out of the range of 64-bit IEEE double, an error is raised.
|
|
1544
|
+
*/
|
|
1545
|
+
static numincrby(transaction, key, path, num) {
|
|
1546
|
+
const args = ["JSON.NUMINCRBY", key, path, num.toString()];
|
|
1547
|
+
return transaction.customCommand(args);
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Multiplies the JSON value(s) at the specified `path` by `number` within the JSON document stored at `key`.
|
|
1551
|
+
*
|
|
1552
|
+
* @param transaction - A transaction to add commands to.
|
|
1553
|
+
* @param key - The key of the JSON document.
|
|
1554
|
+
* @param path - The path within the JSON document.
|
|
1555
|
+
* @param num - The number to multiply by.
|
|
1556
|
+
*
|
|
1557
|
+
* Command Response -
|
|
1558
|
+
* - For JSONPath (path starts with `$`):
|
|
1559
|
+
* - Returns a GlideString representation of an array of strings, indicating the new values after multiplication for each matched `path`.
|
|
1560
|
+
* If a value is not a number, its corresponding return value will be `null`.
|
|
1561
|
+
* If `path` doesn't exist, a byte string representation of an empty array will be returned.
|
|
1562
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1563
|
+
* - Returns a GlideString representation of the resulting value after multiplication.
|
|
1564
|
+
* If multiple paths match, the result of the last updated value is returned.
|
|
1565
|
+
* If the value at the `path` is not a number or `path` doesn't exist, an error is raised.
|
|
1566
|
+
* - If `key` does not exist, an error is raised.
|
|
1567
|
+
* - If the result is out of the range of 64-bit IEEE double, an error is raised.
|
|
1568
|
+
*/
|
|
1569
|
+
static nummultby(transaction, key, path, num) {
|
|
1570
|
+
const args = ["JSON.NUMMULTBY", key, path, num.toString()];
|
|
1571
|
+
return transaction.customCommand(args);
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Retrieves the number of key-value pairs in the object stored at the specified `path` within the JSON document stored at `key`.
|
|
1575
|
+
*
|
|
1576
|
+
* @param transaction - A transaction to add commands to.
|
|
1577
|
+
* @param key - The key of the JSON document.
|
|
1578
|
+
* @param options - (Optional) Additional parameters:
|
|
1579
|
+
* - (Optional) `path`: The path within the JSON document, Defaults to root (`"."`) if not provided.
|
|
1580
|
+
*
|
|
1581
|
+
* Command Response - ReturnTypeJson<number>:
|
|
1582
|
+
* - For JSONPath (`path` starts with `$`):
|
|
1583
|
+
* - Returns a list of integer replies for every possible path, indicating the length of the object,
|
|
1584
|
+
* or `null` for JSON values matching the path that are not an object.
|
|
1585
|
+
* - If `path` doesn't exist, an empty array will be returned.
|
|
1586
|
+
* - For legacy path (`path` doesn't starts with `$`):
|
|
1587
|
+
* - Returns the length of the object at `path`.
|
|
1588
|
+
* - If multiple paths match, the length of the first object match is returned.
|
|
1589
|
+
* - If the JSON value at `path` is not an object or if `path` doesn't exist, an error is raised.
|
|
1590
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1591
|
+
*/
|
|
1592
|
+
static objlen(transaction, key, options) {
|
|
1593
|
+
const args = ["JSON.OBJLEN", key];
|
|
1594
|
+
if (options) {
|
|
1595
|
+
args.push(options.path);
|
|
1596
|
+
}
|
|
1597
|
+
return transaction.customCommand(args);
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Retrieves key names in the object values at the specified `path` within the JSON document stored at `key`.
|
|
1601
|
+
*
|
|
1602
|
+
* @param transaction - A transaction to add commands to.
|
|
1603
|
+
* @param key - The key of the JSON document.
|
|
1604
|
+
* @param options - (Optional) Additional parameters:
|
|
1605
|
+
* - (Optional) `path`: The path within the JSON document where the key names will be retrieved. Defaults to root (`"."`) if not provided.
|
|
1606
|
+
*
|
|
1607
|
+
* Command Response - ReturnTypeJson<GlideString[]>:
|
|
1608
|
+
* - For JSONPath (`path` starts with `$`):
|
|
1609
|
+
* - Returns a list of arrays containing key names for each matching object.
|
|
1610
|
+
* - If a value matching the path is not an object, an empty array is returned.
|
|
1611
|
+
* - If `path` doesn't exist, an empty array is returned.
|
|
1612
|
+
* - For legacy path (`path` starts with `.`):
|
|
1613
|
+
* - Returns a list of key names for the object value matching the path.
|
|
1614
|
+
* - If multiple objects match the path, the key names of the first object is returned.
|
|
1615
|
+
* - If a value matching the path is not an object, an error is raised.
|
|
1616
|
+
* - If `path` doesn't exist, `null` is returned.
|
|
1617
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1618
|
+
*/
|
|
1619
|
+
static objkeys(transaction, key, options) {
|
|
1620
|
+
const args = ["JSON.OBJKEYS", key];
|
|
1621
|
+
if (options) {
|
|
1622
|
+
args.push(options.path);
|
|
1623
|
+
}
|
|
1624
|
+
return transaction.customCommand(args);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
exports.JsonBatch = JsonBatch;
|
|
1012
1628
|
//# sourceMappingURL=GlideJson.js.map
|