@upstash/redis 1.38.4 → 1.39.0
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/{chunk-2JFYL2VL.mjs → chunk-4WQYU7T6.mjs} +614 -8
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +613 -8
- package/cloudflare.mjs +1 -1
- package/{error-8y4qG0W2.d.mts → error-DOszGRxg.d.mts} +703 -3
- package/{error-8y4qG0W2.d.ts → error-DOszGRxg.d.ts} +703 -3
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +613 -8
- package/fastly.mjs +1 -1
- package/nodejs.d.mts +2 -2
- package/nodejs.d.ts +2 -2
- package/nodejs.js +615 -8
- package/nodejs.mjs +3 -1
- package/package.json +1 -1
|
@@ -705,17 +705,25 @@ function buildScoreFuncField(field) {
|
|
|
705
705
|
return result;
|
|
706
706
|
}
|
|
707
707
|
function buildCreateIndexCommand(params) {
|
|
708
|
-
const { name, schema, dataType,
|
|
709
|
-
|
|
708
|
+
const { name, schema, dataType, language, skipInitialScan, existsOk } = params;
|
|
709
|
+
let source;
|
|
710
|
+
if (params.dataType === "stream") {
|
|
711
|
+
source = ["ON", "STREAM", params.stream];
|
|
712
|
+
} else {
|
|
713
|
+
const prefixArray = Array.isArray(params.prefix) ? params.prefix : [params.prefix];
|
|
714
|
+
source = [
|
|
715
|
+
"ON",
|
|
716
|
+
dataType.toUpperCase(),
|
|
717
|
+
"PREFIX",
|
|
718
|
+
prefixArray.length.toString(),
|
|
719
|
+
...prefixArray
|
|
720
|
+
];
|
|
721
|
+
}
|
|
710
722
|
const payload = [
|
|
711
723
|
name,
|
|
712
724
|
...skipInitialScan ? ["SKIPINITIALSCAN"] : [],
|
|
713
725
|
...existsOk ? ["EXISTSOK"] : [],
|
|
714
|
-
|
|
715
|
-
dataType.toUpperCase(),
|
|
716
|
-
"PREFIX",
|
|
717
|
-
prefixArray.length.toString(),
|
|
718
|
-
...prefixArray,
|
|
726
|
+
...source,
|
|
719
727
|
...language ? ["LANGUAGE", language] : [],
|
|
720
728
|
"SCHEMA"
|
|
721
729
|
];
|
|
@@ -837,6 +845,202 @@ async function delAlias(client, { alias }) {
|
|
|
837
845
|
return result;
|
|
838
846
|
}
|
|
839
847
|
|
|
848
|
+
// pkg/commands/vector/utils.ts
|
|
849
|
+
function float32ToBase64(vector) {
|
|
850
|
+
const bytes = new Uint8Array(vector.length * 4);
|
|
851
|
+
const view = new DataView(bytes.buffer);
|
|
852
|
+
for (const [i, value] of vector.entries()) {
|
|
853
|
+
view.setFloat32(i * 4, value, true);
|
|
854
|
+
}
|
|
855
|
+
let binary = "";
|
|
856
|
+
const chunkSize = 32768;
|
|
857
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
858
|
+
binary += String.fromCodePoint(...bytes.subarray(i, i + chunkSize));
|
|
859
|
+
}
|
|
860
|
+
return btoa(binary);
|
|
861
|
+
}
|
|
862
|
+
function serializeVector(vector) {
|
|
863
|
+
if (Array.isArray(vector)) {
|
|
864
|
+
return ["VALUES", vector.length, ...vector];
|
|
865
|
+
}
|
|
866
|
+
if (vector instanceof Float32Array) {
|
|
867
|
+
return ["BASE64-FP32", float32ToBase64(vector)];
|
|
868
|
+
}
|
|
869
|
+
return ["BASE64-FP32", vector.base64];
|
|
870
|
+
}
|
|
871
|
+
function deserializeVectorValues(result) {
|
|
872
|
+
if (result === null) {
|
|
873
|
+
return null;
|
|
874
|
+
}
|
|
875
|
+
return result.map(Number);
|
|
876
|
+
}
|
|
877
|
+
function deserializeVectorQueryResponse(result) {
|
|
878
|
+
return result.map(([id, score]) => ({ id: String(id), score: Number(score) }));
|
|
879
|
+
}
|
|
880
|
+
function deserializeVectorInfoResponse(result) {
|
|
881
|
+
if (result === null) {
|
|
882
|
+
return null;
|
|
883
|
+
}
|
|
884
|
+
const fields = Array.isArray(result) ? Object.fromEntries(
|
|
885
|
+
Array.from({ length: Math.floor(result.length / 2) }, (_, i) => [
|
|
886
|
+
String(result[i * 2]),
|
|
887
|
+
result[i * 2 + 1]
|
|
888
|
+
])
|
|
889
|
+
) : result;
|
|
890
|
+
return {
|
|
891
|
+
dimension: Number(fields.dimension),
|
|
892
|
+
metric: String(fields.metric).toUpperCase()
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
// pkg/commands/vector_add.ts
|
|
897
|
+
var VectorAddCommand = class extends Command {
|
|
898
|
+
constructor([index, id, vector], cmdOpts) {
|
|
899
|
+
super(["VECTOR.ADD", index, id, ...serializeVector(vector)], cmdOpts);
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
// pkg/commands/vector_count.ts
|
|
904
|
+
var VectorCountCommand = class extends Command {
|
|
905
|
+
constructor([index], cmdOpts) {
|
|
906
|
+
super(["VECTOR.COUNT", index], cmdOpts);
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
// pkg/commands/vector_create.ts
|
|
911
|
+
var VectorCreateCommand = class extends Command {
|
|
912
|
+
constructor([index, opts], cmdOpts) {
|
|
913
|
+
const command = [
|
|
914
|
+
"VECTOR.CREATE",
|
|
915
|
+
index,
|
|
916
|
+
"DIM",
|
|
917
|
+
opts.dimension,
|
|
918
|
+
"METRIC",
|
|
919
|
+
opts.metric
|
|
920
|
+
];
|
|
921
|
+
if (opts.existsOk) {
|
|
922
|
+
command.push("EXISTSOK");
|
|
923
|
+
}
|
|
924
|
+
super(command, cmdOpts);
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
// pkg/commands/vector_del.ts
|
|
929
|
+
var VectorDelCommand = class extends Command {
|
|
930
|
+
constructor([index, id], cmdOpts) {
|
|
931
|
+
super(["VECTOR.DEL", index, id], cmdOpts);
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
// pkg/commands/vector_drop.ts
|
|
936
|
+
var VectorDropCommand = class extends Command {
|
|
937
|
+
constructor([index], cmdOpts) {
|
|
938
|
+
super(["VECTOR.DROP", index], cmdOpts);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
|
|
942
|
+
// pkg/commands/vector_get.ts
|
|
943
|
+
var VectorGetCommand = class extends Command {
|
|
944
|
+
constructor([index, id], cmdOpts) {
|
|
945
|
+
super(["VECTOR.GET", index, id], {
|
|
946
|
+
deserialize: deserializeVectorValues,
|
|
947
|
+
...cmdOpts
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
// pkg/commands/vector_info.ts
|
|
953
|
+
var VectorInfoCommand = class extends Command {
|
|
954
|
+
constructor([index], cmdOpts) {
|
|
955
|
+
super(["VECTOR.INFO", index], {
|
|
956
|
+
deserialize: deserializeVectorInfoResponse,
|
|
957
|
+
...cmdOpts
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// pkg/commands/vector_query.ts
|
|
963
|
+
var VectorQueryCommand = class extends Command {
|
|
964
|
+
constructor([index, opts], cmdOpts) {
|
|
965
|
+
const command = ["VECTOR.QUERY", index, "TOPK", opts.topK];
|
|
966
|
+
if (opts.profile) {
|
|
967
|
+
command.push("PROFILE", opts.profile);
|
|
968
|
+
}
|
|
969
|
+
command.push(...serializeVector(opts.vector));
|
|
970
|
+
super(command, {
|
|
971
|
+
deserialize: deserializeVectorQueryResponse,
|
|
972
|
+
...cmdOpts
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
// pkg/commands/vector/vector.ts
|
|
978
|
+
var VectorIndex = class {
|
|
979
|
+
name;
|
|
980
|
+
client;
|
|
981
|
+
commandOptions;
|
|
982
|
+
constructor({ name, client, commandOptions }) {
|
|
983
|
+
this.name = name;
|
|
984
|
+
this.client = client;
|
|
985
|
+
this.commandOptions = commandOptions;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Adds a vector to the index, or overwrites the vector stored under `id`.
|
|
989
|
+
*
|
|
990
|
+
* @returns `1` if a new vector was inserted, `0` if an existing one was overwritten.
|
|
991
|
+
*/
|
|
992
|
+
add(id, vector) {
|
|
993
|
+
return new VectorAddCommand([this.name, id, vector], this.commandOptions).exec(this.client);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Returns the vector stored under `id`, or `null` if it does not exist.
|
|
997
|
+
*/
|
|
998
|
+
get(id) {
|
|
999
|
+
return new VectorGetCommand([this.name, id], this.commandOptions).exec(this.client);
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Returns the `topK` nearest neighbours of the query vector.
|
|
1003
|
+
*/
|
|
1004
|
+
query(options) {
|
|
1005
|
+
return new VectorQueryCommand([this.name, options], this.commandOptions).exec(this.client);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Deletes the vector stored under `id`.
|
|
1009
|
+
*
|
|
1010
|
+
* @returns `1` if the vector existed and was removed, `0` otherwise.
|
|
1011
|
+
*/
|
|
1012
|
+
delete(id) {
|
|
1013
|
+
return new VectorDelCommand([this.name, id], this.commandOptions).exec(this.client);
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Returns the number of vectors in the index.
|
|
1017
|
+
*/
|
|
1018
|
+
count() {
|
|
1019
|
+
return new VectorCountCommand([this.name], this.commandOptions).exec(this.client);
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Returns the dimension and metric of the index, or `null` if it does not exist.
|
|
1023
|
+
*/
|
|
1024
|
+
info() {
|
|
1025
|
+
return new VectorInfoCommand([this.name], this.commandOptions).exec(this.client);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Drops the index and all vectors in it.
|
|
1029
|
+
*
|
|
1030
|
+
* @returns `1` if the index existed and was dropped, `0` otherwise.
|
|
1031
|
+
*/
|
|
1032
|
+
drop() {
|
|
1033
|
+
return new VectorDropCommand([this.name], this.commandOptions).exec(this.client);
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
async function createVectorIndex(client, { name, ...opts }, commandOptions) {
|
|
1037
|
+
await new VectorCreateCommand([name, opts], commandOptions).exec(client);
|
|
1038
|
+
return new VectorIndex({ name, client, commandOptions });
|
|
1039
|
+
}
|
|
1040
|
+
function initVectorIndex(client, name, commandOptions) {
|
|
1041
|
+
return new VectorIndex({ name, client, commandOptions });
|
|
1042
|
+
}
|
|
1043
|
+
|
|
840
1044
|
// pkg/commands/hrandfield.ts
|
|
841
1045
|
function deserialize(result) {
|
|
842
1046
|
if (result.length === 0) {
|
|
@@ -878,6 +1082,225 @@ var AppendCommand = class extends Command {
|
|
|
878
1082
|
}
|
|
879
1083
|
};
|
|
880
1084
|
|
|
1085
|
+
// pkg/commands/arcount.ts
|
|
1086
|
+
var ArCountCommand = class extends Command {
|
|
1087
|
+
constructor(cmd, opts) {
|
|
1088
|
+
super(["ARCOUNT", ...cmd], opts);
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
// pkg/commands/ardel.ts
|
|
1093
|
+
var ArDelCommand = class extends Command {
|
|
1094
|
+
constructor(cmd, opts) {
|
|
1095
|
+
super(["ARDEL", ...cmd], opts);
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
// pkg/commands/ardelrange.ts
|
|
1100
|
+
var ArDelRangeCommand = class extends Command {
|
|
1101
|
+
constructor([key, ...ranges], opts) {
|
|
1102
|
+
super(["ARDELRANGE", key, ...ranges.flat()], opts);
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// pkg/commands/arget.ts
|
|
1107
|
+
var ArGetCommand = class extends Command {
|
|
1108
|
+
constructor(cmd, opts) {
|
|
1109
|
+
super(["ARGET", ...cmd], opts);
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
// pkg/commands/argetrange.ts
|
|
1114
|
+
var ArGetRangeCommand = class extends Command {
|
|
1115
|
+
constructor(cmd, opts) {
|
|
1116
|
+
super(["ARGETRANGE", ...cmd], opts);
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
// pkg/commands/argrep.ts
|
|
1121
|
+
var ArGrepCommand = class extends Command {
|
|
1122
|
+
constructor([key, start, end, opts], cmdOpts) {
|
|
1123
|
+
const command = ["ARGREP", key, start, end];
|
|
1124
|
+
for (const predicate of opts.predicates) {
|
|
1125
|
+
if ("exact" in predicate) {
|
|
1126
|
+
command.push("EXACT", predicate.exact);
|
|
1127
|
+
} else if ("match" in predicate) {
|
|
1128
|
+
command.push("MATCH", predicate.match);
|
|
1129
|
+
} else if ("glob" in predicate) {
|
|
1130
|
+
command.push("GLOB", predicate.glob);
|
|
1131
|
+
} else {
|
|
1132
|
+
command.push("RE", predicate.re);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
if (opts.combine) {
|
|
1136
|
+
command.push(opts.combine.toUpperCase());
|
|
1137
|
+
}
|
|
1138
|
+
if (opts.noCase) {
|
|
1139
|
+
command.push("NOCASE");
|
|
1140
|
+
}
|
|
1141
|
+
if (opts.withValues) {
|
|
1142
|
+
command.push("WITHVALUES");
|
|
1143
|
+
}
|
|
1144
|
+
if (opts.limit !== void 0) {
|
|
1145
|
+
command.push("LIMIT", opts.limit);
|
|
1146
|
+
}
|
|
1147
|
+
super(command, {
|
|
1148
|
+
deserialize: (result) => parseResponse(result).map(
|
|
1149
|
+
(item) => Array.isArray(item) ? [String(item[0]), item[1]] : String(item)
|
|
1150
|
+
),
|
|
1151
|
+
...cmdOpts
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
// pkg/commands/arinfo.ts
|
|
1157
|
+
function toCamelCase(field) {
|
|
1158
|
+
return field.replaceAll(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
1159
|
+
}
|
|
1160
|
+
function deserializeArInfoResponse(result) {
|
|
1161
|
+
const entries = Array.isArray(result) ? Array.from({ length: Math.floor(result.length / 2) }, (_, i) => [
|
|
1162
|
+
result[i * 2],
|
|
1163
|
+
result[i * 2 + 1]
|
|
1164
|
+
]) : Object.entries(result);
|
|
1165
|
+
const indexFields = /* @__PURE__ */ new Set(["len", "nextInsertIndex"]);
|
|
1166
|
+
const info = {};
|
|
1167
|
+
for (const [field, value] of entries) {
|
|
1168
|
+
const name = toCamelCase(String(field));
|
|
1169
|
+
if (indexFields.has(name)) {
|
|
1170
|
+
info[name] = String(value);
|
|
1171
|
+
continue;
|
|
1172
|
+
}
|
|
1173
|
+
const numeric = typeof value === "number" ? value : Number(value);
|
|
1174
|
+
info[name] = Number.isNaN(numeric) ? value : numeric;
|
|
1175
|
+
}
|
|
1176
|
+
return info;
|
|
1177
|
+
}
|
|
1178
|
+
var ArInfoCommand = class extends Command {
|
|
1179
|
+
constructor([key, opts], cmdOpts) {
|
|
1180
|
+
const command = ["ARINFO", key];
|
|
1181
|
+
if (opts?.full) {
|
|
1182
|
+
command.push("FULL");
|
|
1183
|
+
}
|
|
1184
|
+
super(command, {
|
|
1185
|
+
deserialize: deserializeArInfoResponse,
|
|
1186
|
+
...cmdOpts
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
// pkg/commands/arinsert.ts
|
|
1192
|
+
var ArInsertCommand = class extends Command {
|
|
1193
|
+
constructor(cmd, opts) {
|
|
1194
|
+
super(["ARINSERT", ...cmd], {
|
|
1195
|
+
deserialize: String,
|
|
1196
|
+
...opts
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
// pkg/commands/arlastitems.ts
|
|
1202
|
+
var ArLastItemsCommand = class extends Command {
|
|
1203
|
+
constructor([key, count, opts], cmdOpts) {
|
|
1204
|
+
const command = ["ARLASTITEMS", key, count];
|
|
1205
|
+
if (opts?.rev) {
|
|
1206
|
+
command.push("REV");
|
|
1207
|
+
}
|
|
1208
|
+
super(command, cmdOpts);
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
// pkg/commands/arlen.ts
|
|
1213
|
+
var ArLenCommand = class extends Command {
|
|
1214
|
+
constructor(cmd, opts) {
|
|
1215
|
+
super(["ARLEN", ...cmd], {
|
|
1216
|
+
deserialize: String,
|
|
1217
|
+
...opts
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
// pkg/commands/armget.ts
|
|
1223
|
+
var ArMGetCommand = class extends Command {
|
|
1224
|
+
constructor(cmd, opts) {
|
|
1225
|
+
super(["ARMGET", ...cmd], opts);
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
// pkg/commands/armset.ts
|
|
1230
|
+
var ArMSetCommand = class extends Command {
|
|
1231
|
+
constructor([key, values], opts) {
|
|
1232
|
+
const pairs = Array.isArray(values) ? values : Object.entries(values);
|
|
1233
|
+
super(["ARMSET", key, ...pairs.flatMap(([index, value]) => [index, value])], opts);
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
// pkg/commands/arnext.ts
|
|
1238
|
+
var ArNextCommand = class extends Command {
|
|
1239
|
+
constructor(cmd, opts) {
|
|
1240
|
+
super(["ARNEXT", ...cmd], {
|
|
1241
|
+
deserialize: (result) => result === null ? null : String(result),
|
|
1242
|
+
...opts
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
// pkg/commands/arop.ts
|
|
1248
|
+
var ArOpCommand = class extends Command {
|
|
1249
|
+
constructor([key, start, end, operation], opts) {
|
|
1250
|
+
const command = ["AROP", key, start, end];
|
|
1251
|
+
if (typeof operation === "string") {
|
|
1252
|
+
command.push(operation.toUpperCase());
|
|
1253
|
+
} else {
|
|
1254
|
+
command.push("MATCH", operation.match);
|
|
1255
|
+
}
|
|
1256
|
+
super(command, {
|
|
1257
|
+
deserialize: (result) => result === null ? null : Number(result),
|
|
1258
|
+
...opts
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
// pkg/commands/arring.ts
|
|
1264
|
+
var ArRingCommand = class extends Command {
|
|
1265
|
+
constructor(cmd, opts) {
|
|
1266
|
+
super(["ARRING", ...cmd], {
|
|
1267
|
+
deserialize: String,
|
|
1268
|
+
...opts
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
// pkg/commands/arscan.ts
|
|
1274
|
+
var ArScanCommand = class extends Command {
|
|
1275
|
+
constructor([key, start, end, opts], cmdOpts) {
|
|
1276
|
+
const command = ["ARSCAN", key, start, end];
|
|
1277
|
+
if (opts?.limit !== void 0) {
|
|
1278
|
+
command.push("LIMIT", opts.limit);
|
|
1279
|
+
}
|
|
1280
|
+
super(command, {
|
|
1281
|
+
deserialize: (result) => parseResponse(result).map(([index, value]) => [
|
|
1282
|
+
String(index),
|
|
1283
|
+
value
|
|
1284
|
+
]),
|
|
1285
|
+
...cmdOpts
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
// pkg/commands/arseek.ts
|
|
1291
|
+
var ArSeekCommand = class extends Command {
|
|
1292
|
+
constructor(cmd, opts) {
|
|
1293
|
+
super(["ARSEEK", ...cmd], opts);
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
// pkg/commands/arset.ts
|
|
1298
|
+
var ArSetCommand = class extends Command {
|
|
1299
|
+
constructor(cmd, opts) {
|
|
1300
|
+
super(["ARSET", ...cmd], opts);
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
|
|
881
1304
|
// pkg/commands/bitcount.ts
|
|
882
1305
|
var BitCountCommand = class extends Command {
|
|
883
1306
|
constructor([key, start, end], opts) {
|
|
@@ -3099,6 +3522,78 @@ var Pipeline = class {
|
|
|
3099
3522
|
* @see https://redis.io/commands/append
|
|
3100
3523
|
*/
|
|
3101
3524
|
append = (...args) => this.chain(new AppendCommand(args, this.commandOptions));
|
|
3525
|
+
/**
|
|
3526
|
+
* @see https://upstash.com/docs/redis/commands/array/arcount
|
|
3527
|
+
*/
|
|
3528
|
+
arcount = (...args) => this.chain(new ArCountCommand(args, this.commandOptions));
|
|
3529
|
+
/**
|
|
3530
|
+
* @see https://upstash.com/docs/redis/commands/array/ardel
|
|
3531
|
+
*/
|
|
3532
|
+
ardel = (...args) => this.chain(new ArDelCommand(args, this.commandOptions));
|
|
3533
|
+
/**
|
|
3534
|
+
* @see https://upstash.com/docs/redis/commands/array/ardelrange
|
|
3535
|
+
*/
|
|
3536
|
+
ardelrange = (...args) => this.chain(new ArDelRangeCommand(args, this.commandOptions));
|
|
3537
|
+
/**
|
|
3538
|
+
* @see https://upstash.com/docs/redis/commands/array/arget
|
|
3539
|
+
*/
|
|
3540
|
+
arget = (...args) => this.chain(new ArGetCommand(args, this.commandOptions));
|
|
3541
|
+
/**
|
|
3542
|
+
* @see https://upstash.com/docs/redis/commands/array/argetrange
|
|
3543
|
+
*/
|
|
3544
|
+
argetrange = (...args) => this.chain(new ArGetRangeCommand(args, this.commandOptions));
|
|
3545
|
+
/**
|
|
3546
|
+
* @see https://upstash.com/docs/redis/commands/array/argrep
|
|
3547
|
+
*/
|
|
3548
|
+
argrep = (key, start, end, opts) => this.chain(new ArGrepCommand([key, start, end, opts], this.commandOptions));
|
|
3549
|
+
/**
|
|
3550
|
+
* @see https://upstash.com/docs/redis/commands/array/arinfo
|
|
3551
|
+
*/
|
|
3552
|
+
arinfo = (...args) => this.chain(new ArInfoCommand(args, this.commandOptions));
|
|
3553
|
+
/**
|
|
3554
|
+
* @see https://upstash.com/docs/redis/commands/array/arinsert
|
|
3555
|
+
*/
|
|
3556
|
+
arinsert = (key, ...values) => this.chain(new ArInsertCommand([key, ...values], this.commandOptions));
|
|
3557
|
+
/**
|
|
3558
|
+
* @see https://upstash.com/docs/redis/commands/array/arlastitems
|
|
3559
|
+
*/
|
|
3560
|
+
arlastitems = (...args) => this.chain(new ArLastItemsCommand(args, this.commandOptions));
|
|
3561
|
+
/**
|
|
3562
|
+
* @see https://upstash.com/docs/redis/commands/array/arlen
|
|
3563
|
+
*/
|
|
3564
|
+
arlen = (...args) => this.chain(new ArLenCommand(args, this.commandOptions));
|
|
3565
|
+
/**
|
|
3566
|
+
* @see https://upstash.com/docs/redis/commands/array/armget
|
|
3567
|
+
*/
|
|
3568
|
+
armget = (...args) => this.chain(new ArMGetCommand(args, this.commandOptions));
|
|
3569
|
+
/**
|
|
3570
|
+
* @see https://upstash.com/docs/redis/commands/array/armset
|
|
3571
|
+
*/
|
|
3572
|
+
armset = (key, values) => this.chain(new ArMSetCommand([key, values], this.commandOptions));
|
|
3573
|
+
/**
|
|
3574
|
+
* @see https://upstash.com/docs/redis/commands/array/arnext
|
|
3575
|
+
*/
|
|
3576
|
+
arnext = (...args) => this.chain(new ArNextCommand(args, this.commandOptions));
|
|
3577
|
+
/**
|
|
3578
|
+
* @see https://upstash.com/docs/redis/commands/array/arop
|
|
3579
|
+
*/
|
|
3580
|
+
arop = (key, start, end, operation) => this.chain(new ArOpCommand([key, start, end, operation], this.commandOptions));
|
|
3581
|
+
/**
|
|
3582
|
+
* @see https://upstash.com/docs/redis/commands/array/arring
|
|
3583
|
+
*/
|
|
3584
|
+
arring = (key, size, ...values) => this.chain(new ArRingCommand([key, size, ...values], this.commandOptions));
|
|
3585
|
+
/**
|
|
3586
|
+
* @see https://upstash.com/docs/redis/commands/array/arscan
|
|
3587
|
+
*/
|
|
3588
|
+
arscan = (...args) => this.chain(new ArScanCommand(args, this.commandOptions));
|
|
3589
|
+
/**
|
|
3590
|
+
* @see https://upstash.com/docs/redis/commands/array/arseek
|
|
3591
|
+
*/
|
|
3592
|
+
arseek = (...args) => this.chain(new ArSeekCommand(args, this.commandOptions));
|
|
3593
|
+
/**
|
|
3594
|
+
* @see https://upstash.com/docs/redis/commands/array/arset
|
|
3595
|
+
*/
|
|
3596
|
+
arset = (key, index, ...values) => this.chain(new ArSetCommand([key, index, ...values], this.commandOptions));
|
|
3102
3597
|
/**
|
|
3103
3598
|
* @see https://redis.io/commands/bitcount
|
|
3104
3599
|
*/
|
|
@@ -3922,6 +4417,18 @@ var Pipeline = class {
|
|
|
3922
4417
|
// pkg/auto-pipeline.ts
|
|
3923
4418
|
var MAX_PIPELINE_SIZE = 1e3;
|
|
3924
4419
|
var READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
4420
|
+
// Array
|
|
4421
|
+
"arcount",
|
|
4422
|
+
"arget",
|
|
4423
|
+
"argetrange",
|
|
4424
|
+
"argrep",
|
|
4425
|
+
"arinfo",
|
|
4426
|
+
"arlastitems",
|
|
4427
|
+
"arlen",
|
|
4428
|
+
"armget",
|
|
4429
|
+
"arnext",
|
|
4430
|
+
"arop",
|
|
4431
|
+
"arscan",
|
|
3925
4432
|
// String
|
|
3926
4433
|
"get",
|
|
3927
4434
|
"getrange",
|
|
@@ -4695,6 +5202,32 @@ var Redis = class {
|
|
|
4695
5202
|
}
|
|
4696
5203
|
};
|
|
4697
5204
|
}
|
|
5205
|
+
/**
|
|
5206
|
+
* Vector index commands.
|
|
5207
|
+
*
|
|
5208
|
+
* @example
|
|
5209
|
+
* ```typescript
|
|
5210
|
+
* const index = await redis.vector.createIndex({ name: "docs", dimension: 3, metric: "COSINE" });
|
|
5211
|
+
* await index.add("doc-1", [0.1, 0.2, 0.3]);
|
|
5212
|
+
* const hits = await index.query({ vector: [0.1, 0.2, 0.3], topK: 5 });
|
|
5213
|
+
* ```
|
|
5214
|
+
*/
|
|
5215
|
+
get vector() {
|
|
5216
|
+
return {
|
|
5217
|
+
/**
|
|
5218
|
+
* Creates a vector index and returns a handle to it.
|
|
5219
|
+
*/
|
|
5220
|
+
createIndex: (params) => {
|
|
5221
|
+
return createVectorIndex(this.client, params, this.opts);
|
|
5222
|
+
},
|
|
5223
|
+
/**
|
|
5224
|
+
* Returns a handle to an existing vector index without sending any command.
|
|
5225
|
+
*/
|
|
5226
|
+
index: (name) => {
|
|
5227
|
+
return initVectorIndex(this.client, name, this.opts);
|
|
5228
|
+
}
|
|
5229
|
+
};
|
|
5230
|
+
}
|
|
4698
5231
|
/**
|
|
4699
5232
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
4700
5233
|
*
|
|
@@ -4742,6 +5275,78 @@ var Redis = class {
|
|
|
4742
5275
|
* @see https://redis.io/commands/append
|
|
4743
5276
|
*/
|
|
4744
5277
|
append = (...args) => new AppendCommand(args, this.opts).exec(this.client);
|
|
5278
|
+
/**
|
|
5279
|
+
* @see https://upstash.com/docs/redis/commands/array/arcount
|
|
5280
|
+
*/
|
|
5281
|
+
arcount = (...args) => new ArCountCommand(args, this.opts).exec(this.client);
|
|
5282
|
+
/**
|
|
5283
|
+
* @see https://upstash.com/docs/redis/commands/array/ardel
|
|
5284
|
+
*/
|
|
5285
|
+
ardel = (...args) => new ArDelCommand(args, this.opts).exec(this.client);
|
|
5286
|
+
/**
|
|
5287
|
+
* @see https://upstash.com/docs/redis/commands/array/ardelrange
|
|
5288
|
+
*/
|
|
5289
|
+
ardelrange = (...args) => new ArDelRangeCommand(args, this.opts).exec(this.client);
|
|
5290
|
+
/**
|
|
5291
|
+
* @see https://upstash.com/docs/redis/commands/array/arget
|
|
5292
|
+
*/
|
|
5293
|
+
arget = (...args) => new ArGetCommand(args, this.opts).exec(this.client);
|
|
5294
|
+
/**
|
|
5295
|
+
* @see https://upstash.com/docs/redis/commands/array/argetrange
|
|
5296
|
+
*/
|
|
5297
|
+
argetrange = (...args) => new ArGetRangeCommand(args, this.opts).exec(this.client);
|
|
5298
|
+
/**
|
|
5299
|
+
* @see https://upstash.com/docs/redis/commands/array/argrep
|
|
5300
|
+
*/
|
|
5301
|
+
argrep = (key, start, end, opts) => new ArGrepCommand([key, start, end, opts], this.opts).exec(this.client);
|
|
5302
|
+
/**
|
|
5303
|
+
* @see https://upstash.com/docs/redis/commands/array/arinfo
|
|
5304
|
+
*/
|
|
5305
|
+
arinfo = (...args) => new ArInfoCommand(args, this.opts).exec(this.client);
|
|
5306
|
+
/**
|
|
5307
|
+
* @see https://upstash.com/docs/redis/commands/array/arinsert
|
|
5308
|
+
*/
|
|
5309
|
+
arinsert = (key, ...values) => new ArInsertCommand([key, ...values], this.opts).exec(this.client);
|
|
5310
|
+
/**
|
|
5311
|
+
* @see https://upstash.com/docs/redis/commands/array/arlastitems
|
|
5312
|
+
*/
|
|
5313
|
+
arlastitems = (...args) => new ArLastItemsCommand(args, this.opts).exec(this.client);
|
|
5314
|
+
/**
|
|
5315
|
+
* @see https://upstash.com/docs/redis/commands/array/arlen
|
|
5316
|
+
*/
|
|
5317
|
+
arlen = (...args) => new ArLenCommand(args, this.opts).exec(this.client);
|
|
5318
|
+
/**
|
|
5319
|
+
* @see https://upstash.com/docs/redis/commands/array/armget
|
|
5320
|
+
*/
|
|
5321
|
+
armget = (...args) => new ArMGetCommand(args, this.opts).exec(this.client);
|
|
5322
|
+
/**
|
|
5323
|
+
* @see https://upstash.com/docs/redis/commands/array/armset
|
|
5324
|
+
*/
|
|
5325
|
+
armset = (key, values) => new ArMSetCommand([key, values], this.opts).exec(this.client);
|
|
5326
|
+
/**
|
|
5327
|
+
* @see https://upstash.com/docs/redis/commands/array/arnext
|
|
5328
|
+
*/
|
|
5329
|
+
arnext = (...args) => new ArNextCommand(args, this.opts).exec(this.client);
|
|
5330
|
+
/**
|
|
5331
|
+
* @see https://upstash.com/docs/redis/commands/array/arop
|
|
5332
|
+
*/
|
|
5333
|
+
arop = (key, start, end, operation) => new ArOpCommand([key, start, end, operation], this.opts).exec(this.client);
|
|
5334
|
+
/**
|
|
5335
|
+
* @see https://upstash.com/docs/redis/commands/array/arring
|
|
5336
|
+
*/
|
|
5337
|
+
arring = (key, size, ...values) => new ArRingCommand([key, size, ...values], this.opts).exec(this.client);
|
|
5338
|
+
/**
|
|
5339
|
+
* @see https://upstash.com/docs/redis/commands/array/arscan
|
|
5340
|
+
*/
|
|
5341
|
+
arscan = (...args) => new ArScanCommand(args, this.opts).exec(this.client);
|
|
5342
|
+
/**
|
|
5343
|
+
* @see https://upstash.com/docs/redis/commands/array/arseek
|
|
5344
|
+
*/
|
|
5345
|
+
arseek = (...args) => new ArSeekCommand(args, this.opts).exec(this.client);
|
|
5346
|
+
/**
|
|
5347
|
+
* @see https://upstash.com/docs/redis/commands/array/arset
|
|
5348
|
+
*/
|
|
5349
|
+
arset = (key, index, ...values) => new ArSetCommand([key, index, ...values], this.opts).exec(this.client);
|
|
4745
5350
|
/**
|
|
4746
5351
|
* @see https://redis.io/commands/bitcount
|
|
4747
5352
|
*/
|
|
@@ -5430,12 +6035,13 @@ var Redis = class {
|
|
|
5430
6035
|
};
|
|
5431
6036
|
|
|
5432
6037
|
// version.ts
|
|
5433
|
-
var VERSION = "v1.
|
|
6038
|
+
var VERSION = "v1.39.0";
|
|
5434
6039
|
|
|
5435
6040
|
export {
|
|
5436
6041
|
error_exports,
|
|
5437
6042
|
HttpClient,
|
|
5438
6043
|
SearchIndex,
|
|
6044
|
+
VectorIndex,
|
|
5439
6045
|
Redis,
|
|
5440
6046
|
VERSION
|
|
5441
6047
|
};
|