@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
3
3
|
*/
|
|
4
|
+
import { ClusterTransaction, Transaction } from "src/Transaction";
|
|
4
5
|
import { BaseClient, DecoderOption, GlideString } from "../BaseClient";
|
|
5
6
|
import { ConditionalChange } from "../Commands";
|
|
6
7
|
export type ReturnTypeJson<T> = T | (T | null)[];
|
|
@@ -49,7 +50,7 @@ export declare class GlideJson {
|
|
|
49
50
|
* ```typescript
|
|
50
51
|
* const value = {a: 1.0, b:2};
|
|
51
52
|
* const jsonStr = JSON.stringify(value);
|
|
52
|
-
* const result = await GlideJson.set("doc", "$", jsonStr);
|
|
53
|
+
* const result = await GlideJson.set(client, "doc", "$", jsonStr);
|
|
53
54
|
* console.log(result); // 'OK' - Indicates successful setting of the value at path '$' in the key stored at `doc`.
|
|
54
55
|
*
|
|
55
56
|
* const jsonGetStr = await GlideJson.get(client, "doc", {path: "$"}); // Returns the value at path '$' in the JSON document stored at `doc` as JSON string.
|
|
@@ -166,7 +167,7 @@ export declare class GlideJson {
|
|
|
166
167
|
* await GlideJson.set(client, "doc", "$", '[[], ["a"], ["a", "b"]]');
|
|
167
168
|
* const result = await GlideJson.arrinsert(client, "doc", "$[*]", 0, ['"c"', '{"key": "value"}', "true", "null", '["bar"]']);
|
|
168
169
|
* console.log(result); // Output: [5, 6, 7]
|
|
169
|
-
* const doc = await
|
|
170
|
+
* const doc = await GlideJson.get(client, "doc");
|
|
170
171
|
* 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"]]'
|
|
171
172
|
* ```
|
|
172
173
|
* @example
|
|
@@ -174,7 +175,7 @@ export declare class GlideJson {
|
|
|
174
175
|
* await GlideJson.set(client, "doc", "$", '[[], ["a"], ["a", "b"]]');
|
|
175
176
|
* const result = await GlideJson.arrinsert(client, "doc", ".", 0, ['"c"'])
|
|
176
177
|
* console.log(result); // Output: 4
|
|
177
|
-
* const doc = await
|
|
178
|
+
* const doc = await GlideJson.get(client, "doc");
|
|
178
179
|
* console.log(doc); // Output: '[\"c\",[],[\"a\"],[\"a\",\"b\"]]'
|
|
179
180
|
* ```
|
|
180
181
|
*/
|
|
@@ -349,7 +350,7 @@ export declare class GlideJson {
|
|
|
349
350
|
* ```typescript
|
|
350
351
|
* const value = {bool: true, nested: {bool: false, nested: {bool: 10}}};
|
|
351
352
|
* const jsonStr = JSON.stringify(value);
|
|
352
|
-
* const resultSet = await GlideJson.set("doc", "$", jsonStr);
|
|
353
|
+
* const resultSet = await GlideJson.set(client, "doc", "$", jsonStr);
|
|
353
354
|
* // Output: 'OK'
|
|
354
355
|
*
|
|
355
356
|
* const resultToggle = await.GlideJson.toggle(client, "doc", {path: "$.bool"});
|
|
@@ -501,13 +502,13 @@ export declare class GlideJson {
|
|
|
501
502
|
/**
|
|
502
503
|
* Retrieve the JSON value at the specified `path` within the JSON document stored at `key`.
|
|
503
504
|
* The returning result is in the Valkey or Redis OSS Serialization Protocol (RESP).
|
|
504
|
-
* JSON null is mapped to the RESP Null Bulk String.
|
|
505
|
-
* JSON Booleans are mapped to RESP Simple string.
|
|
506
|
-
* JSON integers are mapped to RESP Integers.
|
|
507
|
-
* JSON doubles are mapped to RESP Bulk Strings.
|
|
508
|
-
* JSON strings are mapped to RESP Bulk Strings.
|
|
509
|
-
* JSON arrays are represented as RESP arrays, where the first element is the simple string [, followed by the array's elements.
|
|
510
|
-
* 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.
|
|
505
|
+
* - JSON null is mapped to the RESP Null Bulk String.
|
|
506
|
+
* - JSON Booleans are mapped to RESP Simple string.
|
|
507
|
+
* - JSON integers are mapped to RESP Integers.
|
|
508
|
+
* - JSON doubles are mapped to RESP Bulk Strings.
|
|
509
|
+
* - JSON strings are mapped to RESP Bulk Strings.
|
|
510
|
+
* - JSON arrays are represented as RESP arrays, where the first element is the simple string [, followed by the array's elements.
|
|
511
|
+
* - 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.
|
|
511
512
|
*
|
|
512
513
|
* @param client - The client to execute the command.
|
|
513
514
|
* @param key - The key of the JSON document.
|
|
@@ -694,7 +695,7 @@ export declare class GlideJson {
|
|
|
694
695
|
* ```typescript
|
|
695
696
|
* console.log(await GlideJson.set(client, "doc", "$", '[1, 2.3, "foo", true, null, {}, [], {a:1, b:2}, [1, 2, 3]]'));
|
|
696
697
|
* // Output: 'OK' - Indicates successful setting of the value at path '$' in the key stored at `doc`.
|
|
697
|
-
* console.log(await GlideJson.
|
|
698
|
+
* console.log(await GlideJson.debugFields(client, "doc", {path: "$[*]"});
|
|
698
699
|
* // Output: [1, 1, 1, 1, 1, 0, 0, 2, 3]
|
|
699
700
|
* ```
|
|
700
701
|
*/
|
|
@@ -827,3 +828,508 @@ export declare class GlideJson {
|
|
|
827
828
|
path: GlideString;
|
|
828
829
|
} & DecoderOption): Promise<ReturnTypeJson<GlideString[]>>;
|
|
829
830
|
}
|
|
831
|
+
/**
|
|
832
|
+
* Transaction implementation for JSON module. Transactions allow the execution of a group of
|
|
833
|
+
* commands in a single step. See {@link Transaction} and {@link ClusterTransaction}.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```typescript
|
|
837
|
+
* const transaction = new Transaction();
|
|
838
|
+
* JsonBatch.set(transaction, "doc", ".", '{"a": 1.0, "b": 2}');
|
|
839
|
+
* JsonBatch.get(transaction, "doc");
|
|
840
|
+
* const result = await client.exec(transaction);
|
|
841
|
+
*
|
|
842
|
+
* console.log(result[0]); // Output: 'OK' - result of JsonBatch.set()
|
|
843
|
+
* console.log(result[1]); // Output: '{"a": 1.0, "b": 2}' - result of JsonBatch.get()
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
846
|
+
export declare class JsonBatch {
|
|
847
|
+
/**
|
|
848
|
+
* Sets the JSON value at the specified `path` stored at `key`.
|
|
849
|
+
*
|
|
850
|
+
* @param transaction - A transaction to add commands to.
|
|
851
|
+
* @param key - The key of the JSON document.
|
|
852
|
+
* @param path - Represents the path within the JSON document where the value will be set.
|
|
853
|
+
* 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.
|
|
854
|
+
* @param value - The value to set at the specific path, in JSON formatted bytes or str.
|
|
855
|
+
* @param options - (Optional) Additional parameters:
|
|
856
|
+
* - (Optional) `conditionalChange` - Set the value only if the given condition is met (within the key or path).
|
|
857
|
+
* Equivalent to [`XX` | `NX`] in the module API.
|
|
858
|
+
*
|
|
859
|
+
* Command Response - If the value is successfully set, returns `"OK"`.
|
|
860
|
+
* If `value` isn't set because of `conditionalChange`, returns `null`.
|
|
861
|
+
*/
|
|
862
|
+
static set(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, value: GlideString, options?: {
|
|
863
|
+
conditionalChange: ConditionalChange;
|
|
864
|
+
}): Transaction | ClusterTransaction;
|
|
865
|
+
/**
|
|
866
|
+
* Retrieves the JSON value at the specified `paths` stored at `key`.
|
|
867
|
+
*
|
|
868
|
+
* @param transaction - A transaction to add commands to.
|
|
869
|
+
* @param key - The key of the JSON document.
|
|
870
|
+
* @param options - (Optional) Additional parameters:
|
|
871
|
+
* - (Optional) Options for formatting the byte representation of the JSON data. See {@link JsonGetOptions}.
|
|
872
|
+
*
|
|
873
|
+
* Command Response -
|
|
874
|
+
* - If one path is given:
|
|
875
|
+
* - For JSONPath (path starts with `$`):
|
|
876
|
+
* - Returns a stringified JSON list of bytes replies for every possible path,
|
|
877
|
+
* or a byte string representation of an empty array, if path doesn't exist.
|
|
878
|
+
* If `key` doesn't exist, returns `null`.
|
|
879
|
+
* - For legacy path (path doesn't start with `$`):
|
|
880
|
+
* Returns a byte string representation of the value in `path`.
|
|
881
|
+
* If `path` doesn't exist, an error is raised.
|
|
882
|
+
* If `key` doesn't exist, returns `null`.
|
|
883
|
+
* - If multiple paths are given:
|
|
884
|
+
* 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.
|
|
885
|
+
* 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.
|
|
886
|
+
*/
|
|
887
|
+
static get(transaction: Transaction | ClusterTransaction, key: GlideString, options?: JsonGetOptions): Transaction | ClusterTransaction;
|
|
888
|
+
/**
|
|
889
|
+
* Retrieves the JSON values at the specified `path` stored at multiple `keys`.
|
|
890
|
+
*
|
|
891
|
+
* @remarks When in cluster mode, all keys in the transaction must be mapped to the same slot.
|
|
892
|
+
*
|
|
893
|
+
* @param client - The client to execute the command.
|
|
894
|
+
* @param keys - The keys of the JSON documents.
|
|
895
|
+
* @param path - The path within the JSON documents.
|
|
896
|
+
*
|
|
897
|
+
* Command Response -
|
|
898
|
+
* - For JSONPath (path starts with `$`):
|
|
899
|
+
* Returns a stringified JSON list replies for every possible path, or a string representation
|
|
900
|
+
* of an empty array, if path doesn't exist.
|
|
901
|
+
* - For legacy path (path doesn't start with `$`):
|
|
902
|
+
* Returns a string representation of the value in `path`. If `path` doesn't exist,
|
|
903
|
+
* the corresponding array element will be `null`.
|
|
904
|
+
* - If a `key` doesn't exist, the corresponding array element will be `null`.
|
|
905
|
+
*/
|
|
906
|
+
static mget(transaction: Transaction | ClusterTransaction, keys: GlideString[], path: GlideString): Transaction | ClusterTransaction;
|
|
907
|
+
/**
|
|
908
|
+
* Inserts one or more values into the array at the specified `path` within the JSON
|
|
909
|
+
* document stored at `key`, before the given `index`.
|
|
910
|
+
*
|
|
911
|
+
* @param transaction - A transaction to add commands to.
|
|
912
|
+
* @param key - The key of the JSON document.
|
|
913
|
+
* @param path - The path within the JSON document.
|
|
914
|
+
* @param index - The array index before which values are inserted.
|
|
915
|
+
* @param values - The JSON values to be inserted into the array.
|
|
916
|
+
* JSON string values must be wrapped with quotes. For example, to insert `"foo"`, pass `"\"foo\""`.
|
|
917
|
+
*
|
|
918
|
+
* Command Response -
|
|
919
|
+
* - For JSONPath (path starts with `$`):
|
|
920
|
+
* Returns an array with a list of integers for every possible path,
|
|
921
|
+
* indicating the new length of the array, or `null` for JSON values matching
|
|
922
|
+
* the path that are not an array. If `path` does not exist, an empty array
|
|
923
|
+
* will be returned.
|
|
924
|
+
* - For legacy path (path doesn't start with `$`):
|
|
925
|
+
* Returns an integer representing the new length of the array. If multiple paths are
|
|
926
|
+
* matched, returns the length of the first modified array. If `path` doesn't
|
|
927
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
928
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
929
|
+
*/
|
|
930
|
+
static arrinsert(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, index: number, values: GlideString[]): Transaction | ClusterTransaction;
|
|
931
|
+
/**
|
|
932
|
+
* Pops an element from the array located at `path` in the JSON document stored at `key`.
|
|
933
|
+
*
|
|
934
|
+
* @param transaction - A transaction to add commands to.
|
|
935
|
+
* @param key - The key of the JSON document.
|
|
936
|
+
* @param options - (Optional) See {@link JsonArrPopOptions}.
|
|
937
|
+
*
|
|
938
|
+
* Command Response -
|
|
939
|
+
* - For JSONPath (path starts with `$`):
|
|
940
|
+
* Returns an array with a strings for every possible path, representing the popped JSON
|
|
941
|
+
* values, or `null` for JSON values matching the path that are not an array
|
|
942
|
+
* or an empty array.
|
|
943
|
+
* - For legacy path (path doesn't start with `$`):
|
|
944
|
+
* Returns a string representing the popped JSON value, or `null` if the
|
|
945
|
+
* array at `path` is empty. If multiple paths are matched, the value from
|
|
946
|
+
* the first matching array that is not empty is returned. If `path` doesn't
|
|
947
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
948
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
949
|
+
*/
|
|
950
|
+
static arrpop(transaction: Transaction | ClusterTransaction, key: GlideString, options?: JsonArrPopOptions): Transaction | ClusterTransaction;
|
|
951
|
+
/**
|
|
952
|
+
* Retrieves the length of the array at the specified `path` within the JSON document stored at `key`.
|
|
953
|
+
*
|
|
954
|
+
* @param transaction - A transaction to add commands to.
|
|
955
|
+
* @param key - The key of the JSON document.
|
|
956
|
+
* @param options - (Optional) Additional parameters:
|
|
957
|
+
* - (Optional) `path`: The path within the JSON document. Defaults to the root (`"."`) if not specified.
|
|
958
|
+
*
|
|
959
|
+
* Command Response -
|
|
960
|
+
* - For JSONPath (path starts with `$`):
|
|
961
|
+
* Returns an array with a list of integers for every possible path,
|
|
962
|
+
* indicating the length of the array, or `null` for JSON values matching
|
|
963
|
+
* the path that are not an array. If `path` does not exist, an empty array
|
|
964
|
+
* will be returned.
|
|
965
|
+
* - For legacy path (path doesn't start with `$`):
|
|
966
|
+
* Returns an integer representing the length of the array. If multiple paths are
|
|
967
|
+
* matched, returns the length of the first matching array. If `path` doesn't
|
|
968
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
969
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
970
|
+
*/
|
|
971
|
+
static arrlen(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
972
|
+
path: GlideString;
|
|
973
|
+
}): Transaction | ClusterTransaction;
|
|
974
|
+
/**
|
|
975
|
+
* Trims an array at the specified `path` within the JSON document stored at `key` so that it becomes a subarray [start, end], both inclusive.
|
|
976
|
+
* If `start` < 0, it is treated as 0.
|
|
977
|
+
* If `end` >= size (size of the array), it is treated as size-1.
|
|
978
|
+
* If `start` >= size or `start` > `end`, the array is emptied and 0 is returned.
|
|
979
|
+
*
|
|
980
|
+
* @param transaction - A transaction to add commands to.
|
|
981
|
+
* @param key - The key of the JSON document.
|
|
982
|
+
* @param path - The path within the JSON document.
|
|
983
|
+
* @param start - The start index, inclusive.
|
|
984
|
+
* @param end - The end index, inclusive.
|
|
985
|
+
*
|
|
986
|
+
* Command Response -
|
|
987
|
+
* - For JSONPath (`path` starts with `$`):
|
|
988
|
+
* - Returns a list of integer replies for every possible path, indicating the new length of the array,
|
|
989
|
+
* or `null` for JSON values matching the path that are not an array.
|
|
990
|
+
* - If the array is empty, its corresponding return value is 0.
|
|
991
|
+
* - If `path` doesn't exist, an empty array will be returned.
|
|
992
|
+
* - If an index argument is out of bounds, an error is raised.
|
|
993
|
+
* - For legacy path (`path` doesn't start with `$`):
|
|
994
|
+
* - Returns an integer representing the new length of the array.
|
|
995
|
+
* - If the array is empty, its corresponding return value is 0.
|
|
996
|
+
* - If multiple paths match, the length of the first trimmed array match is returned.
|
|
997
|
+
* - If `path` doesn't exist, or the value at `path` is not an array, an error is raised.
|
|
998
|
+
* - If an index argument is out of bounds, an error is raised.
|
|
999
|
+
*/
|
|
1000
|
+
static arrtrim(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, start: number, end: number): Transaction | ClusterTransaction;
|
|
1001
|
+
/**
|
|
1002
|
+
* Searches for the first occurrence of a `scalar` JSON value in the arrays at the `path`.
|
|
1003
|
+
* Out of range errors are treated by rounding the index to the array's `start` and `end.
|
|
1004
|
+
* If `start` > `end`, return `-1` (not found).
|
|
1005
|
+
*
|
|
1006
|
+
* @param transaction - A transaction to add commands to.
|
|
1007
|
+
* @param key - The key of the JSON document.
|
|
1008
|
+
* @param path - The path within the JSON document.
|
|
1009
|
+
* @param scalar - The scalar value to search for.
|
|
1010
|
+
* @param options - (Optional) Additional parameters:
|
|
1011
|
+
* - (Optional) `start`: The start index, inclusive. Default to 0 if not provided.
|
|
1012
|
+
* - (Optional) `end`: The end index, exclusive. Default to 0 if not provided.
|
|
1013
|
+
* 0 or -1 means the last element is included.
|
|
1014
|
+
* Command Response -
|
|
1015
|
+
* - For JSONPath (path starts with `$`):
|
|
1016
|
+
* Returns an array with a list of integers for every possible path,
|
|
1017
|
+
* indicating the index of the matching element. The value is `-1` if not found.
|
|
1018
|
+
* If a value is not an array, its corresponding return value is `null`.
|
|
1019
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1020
|
+
* Returns an integer representing the index of matching element, or `-1` if
|
|
1021
|
+
* not found. If the value at the `path` is not an array, an error is raised.
|
|
1022
|
+
*/
|
|
1023
|
+
static arrindex(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, scalar: GlideString | number | boolean | null, options?: {
|
|
1024
|
+
start: number;
|
|
1025
|
+
end?: number;
|
|
1026
|
+
}): Transaction | ClusterTransaction;
|
|
1027
|
+
/**
|
|
1028
|
+
* Toggles a Boolean value stored at the specified `path` within the JSON document stored at `key`.
|
|
1029
|
+
*
|
|
1030
|
+
* @param transaction - A transaction to add commands to.
|
|
1031
|
+
* @param key - The key of the JSON document.
|
|
1032
|
+
* @param options - (Optional) Additional parameters:
|
|
1033
|
+
* - (Optional) `path`: The path within the JSON document. Defaults to the root (`"."`) if not specified.
|
|
1034
|
+
*
|
|
1035
|
+
* Command Response - For JSONPath (`path` starts with `$`), returns a list of boolean replies for every possible path, with the toggled boolean value,
|
|
1036
|
+
* or `null` for JSON values matching the path that are not boolean.
|
|
1037
|
+
* - For legacy path (`path` doesn't starts with `$`), returns the value of the toggled boolean in `path`.
|
|
1038
|
+
* - 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.
|
|
1039
|
+
*/
|
|
1040
|
+
static toggle(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1041
|
+
path: GlideString;
|
|
1042
|
+
}): Transaction | ClusterTransaction;
|
|
1043
|
+
/**
|
|
1044
|
+
* Deletes the JSON value at the specified `path` within the JSON document stored at `key`.
|
|
1045
|
+
*
|
|
1046
|
+
* @param transaction - A transaction to add commands to.
|
|
1047
|
+
* @param key - The key of the JSON document.
|
|
1048
|
+
* @param options - (Optional) Additional parameters:
|
|
1049
|
+
* - (Optional) `path`: If `null`, deletes the entire JSON document at `key`.
|
|
1050
|
+
*
|
|
1051
|
+
* Command Response - The number of elements removed. If `key` or `path` doesn't exist, returns 0.
|
|
1052
|
+
*/
|
|
1053
|
+
static del(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1054
|
+
path: GlideString;
|
|
1055
|
+
}): Transaction | ClusterTransaction;
|
|
1056
|
+
/**
|
|
1057
|
+
* Deletes the JSON value at the specified `path` within the JSON document stored at `key`. This command is
|
|
1058
|
+
* an alias of {@link del}.
|
|
1059
|
+
*
|
|
1060
|
+
* @param transaction - A transaction to add commands to.
|
|
1061
|
+
* @param key - The key of the JSON document.
|
|
1062
|
+
* @param options - (Optional) Additional parameters:
|
|
1063
|
+
* - (Optional) `path`: If `null`, deletes the entire JSON document at `key`.
|
|
1064
|
+
*
|
|
1065
|
+
* Command Response - The number of elements removed. If `key` or `path` doesn't exist, returns 0.
|
|
1066
|
+
*/
|
|
1067
|
+
static forget(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1068
|
+
path: GlideString;
|
|
1069
|
+
}): Transaction | ClusterTransaction;
|
|
1070
|
+
/**
|
|
1071
|
+
* Reports the type of values at the given path.
|
|
1072
|
+
*
|
|
1073
|
+
* @param transaction - A transaction to add commands to.
|
|
1074
|
+
* @param key - The key of the JSON document.
|
|
1075
|
+
* @param options - (Optional) Additional parameters:
|
|
1076
|
+
* - (Optional) `path`: Defaults to root (`"."`) if not provided.
|
|
1077
|
+
*
|
|
1078
|
+
* Command Response -
|
|
1079
|
+
* - For JSONPath (path starts with `$`):
|
|
1080
|
+
* - Returns an array of strings that represents the type of value at each path.
|
|
1081
|
+
* The type is one of "null", "boolean", "string", "number", "integer", "object" and "array".
|
|
1082
|
+
* - If a path does not exist, its corresponding return value is `null`.
|
|
1083
|
+
* - Empty array if the document key does not exist.
|
|
1084
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1085
|
+
* - String that represents the type of the value.
|
|
1086
|
+
* - `null` if the document key does not exist.
|
|
1087
|
+
* - `null` if the JSON path is invalid or does not exist.
|
|
1088
|
+
*/
|
|
1089
|
+
static type(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1090
|
+
path: GlideString;
|
|
1091
|
+
}): Transaction | ClusterTransaction;
|
|
1092
|
+
/**
|
|
1093
|
+
* Clears arrays or objects at the specified JSON path in the document stored at `key`.
|
|
1094
|
+
* Numeric values are set to `0`, boolean values are set to `false`, and string values are converted to empty strings.
|
|
1095
|
+
*
|
|
1096
|
+
* @param transaction - A transaction to add commands to.
|
|
1097
|
+
* @param key - The key of the JSON document.
|
|
1098
|
+
* @param options - (Optional) Additional parameters:
|
|
1099
|
+
* - (Optional) `path`: The JSON path to the arrays or objects to be cleared. Defaults to root if not provided.
|
|
1100
|
+
*
|
|
1101
|
+
* Command Response - The number of containers cleared, numeric values zeroed, and booleans toggled to `false`,
|
|
1102
|
+
* and string values converted to empty strings.
|
|
1103
|
+
* If `path` doesn't exist, or the value at `path` is already empty (e.g., an empty array, object, or string), `0` is returned.
|
|
1104
|
+
* If `key doesn't exist, an error is raised.
|
|
1105
|
+
*/
|
|
1106
|
+
static clear(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1107
|
+
path: GlideString;
|
|
1108
|
+
}): Transaction | ClusterTransaction;
|
|
1109
|
+
/**
|
|
1110
|
+
* Retrieve the JSON value at the specified `path` within the JSON document stored at `key`.
|
|
1111
|
+
* The returning result is in the Valkey or Redis OSS Serialization Protocol (RESP).
|
|
1112
|
+
* - JSON null is mapped to the RESP Null Bulk String.
|
|
1113
|
+
* - JSON Booleans are mapped to RESP Simple string.
|
|
1114
|
+
* - JSON integers are mapped to RESP Integers.
|
|
1115
|
+
* - JSON doubles are mapped to RESP Bulk Strings.
|
|
1116
|
+
* - JSON strings are mapped to RESP Bulk Strings.
|
|
1117
|
+
* - JSON arrays are represented as RESP arrays, where the first element is the simple string [, followed by the array's elements.
|
|
1118
|
+
* - 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.
|
|
1119
|
+
*
|
|
1120
|
+
* @param transaction - A transaction to add commands to.
|
|
1121
|
+
* @param key - The key of the JSON document.
|
|
1122
|
+
* @param options - (Optional) Additional parameters:
|
|
1123
|
+
* - (Optional) `path`: The path within the JSON document, defaults to root (`"."`) if not provided.
|
|
1124
|
+
*
|
|
1125
|
+
* Command Response -
|
|
1126
|
+
* - For JSONPath (path starts with `$`):
|
|
1127
|
+
* - Returns an array of replies for every possible path, indicating the RESP form of the JSON value.
|
|
1128
|
+
* If `path` doesn't exist, returns an empty array.
|
|
1129
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1130
|
+
* - Returns a single reply for the JSON value at the specified `path`, in its RESP form.
|
|
1131
|
+
* If multiple paths match, the value of the first JSON value match is returned. If `path` doesn't exist, an error is raised.
|
|
1132
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1133
|
+
*/
|
|
1134
|
+
static resp(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1135
|
+
path: GlideString;
|
|
1136
|
+
}): Transaction | ClusterTransaction;
|
|
1137
|
+
/**
|
|
1138
|
+
* Returns the length of the JSON string value stored at the specified `path` within
|
|
1139
|
+
* the JSON document stored at `key`.
|
|
1140
|
+
*
|
|
1141
|
+
* @param transaction - A transaction to add commands to.
|
|
1142
|
+
* @param key - The key of the JSON document.
|
|
1143
|
+
* @param options - (Optional) Additional parameters:
|
|
1144
|
+
* - (Optional) `path`: The path within the JSON document, Defaults to root (`"."`) if not provided.
|
|
1145
|
+
*
|
|
1146
|
+
* Command Response -
|
|
1147
|
+
* - For JSONPath (path starts with `$`):
|
|
1148
|
+
* - Returns a list of integer replies for every possible path, indicating the length of
|
|
1149
|
+
* the JSON string value, or <code>null</code> for JSON values matching the path that
|
|
1150
|
+
* are not string.
|
|
1151
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1152
|
+
* - Returns the length of the JSON value at `path` or `null` if `key` doesn't exist.
|
|
1153
|
+
* - If multiple paths match, the length of the first matched string is returned.
|
|
1154
|
+
* - If the JSON value at`path` is not a string or if `path` doesn't exist, an error is raised.
|
|
1155
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1156
|
+
*/
|
|
1157
|
+
static strlen(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1158
|
+
path: GlideString;
|
|
1159
|
+
}): Transaction | ClusterTransaction;
|
|
1160
|
+
/**
|
|
1161
|
+
* Appends the specified `value` to the string stored at the specified `path` within the JSON document stored at `key`.
|
|
1162
|
+
*
|
|
1163
|
+
* @param transaction - A transaction to add commands to.
|
|
1164
|
+
* @param key - The key of the JSON document.
|
|
1165
|
+
* @param value - The value to append to the string. Must be wrapped with single quotes. For example, to append "foo", pass '"foo"'.
|
|
1166
|
+
* @param options - (Optional) Additional parameters:
|
|
1167
|
+
* - (Optional) `path`: The path within the JSON document, defaults to root (`"."`) if not provided.
|
|
1168
|
+
*
|
|
1169
|
+
* Command Response -
|
|
1170
|
+
* - For JSONPath (path starts with `$`):
|
|
1171
|
+
* - Returns a list of integer replies for every possible path, indicating the length of the resulting string after appending `value`,
|
|
1172
|
+
* or None for JSON values matching the path that are not string.
|
|
1173
|
+
* - If `key` doesn't exist, an error is raised.
|
|
1174
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1175
|
+
* - Returns the length of the resulting string after appending `value` to the string at `path`.
|
|
1176
|
+
* - If multiple paths match, the length of the last updated string is returned.
|
|
1177
|
+
* - If the JSON value at `path` is not a string of if `path` doesn't exist, an error is raised.
|
|
1178
|
+
* - If `key` doesn't exist, an error is raised.
|
|
1179
|
+
*/
|
|
1180
|
+
static strappend(transaction: Transaction | ClusterTransaction, key: GlideString, value: GlideString, options?: {
|
|
1181
|
+
path: GlideString;
|
|
1182
|
+
}): Transaction | ClusterTransaction;
|
|
1183
|
+
/**
|
|
1184
|
+
* Appends one or more `values` to the JSON array at the specified `path` within the JSON
|
|
1185
|
+
* document stored at `key`.
|
|
1186
|
+
*
|
|
1187
|
+
* @param transaction - A transaction to add commands to.
|
|
1188
|
+
* @param key - The key of the JSON document.
|
|
1189
|
+
* @param path - The path within the JSON document.
|
|
1190
|
+
* @param values - The JSON values to be appended to the array.
|
|
1191
|
+
* JSON string values must be wrapped with quotes. For example, to append `"foo"`, pass `"\"foo\""`.
|
|
1192
|
+
*
|
|
1193
|
+
* Command Response -
|
|
1194
|
+
* - For JSONPath (path starts with `$`):
|
|
1195
|
+
* Returns an array with a list of integers for every possible path,
|
|
1196
|
+
* indicating the new length of the array, or `null` for JSON values matching
|
|
1197
|
+
* the path that are not an array. If `path` does not exist, an empty array
|
|
1198
|
+
* will be returned.
|
|
1199
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1200
|
+
* Returns an integer representing the new length of the array. If multiple paths are
|
|
1201
|
+
* matched, returns the length of the first modified array. If `path` doesn't
|
|
1202
|
+
* exist or the value at `path` is not an array, an error is raised.
|
|
1203
|
+
* - If the index is out of bounds or `key` doesn't exist, an error is raised.
|
|
1204
|
+
*/
|
|
1205
|
+
static arrappend(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, values: GlideString[]): Transaction | ClusterTransaction;
|
|
1206
|
+
/**
|
|
1207
|
+
* Reports memory usage in bytes of a JSON object at the specified `path` within the JSON document stored at `key`.
|
|
1208
|
+
*
|
|
1209
|
+
* @param transaction - A transaction to add commands to.
|
|
1210
|
+
* @param key - The key of the JSON document.
|
|
1211
|
+
* @param value - The value to append to the string. Must be wrapped with single quotes. For example, to append "foo", pass '"foo"'.
|
|
1212
|
+
* @param options - (Optional) Additional parameters:
|
|
1213
|
+
* - (Optional) `path`: The path within the JSON document, returns total memory usage if no path is given.
|
|
1214
|
+
*
|
|
1215
|
+
* Command Response -
|
|
1216
|
+
* - For JSONPath (path starts with `$`):
|
|
1217
|
+
* - Returns an array of numbers for every possible path, indicating the memory usage.
|
|
1218
|
+
* If `path` does not exist, an empty array will be returned.
|
|
1219
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1220
|
+
* - Returns an integer representing the memory usage. If multiple paths are matched,
|
|
1221
|
+
* returns the data of the first matching object. If `path` doesn't exist, an error is raised.
|
|
1222
|
+
* - If `key` doesn't exist, returns `null`.
|
|
1223
|
+
*/
|
|
1224
|
+
static debugMemory(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1225
|
+
path: GlideString;
|
|
1226
|
+
}): Transaction | ClusterTransaction;
|
|
1227
|
+
/**
|
|
1228
|
+
* Reports the number of fields at the specified `path` within the JSON document stored at `key`.
|
|
1229
|
+
*
|
|
1230
|
+
* @param transaction - A transaction to add commands to.
|
|
1231
|
+
* @param key - The key of the JSON document.
|
|
1232
|
+
* @param value - The value to append to the string. Must be wrapped with single quotes. For example, to append "foo", pass '"foo"'.
|
|
1233
|
+
* @param options - (Optional) Additional parameters:
|
|
1234
|
+
* - (Optional) `path`: The path within the JSON document, returns total number of fields if no path is given.
|
|
1235
|
+
*
|
|
1236
|
+
* Command Response -
|
|
1237
|
+
* - For JSONPath (path starts with `$`):
|
|
1238
|
+
* - Returns an array of numbers for every possible path, indicating the number of fields.
|
|
1239
|
+
* If `path` does not exist, an empty array will be returned.
|
|
1240
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1241
|
+
* - Returns an integer representing the memory usage. If multiple paths are matched,
|
|
1242
|
+
* returns the data of the first matching object. If `path` doesn't exist, an error is raised.
|
|
1243
|
+
* - If `key` doesn't exist, returns `null`.
|
|
1244
|
+
*/
|
|
1245
|
+
static debugFields(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1246
|
+
path: GlideString;
|
|
1247
|
+
}): Transaction | ClusterTransaction;
|
|
1248
|
+
/**
|
|
1249
|
+
* Increments or decrements the JSON value(s) at the specified `path` by `number` within the JSON document stored at `key`.
|
|
1250
|
+
*
|
|
1251
|
+
* @param transaction - A transaction to add commands to.
|
|
1252
|
+
* @param key - The key of the JSON document.
|
|
1253
|
+
* @param path - The path within the JSON document.
|
|
1254
|
+
* @param num - The number to increment or decrement by.
|
|
1255
|
+
*
|
|
1256
|
+
* Command Response -
|
|
1257
|
+
* - For JSONPath (path starts with `$`):
|
|
1258
|
+
* - Returns a string representation of an array of strings, indicating the new values after incrementing for each matched `path`.
|
|
1259
|
+
* If a value is not a number, its corresponding return value will be `null`.
|
|
1260
|
+
* If `path` doesn't exist, a byte string representation of an empty array will be returned.
|
|
1261
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1262
|
+
* - Returns a string representation of the resulting value after the increment or decrement.
|
|
1263
|
+
* If multiple paths match, the result of the last updated value is returned.
|
|
1264
|
+
* If the value at the `path` is not a number or `path` doesn't exist, an error is raised.
|
|
1265
|
+
* - If `key` does not exist, an error is raised.
|
|
1266
|
+
* - If the result is out of the range of 64-bit IEEE double, an error is raised.
|
|
1267
|
+
*/
|
|
1268
|
+
static numincrby(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, num: number): Transaction | ClusterTransaction;
|
|
1269
|
+
/**
|
|
1270
|
+
* Multiplies the JSON value(s) at the specified `path` by `number` within the JSON document stored at `key`.
|
|
1271
|
+
*
|
|
1272
|
+
* @param transaction - A transaction to add commands to.
|
|
1273
|
+
* @param key - The key of the JSON document.
|
|
1274
|
+
* @param path - The path within the JSON document.
|
|
1275
|
+
* @param num - The number to multiply by.
|
|
1276
|
+
*
|
|
1277
|
+
* Command Response -
|
|
1278
|
+
* - For JSONPath (path starts with `$`):
|
|
1279
|
+
* - Returns a GlideString representation of an array of strings, indicating the new values after multiplication for each matched `path`.
|
|
1280
|
+
* If a value is not a number, its corresponding return value will be `null`.
|
|
1281
|
+
* If `path` doesn't exist, a byte string representation of an empty array will be returned.
|
|
1282
|
+
* - For legacy path (path doesn't start with `$`):
|
|
1283
|
+
* - Returns a GlideString representation of the resulting value after multiplication.
|
|
1284
|
+
* If multiple paths match, the result of the last updated value is returned.
|
|
1285
|
+
* If the value at the `path` is not a number or `path` doesn't exist, an error is raised.
|
|
1286
|
+
* - If `key` does not exist, an error is raised.
|
|
1287
|
+
* - If the result is out of the range of 64-bit IEEE double, an error is raised.
|
|
1288
|
+
*/
|
|
1289
|
+
static nummultby(transaction: Transaction | ClusterTransaction, key: GlideString, path: GlideString, num: number): Transaction | ClusterTransaction;
|
|
1290
|
+
/**
|
|
1291
|
+
* Retrieves the number of key-value pairs in the object stored at the specified `path` within the JSON document stored at `key`.
|
|
1292
|
+
*
|
|
1293
|
+
* @param transaction - A transaction to add commands to.
|
|
1294
|
+
* @param key - The key of the JSON document.
|
|
1295
|
+
* @param options - (Optional) Additional parameters:
|
|
1296
|
+
* - (Optional) `path`: The path within the JSON document, Defaults to root (`"."`) if not provided.
|
|
1297
|
+
*
|
|
1298
|
+
* Command Response - ReturnTypeJson<number>:
|
|
1299
|
+
* - For JSONPath (`path` starts with `$`):
|
|
1300
|
+
* - Returns a list of integer replies for every possible path, indicating the length of the object,
|
|
1301
|
+
* or `null` for JSON values matching the path that are not an object.
|
|
1302
|
+
* - If `path` doesn't exist, an empty array will be returned.
|
|
1303
|
+
* - For legacy path (`path` doesn't starts with `$`):
|
|
1304
|
+
* - Returns the length of the object at `path`.
|
|
1305
|
+
* - If multiple paths match, the length of the first object match is returned.
|
|
1306
|
+
* - If the JSON value at `path` is not an object or if `path` doesn't exist, an error is raised.
|
|
1307
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1308
|
+
*/
|
|
1309
|
+
static objlen(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1310
|
+
path: GlideString;
|
|
1311
|
+
}): Transaction | ClusterTransaction;
|
|
1312
|
+
/**
|
|
1313
|
+
* Retrieves key names in the object values at the specified `path` within the JSON document stored at `key`.
|
|
1314
|
+
*
|
|
1315
|
+
* @param transaction - A transaction to add commands to.
|
|
1316
|
+
* @param key - The key of the JSON document.
|
|
1317
|
+
* @param options - (Optional) Additional parameters:
|
|
1318
|
+
* - (Optional) `path`: The path within the JSON document where the key names will be retrieved. Defaults to root (`"."`) if not provided.
|
|
1319
|
+
*
|
|
1320
|
+
* Command Response - ReturnTypeJson<GlideString[]>:
|
|
1321
|
+
* - For JSONPath (`path` starts with `$`):
|
|
1322
|
+
* - Returns a list of arrays containing key names for each matching object.
|
|
1323
|
+
* - If a value matching the path is not an object, an empty array is returned.
|
|
1324
|
+
* - If `path` doesn't exist, an empty array is returned.
|
|
1325
|
+
* - For legacy path (`path` starts with `.`):
|
|
1326
|
+
* - Returns a list of key names for the object value matching the path.
|
|
1327
|
+
* - If multiple objects match the path, the key names of the first object is returned.
|
|
1328
|
+
* - If a value matching the path is not an object, an error is raised.
|
|
1329
|
+
* - If `path` doesn't exist, `null` is returned.
|
|
1330
|
+
* - If `key` doesn't exist, `null` is returned.
|
|
1331
|
+
*/
|
|
1332
|
+
static objkeys(transaction: Transaction | ClusterTransaction, key: GlideString, options?: {
|
|
1333
|
+
path: GlideString;
|
|
1334
|
+
}): Transaction | ClusterTransaction;
|
|
1335
|
+
}
|