@windrun-huaiin/backend-core 13.0.0 → 14.1.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/dist/_virtual/index.js +7 -3
- package/dist/_virtual/index.mjs +5 -3
- package/dist/_virtual/index2.js +2 -6
- package/dist/_virtual/index2.mjs +2 -6
- package/dist/index.js +3 -1
- package/dist/index.mjs +2 -2
- package/dist/lib/index.js +3 -1
- package/dist/lib/index.mjs +2 -2
- package/dist/lib/stripe-config.d.ts +1 -1
- package/dist/lib/stripe-config.d.ts.map +1 -1
- package/dist/lib/stripe-config.js +25 -16
- package/dist/lib/stripe-config.mjs +25 -16
- package/dist/lib/upstash/qstash.d.ts.map +1 -1
- package/dist/lib/upstash/qstash.js +66 -62
- package/dist/lib/upstash/qstash.mjs +67 -63
- package/dist/lib/upstash/redis-counter.d.ts.map +1 -1
- package/dist/lib/upstash/redis-counter.js +9 -24
- package/dist/lib/upstash/redis-counter.mjs +10 -25
- package/dist/lib/upstash/redis-favorite.d.ts.map +1 -1
- package/dist/lib/upstash/redis-favorite.js +22 -36
- package/dist/lib/upstash/redis-favorite.mjs +23 -37
- package/dist/lib/upstash/redis-like.d.ts.map +1 -1
- package/dist/lib/upstash/redis-like.js +22 -36
- package/dist/lib/upstash/redis-like.mjs +23 -37
- package/dist/lib/upstash/redis-lock.d.ts.map +1 -1
- package/dist/lib/upstash/redis-lock.js +22 -38
- package/dist/lib/upstash/redis-lock.mjs +23 -39
- package/dist/lib/upstash/redis-structures.d.ts.map +1 -1
- package/dist/lib/upstash/redis-structures.js +77 -113
- package/dist/lib/upstash/redis-structures.mjs +78 -114
- package/dist/lib/upstash-config.d.ts +9 -1
- package/dist/lib/upstash-config.d.ts.map +1 -1
- package/dist/lib/upstash-config.js +221 -27
- package/dist/lib/upstash-config.mjs +220 -28
- package/dist/node_modules/.pnpm/{@upstash_qstash@2.8.4/node_modules/@upstash/qstash/chunk-RQPZUJXG.js → @upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.js} +897 -468
- package/dist/node_modules/.pnpm/{@upstash_qstash@2.8.4/node_modules/@upstash/qstash/chunk-RQPZUJXG.mjs → @upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.mjs} +895 -468
- package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1/node_modules/@upstash/redis/chunk-LLI2WIYN.js → @upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.js} +657 -40
- package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1/node_modules/@upstash/redis/chunk-LLI2WIYN.mjs → @upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.mjs} +657 -41
- package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1 → @upstash_redis@1.37.0}/node_modules/@upstash/redis/nodejs.js +6 -5
- package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1 → @upstash_redis@1.37.0}/node_modules/@upstash/redis/nodejs.mjs +2 -2
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +1 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +1 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js +6 -6
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js +1 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js +2 -2
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js +1 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js +7 -5
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js +4 -2
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js +1 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js +3 -1
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js +6 -4
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js +6 -4
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js +7 -5
- package/dist/services/stripe/webhook-handler.js +4 -2
- package/dist/services/stripe/webhook-handler.mjs +3 -1
- package/package.json +5 -5
- package/src/lib/stripe-config.ts +27 -15
- package/src/lib/upstash/qstash.ts +64 -62
- package/src/lib/upstash/redis-counter.ts +10 -26
- package/src/lib/upstash/redis-favorite.ts +23 -42
- package/src/lib/upstash/redis-like.ts +23 -42
- package/src/lib/upstash/redis-lock.ts +23 -49
- package/src/lib/upstash/redis-structures.ts +82 -131
- package/src/lib/upstash-config.ts +231 -24
- package/src/services/stripe/webhook-handler.ts +3 -1
- package/dist/_virtual/index3.js +0 -5
- package/dist/_virtual/index3.mjs +0 -3
- package/dist/node_modules/.pnpm/@upstash_lock@0.2.1_typescript@5.9.3/node_modules/@upstash/lock/dist/index.js +0 -191
- package/dist/node_modules/.pnpm/@upstash_lock@0.2.1_typescript@5.9.3/node_modules/@upstash/lock/dist/index.mjs +0 -189
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.js +0 -54
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.mjs +0 -51
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.js +0 -44
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.mjs +0 -35
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.js +0 -31
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.mjs +0 -18
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.js +0 -587
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.mjs +0 -527
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.js +0 -447
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.mjs +0 -399
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.js +0 -245
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.mjs +0 -232
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.js +0 -68
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.mjs +0 -62
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.js +0 -39
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.mjs +0 -37
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.js +0 -80
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.mjs +0 -75
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.js +0 -101
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.mjs +0 -86
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.js +0 -102
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.mjs +0 -76
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.js +0 -56
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.mjs +0 -52
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.js +0 -1205
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.mjs +0 -1157
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.js +0 -407
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.mjs +0 -374
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.mjs +0 -7
|
@@ -144,7 +144,6 @@ var HttpClient = class {
|
|
|
144
144
|
const signal = req.signal ?? this.options.signal;
|
|
145
145
|
const isSignalFunction = typeof signal === "function";
|
|
146
146
|
const requestOptions = {
|
|
147
|
-
//@ts-expect-error this should throw due to bun regression
|
|
148
147
|
cache: this.options.cache,
|
|
149
148
|
method: "POST",
|
|
150
149
|
headers: requestHeaders,
|
|
@@ -391,6 +390,442 @@ var Command = class {
|
|
|
391
390
|
}
|
|
392
391
|
};
|
|
393
392
|
|
|
393
|
+
// pkg/commands/exec.ts
|
|
394
|
+
var ExecCommand = class extends Command {
|
|
395
|
+
constructor(cmd, opts) {
|
|
396
|
+
const normalizedCmd = cmd.map((arg) => typeof arg === "string" ? arg : String(arg));
|
|
397
|
+
super(normalizedCmd, opts);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
// pkg/commands/search/types.ts
|
|
402
|
+
var FIELD_TYPES = [
|
|
403
|
+
"TEXT",
|
|
404
|
+
"U64",
|
|
405
|
+
"I64",
|
|
406
|
+
"F64",
|
|
407
|
+
"BOOL",
|
|
408
|
+
"DATE",
|
|
409
|
+
"KEYWORD",
|
|
410
|
+
"FACET"
|
|
411
|
+
];
|
|
412
|
+
|
|
413
|
+
// pkg/commands/search/utils.ts
|
|
414
|
+
function isFieldType(value) {
|
|
415
|
+
return typeof value === "string" && FIELD_TYPES.includes(value);
|
|
416
|
+
}
|
|
417
|
+
function isDetailedField(value) {
|
|
418
|
+
return typeof value === "object" && value !== null && "type" in value && isFieldType(value.type);
|
|
419
|
+
}
|
|
420
|
+
function isNestedSchema(value) {
|
|
421
|
+
return typeof value === "object" && value !== null && !isDetailedField(value);
|
|
422
|
+
}
|
|
423
|
+
function flattenSchema(schema, pathPrefix = []) {
|
|
424
|
+
const fields = [];
|
|
425
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
426
|
+
const currentPath = [...pathPrefix, key];
|
|
427
|
+
const pathString = currentPath.join(".");
|
|
428
|
+
if (isFieldType(value)) {
|
|
429
|
+
fields.push({
|
|
430
|
+
path: pathString,
|
|
431
|
+
type: value
|
|
432
|
+
});
|
|
433
|
+
} else if (isDetailedField(value)) {
|
|
434
|
+
fields.push({
|
|
435
|
+
path: pathString,
|
|
436
|
+
type: value.type,
|
|
437
|
+
fast: "fast" in value ? value.fast : void 0,
|
|
438
|
+
noTokenize: "noTokenize" in value ? value.noTokenize : void 0,
|
|
439
|
+
noStem: "noStem" in value ? value.noStem : void 0,
|
|
440
|
+
from: "from" in value ? value.from : void 0
|
|
441
|
+
});
|
|
442
|
+
} else if (isNestedSchema(value)) {
|
|
443
|
+
const nestedFields = flattenSchema(value, currentPath);
|
|
444
|
+
fields.push(...nestedFields);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return fields;
|
|
448
|
+
}
|
|
449
|
+
function deserializeQueryResponse(rawResponse) {
|
|
450
|
+
return rawResponse.map((itemRaw) => {
|
|
451
|
+
const raw = itemRaw;
|
|
452
|
+
const key = raw[0];
|
|
453
|
+
const score = Number(raw[1]);
|
|
454
|
+
const rawFields = raw[2];
|
|
455
|
+
if (rawFields === void 0) {
|
|
456
|
+
return { key, score };
|
|
457
|
+
}
|
|
458
|
+
if (!Array.isArray(rawFields) || rawFields.length === 0) {
|
|
459
|
+
return { key, score, data: {} };
|
|
460
|
+
}
|
|
461
|
+
let data = {};
|
|
462
|
+
for (const fieldRaw of rawFields) {
|
|
463
|
+
const key2 = fieldRaw[0];
|
|
464
|
+
const value = fieldRaw[1];
|
|
465
|
+
const pathParts = key2.split(".");
|
|
466
|
+
if (pathParts.length === 1) {
|
|
467
|
+
data[key2] = value;
|
|
468
|
+
} else {
|
|
469
|
+
let currentObj = data;
|
|
470
|
+
for (let i = 0; i < pathParts.length - 1; i++) {
|
|
471
|
+
const pathPart = pathParts[i];
|
|
472
|
+
if (!(pathPart in currentObj)) {
|
|
473
|
+
currentObj[pathPart] = {};
|
|
474
|
+
}
|
|
475
|
+
currentObj = currentObj[pathPart];
|
|
476
|
+
}
|
|
477
|
+
currentObj[pathParts.at(-1)] = value;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if ("$" in data) {
|
|
481
|
+
data = data["$"];
|
|
482
|
+
}
|
|
483
|
+
return { key, score, data };
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function deserializeDescribeResponse(rawResponse) {
|
|
487
|
+
const description = {};
|
|
488
|
+
for (let i = 0; i < rawResponse.length; i += 2) {
|
|
489
|
+
const descriptor = rawResponse[i];
|
|
490
|
+
switch (descriptor) {
|
|
491
|
+
case "name": {
|
|
492
|
+
description["name"] = rawResponse[i + 1];
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
case "type": {
|
|
496
|
+
description["dataType"] = rawResponse[i + 1].toLowerCase();
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
case "prefixes": {
|
|
500
|
+
description["prefixes"] = rawResponse[i + 1];
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
case "language": {
|
|
504
|
+
description["language"] = rawResponse[i + 1];
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
case "schema": {
|
|
508
|
+
const schema = {};
|
|
509
|
+
for (const fieldDescription of rawResponse[i + 1]) {
|
|
510
|
+
const fieldName = fieldDescription[0];
|
|
511
|
+
const fieldInfo = { type: fieldDescription[1] };
|
|
512
|
+
if (fieldDescription.length > 2) {
|
|
513
|
+
for (let j = 2; j < fieldDescription.length; j++) {
|
|
514
|
+
const fieldOption = fieldDescription[j];
|
|
515
|
+
switch (fieldOption) {
|
|
516
|
+
case "NOSTEM": {
|
|
517
|
+
fieldInfo.noStem = true;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
case "NOTOKENIZE": {
|
|
521
|
+
fieldInfo.noTokenize = true;
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
case "FAST": {
|
|
525
|
+
fieldInfo.fast = true;
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
case "FROM": {
|
|
529
|
+
fieldInfo.from = fieldDescription[++j];
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
schema[fieldName] = fieldInfo;
|
|
536
|
+
}
|
|
537
|
+
description["schema"] = schema;
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return description;
|
|
543
|
+
}
|
|
544
|
+
function parseCountResponse(rawResponse) {
|
|
545
|
+
return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
|
|
546
|
+
}
|
|
547
|
+
function deserializeAggregateResponse(rawResponse) {
|
|
548
|
+
return parseAggregationArray(rawResponse);
|
|
549
|
+
}
|
|
550
|
+
function parseAggregationArray(arr) {
|
|
551
|
+
const result = {};
|
|
552
|
+
for (let i = 0; i < arr.length; i += 2) {
|
|
553
|
+
const key = arr[i];
|
|
554
|
+
const value = arr[i + 1];
|
|
555
|
+
if (Array.isArray(value)) {
|
|
556
|
+
if (value.length > 0 && typeof value[0] === "string") {
|
|
557
|
+
result[key] = value[0] === "buckets" ? parseBucketsValue(value) : parseStatsValue(value);
|
|
558
|
+
} else {
|
|
559
|
+
result[key] = parseAggregationArray(value);
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
result[key] = value;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return result;
|
|
566
|
+
}
|
|
567
|
+
function coerceNumericString(value) {
|
|
568
|
+
if (typeof value === "string" && value !== "" && !Number.isNaN(Number(value))) {
|
|
569
|
+
return Number(value);
|
|
570
|
+
}
|
|
571
|
+
return value;
|
|
572
|
+
}
|
|
573
|
+
function parseStatsValue(arr) {
|
|
574
|
+
const result = {};
|
|
575
|
+
for (let i = 0; i < arr.length; i += 2) {
|
|
576
|
+
const key = arr[i];
|
|
577
|
+
const value = arr[i + 1];
|
|
578
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
579
|
+
if (typeof value[0] === "string") {
|
|
580
|
+
result[key] = parseStatsValue(value);
|
|
581
|
+
} else if (Array.isArray(value[0]) && typeof value[0][0] === "string") {
|
|
582
|
+
result[key] = value.map((item) => parseStatsValue(item));
|
|
583
|
+
} else {
|
|
584
|
+
result[key] = value;
|
|
585
|
+
}
|
|
586
|
+
} else {
|
|
587
|
+
result[key] = coerceNumericString(value);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return result;
|
|
591
|
+
}
|
|
592
|
+
function parseBucketsValue(arr) {
|
|
593
|
+
if (arr[0] === "buckets" && Array.isArray(arr[1])) {
|
|
594
|
+
const result = {
|
|
595
|
+
buckets: arr[1].map((bucket) => {
|
|
596
|
+
const bucketObj = {};
|
|
597
|
+
for (let i = 0; i < bucket.length; i += 2) {
|
|
598
|
+
const key = bucket[i];
|
|
599
|
+
const value = bucket[i + 1];
|
|
600
|
+
bucketObj[key] = Array.isArray(value) && value.length > 0 && typeof value[0] === "string" ? parseStatsValue(value) : value;
|
|
601
|
+
}
|
|
602
|
+
return bucketObj;
|
|
603
|
+
})
|
|
604
|
+
};
|
|
605
|
+
for (let i = 2; i < arr.length; i += 2) {
|
|
606
|
+
result[arr[i]] = arr[i + 1];
|
|
607
|
+
}
|
|
608
|
+
return result;
|
|
609
|
+
}
|
|
610
|
+
return arr;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// pkg/commands/search/command-builder.ts
|
|
614
|
+
function buildQueryCommand(redisCommand, name, options) {
|
|
615
|
+
const query = JSON.stringify(options?.filter ?? {});
|
|
616
|
+
const command = [redisCommand, name, query];
|
|
617
|
+
if (options?.limit !== void 0) {
|
|
618
|
+
command.push("LIMIT", options.limit.toString());
|
|
619
|
+
}
|
|
620
|
+
if (options?.offset !== void 0) {
|
|
621
|
+
command.push("OFFSET", options.offset.toString());
|
|
622
|
+
}
|
|
623
|
+
if (options?.select && Object.keys(options.select).length === 0) {
|
|
624
|
+
command.push("NOCONTENT");
|
|
625
|
+
}
|
|
626
|
+
if (options) {
|
|
627
|
+
if ("orderBy" in options && options.orderBy) {
|
|
628
|
+
command.push("ORDERBY");
|
|
629
|
+
for (const [field, direction] of Object.entries(options.orderBy)) {
|
|
630
|
+
command.push(field, direction);
|
|
631
|
+
}
|
|
632
|
+
} else if ("scoreFunc" in options && options.scoreFunc) {
|
|
633
|
+
command.push("SCOREFUNC", ...buildScoreFunc(options.scoreFunc));
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
if (options?.highlight) {
|
|
637
|
+
command.push(
|
|
638
|
+
"HIGHLIGHT",
|
|
639
|
+
"FIELDS",
|
|
640
|
+
options.highlight.fields.length.toString(),
|
|
641
|
+
...options.highlight.fields
|
|
642
|
+
);
|
|
643
|
+
if (options.highlight.preTag && options.highlight.postTag) {
|
|
644
|
+
command.push("TAGS", options.highlight.preTag, options.highlight.postTag);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (options?.select && Object.keys(options.select).length > 0) {
|
|
648
|
+
command.push(
|
|
649
|
+
"SELECT",
|
|
650
|
+
Object.keys(options.select).length.toString(),
|
|
651
|
+
...Object.keys(options.select)
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
return command;
|
|
655
|
+
}
|
|
656
|
+
function buildScoreFunc(scoreBy) {
|
|
657
|
+
const result = [];
|
|
658
|
+
if (typeof scoreBy === "string") {
|
|
659
|
+
result.push("FIELDVALUE", scoreBy);
|
|
660
|
+
} else if ("fields" in scoreBy) {
|
|
661
|
+
if (scoreBy.combineMode) {
|
|
662
|
+
result.push("COMBINEMODE", scoreBy.combineMode.toUpperCase());
|
|
663
|
+
}
|
|
664
|
+
if (scoreBy.scoreMode) {
|
|
665
|
+
result.push("SCOREMODE", scoreBy.scoreMode.toUpperCase());
|
|
666
|
+
}
|
|
667
|
+
for (const field of scoreBy.fields) {
|
|
668
|
+
result.push(...buildScoreFuncField(field));
|
|
669
|
+
}
|
|
670
|
+
} else {
|
|
671
|
+
result.push(...buildScoreFuncField(scoreBy));
|
|
672
|
+
}
|
|
673
|
+
return result;
|
|
674
|
+
}
|
|
675
|
+
function buildScoreFuncField(field) {
|
|
676
|
+
const result = [];
|
|
677
|
+
if (typeof field === "string") {
|
|
678
|
+
result.push("FIELDVALUE", field);
|
|
679
|
+
} else {
|
|
680
|
+
if (field.scoreMode) {
|
|
681
|
+
result.push("SCOREMODE", field.scoreMode.toUpperCase());
|
|
682
|
+
}
|
|
683
|
+
result.push("FIELDVALUE", field.field);
|
|
684
|
+
if (field.modifier) {
|
|
685
|
+
result.push("MODIFIER", field.modifier.toUpperCase());
|
|
686
|
+
}
|
|
687
|
+
if (field.factor !== void 0) {
|
|
688
|
+
result.push("FACTOR", field.factor.toString());
|
|
689
|
+
}
|
|
690
|
+
if (field.missing !== void 0) {
|
|
691
|
+
result.push("MISSING", field.missing.toString());
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return result;
|
|
695
|
+
}
|
|
696
|
+
function buildCreateIndexCommand(params) {
|
|
697
|
+
const { name, schema, dataType, prefix, language, skipInitialScan, existsOk } = params;
|
|
698
|
+
const prefixArray = Array.isArray(prefix) ? prefix : [prefix];
|
|
699
|
+
const payload = [
|
|
700
|
+
name,
|
|
701
|
+
...skipInitialScan ? ["SKIPINITIALSCAN"] : [],
|
|
702
|
+
...existsOk ? ["EXISTSOK"] : [],
|
|
703
|
+
"ON",
|
|
704
|
+
dataType.toUpperCase(),
|
|
705
|
+
"PREFIX",
|
|
706
|
+
prefixArray.length.toString(),
|
|
707
|
+
...prefixArray,
|
|
708
|
+
...language ? ["LANGUAGE", language] : [],
|
|
709
|
+
"SCHEMA"
|
|
710
|
+
];
|
|
711
|
+
const fields = flattenSchema(schema);
|
|
712
|
+
for (const field of fields) {
|
|
713
|
+
payload.push(field.path, field.type);
|
|
714
|
+
if (field.fast) {
|
|
715
|
+
payload.push("FAST");
|
|
716
|
+
}
|
|
717
|
+
if (field.noTokenize) {
|
|
718
|
+
payload.push("NOTOKENIZE");
|
|
719
|
+
}
|
|
720
|
+
if (field.noStem) {
|
|
721
|
+
payload.push("NOSTEM");
|
|
722
|
+
}
|
|
723
|
+
if (field.from) {
|
|
724
|
+
payload.push("FROM", field.from);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return ["SEARCH.CREATE", ...payload];
|
|
728
|
+
}
|
|
729
|
+
function buildAggregateCommand(name, options) {
|
|
730
|
+
const query = JSON.stringify(options?.filter ?? {});
|
|
731
|
+
const aggregations = JSON.stringify(options.aggregations);
|
|
732
|
+
return ["SEARCH.AGGREGATE", name, query, aggregations];
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// pkg/commands/search/search.ts
|
|
736
|
+
var SearchIndex = class {
|
|
737
|
+
name;
|
|
738
|
+
schema;
|
|
739
|
+
client;
|
|
740
|
+
constructor({ name, schema, client }) {
|
|
741
|
+
this.name = name;
|
|
742
|
+
this.schema = schema;
|
|
743
|
+
this.client = client;
|
|
744
|
+
}
|
|
745
|
+
async waitIndexing() {
|
|
746
|
+
const command = ["SEARCH.WAITINDEXING", this.name];
|
|
747
|
+
return await new ExecCommand(command).exec(this.client);
|
|
748
|
+
}
|
|
749
|
+
async describe() {
|
|
750
|
+
const command = ["SEARCH.DESCRIBE", this.name];
|
|
751
|
+
const rawResult = await new ExecCommand(command).exec(
|
|
752
|
+
this.client
|
|
753
|
+
);
|
|
754
|
+
if (!rawResult) return null;
|
|
755
|
+
return deserializeDescribeResponse(rawResult);
|
|
756
|
+
}
|
|
757
|
+
async query(options) {
|
|
758
|
+
const command = buildQueryCommand("SEARCH.QUERY", this.name, options);
|
|
759
|
+
const rawResult = await new ExecCommand(command).exec(
|
|
760
|
+
this.client
|
|
761
|
+
);
|
|
762
|
+
if (!rawResult) return rawResult;
|
|
763
|
+
return deserializeQueryResponse(rawResult);
|
|
764
|
+
}
|
|
765
|
+
async aggregate(options) {
|
|
766
|
+
const command = buildAggregateCommand(this.name, options);
|
|
767
|
+
const rawResult = await new ExecCommand(
|
|
768
|
+
command
|
|
769
|
+
).exec(this.client);
|
|
770
|
+
return deserializeAggregateResponse(rawResult);
|
|
771
|
+
}
|
|
772
|
+
async count({ filter }) {
|
|
773
|
+
const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
|
|
774
|
+
const rawResult = await new ExecCommand(command).exec(
|
|
775
|
+
this.client
|
|
776
|
+
);
|
|
777
|
+
return { count: parseCountResponse(rawResult) };
|
|
778
|
+
}
|
|
779
|
+
async drop() {
|
|
780
|
+
const command = ["SEARCH.DROP", this.name];
|
|
781
|
+
const result = await new ExecCommand(command).exec(this.client);
|
|
782
|
+
return result;
|
|
783
|
+
}
|
|
784
|
+
async addAlias({ alias }) {
|
|
785
|
+
const command = ["SEARCH.ALIASADD", alias, this.name];
|
|
786
|
+
const result = await new ExecCommand(command).exec(this.client);
|
|
787
|
+
return result;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
async function createIndex(client, params) {
|
|
791
|
+
const { name, schema } = params;
|
|
792
|
+
const createIndexCommand = buildCreateIndexCommand(params);
|
|
793
|
+
await new ExecCommand(createIndexCommand).exec(client);
|
|
794
|
+
return initIndex(client, { name, schema });
|
|
795
|
+
}
|
|
796
|
+
function initIndex(client, params) {
|
|
797
|
+
const { name, schema } = params;
|
|
798
|
+
return new SearchIndex({ name, schema, client });
|
|
799
|
+
}
|
|
800
|
+
async function listAliases(client) {
|
|
801
|
+
const command = ["SEARCH.LISTALIASES"];
|
|
802
|
+
const rawResult = await new ExecCommand(command).exec(client);
|
|
803
|
+
if (rawResult === 0 || Array.isArray(rawResult) && rawResult.length === 0) {
|
|
804
|
+
return {};
|
|
805
|
+
}
|
|
806
|
+
if (!Array.isArray(rawResult)) {
|
|
807
|
+
return {};
|
|
808
|
+
}
|
|
809
|
+
const aliases = {};
|
|
810
|
+
for (const pair of rawResult) {
|
|
811
|
+
if (Array.isArray(pair) && pair.length === 2) {
|
|
812
|
+
const [alias, index] = pair;
|
|
813
|
+
aliases[alias] = index;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return aliases;
|
|
817
|
+
}
|
|
818
|
+
async function addAlias(client, { indexName, alias }) {
|
|
819
|
+
const command = ["SEARCH.ALIASADD", alias, indexName];
|
|
820
|
+
const result = await new ExecCommand(command).exec(client);
|
|
821
|
+
return result;
|
|
822
|
+
}
|
|
823
|
+
async function delAlias(client, { alias }) {
|
|
824
|
+
const command = ["SEARCH.ALIASDEL", alias];
|
|
825
|
+
const result = await new ExecCommand(command).exec(client);
|
|
826
|
+
return result;
|
|
827
|
+
}
|
|
828
|
+
|
|
394
829
|
// pkg/commands/hrandfield.ts
|
|
395
830
|
function deserialize(result) {
|
|
396
831
|
if (result.length === 0) {
|
|
@@ -491,6 +926,13 @@ var BitPosCommand = class extends Command {
|
|
|
491
926
|
}
|
|
492
927
|
};
|
|
493
928
|
|
|
929
|
+
// pkg/commands/client_setinfo.ts
|
|
930
|
+
var ClientSetInfoCommand = class extends Command {
|
|
931
|
+
constructor([attribute, value], opts) {
|
|
932
|
+
super(["CLIENT", "SETINFO", attribute.toUpperCase(), value], opts);
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
|
|
494
936
|
// pkg/commands/copy.ts
|
|
495
937
|
var CopyCommand = class extends Command {
|
|
496
938
|
constructor([key, destinationKey, opts], commandOptions) {
|
|
@@ -569,14 +1011,6 @@ var EvalshaCommand = class extends Command {
|
|
|
569
1011
|
}
|
|
570
1012
|
};
|
|
571
1013
|
|
|
572
|
-
// pkg/commands/exec.ts
|
|
573
|
-
var ExecCommand = class extends Command {
|
|
574
|
-
constructor(cmd, opts) {
|
|
575
|
-
const normalizedCmd = cmd.map((arg) => typeof arg === "string" ? arg : String(arg));
|
|
576
|
-
super(normalizedCmd, opts);
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
|
|
580
1014
|
// pkg/commands/exists.ts
|
|
581
1015
|
var ExistsCommand = class extends Command {
|
|
582
1016
|
constructor(cmd, opts) {
|
|
@@ -1088,6 +1522,63 @@ var HGetAllCommand = class extends Command {
|
|
|
1088
1522
|
}
|
|
1089
1523
|
};
|
|
1090
1524
|
|
|
1525
|
+
// pkg/commands/hmget.ts
|
|
1526
|
+
function deserialize5(fields, result) {
|
|
1527
|
+
if (result.every((field) => field === null)) {
|
|
1528
|
+
return null;
|
|
1529
|
+
}
|
|
1530
|
+
const obj = {};
|
|
1531
|
+
for (const [i, field] of fields.entries()) {
|
|
1532
|
+
try {
|
|
1533
|
+
obj[field] = JSON.parse(result[i]);
|
|
1534
|
+
} catch {
|
|
1535
|
+
obj[field] = result[i];
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return obj;
|
|
1539
|
+
}
|
|
1540
|
+
var HMGetCommand = class extends Command {
|
|
1541
|
+
constructor([key, ...fields], opts) {
|
|
1542
|
+
super(["hmget", key, ...fields], {
|
|
1543
|
+
deserialize: (result) => deserialize5(fields, result),
|
|
1544
|
+
...opts
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1549
|
+
// pkg/commands/hgetdel.ts
|
|
1550
|
+
var HGetDelCommand = class extends Command {
|
|
1551
|
+
constructor([key, ...fields], opts) {
|
|
1552
|
+
super(["hgetdel", key, "FIELDS", fields.length, ...fields], {
|
|
1553
|
+
deserialize: (result) => deserialize5(fields.map(String), result),
|
|
1554
|
+
...opts
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
// pkg/commands/hgetex.ts
|
|
1560
|
+
var HGetExCommand = class extends Command {
|
|
1561
|
+
constructor([key, opts, ...fields], cmdOpts) {
|
|
1562
|
+
const command = ["hgetex", key];
|
|
1563
|
+
if ("ex" in opts && typeof opts.ex === "number") {
|
|
1564
|
+
command.push("EX", opts.ex);
|
|
1565
|
+
} else if ("px" in opts && typeof opts.px === "number") {
|
|
1566
|
+
command.push("PX", opts.px);
|
|
1567
|
+
} else if ("exat" in opts && typeof opts.exat === "number") {
|
|
1568
|
+
command.push("EXAT", opts.exat);
|
|
1569
|
+
} else if ("pxat" in opts && typeof opts.pxat === "number") {
|
|
1570
|
+
command.push("PXAT", opts.pxat);
|
|
1571
|
+
} else if ("persist" in opts && opts.persist) {
|
|
1572
|
+
command.push("PERSIST");
|
|
1573
|
+
}
|
|
1574
|
+
command.push("FIELDS", fields.length, ...fields);
|
|
1575
|
+
super(command, {
|
|
1576
|
+
deserialize: (result) => deserialize5(fields.map(String), result),
|
|
1577
|
+
...cmdOpts
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
|
|
1091
1582
|
// pkg/commands/hincrby.ts
|
|
1092
1583
|
var HIncrByCommand = class extends Command {
|
|
1093
1584
|
constructor(cmd, opts) {
|
|
@@ -1116,30 +1607,6 @@ var HLenCommand = class extends Command {
|
|
|
1116
1607
|
}
|
|
1117
1608
|
};
|
|
1118
1609
|
|
|
1119
|
-
// pkg/commands/hmget.ts
|
|
1120
|
-
function deserialize5(fields, result) {
|
|
1121
|
-
if (result.every((field) => field === null)) {
|
|
1122
|
-
return null;
|
|
1123
|
-
}
|
|
1124
|
-
const obj = {};
|
|
1125
|
-
for (const [i, field] of fields.entries()) {
|
|
1126
|
-
try {
|
|
1127
|
-
obj[field] = JSON.parse(result[i]);
|
|
1128
|
-
} catch {
|
|
1129
|
-
obj[field] = result[i];
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
return obj;
|
|
1133
|
-
}
|
|
1134
|
-
var HMGetCommand = class extends Command {
|
|
1135
|
-
constructor([key, ...fields], opts) {
|
|
1136
|
-
super(["hmget", key, ...fields], {
|
|
1137
|
-
deserialize: (result) => deserialize5(fields, result),
|
|
1138
|
-
...opts
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
1610
|
// pkg/commands/hmset.ts
|
|
1144
1611
|
var HMSetCommand = class extends Command {
|
|
1145
1612
|
constructor([key, kv], opts) {
|
|
@@ -1171,6 +1638,35 @@ var HSetCommand = class extends Command {
|
|
|
1171
1638
|
}
|
|
1172
1639
|
};
|
|
1173
1640
|
|
|
1641
|
+
// pkg/commands/hsetex.ts
|
|
1642
|
+
var HSetExCommand = class extends Command {
|
|
1643
|
+
constructor([key, opts, kv], cmdOpts) {
|
|
1644
|
+
const command = ["hsetex", key];
|
|
1645
|
+
if (opts.conditional) {
|
|
1646
|
+
command.push(opts.conditional.toUpperCase());
|
|
1647
|
+
}
|
|
1648
|
+
if (opts.expiration) {
|
|
1649
|
+
if ("ex" in opts.expiration && typeof opts.expiration.ex === "number") {
|
|
1650
|
+
command.push("EX", opts.expiration.ex);
|
|
1651
|
+
} else if ("px" in opts.expiration && typeof opts.expiration.px === "number") {
|
|
1652
|
+
command.push("PX", opts.expiration.px);
|
|
1653
|
+
} else if ("exat" in opts.expiration && typeof opts.expiration.exat === "number") {
|
|
1654
|
+
command.push("EXAT", opts.expiration.exat);
|
|
1655
|
+
} else if ("pxat" in opts.expiration && typeof opts.expiration.pxat === "number") {
|
|
1656
|
+
command.push("PXAT", opts.expiration.pxat);
|
|
1657
|
+
} else if ("keepttl" in opts.expiration && opts.expiration.keepttl) {
|
|
1658
|
+
command.push("KEEPTTL");
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
const entries = Object.entries(kv);
|
|
1662
|
+
command.push("FIELDS", entries.length);
|
|
1663
|
+
for (const [field, value] of entries) {
|
|
1664
|
+
command.push(field, value);
|
|
1665
|
+
}
|
|
1666
|
+
super(command, cmdOpts);
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1174
1670
|
// pkg/commands/hsetnx.ts
|
|
1175
1671
|
var HSetNXCommand = class extends Command {
|
|
1176
1672
|
constructor(cmd, opts) {
|
|
@@ -1809,6 +2305,18 @@ var SInterCommand = class extends Command {
|
|
|
1809
2305
|
}
|
|
1810
2306
|
};
|
|
1811
2307
|
|
|
2308
|
+
// pkg/commands/sintercard.ts
|
|
2309
|
+
var SInterCardCommand = class extends Command {
|
|
2310
|
+
constructor(cmd, cmdOpts) {
|
|
2311
|
+
const [keys, opts] = cmd;
|
|
2312
|
+
const command = ["sintercard", keys.length, ...keys];
|
|
2313
|
+
if (opts?.limit !== void 0) {
|
|
2314
|
+
command.push("LIMIT", opts.limit);
|
|
2315
|
+
}
|
|
2316
|
+
super(command, cmdOpts);
|
|
2317
|
+
}
|
|
2318
|
+
};
|
|
2319
|
+
|
|
1812
2320
|
// pkg/commands/sinterstore.ts
|
|
1813
2321
|
var SInterStoreCommand = class extends Command {
|
|
1814
2322
|
constructor(cmd, opts) {
|
|
@@ -1954,6 +2462,15 @@ var XAckCommand = class extends Command {
|
|
|
1954
2462
|
}
|
|
1955
2463
|
};
|
|
1956
2464
|
|
|
2465
|
+
// pkg/commands/xackdel.ts
|
|
2466
|
+
var XAckDelCommand = class extends Command {
|
|
2467
|
+
constructor([key, group, opts, ...ids], cmdOpts) {
|
|
2468
|
+
const command = ["XACKDEL", key, group];
|
|
2469
|
+
command.push(opts.toUpperCase(), "IDS", ids.length, ...ids);
|
|
2470
|
+
super(command, cmdOpts);
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
|
|
1957
2474
|
// pkg/commands/xadd.ts
|
|
1958
2475
|
var XAddCommand = class extends Command {
|
|
1959
2476
|
constructor([key, id, entries, opts], commandOptions) {
|
|
@@ -2026,6 +2543,18 @@ var XDelCommand = class extends Command {
|
|
|
2026
2543
|
}
|
|
2027
2544
|
};
|
|
2028
2545
|
|
|
2546
|
+
// pkg/commands/xdelex.ts
|
|
2547
|
+
var XDelExCommand = class extends Command {
|
|
2548
|
+
constructor([key, opts, ...ids], cmdOpts) {
|
|
2549
|
+
const command = ["XDELEX", key];
|
|
2550
|
+
if (opts) {
|
|
2551
|
+
command.push(opts.toUpperCase());
|
|
2552
|
+
}
|
|
2553
|
+
command.push("IDS", ids.length, ...ids);
|
|
2554
|
+
super(command, cmdOpts);
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2029
2558
|
// pkg/commands/xgroup.ts
|
|
2030
2559
|
var XGroupCommand = class extends Command {
|
|
2031
2560
|
constructor([key, opts], commandOptions) {
|
|
@@ -2590,6 +3119,10 @@ var Pipeline = class {
|
|
|
2590
3119
|
* @see https://redis.io/commands/bitpos
|
|
2591
3120
|
*/
|
|
2592
3121
|
bitpos = (...args) => this.chain(new BitPosCommand(args, this.commandOptions));
|
|
3122
|
+
/**
|
|
3123
|
+
* @see https://redis.io/commands/client-setinfo
|
|
3124
|
+
*/
|
|
3125
|
+
clientSetinfo = (...args) => this.chain(new ClientSetInfoCommand(args, this.commandOptions));
|
|
2593
3126
|
/**
|
|
2594
3127
|
* @see https://redis.io/commands/copy
|
|
2595
3128
|
*/
|
|
@@ -2754,6 +3287,14 @@ var Pipeline = class {
|
|
|
2754
3287
|
* @see https://redis.io/commands/hgetall
|
|
2755
3288
|
*/
|
|
2756
3289
|
hgetall = (...args) => this.chain(new HGetAllCommand(args, this.commandOptions));
|
|
3290
|
+
/**
|
|
3291
|
+
* @see https://redis.io/commands/hgetdel
|
|
3292
|
+
*/
|
|
3293
|
+
hgetdel = (...args) => this.chain(new HGetDelCommand(args, this.commandOptions));
|
|
3294
|
+
/**
|
|
3295
|
+
* @see https://redis.io/commands/hgetex
|
|
3296
|
+
*/
|
|
3297
|
+
hgetex = (...args) => this.chain(new HGetExCommand(args, this.commandOptions));
|
|
2757
3298
|
/**
|
|
2758
3299
|
* @see https://redis.io/commands/hincrby
|
|
2759
3300
|
*/
|
|
@@ -2790,6 +3331,10 @@ var Pipeline = class {
|
|
|
2790
3331
|
* @see https://redis.io/commands/hset
|
|
2791
3332
|
*/
|
|
2792
3333
|
hset = (key, kv) => this.chain(new HSetCommand([key, kv], this.commandOptions));
|
|
3334
|
+
/**
|
|
3335
|
+
* @see https://redis.io/commands/hsetex
|
|
3336
|
+
*/
|
|
3337
|
+
hsetex = (...args) => this.chain(new HSetExCommand(args, this.commandOptions));
|
|
2793
3338
|
/**
|
|
2794
3339
|
* @see https://redis.io/commands/hsetnx
|
|
2795
3340
|
*/
|
|
@@ -3002,6 +3547,10 @@ var Pipeline = class {
|
|
|
3002
3547
|
* @see https://redis.io/commands/sinter
|
|
3003
3548
|
*/
|
|
3004
3549
|
sinter = (...args) => this.chain(new SInterCommand(args, this.commandOptions));
|
|
3550
|
+
/**
|
|
3551
|
+
* @see https://redis.io/commands/sintercard
|
|
3552
|
+
*/
|
|
3553
|
+
sintercard = (...args) => this.chain(new SInterCardCommand(args, this.commandOptions));
|
|
3005
3554
|
/**
|
|
3006
3555
|
* @see https://redis.io/commands/sinterstore
|
|
3007
3556
|
*/
|
|
@@ -3094,10 +3643,18 @@ var Pipeline = class {
|
|
|
3094
3643
|
* @see https://redis.io/commands/xack
|
|
3095
3644
|
*/
|
|
3096
3645
|
xack = (...args) => this.chain(new XAckCommand(args, this.commandOptions));
|
|
3646
|
+
/**
|
|
3647
|
+
* @see https://redis.io/commands/xackdel
|
|
3648
|
+
*/
|
|
3649
|
+
xackdel = (...args) => this.chain(new XAckDelCommand(args, this.commandOptions));
|
|
3097
3650
|
/**
|
|
3098
3651
|
* @see https://redis.io/commands/xdel
|
|
3099
3652
|
*/
|
|
3100
3653
|
xdel = (...args) => this.chain(new XDelCommand(args, this.commandOptions));
|
|
3654
|
+
/**
|
|
3655
|
+
* @see https://redis.io/commands/xdelex
|
|
3656
|
+
*/
|
|
3657
|
+
xdelex = (...args) => this.chain(new XDelExCommand(args, this.commandOptions));
|
|
3101
3658
|
/**
|
|
3102
3659
|
* @see https://redis.io/commands/xgroup
|
|
3103
3660
|
*/
|
|
@@ -3646,6 +4203,7 @@ var Script = class {
|
|
|
3646
4203
|
* future major release.
|
|
3647
4204
|
*/
|
|
3648
4205
|
sha1;
|
|
4206
|
+
initPromise;
|
|
3649
4207
|
redis;
|
|
3650
4208
|
constructor(redis, script) {
|
|
3651
4209
|
this.redis = redis;
|
|
@@ -3656,9 +4214,13 @@ var Script = class {
|
|
|
3656
4214
|
/**
|
|
3657
4215
|
* Initialize the script by computing its SHA-1 hash.
|
|
3658
4216
|
*/
|
|
3659
|
-
|
|
3660
|
-
if (this.
|
|
3661
|
-
|
|
4217
|
+
init(script) {
|
|
4218
|
+
if (!this.initPromise) {
|
|
4219
|
+
this.initPromise = this.digest(script).then((sha1) => {
|
|
4220
|
+
this.sha1 = sha1;
|
|
4221
|
+
});
|
|
4222
|
+
}
|
|
4223
|
+
return this.initPromise;
|
|
3662
4224
|
}
|
|
3663
4225
|
/**
|
|
3664
4226
|
* Send an `EVAL` command to redis.
|
|
@@ -3710,6 +4272,7 @@ var ScriptRO = class {
|
|
|
3710
4272
|
* future major release.
|
|
3711
4273
|
*/
|
|
3712
4274
|
sha1;
|
|
4275
|
+
initPromise;
|
|
3713
4276
|
redis;
|
|
3714
4277
|
constructor(redis, script) {
|
|
3715
4278
|
this.redis = redis;
|
|
@@ -3717,9 +4280,13 @@ var ScriptRO = class {
|
|
|
3717
4280
|
this.script = script;
|
|
3718
4281
|
void this.init(script);
|
|
3719
4282
|
}
|
|
3720
|
-
|
|
3721
|
-
if (this.
|
|
3722
|
-
|
|
4283
|
+
init(script) {
|
|
4284
|
+
if (!this.initPromise) {
|
|
4285
|
+
this.initPromise = this.digest(script).then((sha1) => {
|
|
4286
|
+
this.sha1 = sha1;
|
|
4287
|
+
});
|
|
4288
|
+
}
|
|
4289
|
+
return this.initPromise;
|
|
3723
4290
|
}
|
|
3724
4291
|
/**
|
|
3725
4292
|
* Send an `EVAL_RO` command to redis.
|
|
@@ -3974,6 +4541,27 @@ var Redis = class {
|
|
|
3974
4541
|
createScript(script, opts) {
|
|
3975
4542
|
return opts?.readonly ? new ScriptRO(this, script) : new Script(this, script);
|
|
3976
4543
|
}
|
|
4544
|
+
get search() {
|
|
4545
|
+
return {
|
|
4546
|
+
createIndex: (params) => {
|
|
4547
|
+
return createIndex(this.client, params);
|
|
4548
|
+
},
|
|
4549
|
+
index: (params) => {
|
|
4550
|
+
return initIndex(this.client, params);
|
|
4551
|
+
},
|
|
4552
|
+
alias: {
|
|
4553
|
+
list: () => {
|
|
4554
|
+
return listAliases(this.client);
|
|
4555
|
+
},
|
|
4556
|
+
add: ({ indexName, alias }) => {
|
|
4557
|
+
return addAlias(this.client, { indexName, alias });
|
|
4558
|
+
},
|
|
4559
|
+
delete: ({ alias }) => {
|
|
4560
|
+
return delAlias(this.client, { alias });
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
};
|
|
4564
|
+
}
|
|
3977
4565
|
/**
|
|
3978
4566
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
3979
4567
|
*
|
|
@@ -4035,6 +4623,10 @@ var Redis = class {
|
|
|
4035
4623
|
* @see https://redis.io/commands/bitpos
|
|
4036
4624
|
*/
|
|
4037
4625
|
bitpos = (...args) => new BitPosCommand(args, this.opts).exec(this.client);
|
|
4626
|
+
/**
|
|
4627
|
+
* @see https://redis.io/commands/client-setinfo
|
|
4628
|
+
*/
|
|
4629
|
+
clientSetinfo = (...args) => new ClientSetInfoCommand(args, this.opts).exec(this.client);
|
|
4038
4630
|
/**
|
|
4039
4631
|
* @see https://redis.io/commands/copy
|
|
4040
4632
|
*/
|
|
@@ -4199,6 +4791,14 @@ var Redis = class {
|
|
|
4199
4791
|
* @see https://redis.io/commands/hgetall
|
|
4200
4792
|
*/
|
|
4201
4793
|
hgetall = (...args) => new HGetAllCommand(args, this.opts).exec(this.client);
|
|
4794
|
+
/**
|
|
4795
|
+
* @see https://redis.io/commands/hgetdel
|
|
4796
|
+
*/
|
|
4797
|
+
hgetdel = (...args) => new HGetDelCommand(args, this.opts).exec(this.client);
|
|
4798
|
+
/**
|
|
4799
|
+
* @see https://redis.io/commands/hgetex
|
|
4800
|
+
*/
|
|
4801
|
+
hgetex = (...args) => new HGetExCommand(args, this.opts).exec(this.client);
|
|
4202
4802
|
/**
|
|
4203
4803
|
* @see https://redis.io/commands/hincrby
|
|
4204
4804
|
*/
|
|
@@ -4235,6 +4835,10 @@ var Redis = class {
|
|
|
4235
4835
|
* @see https://redis.io/commands/hset
|
|
4236
4836
|
*/
|
|
4237
4837
|
hset = (key, kv) => new HSetCommand([key, kv], this.opts).exec(this.client);
|
|
4838
|
+
/**
|
|
4839
|
+
* @see https://redis.io/commands/hsetex
|
|
4840
|
+
*/
|
|
4841
|
+
hsetex = (...args) => new HSetExCommand(args, this.opts).exec(this.client);
|
|
4238
4842
|
/**
|
|
4239
4843
|
* @see https://redis.io/commands/hsetnx
|
|
4240
4844
|
*/
|
|
@@ -4453,6 +5057,10 @@ var Redis = class {
|
|
|
4453
5057
|
* @see https://redis.io/commands/sinter
|
|
4454
5058
|
*/
|
|
4455
5059
|
sinter = (...args) => new SInterCommand(args, this.opts).exec(this.client);
|
|
5060
|
+
/**
|
|
5061
|
+
* @see https://redis.io/commands/sintercard
|
|
5062
|
+
*/
|
|
5063
|
+
sintercard = (...args) => new SInterCardCommand(args, this.opts).exec(this.client);
|
|
4456
5064
|
/**
|
|
4457
5065
|
* @see https://redis.io/commands/sinterstore
|
|
4458
5066
|
*/
|
|
@@ -4536,10 +5144,18 @@ var Redis = class {
|
|
|
4536
5144
|
* @see https://redis.io/commands/xack
|
|
4537
5145
|
*/
|
|
4538
5146
|
xack = (...args) => new XAckCommand(args, this.opts).exec(this.client);
|
|
5147
|
+
/**
|
|
5148
|
+
* @see https://redis.io/commands/xackdel
|
|
5149
|
+
*/
|
|
5150
|
+
xackdel = (...args) => new XAckDelCommand(args, this.opts).exec(this.client);
|
|
4539
5151
|
/**
|
|
4540
5152
|
* @see https://redis.io/commands/xdel
|
|
4541
5153
|
*/
|
|
4542
5154
|
xdel = (...args) => new XDelCommand(args, this.opts).exec(this.client);
|
|
5155
|
+
/**
|
|
5156
|
+
* @see https://redis.io/commands/xdelex
|
|
5157
|
+
*/
|
|
5158
|
+
xdelex = (...args) => new XDelExCommand(args, this.opts).exec(this.client);
|
|
4543
5159
|
/**
|
|
4544
5160
|
* @see https://redis.io/commands/xgroup
|
|
4545
5161
|
*/
|
|
@@ -4681,6 +5297,6 @@ var Redis = class {
|
|
|
4681
5297
|
};
|
|
4682
5298
|
|
|
4683
5299
|
// version.ts
|
|
4684
|
-
var VERSION = "v1.
|
|
5300
|
+
var VERSION = "v1.30.2";
|
|
4685
5301
|
|
|
4686
|
-
export { HttpClient, Redis, VERSION, error_exports };
|
|
5302
|
+
export { HttpClient, Redis, SearchIndex, VERSION, error_exports };
|