@upstash/redis 0.0.0-ci.babdc47f97e036e2863dfed16300cda2b97bf6ad-20240322001434 → 0.0.0-ci.bb93ac2803c2e927dc8bf1a1b3c5aa2a14034eb6-20240930061920
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/.env.example +2 -0
- package/.github/workflows/release.yml +53 -0
- package/.github/workflows/tests.yaml +609 -0
- package/.gitignore +175 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +2 -0
- package/.husky/pre-push +1 -0
- package/.prettierignore +1 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +20 -0
- package/README.md +1 -2
- package/bun.lockb +0 -0
- package/commitlint.config.js +46 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +136 -0
- package/dist/chunk-TEVCO3ZO.mjs +3797 -0
- package/dist/cloudflare.d.mts +55 -0
- package/dist/cloudflare.d.ts +55 -0
- package/dist/cloudflare.js +3907 -0
- package/dist/cloudflare.mjs +91 -0
- package/dist/fastly.d.mts +48 -0
- package/dist/fastly.d.ts +48 -0
- package/dist/fastly.js +3880 -0
- package/dist/fastly.mjs +64 -0
- package/dist/nodejs.d.mts +73 -0
- package/dist/nodejs.d.ts +73 -0
- package/dist/nodejs.js +3926 -0
- package/dist/nodejs.mjs +110 -0
- package/dist/package.json +1 -0
- package/{zmscore-5d82e632.d.ts → dist/zmscore-BhX8yEQc.d.mts} +249 -184
- package/dist/zmscore-BhX8yEQc.d.ts +3486 -0
- package/eslint.config.mjs +102 -0
- package/examples/auto-pipeline/.eslintrc.json +3 -0
- package/examples/auto-pipeline/README.md +77 -0
- package/examples/auto-pipeline/app/components/DataComponent.tsx +49 -0
- package/examples/auto-pipeline/app/data/getEvents.ts +18 -0
- package/examples/auto-pipeline/app/data/getUsers.ts +18 -0
- package/examples/auto-pipeline/app/data/redis.ts +12 -0
- package/examples/auto-pipeline/app/favicon.ico +0 -0
- package/examples/auto-pipeline/app/globals.css +0 -0
- package/examples/auto-pipeline/app/layout.tsx +22 -0
- package/examples/auto-pipeline/app/page.tsx +15 -0
- package/examples/auto-pipeline/next.config.mjs +4 -0
- package/examples/auto-pipeline/package.json +27 -0
- package/examples/auto-pipeline/postcss.config.mjs +8 -0
- package/examples/auto-pipeline/public/next.svg +1 -0
- package/examples/auto-pipeline/public/vercel.svg +1 -0
- package/examples/auto-pipeline/tailwind.config.ts +20 -0
- package/examples/auto-pipeline/tsconfig.json +26 -0
- package/examples/aws-cdk-python/README.md +36 -0
- package/examples/aws-cdk-python/cdk.json +72 -0
- package/examples/aws-cdk-python/jest.config.js +8 -0
- package/examples/aws-cdk-python/lib/api/index.py +10 -0
- package/examples/aws-cdk-python/lib/api/requirements.txt +1 -0
- package/examples/aws-cdk-python/package-lock.json +4470 -0
- package/examples/aws-cdk-python/package.json +27 -0
- package/examples/aws-cdk-python/tsconfig.json +31 -0
- package/examples/aws-cdk-typescript/README.md +36 -0
- package/examples/aws-cdk-typescript/cdk.json +72 -0
- package/examples/aws-cdk-typescript/jest.config.js +8 -0
- package/examples/aws-cdk-typescript/package-lock.json +4548 -0
- package/examples/aws-cdk-typescript/package.json +28 -0
- package/examples/aws-cdk-typescript/tsconfig.json +31 -0
- package/examples/aws-lambda/README.md +39 -0
- package/examples/aws-lambda/index.js +11 -0
- package/examples/aws-lambda/package-lock.json +27 -0
- package/examples/aws-lambda/package.json +6 -0
- package/examples/aws-sam/README.md +34 -0
- package/examples/aws-sam/__init__.py +0 -0
- package/examples/aws-sam/events/event.json +62 -0
- package/examples/aws-sam/hello_world/__init__.py +0 -0
- package/examples/aws-sam/hello_world/app.py +10 -0
- package/examples/aws-sam/hello_world/requirements.txt +2 -0
- package/examples/aws-sam/samconfig.toml +34 -0
- package/examples/aws-sam/template.yaml +52 -0
- package/examples/aws-sam/tests/__init__.py +0 -0
- package/examples/aws-sam/tests/integration/__init__.py +0 -0
- package/examples/aws-sam/tests/integration/test_api_gateway.py +45 -0
- package/examples/aws-sam/tests/requirements.txt +3 -0
- package/examples/aws-sam/tests/unit/__init__.py +0 -0
- package/examples/aws-sam/tests/unit/test_handler.py +72 -0
- package/examples/azure-functions/.funcignore +10 -0
- package/examples/azure-functions/.vscode/extensions.json +5 -0
- package/examples/azure-functions/README.md +67 -0
- package/examples/azure-functions/host.json +15 -0
- package/examples/azure-functions/package-lock.json +1019 -0
- package/examples/azure-functions/package.json +24 -0
- package/examples/azure-functions/src/functions/CounterFunction.ts +19 -0
- package/examples/azure-functions/tsconfig.json +10 -0
- package/examples/cloudflare-workers/README.md +26 -0
- package/examples/cloudflare-workers/bun.lockb +0 -0
- package/examples/cloudflare-workers/ci.test.ts +18 -0
- package/examples/cloudflare-workers/index.js +11 -0
- package/examples/cloudflare-workers/package.json +17 -0
- package/examples/cloudflare-workers/wrangler.toml +11 -0
- package/examples/cloudflare-workers-with-typescript/README.md +26 -0
- package/examples/cloudflare-workers-with-typescript/ci.test.ts +17 -0
- package/examples/cloudflare-workers-with-typescript/package.json +17 -0
- package/examples/cloudflare-workers-with-typescript/src/index.ts +16 -0
- package/examples/cloudflare-workers-with-typescript/tsconfig.json +105 -0
- package/examples/cloudflare-workers-with-typescript/wrangler.toml +9 -0
- package/examples/deno/main.test.ts +16 -0
- package/examples/deno/main.ts +9 -0
- package/examples/fastapi/README.md +23 -0
- package/examples/fastapi/main.py +12 -0
- package/examples/fastapi/requirements.txt +2 -0
- package/examples/fastly/README.md +7 -0
- package/examples/fastly/fastly.toml +12 -0
- package/examples/fastly/package.json +23 -0
- package/examples/fastly/src/index.js +19 -0
- package/examples/fastly/webpack.config.js +28 -0
- package/examples/google-cloud-functions/README.md +37 -0
- package/examples/google-cloud-functions/index.js +12 -0
- package/examples/google-cloud-functions/package.json +7 -0
- package/examples/ion/.env.example +2 -0
- package/examples/ion/.eslintrc.json +3 -0
- package/examples/ion/README.md +49 -0
- package/examples/ion/app/favicon.ico +0 -0
- package/examples/ion/app/globals.css +33 -0
- package/examples/ion/app/layout.tsx +22 -0
- package/examples/ion/app/page.tsx +12 -0
- package/examples/ion/next.config.mjs +4 -0
- package/examples/ion/package-lock.json +6709 -0
- package/examples/ion/package.json +28 -0
- package/examples/ion/postcss.config.mjs +8 -0
- package/examples/ion/public/next.svg +1 -0
- package/examples/ion/public/vercel.svg +1 -0
- package/examples/ion/sst-env.d.ts +12 -0
- package/examples/ion/sst.config.ts +19 -0
- package/examples/ion/tailwind.config.ts +20 -0
- package/examples/ion/tsconfig.json +26 -0
- package/examples/nextjs-app-router/.env.example +2 -0
- package/examples/nextjs-app-router/.eslintrc.json +3 -0
- package/examples/nextjs-app-router/README.md +26 -0
- package/examples/nextjs-app-router/app/globals.css +3 -0
- package/examples/nextjs-app-router/app/layout.tsx +22 -0
- package/examples/nextjs-app-router/app/page.tsx +12 -0
- package/examples/nextjs-app-router/next.config.mjs +4 -0
- package/examples/nextjs-app-router/package.json +27 -0
- package/examples/nextjs-app-router/postcss.config.mjs +8 -0
- package/examples/nextjs-app-router/tailwind.config.ts +20 -0
- package/examples/nextjs-app-router/tsconfig.json +26 -0
- package/examples/nextjs-pages-router/.env.example +2 -0
- package/examples/nextjs-pages-router/.eslintrc.json +3 -0
- package/examples/nextjs-pages-router/README.md +26 -0
- package/examples/nextjs-pages-router/next.config.mjs +6 -0
- package/examples/nextjs-pages-router/package.json +27 -0
- package/examples/nextjs-pages-router/pages/_app.tsx +6 -0
- package/examples/nextjs-pages-router/pages/_document.tsx +13 -0
- package/examples/nextjs-pages-router/pages/api/hello.ts +13 -0
- package/examples/nextjs-pages-router/pages/index.tsx +19 -0
- package/examples/nextjs-pages-router/postcss.config.mjs +8 -0
- package/examples/nextjs-pages-router/styles/globals.css +3 -0
- package/examples/nextjs-pages-router/tailwind.config.ts +20 -0
- package/examples/nextjs-pages-router/tsconfig.json +21 -0
- package/examples/nodejs/.env.example +2 -0
- package/examples/nodejs/README.md +24 -0
- package/examples/nodejs/index.js +10 -0
- package/examples/nodejs/package.json +10 -0
- package/examples/serverless-framework/counter/.env.example +2 -0
- package/examples/serverless-framework/counter/README.md +38 -0
- package/examples/serverless-framework/counter/handler.js +12 -0
- package/examples/serverless-framework/counter/package-lock.json +27 -0
- package/examples/serverless-framework/counter/package.json +6 -0
- package/examples/serverless-framework/counter/serverless.yml +16 -0
- package/examples/sst-v2/.vscode/launch.json +15 -0
- package/examples/sst-v2/.vscode/settings.json +5 -0
- package/examples/sst-v2/README.md +62 -0
- package/examples/sst-v2/package.json +27 -0
- package/examples/sst-v2/packages/core/package.json +14 -0
- package/examples/sst-v2/packages/core/sst-env.d.ts +1 -0
- package/examples/sst-v2/packages/core/tsconfig.json +7 -0
- package/examples/sst-v2/packages/functions/package.json +15 -0
- package/examples/sst-v2/packages/functions/sst-env.d.ts +1 -0
- package/examples/sst-v2/packages/functions/tsconfig.json +11 -0
- package/examples/sst-v2/packages/web/README.md +40 -0
- package/examples/sst-v2/packages/web/next.config.mjs +6 -0
- package/examples/sst-v2/packages/web/package.json +23 -0
- package/examples/sst-v2/packages/web/pages/_app.tsx +6 -0
- package/examples/sst-v2/packages/web/pages/_document.tsx +13 -0
- package/examples/sst-v2/packages/web/pages/api/hello.ts +16 -0
- package/examples/sst-v2/packages/web/pages/index.tsx +114 -0
- package/examples/sst-v2/packages/web/public/favicon.ico +0 -0
- package/examples/sst-v2/packages/web/public/next.svg +1 -0
- package/examples/sst-v2/packages/web/public/vercel.svg +1 -0
- package/examples/sst-v2/packages/web/sst-env.d.ts +1 -0
- package/examples/sst-v2/packages/web/styles/Home.module.css +229 -0
- package/examples/sst-v2/packages/web/styles/globals.css +107 -0
- package/examples/sst-v2/packages/web/tsconfig.json +36 -0
- package/examples/sst-v2/pnpm-workspace.yaml +2 -0
- package/examples/sst-v2/sst.config.ts +14 -0
- package/examples/sst-v2/stacks/Default.ts +13 -0
- package/examples/sst-v2/tsconfig.json +8 -0
- package/examples/terraform/README.md +38 -0
- package/examples/terraform/counter/counter.js +11 -0
- package/examples/terraform/counter/package.json +6 -0
- package/examples/terraform/main.tf +166 -0
- package/examples/terraform/outputs.tf +17 -0
- package/examples/terraform/terraform.tf +18 -0
- package/examples/terraform/variables.tf +6 -0
- package/examples/vercel-functions-app-router/.env.example +2 -0
- package/examples/vercel-functions-app-router/.eslintrc.json +3 -0
- package/examples/vercel-functions-app-router/README.md +26 -0
- package/examples/vercel-functions-app-router/app/api/hello/route.ts +11 -0
- package/examples/vercel-functions-app-router/app/globals.css +3 -0
- package/examples/vercel-functions-app-router/app/layout.tsx +22 -0
- package/examples/vercel-functions-app-router/ci.test.ts +14 -0
- package/examples/vercel-functions-app-router/next.config.mjs +4 -0
- package/examples/vercel-functions-app-router/package.json +27 -0
- package/examples/vercel-functions-app-router/postcss.config.mjs +8 -0
- package/examples/vercel-functions-app-router/tailwind.config.ts +20 -0
- package/examples/vercel-functions-app-router/tsconfig.json +26 -0
- package/examples/vercel-functions-pages-router/.env.example +2 -0
- package/examples/vercel-functions-pages-router/.eslintrc.json +3 -0
- package/examples/vercel-functions-pages-router/README.md +26 -0
- package/examples/vercel-functions-pages-router/ci.test.ts +14 -0
- package/examples/vercel-functions-pages-router/next.config.mjs +6 -0
- package/examples/vercel-functions-pages-router/package.json +27 -0
- package/examples/vercel-functions-pages-router/pages/_app.tsx +6 -0
- package/examples/vercel-functions-pages-router/pages/_document.tsx +13 -0
- package/examples/vercel-functions-pages-router/pages/api/hello.ts +12 -0
- package/examples/vercel-functions-pages-router/postcss.config.mjs +8 -0
- package/examples/vercel-functions-pages-router/styles/globals.css +3 -0
- package/examples/vercel-functions-pages-router/tailwind.config.ts +20 -0
- package/examples/vercel-functions-pages-router/tsconfig.json +21 -0
- package/examples/vercel-python-runtime-django/.env.example +2 -0
- package/examples/vercel-python-runtime-django/README.md +34 -0
- package/examples/vercel-python-runtime-django/api/__init__.py +0 -0
- package/examples/vercel-python-runtime-django/api/asgi.py +16 -0
- package/examples/vercel-python-runtime-django/api/settings.py +121 -0
- package/examples/vercel-python-runtime-django/api/urls.py +22 -0
- package/examples/vercel-python-runtime-django/api/wsgi.py +16 -0
- package/examples/vercel-python-runtime-django/example/__init__.py +0 -0
- package/examples/vercel-python-runtime-django/example/admin.py +3 -0
- package/examples/vercel-python-runtime-django/example/apps.py +6 -0
- package/examples/vercel-python-runtime-django/example/urls.py +9 -0
- package/examples/vercel-python-runtime-django/example/views.py +18 -0
- package/examples/vercel-python-runtime-django/manage.py +22 -0
- package/examples/vercel-python-runtime-django/package.json +5 -0
- package/examples/vercel-python-runtime-django/requirements.txt +2 -0
- package/examples/vercel-python-runtime-django/vercel.json +8 -0
- package/examples/with-sentry/index.ts +36 -0
- package/examples/with-sentry/package.json +17 -0
- package/package.json +1 -1
- package/pkg/auto-pipeline.test.ts +321 -0
- package/pkg/auto-pipeline.ts +107 -0
- package/pkg/commands/append.test.ts +28 -0
- package/pkg/commands/append.ts +11 -0
- package/pkg/commands/bitcount.test.ts +37 -0
- package/pkg/commands/bitcount.ts +29 -0
- package/pkg/commands/bitfield.test.ts +51 -0
- package/pkg/commands/bitfield.ts +50 -0
- package/pkg/commands/bitop.test.ts +45 -0
- package/pkg/commands/bitop.ts +22 -0
- package/pkg/commands/bitpos.test.ts +47 -0
- package/pkg/commands/bitpos.ts +14 -0
- package/pkg/commands/command.test.ts +22 -0
- package/pkg/commands/command.ts +98 -0
- package/pkg/commands/copy.test.ts +65 -0
- package/pkg/commands/copy.ts +22 -0
- package/pkg/commands/dbsize.test.ts +18 -0
- package/pkg/commands/dbsize.ts +11 -0
- package/pkg/commands/decr.test.ts +23 -0
- package/pkg/commands/decr.ts +11 -0
- package/pkg/commands/decrby.test.ts +24 -0
- package/pkg/commands/decrby.ts +11 -0
- package/pkg/commands/del.test.ts +38 -0
- package/pkg/commands/del.ts +11 -0
- package/pkg/commands/echo.test.ts +11 -0
- package/pkg/commands/echo.ts +11 -0
- package/pkg/commands/eval.test.ts +30 -0
- package/pkg/commands/eval.ts +14 -0
- package/pkg/commands/evalsha.test.ts +19 -0
- package/pkg/commands/evalsha.ts +14 -0
- package/pkg/commands/exists.test.ts +38 -0
- package/pkg/commands/exists.ts +11 -0
- package/pkg/commands/expire.test.ts +119 -0
- package/pkg/commands/expire.ts +12 -0
- package/pkg/commands/expireat.test.ts +25 -0
- package/pkg/commands/expireat.ts +11 -0
- package/pkg/commands/flushall.test.ts +18 -0
- package/pkg/commands/flushall.ts +14 -0
- package/pkg/commands/flushdb.test.ts +17 -0
- package/pkg/commands/flushdb.ts +14 -0
- package/pkg/commands/geo_add.test.ts +202 -0
- package/pkg/commands/geo_add.ts +54 -0
- package/pkg/commands/geo_dist.test.ts +79 -0
- package/pkg/commands/geo_dist.ts +19 -0
- package/pkg/commands/geo_hash.test.ts +49 -0
- package/pkg/commands/geo_hash.ts +23 -0
- package/pkg/commands/geo_pos.test.ts +60 -0
- package/pkg/commands/geo_pos.ts +39 -0
- package/pkg/commands/geo_search.test.ts +197 -0
- package/pkg/commands/geo_search.ts +139 -0
- package/pkg/commands/geo_search_store.test.ts +153 -0
- package/pkg/commands/geo_search_store.ts +69 -0
- package/pkg/commands/get.test.ts +35 -0
- package/pkg/commands/get.ts +11 -0
- package/pkg/commands/getbit.test.ts +17 -0
- package/pkg/commands/getbit.ts +11 -0
- package/pkg/commands/getdel.test.ts +39 -0
- package/pkg/commands/getdel.ts +11 -0
- package/pkg/commands/getrange.test.ts +25 -0
- package/pkg/commands/getrange.ts +14 -0
- package/pkg/commands/getset.test.ts +33 -0
- package/pkg/commands/getset.ts +14 -0
- package/pkg/commands/hdel.test.ts +45 -0
- package/pkg/commands/hdel.ts +11 -0
- package/pkg/commands/hexists.test.ts +36 -0
- package/pkg/commands/hexists.ts +11 -0
- package/pkg/commands/hget.test.ts +52 -0
- package/pkg/commands/hget.ts +14 -0
- package/pkg/commands/hgetall.test.ts +45 -0
- package/pkg/commands/hgetall.ts +37 -0
- package/pkg/commands/hincrby.test.ts +28 -0
- package/pkg/commands/hincrby.ts +14 -0
- package/pkg/commands/hincrbyfloat.test.ts +28 -0
- package/pkg/commands/hincrbyfloat.ts +14 -0
- package/pkg/commands/hkeys.test.ts +23 -0
- package/pkg/commands/hkeys.ts +11 -0
- package/pkg/commands/hlen.test.ts +25 -0
- package/pkg/commands/hlen.ts +11 -0
- package/pkg/commands/hmget.test.ts +44 -0
- package/pkg/commands/hmget.ts +46 -0
- package/pkg/commands/hmset.test.ts +23 -0
- package/pkg/commands/hmset.ts +14 -0
- package/pkg/commands/hrandfield.test.ts +59 -0
- package/pkg/commands/hrandfield.ts +50 -0
- package/pkg/commands/hscan.test.ts +44 -0
- package/pkg/commands/hscan.ts +30 -0
- package/pkg/commands/hset.test.ts +21 -0
- package/pkg/commands/hset.ts +14 -0
- package/pkg/commands/hsetnx.test.ts +37 -0
- package/pkg/commands/hsetnx.ts +14 -0
- package/pkg/commands/hstrlen.test.ts +24 -0
- package/pkg/commands/hstrlen.ts +11 -0
- package/pkg/commands/hvals.test.ts +24 -0
- package/pkg/commands/hvals.ts +11 -0
- package/pkg/commands/incr.test.ts +24 -0
- package/pkg/commands/incr.ts +11 -0
- package/pkg/commands/incrby.test.ts +24 -0
- package/pkg/commands/incrby.ts +11 -0
- package/pkg/commands/incrbyfloat.test.ts +25 -0
- package/pkg/commands/incrbyfloat.ts +11 -0
- package/pkg/commands/json_arrappend.test.ts +40 -0
- package/pkg/commands/json_arrappend.ts +17 -0
- package/pkg/commands/json_arrindex.test.ts +54 -0
- package/pkg/commands/json_arrindex.ts +14 -0
- package/pkg/commands/json_arrinsert.test.ts +49 -0
- package/pkg/commands/json_arrinsert.ts +17 -0
- package/pkg/commands/json_arrlen.test.ts +31 -0
- package/pkg/commands/json_arrlen.ts +14 -0
- package/pkg/commands/json_arrpop.test.ts +30 -0
- package/pkg/commands/json_arrpop.ts +14 -0
- package/pkg/commands/json_arrtrim.test.ts +31 -0
- package/pkg/commands/json_arrtrim.ts +18 -0
- package/pkg/commands/json_clear.test.ts +35 -0
- package/pkg/commands/json_clear.ts +11 -0
- package/pkg/commands/json_del.test.ts +29 -0
- package/pkg/commands/json_del.ts +11 -0
- package/pkg/commands/json_forget.test.ts +29 -0
- package/pkg/commands/json_forget.ts +11 -0
- package/pkg/commands/json_get.test.ts +28 -0
- package/pkg/commands/json_get.ts +44 -0
- package/pkg/commands/json_mget.test.ts +43 -0
- package/pkg/commands/json_mget.ts +11 -0
- package/pkg/commands/json_mset.test.ts +50 -0
- package/pkg/commands/json_mset.ts +26 -0
- package/pkg/commands/json_numincrby.test.ts +28 -0
- package/pkg/commands/json_numincrby.ts +14 -0
- package/pkg/commands/json_nummultby.test.ts +28 -0
- package/pkg/commands/json_nummultby.ts +14 -0
- package/pkg/commands/json_objkeys.test.ts +32 -0
- package/pkg/commands/json_objkeys.ts +14 -0
- package/pkg/commands/json_objlen.test.ts +26 -0
- package/pkg/commands/json_objlen.ts +14 -0
- package/pkg/commands/json_resp.test.ts +31 -0
- package/pkg/commands/json_resp.ts +11 -0
- package/pkg/commands/json_set.test.ts +48 -0
- package/pkg/commands/json_set.ts +34 -0
- package/pkg/commands/json_strappend.test.ts +34 -0
- package/pkg/commands/json_strappend.ts +14 -0
- package/pkg/commands/json_strlen.test.ts +27 -0
- package/pkg/commands/json_strlen.ts +14 -0
- package/pkg/commands/json_toggle.test.ts +26 -0
- package/pkg/commands/json_toggle.ts +11 -0
- package/pkg/commands/json_type.test.ts +29 -0
- package/pkg/commands/json_type.ts +11 -0
- package/pkg/commands/keys.test.ts +18 -0
- package/pkg/commands/keys.ts +11 -0
- package/pkg/commands/lindex.test.ts +33 -0
- package/pkg/commands/lindex.ts +11 -0
- package/pkg/commands/linsert.test.ts +24 -0
- package/pkg/commands/linsert.ts +10 -0
- package/pkg/commands/llen.test.ts +27 -0
- package/pkg/commands/llen.ts +11 -0
- package/pkg/commands/lmove.test.ts +48 -0
- package/pkg/commands/lmove.ts +19 -0
- package/pkg/commands/lmpop.test.ts +86 -0
- package/pkg/commands/lmpop.ts +19 -0
- package/pkg/commands/lpop.test.ts +40 -0
- package/pkg/commands/lpop.ts +14 -0
- package/pkg/commands/lpos.test.ts +56 -0
- package/pkg/commands/lpos.ts +25 -0
- package/pkg/commands/lpush.test.ts +18 -0
- package/pkg/commands/lpush.ts +11 -0
- package/pkg/commands/lpushx.test.ts +30 -0
- package/pkg/commands/lpushx.ts +11 -0
- package/pkg/commands/lrange.test.ts +21 -0
- package/pkg/commands/lrange.ts +11 -0
- package/pkg/commands/lrem.test.ts +19 -0
- package/pkg/commands/lrem.ts +10 -0
- package/pkg/commands/lset.test.ts +43 -0
- package/pkg/commands/lset.ts +8 -0
- package/pkg/commands/ltrim.test.ts +30 -0
- package/pkg/commands/ltrim.ts +8 -0
- package/pkg/commands/mget.test.ts +44 -0
- package/pkg/commands/mget.ts +11 -0
- package/pkg/commands/mod.ts +168 -0
- package/pkg/commands/mset.test.ts +24 -0
- package/pkg/commands/mset.ts +11 -0
- package/pkg/commands/msetnx.test.ts +46 -0
- package/pkg/commands/msetnx.ts +11 -0
- package/pkg/commands/persist.test.ts +22 -0
- package/pkg/commands/persist.ts +11 -0
- package/pkg/commands/pexpire.test.ts +24 -0
- package/pkg/commands/pexpire.ts +11 -0
- package/pkg/commands/pexpireat.test.ts +31 -0
- package/pkg/commands/pexpireat.ts +11 -0
- package/pkg/commands/pfadd.test.ts +80 -0
- package/pkg/commands/pfadd.ts +11 -0
- package/pkg/commands/pfcount.test.ts +55 -0
- package/pkg/commands/pfcount.ts +11 -0
- package/pkg/commands/pfmerge.test.ts +67 -0
- package/pkg/commands/pfmerge.ts +11 -0
- package/pkg/commands/ping.test.ts +19 -0
- package/pkg/commands/ping.ts +14 -0
- package/pkg/commands/psetex.test.ts +23 -0
- package/pkg/commands/psetex.ts +14 -0
- package/pkg/commands/pttl.test.ts +18 -0
- package/pkg/commands/pttl.ts +11 -0
- package/pkg/commands/publish.test.ts +12 -0
- package/pkg/commands/publish.ts +11 -0
- package/pkg/commands/randomkey.test.ts +16 -0
- package/pkg/commands/randomkey.ts +11 -0
- package/pkg/commands/rename.test.ts +19 -0
- package/pkg/commands/rename.ts +11 -0
- package/pkg/commands/renamenx.test.ts +33 -0
- package/pkg/commands/renamenx.ts +11 -0
- package/pkg/commands/rpop.test.ts +40 -0
- package/pkg/commands/rpop.ts +17 -0
- package/pkg/commands/rpush.test.ts +17 -0
- package/pkg/commands/rpush.ts +11 -0
- package/pkg/commands/rpushx.test.ts +30 -0
- package/pkg/commands/rpushx.ts +11 -0
- package/pkg/commands/sadd.test.ts +22 -0
- package/pkg/commands/sadd.ts +14 -0
- package/pkg/commands/scan.test.ts +91 -0
- package/pkg/commands/scan.ts +33 -0
- package/pkg/commands/scard.test.ts +16 -0
- package/pkg/commands/scard.ts +10 -0
- package/pkg/commands/script_exists.test.ts +34 -0
- package/pkg/commands/script_exists.ts +14 -0
- package/pkg/commands/script_flush.ts +21 -0
- package/pkg/commands/script_load.test.ts +11 -0
- package/pkg/commands/script_load.ts +11 -0
- package/pkg/commands/sdiff.test.ts +20 -0
- package/pkg/commands/sdiff.ts +10 -0
- package/pkg/commands/sdiffstore.test.ts +22 -0
- package/pkg/commands/sdiffstore.ts +13 -0
- package/pkg/commands/set.test.ts +168 -0
- package/pkg/commands/set.ts +51 -0
- package/pkg/commands/setbit.test.ts +17 -0
- package/pkg/commands/setbit.ts +14 -0
- package/pkg/commands/setex.test.ts +22 -0
- package/pkg/commands/setex.ts +11 -0
- package/pkg/commands/setnx.test.ts +27 -0
- package/pkg/commands/setnx.ts +11 -0
- package/pkg/commands/setrange.test.ts +25 -0
- package/pkg/commands/setrange.ts +14 -0
- package/pkg/commands/sinter.test.ts +37 -0
- package/pkg/commands/sinter.ts +10 -0
- package/pkg/commands/sinterstore.test.ts +22 -0
- package/pkg/commands/sinterstore.ts +13 -0
- package/pkg/commands/sismember.test.ts +31 -0
- package/pkg/commands/sismember.ts +10 -0
- package/pkg/commands/smembers.test.ts +22 -0
- package/pkg/commands/smembers.ts +11 -0
- package/pkg/commands/smismember.test.ts +22 -0
- package/pkg/commands/smismember.ts +16 -0
- package/pkg/commands/smove.test.ts +18 -0
- package/pkg/commands/smove.ts +13 -0
- package/pkg/commands/spop.test.ts +36 -0
- package/pkg/commands/spop.ts +17 -0
- package/pkg/commands/srandmember.test.ts +31 -0
- package/pkg/commands/srandmember.ts +17 -0
- package/pkg/commands/srem.test.ts +19 -0
- package/pkg/commands/srem.ts +10 -0
- package/pkg/commands/sscan.test.ts +48 -0
- package/pkg/commands/sscan.ts +30 -0
- package/pkg/commands/strlen.test.ts +17 -0
- package/pkg/commands/strlen.ts +11 -0
- package/pkg/commands/sunion.test.ts +22 -0
- package/pkg/commands/sunion.ts +11 -0
- package/pkg/commands/sunionstore.test.ts +30 -0
- package/pkg/commands/sunionstore.ts +14 -0
- package/pkg/commands/time.test.ts +12 -0
- package/pkg/commands/time.ts +10 -0
- package/pkg/commands/touch.test.ts +21 -0
- package/pkg/commands/touch.ts +11 -0
- package/pkg/commands/ttl.test.ts +17 -0
- package/pkg/commands/ttl.ts +11 -0
- package/pkg/commands/type.test.ts +72 -0
- package/pkg/commands/type.ts +12 -0
- package/pkg/commands/types.ts +150 -0
- package/pkg/commands/unlink.test.ts +22 -0
- package/pkg/commands/unlink.ts +11 -0
- package/pkg/commands/xack.test.ts +53 -0
- package/pkg/commands/xack.ts +15 -0
- package/pkg/commands/xadd.test.ts +128 -0
- package/pkg/commands/xadd.ts +64 -0
- package/pkg/commands/xautoclaim.test.ts +105 -0
- package/pkg/commands/xautoclaim.ts +30 -0
- package/pkg/commands/xclaim.test.ts +70 -0
- package/pkg/commands/xclaim.ts +55 -0
- package/pkg/commands/xdel.test.ts +50 -0
- package/pkg/commands/xdel.ts +15 -0
- package/pkg/commands/xgroup.test.ts +202 -0
- package/pkg/commands/xgroup.ts +100 -0
- package/pkg/commands/xinfo.test.ts +82 -0
- package/pkg/commands/xinfo.ts +27 -0
- package/pkg/commands/xlen.test.ts +29 -0
- package/pkg/commands/xlen.ts +11 -0
- package/pkg/commands/xpending.test.ts +94 -0
- package/pkg/commands/xpending.ts +43 -0
- package/pkg/commands/xrange.test.ts +69 -0
- package/pkg/commands/xrange.ts +48 -0
- package/pkg/commands/xread.test.ts +117 -0
- package/pkg/commands/xread.ts +51 -0
- package/pkg/commands/xreadgroup.test.ts +166 -0
- package/pkg/commands/xreadgroup.ts +66 -0
- package/pkg/commands/xrevrange.test.ts +48 -0
- package/pkg/commands/xrevrange.ts +47 -0
- package/pkg/commands/xtrim.test.ts +65 -0
- package/pkg/commands/xtrim.ts +24 -0
- package/pkg/commands/zadd.test.ts +242 -0
- package/pkg/commands/zadd.ts +53 -0
- package/pkg/commands/zcard.test.ts +16 -0
- package/pkg/commands/zcard.ts +11 -0
- package/pkg/commands/zcount.test.ts +16 -0
- package/pkg/commands/zcount.ts +13 -0
- package/pkg/commands/zdiffstore.test.ts +42 -0
- package/pkg/commands/zdiffstore.ts +14 -0
- package/pkg/commands/zincrby.test.ts +19 -0
- package/pkg/commands/zincrby.ts +13 -0
- package/pkg/commands/zinterstore.test.ts +297 -0
- package/pkg/commands/zinterstore.ts +51 -0
- package/pkg/commands/zlexcount.test.ts +23 -0
- package/pkg/commands/zlexcount.ts +10 -0
- package/pkg/commands/zmscore.test.ts +39 -0
- package/pkg/commands/zmscore.ts +15 -0
- package/pkg/commands/zpopmax.test.ts +46 -0
- package/pkg/commands/zpopmax.ts +17 -0
- package/pkg/commands/zpopmin.test.ts +50 -0
- package/pkg/commands/zpopmin.ts +17 -0
- package/pkg/commands/zrange.test.ts +188 -0
- package/pkg/commands/zrange.ts +68 -0
- package/pkg/commands/zrank.test.ts +23 -0
- package/pkg/commands/zrank.ts +14 -0
- package/pkg/commands/zrem.test.ts +21 -0
- package/pkg/commands/zrem.ts +10 -0
- package/pkg/commands/zremrangebylex.test.ts +24 -0
- package/pkg/commands/zremrangebylex.ts +10 -0
- package/pkg/commands/zremrangebyrank.test.ts +27 -0
- package/pkg/commands/zremrangebyrank.ts +13 -0
- package/pkg/commands/zremrangebyscore.test.ts +24 -0
- package/pkg/commands/zremrangebyscore.ts +10 -0
- package/pkg/commands/zrevrank.test.ts +23 -0
- package/pkg/commands/zrevrank.ts +14 -0
- package/pkg/commands/zscan.test.ts +48 -0
- package/pkg/commands/zscan.ts +30 -0
- package/pkg/commands/zscore.test.ts +18 -0
- package/pkg/commands/zscore.ts +14 -0
- package/pkg/commands/zunion.test.ts +251 -0
- package/pkg/commands/zunion.ts +54 -0
- package/pkg/commands/zunionstore.test.ts +274 -0
- package/pkg/commands/zunionstore.ts +51 -0
- package/pkg/error.ts +18 -0
- package/pkg/http.ts +349 -0
- package/pkg/index.ts +1 -0
- package/pkg/pipeline.test.ts +254 -0
- package/pkg/pipeline.ts +1401 -0
- package/pkg/read-your-writes.test.ts +115 -0
- package/pkg/redis.test.ts +250 -0
- package/pkg/redis.ts +1367 -0
- package/pkg/script.test.ts +58 -0
- package/pkg/script.ts +67 -0
- package/pkg/test-utils.test.ts +17 -0
- package/pkg/test-utils.ts +72 -0
- package/pkg/types.ts +35 -0
- package/pkg/util.ts +42 -0
- package/platforms/cloudflare.ts +144 -0
- package/platforms/fastly.ts +100 -0
- package/platforms/nodejs.ts +196 -0
- package/prettier.config.mjs +13 -0
- package/tsconfig.json +21 -0
- package/tsup.config.ts +8 -0
- package/version.ts +1 -0
- package/chunk-JD7AT2OK.js +0 -1
- package/chunk-XCPX3L6C.mjs +0 -1
- package/cloudflare.d.mts +0 -50
- package/cloudflare.d.ts +0 -50
- package/cloudflare.js +0 -1
- package/cloudflare.mjs +0 -1
- package/fastly.d.mts +0 -43
- package/fastly.d.ts +0 -43
- package/fastly.js +0 -1
- package/fastly.mjs +0 -1
- package/nodejs.d.mts +0 -85
- package/nodejs.d.ts +0 -85
- package/nodejs.js +0 -1
- package/nodejs.mjs +0 -1
package/pkg/redis.ts
ADDED
|
@@ -0,0 +1,1367 @@
|
|
|
1
|
+
import { createAutoPipelineProxy } from "../pkg/auto-pipeline";
|
|
2
|
+
import type {
|
|
3
|
+
CommandOptions,
|
|
4
|
+
ScoreMember,
|
|
5
|
+
SetCommandOptions,
|
|
6
|
+
ZAddCommandOptions,
|
|
7
|
+
ZRangeCommandOptions,
|
|
8
|
+
} from "./commands/mod";
|
|
9
|
+
import {
|
|
10
|
+
AppendCommand,
|
|
11
|
+
BitCountCommand,
|
|
12
|
+
BitFieldCommand,
|
|
13
|
+
BitOpCommand,
|
|
14
|
+
BitPosCommand,
|
|
15
|
+
CopyCommand,
|
|
16
|
+
DBSizeCommand,
|
|
17
|
+
DecrByCommand,
|
|
18
|
+
DecrCommand,
|
|
19
|
+
DelCommand,
|
|
20
|
+
EchoCommand,
|
|
21
|
+
EvalCommand,
|
|
22
|
+
EvalshaCommand,
|
|
23
|
+
ExistsCommand,
|
|
24
|
+
ExpireAtCommand,
|
|
25
|
+
ExpireCommand,
|
|
26
|
+
FlushAllCommand,
|
|
27
|
+
FlushDBCommand,
|
|
28
|
+
GeoAddCommand,
|
|
29
|
+
GeoDistCommand,
|
|
30
|
+
GeoHashCommand,
|
|
31
|
+
GeoPosCommand,
|
|
32
|
+
GeoSearchCommand,
|
|
33
|
+
GeoSearchStoreCommand,
|
|
34
|
+
GetBitCommand,
|
|
35
|
+
GetCommand,
|
|
36
|
+
GetDelCommand,
|
|
37
|
+
GetRangeCommand,
|
|
38
|
+
GetSetCommand,
|
|
39
|
+
HDelCommand,
|
|
40
|
+
HExistsCommand,
|
|
41
|
+
HGetAllCommand,
|
|
42
|
+
HGetCommand,
|
|
43
|
+
HIncrByCommand,
|
|
44
|
+
HIncrByFloatCommand,
|
|
45
|
+
HKeysCommand,
|
|
46
|
+
HLenCommand,
|
|
47
|
+
HMGetCommand,
|
|
48
|
+
HMSetCommand,
|
|
49
|
+
HRandFieldCommand,
|
|
50
|
+
HScanCommand,
|
|
51
|
+
HSetCommand,
|
|
52
|
+
HSetNXCommand,
|
|
53
|
+
HStrLenCommand,
|
|
54
|
+
HValsCommand,
|
|
55
|
+
IncrByCommand,
|
|
56
|
+
IncrByFloatCommand,
|
|
57
|
+
IncrCommand,
|
|
58
|
+
JsonArrAppendCommand,
|
|
59
|
+
JsonArrIndexCommand,
|
|
60
|
+
JsonArrInsertCommand,
|
|
61
|
+
JsonArrLenCommand,
|
|
62
|
+
JsonArrPopCommand,
|
|
63
|
+
JsonArrTrimCommand,
|
|
64
|
+
JsonClearCommand,
|
|
65
|
+
JsonDelCommand,
|
|
66
|
+
JsonForgetCommand,
|
|
67
|
+
JsonGetCommand,
|
|
68
|
+
JsonMGetCommand,
|
|
69
|
+
JsonMSetCommand,
|
|
70
|
+
JsonNumIncrByCommand,
|
|
71
|
+
JsonNumMultByCommand,
|
|
72
|
+
JsonObjKeysCommand,
|
|
73
|
+
JsonObjLenCommand,
|
|
74
|
+
JsonRespCommand,
|
|
75
|
+
JsonSetCommand,
|
|
76
|
+
JsonStrAppendCommand,
|
|
77
|
+
JsonStrLenCommand,
|
|
78
|
+
JsonToggleCommand,
|
|
79
|
+
JsonTypeCommand,
|
|
80
|
+
KeysCommand,
|
|
81
|
+
LIndexCommand,
|
|
82
|
+
LInsertCommand,
|
|
83
|
+
LLenCommand,
|
|
84
|
+
LMoveCommand,
|
|
85
|
+
LPopCommand,
|
|
86
|
+
LPosCommand,
|
|
87
|
+
LPushCommand,
|
|
88
|
+
LPushXCommand,
|
|
89
|
+
LRangeCommand,
|
|
90
|
+
LRemCommand,
|
|
91
|
+
LSetCommand,
|
|
92
|
+
LTrimCommand,
|
|
93
|
+
LmPopCommand,
|
|
94
|
+
MGetCommand,
|
|
95
|
+
MSetCommand,
|
|
96
|
+
MSetNXCommand,
|
|
97
|
+
PExpireAtCommand,
|
|
98
|
+
PExpireCommand,
|
|
99
|
+
PSetEXCommand,
|
|
100
|
+
PTtlCommand,
|
|
101
|
+
PersistCommand,
|
|
102
|
+
PfAddCommand,
|
|
103
|
+
PfCountCommand,
|
|
104
|
+
PfMergeCommand,
|
|
105
|
+
PingCommand,
|
|
106
|
+
PublishCommand,
|
|
107
|
+
RPopCommand,
|
|
108
|
+
RPushCommand,
|
|
109
|
+
RPushXCommand,
|
|
110
|
+
RandomKeyCommand,
|
|
111
|
+
RenameCommand,
|
|
112
|
+
RenameNXCommand,
|
|
113
|
+
SAddCommand,
|
|
114
|
+
SCardCommand,
|
|
115
|
+
SDiffCommand,
|
|
116
|
+
SDiffStoreCommand,
|
|
117
|
+
SInterCommand,
|
|
118
|
+
SInterStoreCommand,
|
|
119
|
+
SIsMemberCommand,
|
|
120
|
+
SMIsMemberCommand,
|
|
121
|
+
SMembersCommand,
|
|
122
|
+
SMoveCommand,
|
|
123
|
+
SPopCommand,
|
|
124
|
+
SRandMemberCommand,
|
|
125
|
+
SRemCommand,
|
|
126
|
+
SScanCommand,
|
|
127
|
+
SUnionCommand,
|
|
128
|
+
SUnionStoreCommand,
|
|
129
|
+
ScanCommand,
|
|
130
|
+
ScriptExistsCommand,
|
|
131
|
+
ScriptFlushCommand,
|
|
132
|
+
ScriptLoadCommand,
|
|
133
|
+
SetBitCommand,
|
|
134
|
+
SetCommand,
|
|
135
|
+
SetExCommand,
|
|
136
|
+
SetNxCommand,
|
|
137
|
+
SetRangeCommand,
|
|
138
|
+
StrLenCommand,
|
|
139
|
+
TimeCommand,
|
|
140
|
+
TouchCommand,
|
|
141
|
+
TtlCommand,
|
|
142
|
+
TypeCommand,
|
|
143
|
+
UnlinkCommand,
|
|
144
|
+
XAckCommand,
|
|
145
|
+
XAddCommand,
|
|
146
|
+
XAutoClaim,
|
|
147
|
+
XClaimCommand,
|
|
148
|
+
XDelCommand,
|
|
149
|
+
XGroupCommand,
|
|
150
|
+
XInfoCommand,
|
|
151
|
+
XLenCommand,
|
|
152
|
+
XPendingCommand,
|
|
153
|
+
XRangeCommand,
|
|
154
|
+
XReadCommand,
|
|
155
|
+
XReadGroupCommand,
|
|
156
|
+
XRevRangeCommand,
|
|
157
|
+
XTrimCommand,
|
|
158
|
+
ZAddCommand,
|
|
159
|
+
ZCardCommand,
|
|
160
|
+
ZCountCommand,
|
|
161
|
+
ZIncrByCommand,
|
|
162
|
+
ZInterStoreCommand,
|
|
163
|
+
ZLexCountCommand,
|
|
164
|
+
ZPopMaxCommand,
|
|
165
|
+
ZPopMinCommand,
|
|
166
|
+
ZRangeCommand,
|
|
167
|
+
ZRankCommand,
|
|
168
|
+
ZRemCommand,
|
|
169
|
+
ZRemRangeByLexCommand,
|
|
170
|
+
ZRemRangeByRankCommand,
|
|
171
|
+
ZRemRangeByScoreCommand,
|
|
172
|
+
ZRevRankCommand,
|
|
173
|
+
ZScanCommand,
|
|
174
|
+
ZScoreCommand,
|
|
175
|
+
ZUnionCommand,
|
|
176
|
+
ZUnionStoreCommand,
|
|
177
|
+
} from "./commands/mod";
|
|
178
|
+
import { ZDiffStoreCommand } from "./commands/zdiffstore";
|
|
179
|
+
import { ZMScoreCommand } from "./commands/zmscore";
|
|
180
|
+
import type { Requester, UpstashRequest, UpstashResponse } from "./http";
|
|
181
|
+
import { Pipeline } from "./pipeline";
|
|
182
|
+
import { Script } from "./script";
|
|
183
|
+
import type { CommandArgs, RedisOptions, Telemetry } from "./types";
|
|
184
|
+
|
|
185
|
+
// See https://github.com/upstash/upstash-redis/issues/342
|
|
186
|
+
// why we need this export
|
|
187
|
+
export type { RedisOptions } from "./types";
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Serverless redis client for upstash.
|
|
191
|
+
*/
|
|
192
|
+
export class Redis {
|
|
193
|
+
protected client: Requester;
|
|
194
|
+
protected opts?: CommandOptions<any, any>;
|
|
195
|
+
protected enableTelemetry: boolean;
|
|
196
|
+
protected enableAutoPipelining: boolean;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Create a new redis client
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const redis = new Redis({
|
|
204
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
205
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
constructor(client: Requester, opts?: RedisOptions) {
|
|
210
|
+
this.client = client;
|
|
211
|
+
this.opts = opts;
|
|
212
|
+
this.enableTelemetry = opts?.enableTelemetry ?? true;
|
|
213
|
+
|
|
214
|
+
if (opts?.readYourWrites === false) {
|
|
215
|
+
this.client.readYourWrites = false;
|
|
216
|
+
}
|
|
217
|
+
this.enableAutoPipelining = opts?.enableAutoPipelining ?? true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get json() {
|
|
221
|
+
return {
|
|
222
|
+
/**
|
|
223
|
+
* @see https://redis.io/commands/json.arrappend
|
|
224
|
+
*/
|
|
225
|
+
arrappend: (...args: CommandArgs<typeof JsonArrAppendCommand>) =>
|
|
226
|
+
new JsonArrAppendCommand(args, this.opts).exec(this.client),
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @see https://redis.io/commands/json.arrindex
|
|
230
|
+
*/
|
|
231
|
+
arrindex: (...args: CommandArgs<typeof JsonArrIndexCommand>) =>
|
|
232
|
+
new JsonArrIndexCommand(args, this.opts).exec(this.client),
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
236
|
+
*/
|
|
237
|
+
arrinsert: (...args: CommandArgs<typeof JsonArrInsertCommand>) =>
|
|
238
|
+
new JsonArrInsertCommand(args, this.opts).exec(this.client),
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @see https://redis.io/commands/json.arrlen
|
|
242
|
+
*/
|
|
243
|
+
arrlen: (...args: CommandArgs<typeof JsonArrLenCommand>) =>
|
|
244
|
+
new JsonArrLenCommand(args, this.opts).exec(this.client),
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @see https://redis.io/commands/json.arrpop
|
|
248
|
+
*/
|
|
249
|
+
arrpop: (...args: CommandArgs<typeof JsonArrPopCommand>) =>
|
|
250
|
+
new JsonArrPopCommand(args, this.opts).exec(this.client),
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
254
|
+
*/
|
|
255
|
+
arrtrim: (...args: CommandArgs<typeof JsonArrTrimCommand>) =>
|
|
256
|
+
new JsonArrTrimCommand(args, this.opts).exec(this.client),
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @see https://redis.io/commands/json.clear
|
|
260
|
+
*/
|
|
261
|
+
clear: (...args: CommandArgs<typeof JsonClearCommand>) =>
|
|
262
|
+
new JsonClearCommand(args, this.opts).exec(this.client),
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @see https://redis.io/commands/json.del
|
|
266
|
+
*/
|
|
267
|
+
del: (...args: CommandArgs<typeof JsonDelCommand>) =>
|
|
268
|
+
new JsonDelCommand(args, this.opts).exec(this.client),
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @see https://redis.io/commands/json.forget
|
|
272
|
+
*/
|
|
273
|
+
forget: (...args: CommandArgs<typeof JsonForgetCommand>) =>
|
|
274
|
+
new JsonForgetCommand(args, this.opts).exec(this.client),
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @see https://redis.io/commands/json.get
|
|
278
|
+
*/
|
|
279
|
+
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) =>
|
|
280
|
+
new JsonGetCommand<TData>(args, this.opts).exec(this.client),
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @see https://redis.io/commands/json.mget
|
|
284
|
+
*/
|
|
285
|
+
mget: <TData>(...args: CommandArgs<typeof JsonMGetCommand>) =>
|
|
286
|
+
new JsonMGetCommand<TData>(args, this.opts).exec(this.client),
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @see https://redis.io/commands/json.mset
|
|
290
|
+
*/
|
|
291
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) =>
|
|
292
|
+
new JsonMSetCommand(args, this.opts).exec(this.client),
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @see https://redis.io/commands/json.numincrby
|
|
296
|
+
*/
|
|
297
|
+
numincrby: (...args: CommandArgs<typeof JsonNumIncrByCommand>) =>
|
|
298
|
+
new JsonNumIncrByCommand(args, this.opts).exec(this.client),
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @see https://redis.io/commands/json.nummultby
|
|
302
|
+
*/
|
|
303
|
+
nummultby: (...args: CommandArgs<typeof JsonNumMultByCommand>) =>
|
|
304
|
+
new JsonNumMultByCommand(args, this.opts).exec(this.client),
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @see https://redis.io/commands/json.objkeys
|
|
308
|
+
*/
|
|
309
|
+
objkeys: (...args: CommandArgs<typeof JsonObjKeysCommand>) =>
|
|
310
|
+
new JsonObjKeysCommand(args, this.opts).exec(this.client),
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @see https://redis.io/commands/json.objlen
|
|
314
|
+
*/
|
|
315
|
+
objlen: (...args: CommandArgs<typeof JsonObjLenCommand>) =>
|
|
316
|
+
new JsonObjLenCommand(args, this.opts).exec(this.client),
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @see https://redis.io/commands/json.resp
|
|
320
|
+
*/
|
|
321
|
+
resp: (...args: CommandArgs<typeof JsonRespCommand>) =>
|
|
322
|
+
new JsonRespCommand(args, this.opts).exec(this.client),
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* @see https://redis.io/commands/json.set
|
|
326
|
+
*/
|
|
327
|
+
set: (...args: CommandArgs<typeof JsonSetCommand>) =>
|
|
328
|
+
new JsonSetCommand(args, this.opts).exec(this.client),
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @see https://redis.io/commands/json.strappend
|
|
332
|
+
*/
|
|
333
|
+
strappend: (...args: CommandArgs<typeof JsonStrAppendCommand>) =>
|
|
334
|
+
new JsonStrAppendCommand(args, this.opts).exec(this.client),
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @see https://redis.io/commands/json.strlen
|
|
338
|
+
*/
|
|
339
|
+
strlen: (...args: CommandArgs<typeof JsonStrLenCommand>) =>
|
|
340
|
+
new JsonStrLenCommand(args, this.opts).exec(this.client),
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @see https://redis.io/commands/json.toggle
|
|
344
|
+
*/
|
|
345
|
+
toggle: (...args: CommandArgs<typeof JsonToggleCommand>) =>
|
|
346
|
+
new JsonToggleCommand(args, this.opts).exec(this.client),
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @see https://redis.io/commands/json.type
|
|
350
|
+
*/
|
|
351
|
+
type: (...args: CommandArgs<typeof JsonTypeCommand>) =>
|
|
352
|
+
new JsonTypeCommand(args, this.opts).exec(this.client),
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Wrap a new middleware around the HTTP client.
|
|
357
|
+
*/
|
|
358
|
+
use = <TResult = unknown>(
|
|
359
|
+
middleware: (
|
|
360
|
+
r: UpstashRequest,
|
|
361
|
+
next: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>
|
|
362
|
+
) => Promise<UpstashResponse<TResult>>
|
|
363
|
+
) => {
|
|
364
|
+
const makeRequest = this.client.request.bind(this.client);
|
|
365
|
+
this.client.request = (req: UpstashRequest) => middleware(req, makeRequest) as any;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Technically this is not private, we can hide it from intellisense by doing this
|
|
370
|
+
*/
|
|
371
|
+
protected addTelemetry = (telemetry: Telemetry) => {
|
|
372
|
+
if (!this.enableTelemetry) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
377
|
+
// @ts-ignore - The `Requester` interface does not know about this method but it will be there
|
|
378
|
+
// as long as the user uses the standard HttpClient
|
|
379
|
+
this.client.mergeTelemetry(telemetry);
|
|
380
|
+
} catch {
|
|
381
|
+
// ignore
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
createScript(script: string): Script {
|
|
386
|
+
return new Script(this, script);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Create a new pipeline that allows you to send requests in bulk.
|
|
390
|
+
*
|
|
391
|
+
* @see {@link Pipeline}
|
|
392
|
+
*/
|
|
393
|
+
pipeline = () =>
|
|
394
|
+
new Pipeline({
|
|
395
|
+
client: this.client,
|
|
396
|
+
commandOptions: this.opts,
|
|
397
|
+
multiExec: false,
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
protected autoPipeline = () => {
|
|
401
|
+
return createAutoPipelineProxy(this);
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Create a new transaction to allow executing multiple steps atomically.
|
|
406
|
+
*
|
|
407
|
+
* All the commands in a transaction are serialized and executed sequentially. A request sent by
|
|
408
|
+
* another client will never be served in the middle of the execution of a Redis Transaction. This
|
|
409
|
+
* guarantees that the commands are executed as a single isolated operation.
|
|
410
|
+
*
|
|
411
|
+
* @see {@link Pipeline}
|
|
412
|
+
*/
|
|
413
|
+
multi = () =>
|
|
414
|
+
new Pipeline({
|
|
415
|
+
client: this.client,
|
|
416
|
+
commandOptions: this.opts,
|
|
417
|
+
multiExec: true,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```typescript
|
|
425
|
+
* redis.set("mykey", 0);
|
|
426
|
+
* const result = await redis.bitfield("mykey")
|
|
427
|
+
* .set("u4", 0, 16)
|
|
428
|
+
* .incr("u4", "#1", 1)
|
|
429
|
+
* .exec();
|
|
430
|
+
* console.log(result); // [0, 1]
|
|
431
|
+
* ```
|
|
432
|
+
*
|
|
433
|
+
* @see https://redis.io/commands/bitfield
|
|
434
|
+
*/
|
|
435
|
+
bitfield = (...args: CommandArgs<typeof BitFieldCommand>) =>
|
|
436
|
+
new BitFieldCommand(args, this.client, this.opts);
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* @see https://redis.io/commands/append
|
|
440
|
+
*/
|
|
441
|
+
append = (...args: CommandArgs<typeof AppendCommand>) =>
|
|
442
|
+
new AppendCommand(args, this.opts).exec(this.client);
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @see https://redis.io/commands/bitcount
|
|
446
|
+
*/
|
|
447
|
+
bitcount = (...args: CommandArgs<typeof BitCountCommand>) =>
|
|
448
|
+
new BitCountCommand(args, this.opts).exec(this.client);
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* @see https://redis.io/commands/bitop
|
|
452
|
+
*/
|
|
453
|
+
bitop: {
|
|
454
|
+
(
|
|
455
|
+
op: "and" | "or" | "xor",
|
|
456
|
+
destinationKey: string,
|
|
457
|
+
sourceKey: string,
|
|
458
|
+
...sourceKeys: string[]
|
|
459
|
+
): Promise<number>;
|
|
460
|
+
(op: "not", destinationKey: string, sourceKey: string): Promise<number>;
|
|
461
|
+
} = (
|
|
462
|
+
op: "and" | "or" | "xor" | "not",
|
|
463
|
+
destinationKey: string,
|
|
464
|
+
sourceKey: string,
|
|
465
|
+
...sourceKeys: string[]
|
|
466
|
+
) =>
|
|
467
|
+
new BitOpCommand([op as any, destinationKey, sourceKey, ...sourceKeys], this.opts).exec(
|
|
468
|
+
this.client
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* @see https://redis.io/commands/bitpos
|
|
473
|
+
*/
|
|
474
|
+
bitpos = (...args: CommandArgs<typeof BitPosCommand>) =>
|
|
475
|
+
new BitPosCommand(args, this.opts).exec(this.client);
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* @see https://redis.io/commands/copy
|
|
479
|
+
*/
|
|
480
|
+
copy = (...args: CommandArgs<typeof CopyCommand>) =>
|
|
481
|
+
new CopyCommand(args, this.opts).exec(this.client);
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @see https://redis.io/commands/dbsize
|
|
485
|
+
*/
|
|
486
|
+
dbsize = () => new DBSizeCommand(this.opts).exec(this.client);
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* @see https://redis.io/commands/decr
|
|
490
|
+
*/
|
|
491
|
+
decr = (...args: CommandArgs<typeof DecrCommand>) =>
|
|
492
|
+
new DecrCommand(args, this.opts).exec(this.client);
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* @see https://redis.io/commands/decrby
|
|
496
|
+
*/
|
|
497
|
+
decrby = (...args: CommandArgs<typeof DecrByCommand>) =>
|
|
498
|
+
new DecrByCommand(args, this.opts).exec(this.client);
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* @see https://redis.io/commands/del
|
|
502
|
+
*/
|
|
503
|
+
del = (...args: CommandArgs<typeof DelCommand>) =>
|
|
504
|
+
new DelCommand(args, this.opts).exec(this.client);
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* @see https://redis.io/commands/echo
|
|
508
|
+
*/
|
|
509
|
+
echo = (...args: CommandArgs<typeof EchoCommand>) =>
|
|
510
|
+
new EchoCommand(args, this.opts).exec(this.client);
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @see https://redis.io/commands/eval
|
|
514
|
+
*/
|
|
515
|
+
eval = <TArgs extends unknown[], TData = unknown>(
|
|
516
|
+
...args: [script: string, keys: string[], args: TArgs]
|
|
517
|
+
) => new EvalCommand<TArgs, TData>(args, this.opts).exec(this.client);
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @see https://redis.io/commands/evalsha
|
|
521
|
+
*/
|
|
522
|
+
evalsha = <TArgs extends unknown[], TData = unknown>(
|
|
523
|
+
...args: [sha1: string, keys: string[], args: TArgs]
|
|
524
|
+
) => new EvalshaCommand<TArgs, TData>(args, this.opts).exec(this.client);
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* @see https://redis.io/commands/exists
|
|
528
|
+
*/
|
|
529
|
+
exists = (...args: CommandArgs<typeof ExistsCommand>) =>
|
|
530
|
+
new ExistsCommand(args, this.opts).exec(this.client);
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @see https://redis.io/commands/expire
|
|
534
|
+
*/
|
|
535
|
+
expire = (...args: CommandArgs<typeof ExpireCommand>) =>
|
|
536
|
+
new ExpireCommand(args, this.opts).exec(this.client);
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @see https://redis.io/commands/expireat
|
|
540
|
+
*/
|
|
541
|
+
expireat = (...args: CommandArgs<typeof ExpireAtCommand>) =>
|
|
542
|
+
new ExpireAtCommand(args, this.opts).exec(this.client);
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* @see https://redis.io/commands/flushall
|
|
546
|
+
*/
|
|
547
|
+
flushall = (args?: CommandArgs<typeof FlushAllCommand>) =>
|
|
548
|
+
new FlushAllCommand(args, this.opts).exec(this.client);
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* @see https://redis.io/commands/flushdb
|
|
552
|
+
*/
|
|
553
|
+
flushdb = (...args: CommandArgs<typeof FlushDBCommand>) =>
|
|
554
|
+
new FlushDBCommand(args, this.opts).exec(this.client);
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @see https://redis.io/commands/geoadd
|
|
558
|
+
*/
|
|
559
|
+
geoadd = <TData>(...args: CommandArgs<typeof GeoAddCommand<TData>>) =>
|
|
560
|
+
new GeoAddCommand<TData>(args, this.opts).exec(this.client);
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* @see https://redis.io/commands/geopos
|
|
564
|
+
*/
|
|
565
|
+
geopos = <TData>(...args: CommandArgs<typeof GeoPosCommand<TData>>) =>
|
|
566
|
+
new GeoPosCommand<TData>(args, this.opts).exec(this.client);
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* @see https://redis.io/commands/geodist
|
|
570
|
+
*/
|
|
571
|
+
geodist = <TData>(...args: CommandArgs<typeof GeoDistCommand<TData>>) =>
|
|
572
|
+
new GeoDistCommand<TData>(args, this.opts).exec(this.client);
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* @see https://redis.io/commands/geohash
|
|
576
|
+
*/
|
|
577
|
+
geohash = <TData>(...args: CommandArgs<typeof GeoHashCommand<TData>>) =>
|
|
578
|
+
new GeoHashCommand<TData>(args, this.opts).exec(this.client);
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* @see https://redis.io/commands/geosearch
|
|
582
|
+
*/
|
|
583
|
+
geosearch = <TData>(...args: CommandArgs<typeof GeoSearchCommand<TData>>) =>
|
|
584
|
+
new GeoSearchCommand<TData>(args, this.opts).exec(this.client);
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* @see https://redis.io/commands/geosearchstore
|
|
588
|
+
*/
|
|
589
|
+
geosearchstore = <TData>(...args: CommandArgs<typeof GeoSearchStoreCommand<TData>>) =>
|
|
590
|
+
new GeoSearchStoreCommand<TData>(args, this.opts).exec(this.client);
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* @see https://redis.io/commands/get
|
|
594
|
+
*/
|
|
595
|
+
get = <TData>(...args: CommandArgs<typeof GetCommand>) =>
|
|
596
|
+
new GetCommand<TData>(args, this.opts).exec(this.client);
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* @see https://redis.io/commands/getbit
|
|
600
|
+
*/
|
|
601
|
+
getbit = (...args: CommandArgs<typeof GetBitCommand>) =>
|
|
602
|
+
new GetBitCommand(args, this.opts).exec(this.client);
|
|
603
|
+
/**
|
|
604
|
+
* @see https://redis.io/commands/getdel
|
|
605
|
+
*/
|
|
606
|
+
getdel = <TData>(...args: CommandArgs<typeof GetDelCommand>) =>
|
|
607
|
+
new GetDelCommand<TData>(args, this.opts).exec(this.client);
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* @see https://redis.io/commands/getrange
|
|
611
|
+
*/
|
|
612
|
+
getrange = (...args: CommandArgs<typeof GetRangeCommand>) =>
|
|
613
|
+
new GetRangeCommand(args, this.opts).exec(this.client);
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* @see https://redis.io/commands/getset
|
|
617
|
+
*/
|
|
618
|
+
getset = <TData>(key: string, value: TData) =>
|
|
619
|
+
new GetSetCommand<TData>([key, value], this.opts).exec(this.client);
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* @see https://redis.io/commands/hdel
|
|
623
|
+
*/
|
|
624
|
+
hdel = (...args: CommandArgs<typeof HDelCommand>) =>
|
|
625
|
+
new HDelCommand(args, this.opts).exec(this.client);
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* @see https://redis.io/commands/hexists
|
|
629
|
+
*/
|
|
630
|
+
hexists = (...args: CommandArgs<typeof HExistsCommand>) =>
|
|
631
|
+
new HExistsCommand(args, this.opts).exec(this.client);
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @see https://redis.io/commands/hget
|
|
635
|
+
*/
|
|
636
|
+
hget = <TData>(...args: CommandArgs<typeof HGetCommand>) =>
|
|
637
|
+
new HGetCommand<TData>(args, this.opts).exec(this.client);
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* @see https://redis.io/commands/hgetall
|
|
641
|
+
*/
|
|
642
|
+
hgetall = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof HGetAllCommand>) =>
|
|
643
|
+
new HGetAllCommand<TData>(args, this.opts).exec(this.client);
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* @see https://redis.io/commands/hincrby
|
|
647
|
+
*/
|
|
648
|
+
hincrby = (...args: CommandArgs<typeof HIncrByCommand>) =>
|
|
649
|
+
new HIncrByCommand(args, this.opts).exec(this.client);
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* @see https://redis.io/commands/hincrbyfloat
|
|
653
|
+
*/
|
|
654
|
+
hincrbyfloat = (...args: CommandArgs<typeof HIncrByFloatCommand>) =>
|
|
655
|
+
new HIncrByFloatCommand(args, this.opts).exec(this.client);
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* @see https://redis.io/commands/hkeys
|
|
659
|
+
*/
|
|
660
|
+
hkeys = (...args: CommandArgs<typeof HKeysCommand>) =>
|
|
661
|
+
new HKeysCommand(args, this.opts).exec(this.client);
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* @see https://redis.io/commands/hlen
|
|
665
|
+
*/
|
|
666
|
+
hlen = (...args: CommandArgs<typeof HLenCommand>) =>
|
|
667
|
+
new HLenCommand(args, this.opts).exec(this.client);
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* @see https://redis.io/commands/hmget
|
|
671
|
+
*/
|
|
672
|
+
hmget = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof HMGetCommand>) =>
|
|
673
|
+
new HMGetCommand<TData>(args, this.opts).exec(this.client);
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* @see https://redis.io/commands/hmset
|
|
677
|
+
*/
|
|
678
|
+
hmset = <TData>(key: string, kv: Record<string, TData>) =>
|
|
679
|
+
new HMSetCommand([key, kv], this.opts).exec(this.client);
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* @see https://redis.io/commands/hrandfield
|
|
683
|
+
*/
|
|
684
|
+
hrandfield: {
|
|
685
|
+
(key: string): Promise<string | null>;
|
|
686
|
+
(key: string, count: number): Promise<string[]>;
|
|
687
|
+
<TData extends Record<string, unknown>>(
|
|
688
|
+
key: string,
|
|
689
|
+
count: number,
|
|
690
|
+
withValues: boolean
|
|
691
|
+
): Promise<Partial<TData>>;
|
|
692
|
+
} = <TData extends string | string[] | Record<string, unknown>>(
|
|
693
|
+
key: string,
|
|
694
|
+
count?: number,
|
|
695
|
+
withValues?: boolean
|
|
696
|
+
) => new HRandFieldCommand<TData>([key, count, withValues] as any, this.opts).exec(this.client);
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* @see https://redis.io/commands/hscan
|
|
700
|
+
*/
|
|
701
|
+
hscan = (...args: CommandArgs<typeof HScanCommand>) =>
|
|
702
|
+
new HScanCommand(args, this.opts).exec(this.client);
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* @see https://redis.io/commands/hset
|
|
706
|
+
*/
|
|
707
|
+
hset = <TData>(key: string, kv: Record<string, TData>) =>
|
|
708
|
+
new HSetCommand<TData>([key, kv], this.opts).exec(this.client);
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* @see https://redis.io/commands/hsetnx
|
|
712
|
+
*/
|
|
713
|
+
hsetnx = <TData>(key: string, field: string, value: TData) =>
|
|
714
|
+
new HSetNXCommand<TData>([key, field, value], this.opts).exec(this.client);
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* @see https://redis.io/commands/hstrlen
|
|
718
|
+
*/
|
|
719
|
+
hstrlen = (...args: CommandArgs<typeof HStrLenCommand>) =>
|
|
720
|
+
new HStrLenCommand(args, this.opts).exec(this.client);
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* @see https://redis.io/commands/hvals
|
|
724
|
+
*/
|
|
725
|
+
hvals = (...args: CommandArgs<typeof HValsCommand>) =>
|
|
726
|
+
new HValsCommand(args, this.opts).exec(this.client);
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* @see https://redis.io/commands/incr
|
|
730
|
+
*/
|
|
731
|
+
incr = (...args: CommandArgs<typeof IncrCommand>) =>
|
|
732
|
+
new IncrCommand(args, this.opts).exec(this.client);
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* @see https://redis.io/commands/incrby
|
|
736
|
+
*/
|
|
737
|
+
incrby = (...args: CommandArgs<typeof IncrByCommand>) =>
|
|
738
|
+
new IncrByCommand(args, this.opts).exec(this.client);
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* @see https://redis.io/commands/incrbyfloat
|
|
742
|
+
*/
|
|
743
|
+
incrbyfloat = (...args: CommandArgs<typeof IncrByFloatCommand>) =>
|
|
744
|
+
new IncrByFloatCommand(args, this.opts).exec(this.client);
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* @see https://redis.io/commands/keys
|
|
748
|
+
*/
|
|
749
|
+
keys = (...args: CommandArgs<typeof KeysCommand>) =>
|
|
750
|
+
new KeysCommand(args, this.opts).exec(this.client);
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* @see https://redis.io/commands/lindex
|
|
754
|
+
*/
|
|
755
|
+
lindex = (...args: CommandArgs<typeof LIndexCommand>) =>
|
|
756
|
+
new LIndexCommand(args, this.opts).exec(this.client);
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* @see https://redis.io/commands/linsert
|
|
760
|
+
*/
|
|
761
|
+
linsert = <TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) =>
|
|
762
|
+
new LInsertCommand<TData>([key, direction, pivot, value], this.opts).exec(this.client);
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* @see https://redis.io/commands/llen
|
|
766
|
+
*/
|
|
767
|
+
llen = (...args: CommandArgs<typeof LLenCommand>) =>
|
|
768
|
+
new LLenCommand(args, this.opts).exec(this.client);
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* @see https://redis.io/commands/lmove
|
|
772
|
+
*/
|
|
773
|
+
lmove = <TData = string>(...args: CommandArgs<typeof LMoveCommand>) =>
|
|
774
|
+
new LMoveCommand<TData>(args, this.opts).exec(this.client);
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* @see https://redis.io/commands/lpop
|
|
778
|
+
*/
|
|
779
|
+
lpop = <TData>(...args: CommandArgs<typeof LPopCommand>) =>
|
|
780
|
+
new LPopCommand<TData>(args, this.opts).exec(this.client);
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* @see https://redis.io/commands/lmpop
|
|
784
|
+
*/
|
|
785
|
+
lmpop = <TData>(...args: CommandArgs<typeof LmPopCommand>) =>
|
|
786
|
+
new LmPopCommand<TData>(args, this.opts).exec(this.client);
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* @see https://redis.io/commands/lpos
|
|
790
|
+
*/
|
|
791
|
+
lpos = <TData = number>(...args: CommandArgs<typeof LPosCommand>) =>
|
|
792
|
+
new LPosCommand<TData>(args, this.opts).exec(this.client);
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* @see https://redis.io/commands/lpush
|
|
796
|
+
*/
|
|
797
|
+
lpush = <TData>(key: string, ...elements: TData[]) =>
|
|
798
|
+
new LPushCommand<TData>([key, ...elements], this.opts).exec(this.client);
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* @see https://redis.io/commands/lpushx
|
|
802
|
+
*/
|
|
803
|
+
lpushx = <TData>(key: string, ...elements: TData[]) =>
|
|
804
|
+
new LPushXCommand<TData>([key, ...elements], this.opts).exec(this.client);
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* @see https://redis.io/commands/lrange
|
|
808
|
+
*/
|
|
809
|
+
lrange = <TResult = string>(...args: CommandArgs<typeof LRangeCommand>) =>
|
|
810
|
+
new LRangeCommand<TResult>(args, this.opts).exec(this.client);
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* @see https://redis.io/commands/lrem
|
|
814
|
+
*/
|
|
815
|
+
lrem = <TData>(key: string, count: number, value: TData) =>
|
|
816
|
+
new LRemCommand([key, count, value], this.opts).exec(this.client);
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* @see https://redis.io/commands/lset
|
|
820
|
+
*/
|
|
821
|
+
lset = <TData>(key: string, index: number, value: TData) =>
|
|
822
|
+
new LSetCommand([key, index, value], this.opts).exec(this.client);
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* @see https://redis.io/commands/ltrim
|
|
826
|
+
*/
|
|
827
|
+
ltrim = (...args: CommandArgs<typeof LTrimCommand>) =>
|
|
828
|
+
new LTrimCommand(args, this.opts).exec(this.client);
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* @see https://redis.io/commands/mget
|
|
832
|
+
*/
|
|
833
|
+
mget = <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) =>
|
|
834
|
+
new MGetCommand<TData>(args, this.opts).exec(this.client);
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* @see https://redis.io/commands/mset
|
|
838
|
+
*/
|
|
839
|
+
mset = <TData>(kv: Record<string, TData>) =>
|
|
840
|
+
new MSetCommand<TData>([kv], this.opts).exec(this.client);
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* @see https://redis.io/commands/msetnx
|
|
844
|
+
*/
|
|
845
|
+
msetnx = <TData>(kv: Record<string, TData>) =>
|
|
846
|
+
new MSetNXCommand<TData>([kv], this.opts).exec(this.client);
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* @see https://redis.io/commands/persist
|
|
850
|
+
*/
|
|
851
|
+
persist = (...args: CommandArgs<typeof PersistCommand>) =>
|
|
852
|
+
new PersistCommand(args, this.opts).exec(this.client);
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* @see https://redis.io/commands/pexpire
|
|
856
|
+
*/
|
|
857
|
+
pexpire = (...args: CommandArgs<typeof PExpireCommand>) =>
|
|
858
|
+
new PExpireCommand(args, this.opts).exec(this.client);
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* @see https://redis.io/commands/pexpireat
|
|
862
|
+
*/
|
|
863
|
+
pexpireat = (...args: CommandArgs<typeof PExpireAtCommand>) =>
|
|
864
|
+
new PExpireAtCommand(args, this.opts).exec(this.client);
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* @see https://redis.io/commands/pfadd
|
|
868
|
+
*/
|
|
869
|
+
pfadd = (...args: CommandArgs<typeof PfAddCommand>) =>
|
|
870
|
+
new PfAddCommand(args, this.opts).exec(this.client);
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* @see https://redis.io/commands/pfcount
|
|
874
|
+
*/
|
|
875
|
+
pfcount = (...args: CommandArgs<typeof PfCountCommand>) =>
|
|
876
|
+
new PfCountCommand(args, this.opts).exec(this.client);
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* @see https://redis.io/commands/pfmerge
|
|
880
|
+
*/
|
|
881
|
+
pfmerge = (...args: CommandArgs<typeof PfMergeCommand>) =>
|
|
882
|
+
new PfMergeCommand(args, this.opts).exec(this.client);
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* @see https://redis.io/commands/ping
|
|
886
|
+
*/
|
|
887
|
+
ping = (args?: CommandArgs<typeof PingCommand>) =>
|
|
888
|
+
new PingCommand(args, this.opts).exec(this.client);
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* @see https://redis.io/commands/psetex
|
|
892
|
+
*/
|
|
893
|
+
psetex = <TData>(key: string, ttl: number, value: TData) =>
|
|
894
|
+
new PSetEXCommand<TData>([key, ttl, value], this.opts).exec(this.client);
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* @see https://redis.io/commands/pttl
|
|
898
|
+
*/
|
|
899
|
+
pttl = (...args: CommandArgs<typeof PTtlCommand>) =>
|
|
900
|
+
new PTtlCommand(args, this.opts).exec(this.client);
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* @see https://redis.io/commands/publish
|
|
904
|
+
*/
|
|
905
|
+
publish = (...args: CommandArgs<typeof PublishCommand>) =>
|
|
906
|
+
new PublishCommand(args, this.opts).exec(this.client);
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* @see https://redis.io/commands/randomkey
|
|
910
|
+
*/
|
|
911
|
+
randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* @see https://redis.io/commands/rename
|
|
915
|
+
*/
|
|
916
|
+
rename = (...args: CommandArgs<typeof RenameCommand>) =>
|
|
917
|
+
new RenameCommand(args, this.opts).exec(this.client);
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* @see https://redis.io/commands/renamenx
|
|
921
|
+
*/
|
|
922
|
+
renamenx = (...args: CommandArgs<typeof RenameNXCommand>) =>
|
|
923
|
+
new RenameNXCommand(args, this.opts).exec(this.client);
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* @see https://redis.io/commands/rpop
|
|
927
|
+
*/
|
|
928
|
+
rpop = <TData = string>(...args: CommandArgs<typeof RPopCommand>) =>
|
|
929
|
+
new RPopCommand<TData>(args, this.opts).exec(this.client);
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* @see https://redis.io/commands/rpush
|
|
933
|
+
*/
|
|
934
|
+
rpush = <TData>(key: string, ...elements: TData[]) =>
|
|
935
|
+
new RPushCommand([key, ...elements], this.opts).exec(this.client);
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* @see https://redis.io/commands/rpushx
|
|
939
|
+
*/
|
|
940
|
+
rpushx = <TData>(key: string, ...elements: TData[]) =>
|
|
941
|
+
new RPushXCommand([key, ...elements], this.opts).exec(this.client);
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* @see https://redis.io/commands/sadd
|
|
945
|
+
*/
|
|
946
|
+
sadd = <TData>(key: string, member: TData, ...members: TData[]) =>
|
|
947
|
+
new SAddCommand<TData>([key, member, ...members], this.opts).exec(this.client);
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* @see https://redis.io/commands/scan
|
|
951
|
+
*/
|
|
952
|
+
scan = (...args: CommandArgs<typeof ScanCommand>) =>
|
|
953
|
+
new ScanCommand(args, this.opts).exec(this.client);
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* @see https://redis.io/commands/scard
|
|
957
|
+
*/
|
|
958
|
+
scard = (...args: CommandArgs<typeof SCardCommand>) =>
|
|
959
|
+
new SCardCommand(args, this.opts).exec(this.client);
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* @see https://redis.io/commands/script-exists
|
|
963
|
+
*/
|
|
964
|
+
scriptExists = (...args: CommandArgs<typeof ScriptExistsCommand>) =>
|
|
965
|
+
new ScriptExistsCommand(args, this.opts).exec(this.client);
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* @see https://redis.io/commands/script-flush
|
|
969
|
+
*/
|
|
970
|
+
scriptFlush = (...args: CommandArgs<typeof ScriptFlushCommand>) =>
|
|
971
|
+
new ScriptFlushCommand(args, this.opts).exec(this.client);
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* @see https://redis.io/commands/script-load
|
|
975
|
+
*/
|
|
976
|
+
scriptLoad = (...args: CommandArgs<typeof ScriptLoadCommand>) =>
|
|
977
|
+
new ScriptLoadCommand(args, this.opts).exec(this.client);
|
|
978
|
+
/**
|
|
979
|
+
* @see https://redis.io/commands/sdiff
|
|
980
|
+
*/
|
|
981
|
+
sdiff = (...args: CommandArgs<typeof SDiffCommand>) =>
|
|
982
|
+
new SDiffCommand(args, this.opts).exec(this.client);
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* @see https://redis.io/commands/sdiffstore
|
|
986
|
+
*/
|
|
987
|
+
sdiffstore = (...args: CommandArgs<typeof SDiffStoreCommand>) =>
|
|
988
|
+
new SDiffStoreCommand(args, this.opts).exec(this.client);
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* @see https://redis.io/commands/set
|
|
992
|
+
*/
|
|
993
|
+
set = <TData>(key: string, value: TData, opts?: SetCommandOptions) =>
|
|
994
|
+
new SetCommand<TData>([key, value, opts], this.opts).exec(this.client);
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* @see https://redis.io/commands/setbit
|
|
998
|
+
*/
|
|
999
|
+
setbit = (...args: CommandArgs<typeof SetBitCommand>) =>
|
|
1000
|
+
new SetBitCommand(args, this.opts).exec(this.client);
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* @see https://redis.io/commands/setex
|
|
1004
|
+
*/
|
|
1005
|
+
setex = <TData>(key: string, ttl: number, value: TData) =>
|
|
1006
|
+
new SetExCommand<TData>([key, ttl, value], this.opts).exec(this.client);
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* @see https://redis.io/commands/setnx
|
|
1010
|
+
*/
|
|
1011
|
+
setnx = <TData>(key: string, value: TData) =>
|
|
1012
|
+
new SetNxCommand<TData>([key, value], this.opts).exec(this.client);
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* @see https://redis.io/commands/setrange
|
|
1016
|
+
*/
|
|
1017
|
+
setrange = (...args: CommandArgs<typeof SetRangeCommand>) =>
|
|
1018
|
+
new SetRangeCommand(args, this.opts).exec(this.client);
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* @see https://redis.io/commands/sinter
|
|
1022
|
+
*/
|
|
1023
|
+
sinter = (...args: CommandArgs<typeof SInterCommand>) =>
|
|
1024
|
+
new SInterCommand(args, this.opts).exec(this.client);
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* @see https://redis.io/commands/sinterstore
|
|
1028
|
+
*/
|
|
1029
|
+
sinterstore = (...args: CommandArgs<typeof SInterStoreCommand>) =>
|
|
1030
|
+
new SInterStoreCommand(args, this.opts).exec(this.client);
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* @see https://redis.io/commands/sismember
|
|
1034
|
+
*/
|
|
1035
|
+
sismember = <TData>(key: string, member: TData) =>
|
|
1036
|
+
new SIsMemberCommand<TData>([key, member], this.opts).exec(this.client);
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* @see https://redis.io/commands/smismember
|
|
1040
|
+
*/
|
|
1041
|
+
smismember = <TMembers extends unknown[]>(key: string, members: TMembers) =>
|
|
1042
|
+
new SMIsMemberCommand<TMembers>([key, members], this.opts).exec(this.client);
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* @see https://redis.io/commands/smembers
|
|
1046
|
+
*/
|
|
1047
|
+
smembers = <TData extends unknown[] = string[]>(...args: CommandArgs<typeof SMembersCommand>) =>
|
|
1048
|
+
new SMembersCommand<TData>(args, this.opts).exec(this.client);
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* @see https://redis.io/commands/smove
|
|
1052
|
+
*/
|
|
1053
|
+
smove = <TData>(source: string, destination: string, member: TData) =>
|
|
1054
|
+
new SMoveCommand<TData>([source, destination, member], this.opts).exec(this.client);
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* @see https://redis.io/commands/spop
|
|
1058
|
+
*/
|
|
1059
|
+
spop = <TData>(...args: CommandArgs<typeof SPopCommand>) =>
|
|
1060
|
+
new SPopCommand<TData>(args, this.opts).exec(this.client);
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* @see https://redis.io/commands/srandmember
|
|
1064
|
+
*/
|
|
1065
|
+
srandmember = <TData>(...args: CommandArgs<typeof SRandMemberCommand>) =>
|
|
1066
|
+
new SRandMemberCommand<TData>(args, this.opts).exec(this.client);
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* @see https://redis.io/commands/srem
|
|
1070
|
+
*/
|
|
1071
|
+
srem = <TData>(key: string, ...members: TData[]) =>
|
|
1072
|
+
new SRemCommand<TData>([key, ...members], this.opts).exec(this.client);
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* @see https://redis.io/commands/sscan
|
|
1076
|
+
*/
|
|
1077
|
+
sscan = (...args: CommandArgs<typeof SScanCommand>) =>
|
|
1078
|
+
new SScanCommand(args, this.opts).exec(this.client);
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* @see https://redis.io/commands/strlen
|
|
1082
|
+
*/
|
|
1083
|
+
strlen = (...args: CommandArgs<typeof StrLenCommand>) =>
|
|
1084
|
+
new StrLenCommand(args, this.opts).exec(this.client);
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* @see https://redis.io/commands/sunion
|
|
1088
|
+
*/
|
|
1089
|
+
sunion = (...args: CommandArgs<typeof SUnionCommand>) =>
|
|
1090
|
+
new SUnionCommand(args, this.opts).exec(this.client);
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* @see https://redis.io/commands/sunionstore
|
|
1094
|
+
*/
|
|
1095
|
+
sunionstore = (...args: CommandArgs<typeof SUnionStoreCommand>) =>
|
|
1096
|
+
new SUnionStoreCommand(args, this.opts).exec(this.client);
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* @see https://redis.io/commands/time
|
|
1100
|
+
*/
|
|
1101
|
+
time = () => new TimeCommand().exec(this.client);
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* @see https://redis.io/commands/touch
|
|
1105
|
+
*/
|
|
1106
|
+
touch = (...args: CommandArgs<typeof TouchCommand>) =>
|
|
1107
|
+
new TouchCommand(args, this.opts).exec(this.client);
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* @see https://redis.io/commands/ttl
|
|
1111
|
+
*/
|
|
1112
|
+
ttl = (...args: CommandArgs<typeof TtlCommand>) =>
|
|
1113
|
+
new TtlCommand(args, this.opts).exec(this.client);
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @see https://redis.io/commands/type
|
|
1117
|
+
*/
|
|
1118
|
+
type = (...args: CommandArgs<typeof TypeCommand>) =>
|
|
1119
|
+
new TypeCommand(args, this.opts).exec(this.client);
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* @see https://redis.io/commands/unlink
|
|
1123
|
+
*/
|
|
1124
|
+
unlink = (...args: CommandArgs<typeof UnlinkCommand>) =>
|
|
1125
|
+
new UnlinkCommand(args, this.opts).exec(this.client);
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* @see https://redis.io/commands/xadd
|
|
1129
|
+
*/
|
|
1130
|
+
xadd = (...args: CommandArgs<typeof XAddCommand>) =>
|
|
1131
|
+
new XAddCommand(args, this.opts).exec(this.client);
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* @see https://redis.io/commands/xack
|
|
1135
|
+
*/
|
|
1136
|
+
xack = (...args: CommandArgs<typeof XAckCommand>) =>
|
|
1137
|
+
new XAckCommand(args, this.opts).exec(this.client);
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* @see https://redis.io/commands/xdel
|
|
1141
|
+
*/
|
|
1142
|
+
xdel = (...args: CommandArgs<typeof XDelCommand>) =>
|
|
1143
|
+
new XDelCommand(args, this.opts).exec(this.client);
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* @see https://redis.io/commands/xgroup
|
|
1147
|
+
*/
|
|
1148
|
+
xgroup = (...args: CommandArgs<typeof XGroupCommand>) =>
|
|
1149
|
+
new XGroupCommand(args, this.opts).exec(this.client);
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* @see https://redis.io/commands/xread
|
|
1153
|
+
*/
|
|
1154
|
+
xread = (...args: CommandArgs<typeof XReadCommand>) =>
|
|
1155
|
+
new XReadCommand(args, this.opts).exec(this.client);
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* @see https://redis.io/commands/xreadgroup
|
|
1159
|
+
*/
|
|
1160
|
+
xreadgroup = (...args: CommandArgs<typeof XReadGroupCommand>) =>
|
|
1161
|
+
new XReadGroupCommand(args, this.opts).exec(this.client);
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* @see https://redis.io/commands/xinfo
|
|
1165
|
+
*/
|
|
1166
|
+
xinfo = (...args: CommandArgs<typeof XInfoCommand>) =>
|
|
1167
|
+
new XInfoCommand(args, this.opts).exec(this.client);
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* @see https://redis.io/commands/xlen
|
|
1171
|
+
*/
|
|
1172
|
+
xlen = (...args: CommandArgs<typeof XLenCommand>) =>
|
|
1173
|
+
new XLenCommand(args, this.opts).exec(this.client);
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* @see https://redis.io/commands/xpending
|
|
1177
|
+
*/
|
|
1178
|
+
xpending = (...args: CommandArgs<typeof XPendingCommand>) =>
|
|
1179
|
+
new XPendingCommand(args, this.opts).exec(this.client);
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* @see https://redis.io/commands/xclaim
|
|
1183
|
+
*/
|
|
1184
|
+
xclaim = (...args: CommandArgs<typeof XClaimCommand>) =>
|
|
1185
|
+
new XClaimCommand(args, this.opts).exec(this.client);
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* @see https://redis.io/commands/xautoclaim
|
|
1189
|
+
*/
|
|
1190
|
+
xautoclaim = (...args: CommandArgs<typeof XAutoClaim>) =>
|
|
1191
|
+
new XAutoClaim(args, this.opts).exec(this.client);
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* @see https://redis.io/commands/xtrim
|
|
1195
|
+
*/
|
|
1196
|
+
xtrim = (...args: CommandArgs<typeof XTrimCommand>) =>
|
|
1197
|
+
new XTrimCommand(args, this.opts).exec(this.client);
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* @see https://redis.io/commands/xrange
|
|
1201
|
+
*/
|
|
1202
|
+
xrange = (...args: CommandArgs<typeof XRangeCommand>) =>
|
|
1203
|
+
new XRangeCommand(args, this.opts).exec(this.client);
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* @see https://redis.io/commands/xrevrange
|
|
1207
|
+
*/
|
|
1208
|
+
xrevrange = (...args: CommandArgs<typeof XRevRangeCommand>) =>
|
|
1209
|
+
new XRevRangeCommand(args, this.opts).exec(this.client);
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* @see https://redis.io/commands/zadd
|
|
1213
|
+
*/
|
|
1214
|
+
zadd = <TData>(
|
|
1215
|
+
...args:
|
|
1216
|
+
| [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]]
|
|
1217
|
+
| [
|
|
1218
|
+
key: string,
|
|
1219
|
+
opts: ZAddCommandOptions,
|
|
1220
|
+
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]],
|
|
1221
|
+
]
|
|
1222
|
+
) => {
|
|
1223
|
+
if ("score" in args[1]) {
|
|
1224
|
+
return new ZAddCommand<TData>([args[0], args[1], ...(args.slice(2) as any)], this.opts).exec(
|
|
1225
|
+
this.client
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
return new ZAddCommand<TData>(
|
|
1230
|
+
[args[0], args[1] as any, ...(args.slice(2) as any)],
|
|
1231
|
+
this.opts
|
|
1232
|
+
).exec(this.client);
|
|
1233
|
+
};
|
|
1234
|
+
/**
|
|
1235
|
+
* @see https://redis.io/commands/zcard
|
|
1236
|
+
*/
|
|
1237
|
+
zcard = (...args: CommandArgs<typeof ZCardCommand>) =>
|
|
1238
|
+
new ZCardCommand(args, this.opts).exec(this.client);
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* @see https://redis.io/commands/zcount
|
|
1242
|
+
*/
|
|
1243
|
+
zcount = (...args: CommandArgs<typeof ZCountCommand>) =>
|
|
1244
|
+
new ZCountCommand(args, this.opts).exec(this.client);
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* @see https://redis.io/commands/zdiffstore
|
|
1248
|
+
*/
|
|
1249
|
+
zdiffstore = (...args: CommandArgs<typeof ZDiffStoreCommand>) =>
|
|
1250
|
+
new ZDiffStoreCommand(args, this.opts).exec(this.client);
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* @see https://redis.io/commands/zincrby
|
|
1254
|
+
*/
|
|
1255
|
+
zincrby = <TData>(key: string, increment: number, member: TData) =>
|
|
1256
|
+
new ZIncrByCommand<TData>([key, increment, member], this.opts).exec(this.client);
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* @see https://redis.io/commands/zinterstore
|
|
1260
|
+
*/
|
|
1261
|
+
zinterstore = (...args: CommandArgs<typeof ZInterStoreCommand>) =>
|
|
1262
|
+
new ZInterStoreCommand(args, this.opts).exec(this.client);
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* @see https://redis.io/commands/zlexcount
|
|
1266
|
+
*/
|
|
1267
|
+
zlexcount = (...args: CommandArgs<typeof ZLexCountCommand>) =>
|
|
1268
|
+
new ZLexCountCommand(args, this.opts).exec(this.client);
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* @see https://redis.io/commands/zmscore
|
|
1272
|
+
*/
|
|
1273
|
+
zmscore = (...args: CommandArgs<typeof ZMScoreCommand>) =>
|
|
1274
|
+
new ZMScoreCommand(args, this.opts).exec(this.client);
|
|
1275
|
+
|
|
1276
|
+
/**
|
|
1277
|
+
* @see https://redis.io/commands/zpopmax
|
|
1278
|
+
*/
|
|
1279
|
+
zpopmax = <TData>(...args: CommandArgs<typeof ZPopMaxCommand>) =>
|
|
1280
|
+
new ZPopMaxCommand<TData>(args, this.opts).exec(this.client);
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* @see https://redis.io/commands/zpopmin
|
|
1284
|
+
*/
|
|
1285
|
+
zpopmin = <TData>(...args: CommandArgs<typeof ZPopMinCommand>) =>
|
|
1286
|
+
new ZPopMinCommand<TData>(args, this.opts).exec(this.client);
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* @see https://redis.io/commands/zrange
|
|
1290
|
+
*/
|
|
1291
|
+
zrange = <TData extends unknown[]>(
|
|
1292
|
+
...args:
|
|
1293
|
+
| [key: string, min: number, max: number, opts?: ZRangeCommandOptions]
|
|
1294
|
+
| [
|
|
1295
|
+
key: string,
|
|
1296
|
+
min: `(${string}` | `[${string}` | "-" | "+",
|
|
1297
|
+
max: `(${string}` | `[${string}` | "-" | "+",
|
|
1298
|
+
opts: { byLex: true } & ZRangeCommandOptions,
|
|
1299
|
+
]
|
|
1300
|
+
| [
|
|
1301
|
+
key: string,
|
|
1302
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
1303
|
+
max: number | `(${number}` | "-inf" | "+inf",
|
|
1304
|
+
opts: { byScore: true } & ZRangeCommandOptions,
|
|
1305
|
+
]
|
|
1306
|
+
) => new ZRangeCommand<TData>(args as any, this.opts).exec(this.client);
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* @see https://redis.io/commands/zrank
|
|
1310
|
+
*/
|
|
1311
|
+
zrank = <TData>(key: string, member: TData) =>
|
|
1312
|
+
new ZRankCommand<TData>([key, member], this.opts).exec(this.client);
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* @see https://redis.io/commands/zrem
|
|
1316
|
+
*/
|
|
1317
|
+
zrem = <TData>(key: string, ...members: TData[]) =>
|
|
1318
|
+
new ZRemCommand<TData>([key, ...members], this.opts).exec(this.client);
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* @see https://redis.io/commands/zremrangebylex
|
|
1322
|
+
*/
|
|
1323
|
+
zremrangebylex = (...args: CommandArgs<typeof ZRemRangeByLexCommand>) =>
|
|
1324
|
+
new ZRemRangeByLexCommand(args, this.opts).exec(this.client);
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* @see https://redis.io/commands/zremrangebyrank
|
|
1328
|
+
*/
|
|
1329
|
+
zremrangebyrank = (...args: CommandArgs<typeof ZRemRangeByRankCommand>) =>
|
|
1330
|
+
new ZRemRangeByRankCommand(args, this.opts).exec(this.client);
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* @see https://redis.io/commands/zremrangebyscore
|
|
1334
|
+
*/
|
|
1335
|
+
zremrangebyscore = (...args: CommandArgs<typeof ZRemRangeByScoreCommand>) =>
|
|
1336
|
+
new ZRemRangeByScoreCommand(args, this.opts).exec(this.client);
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* @see https://redis.io/commands/zrevrank
|
|
1340
|
+
*/
|
|
1341
|
+
zrevrank = <TData>(key: string, member: TData) =>
|
|
1342
|
+
new ZRevRankCommand<TData>([key, member], this.opts).exec(this.client);
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* @see https://redis.io/commands/zscan
|
|
1346
|
+
*/
|
|
1347
|
+
zscan = (...args: CommandArgs<typeof ZScanCommand>) =>
|
|
1348
|
+
new ZScanCommand(args, this.opts).exec(this.client);
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* @see https://redis.io/commands/zscore
|
|
1352
|
+
*/
|
|
1353
|
+
zscore = <TData>(key: string, member: TData) =>
|
|
1354
|
+
new ZScoreCommand<TData>([key, member], this.opts).exec(this.client);
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* @see https://redis.io/commands/zunion
|
|
1358
|
+
*/
|
|
1359
|
+
zunion = (...args: CommandArgs<typeof ZUnionCommand>) =>
|
|
1360
|
+
new ZUnionCommand(args, this.opts).exec(this.client);
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* @see https://redis.io/commands/zunionstore
|
|
1364
|
+
*/
|
|
1365
|
+
zunionstore = (...args: CommandArgs<typeof ZUnionStoreCommand>) =>
|
|
1366
|
+
new ZUnionStoreCommand(args, this.opts).exec(this.client);
|
|
1367
|
+
}
|