@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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, describe, expect, test } from "bun:test";
|
|
4
|
+
import { SAddCommand } from "./sadd";
|
|
5
|
+
import { SPopCommand } from "./spop";
|
|
6
|
+
|
|
7
|
+
const client = newHttpClient();
|
|
8
|
+
|
|
9
|
+
const { newKey, cleanup } = keygen();
|
|
10
|
+
afterAll(cleanup);
|
|
11
|
+
|
|
12
|
+
describe("without count", () => {
|
|
13
|
+
test("returns the first element", async () => {
|
|
14
|
+
const key = newKey();
|
|
15
|
+
const member = randomID();
|
|
16
|
+
await new SAddCommand([key, member]).exec(client);
|
|
17
|
+
const res = await new SPopCommand([key]).exec(client);
|
|
18
|
+
expect(res).toEqual(member);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("with count", () => {
|
|
23
|
+
test("returns n elements", async () => {
|
|
24
|
+
const key = newKey();
|
|
25
|
+
const member1 = randomID();
|
|
26
|
+
const member2 = randomID();
|
|
27
|
+
const member3 = randomID();
|
|
28
|
+
const member4 = randomID();
|
|
29
|
+
await new SAddCommand([key, member1, member2, member3, member4]).exec(client);
|
|
30
|
+
const res = await new SPopCommand<string[]>([key, 2]).exec(client);
|
|
31
|
+
|
|
32
|
+
expect(res?.length).toBe(2);
|
|
33
|
+
expect([member1, member2, member3, member4].includes(res![0])).toBe(true);
|
|
34
|
+
expect([member1, member2, member3, member4].includes(res![1])).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
/**
|
|
4
|
+
* @see https://redis.io/commands/spop
|
|
5
|
+
*/
|
|
6
|
+
export class SPopCommand<TData> extends Command<string | string[] | null, TData | null> {
|
|
7
|
+
constructor(
|
|
8
|
+
[key, count]: [key: string, count?: number],
|
|
9
|
+
opts?: CommandOptions<string | string[] | null, TData | null>
|
|
10
|
+
) {
|
|
11
|
+
const command: unknown[] = ["spop", key];
|
|
12
|
+
if (typeof count === "number") {
|
|
13
|
+
command.push(count);
|
|
14
|
+
}
|
|
15
|
+
super(command, opts);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { SAddCommand } from "./sadd";
|
|
5
|
+
import { SRandMemberCommand } from "./srandmember";
|
|
6
|
+
|
|
7
|
+
const client = newHttpClient();
|
|
8
|
+
|
|
9
|
+
const { newKey, cleanup } = keygen();
|
|
10
|
+
afterAll(cleanup);
|
|
11
|
+
|
|
12
|
+
test("without opts", () => {
|
|
13
|
+
test("returns a random key", async () => {
|
|
14
|
+
const key = newKey();
|
|
15
|
+
const member = randomID();
|
|
16
|
+
await new SAddCommand([key, member]).exec(client);
|
|
17
|
+
const res = await new SRandMemberCommand([key]).exec(client);
|
|
18
|
+
expect(res).toEqual(member);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("with count", () => {
|
|
23
|
+
test("returns a random key", async () => {
|
|
24
|
+
const key = newKey();
|
|
25
|
+
const member1 = randomID();
|
|
26
|
+
const member2 = randomID();
|
|
27
|
+
await new SAddCommand([key, member1, member2]).exec(client);
|
|
28
|
+
const res = await new SRandMemberCommand<unknown[]>([key, 2]).exec(client);
|
|
29
|
+
expect(res?.length).toBe(2);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
/**
|
|
4
|
+
* @see https://redis.io/commands/srandmember
|
|
5
|
+
*/
|
|
6
|
+
export class SRandMemberCommand<TData> extends Command<string | null, TData | null> {
|
|
7
|
+
constructor(
|
|
8
|
+
[key, count]: [key: string, count?: number],
|
|
9
|
+
opts?: CommandOptions<string | null, TData | null>
|
|
10
|
+
) {
|
|
11
|
+
const command: unknown[] = ["srandmember", key];
|
|
12
|
+
if (typeof count === "number") {
|
|
13
|
+
command.push(count);
|
|
14
|
+
}
|
|
15
|
+
super(command, opts);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { SAddCommand } from "./sadd";
|
|
5
|
+
import { SRemCommand } from "./srem";
|
|
6
|
+
|
|
7
|
+
const client = newHttpClient();
|
|
8
|
+
|
|
9
|
+
const { newKey, cleanup } = keygen();
|
|
10
|
+
afterAll(cleanup);
|
|
11
|
+
|
|
12
|
+
test("returns the number of removed members", async () => {
|
|
13
|
+
const key = newKey();
|
|
14
|
+
const value1 = randomID();
|
|
15
|
+
const value2 = randomID();
|
|
16
|
+
await new SAddCommand([key, value1, value2]).exec(client);
|
|
17
|
+
const res = await new SRemCommand([key, value1]).exec(client);
|
|
18
|
+
expect(res).toEqual(1);
|
|
19
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
/**
|
|
4
|
+
* @see https://redis.io/commands/srem
|
|
5
|
+
*/
|
|
6
|
+
export class SRemCommand<TData = string> extends Command<number, number> {
|
|
7
|
+
constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>) {
|
|
8
|
+
super(["srem", ...cmd], opts);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, describe, expect, test } from "bun:test";
|
|
4
|
+
import { SAddCommand } from "./sadd";
|
|
5
|
+
import { SScanCommand } from "./sscan";
|
|
6
|
+
const client = newHttpClient();
|
|
7
|
+
|
|
8
|
+
const { newKey, cleanup } = keygen();
|
|
9
|
+
|
|
10
|
+
afterAll(cleanup);
|
|
11
|
+
describe("without options", () => {
|
|
12
|
+
test("returns cursor and members", async () => {
|
|
13
|
+
const key = newKey();
|
|
14
|
+
const member = randomID();
|
|
15
|
+
await new SAddCommand([key, member]).exec(client);
|
|
16
|
+
const res = await new SScanCommand([key, 0]).exec(client);
|
|
17
|
+
|
|
18
|
+
expect(res.length).toBe(2);
|
|
19
|
+
expect(typeof res[0]).toBe("string");
|
|
20
|
+
expect(res[1].length > 0).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("with match", () => {
|
|
25
|
+
test("returns cursor and members", async () => {
|
|
26
|
+
const key = newKey();
|
|
27
|
+
const member = randomID();
|
|
28
|
+
await new SAddCommand([key, member]).exec(client);
|
|
29
|
+
const res = await new SScanCommand([key, "0", { match: member }]).exec(client);
|
|
30
|
+
|
|
31
|
+
expect(res.length).toBe(2);
|
|
32
|
+
expect(typeof res[0]).toBe("string");
|
|
33
|
+
expect(res[1].length > 0).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("with count", () => {
|
|
38
|
+
test("returns cursor and members", async () => {
|
|
39
|
+
const key = newKey();
|
|
40
|
+
const member = randomID();
|
|
41
|
+
await new SAddCommand([key, member]).exec(client);
|
|
42
|
+
const res = await new SScanCommand([key, "0", { count: 1 }]).exec(client);
|
|
43
|
+
|
|
44
|
+
expect(res.length).toBe(2);
|
|
45
|
+
expect(typeof res[0]).toBe("string");
|
|
46
|
+
expect(res[1].length > 0).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { deserializeScanResponse } from "../util";
|
|
2
|
+
import type { CommandOptions } from "./command";
|
|
3
|
+
import { Command } from "./command";
|
|
4
|
+
import type { ScanCommandOptions } from "./scan";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @see https://redis.io/commands/sscan
|
|
8
|
+
*/
|
|
9
|
+
export class SScanCommand extends Command<
|
|
10
|
+
[string, (string | number)[]],
|
|
11
|
+
[string, (string | number)[]]
|
|
12
|
+
> {
|
|
13
|
+
constructor(
|
|
14
|
+
[key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions],
|
|
15
|
+
cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>
|
|
16
|
+
) {
|
|
17
|
+
const command: (number | string)[] = ["sscan", key, cursor];
|
|
18
|
+
if (opts?.match) {
|
|
19
|
+
command.push("match", opts.match);
|
|
20
|
+
}
|
|
21
|
+
if (typeof opts?.count === "number") {
|
|
22
|
+
command.push("count", opts.count);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
super(command, {
|
|
26
|
+
deserialize: deserializeScanResponse,
|
|
27
|
+
...cmdOpts,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { afterAll, expect, test } from "bun:test";
|
|
2
|
+
import { keygen, newHttpClient } from "../test-utils";
|
|
3
|
+
import { SetCommand } from "./set";
|
|
4
|
+
|
|
5
|
+
import { StrLenCommand } from "./strlen";
|
|
6
|
+
const client = newHttpClient();
|
|
7
|
+
|
|
8
|
+
const { newKey, cleanup } = keygen();
|
|
9
|
+
afterAll(cleanup);
|
|
10
|
+
|
|
11
|
+
test("returns the correct length", async () => {
|
|
12
|
+
const key = newKey();
|
|
13
|
+
const value = "abcd";
|
|
14
|
+
await new SetCommand([key, value]).exec(client);
|
|
15
|
+
const res = await new StrLenCommand([key]).exec(client);
|
|
16
|
+
expect(res).toEqual(value.length);
|
|
17
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see https://redis.io/commands/strlen
|
|
6
|
+
*/
|
|
7
|
+
export class StrLenCommand extends Command<number, number> {
|
|
8
|
+
constructor(cmd: [key: string], opts?: CommandOptions<number, number>) {
|
|
9
|
+
super(["strlen", ...cmd], opts);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { SAddCommand } from "./sadd";
|
|
5
|
+
import { SUnionCommand } from "./sunion";
|
|
6
|
+
const client = newHttpClient();
|
|
7
|
+
|
|
8
|
+
const { newKey, cleanup } = keygen();
|
|
9
|
+
afterAll(cleanup);
|
|
10
|
+
|
|
11
|
+
test("returns the union", async () => {
|
|
12
|
+
const key1 = newKey();
|
|
13
|
+
const key2 = newKey();
|
|
14
|
+
|
|
15
|
+
const member1 = randomID();
|
|
16
|
+
const member2 = randomID();
|
|
17
|
+
|
|
18
|
+
await new SAddCommand([key1, member1]).exec(client);
|
|
19
|
+
await new SAddCommand([key2, member2]).exec(client);
|
|
20
|
+
const res = await new SUnionCommand([key1, key2]).exec(client);
|
|
21
|
+
expect(res.sort()).toEqual([member1, member2].sort());
|
|
22
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see https://redis.io/commands/sunion
|
|
6
|
+
*/
|
|
7
|
+
export class SUnionCommand<TData> extends Command<string[], TData[]> {
|
|
8
|
+
constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions<string[], TData[]>) {
|
|
9
|
+
super(["sunion", ...cmd], opts);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { SAddCommand } from "./sadd";
|
|
5
|
+
|
|
6
|
+
import { SMembersCommand } from "./smembers";
|
|
7
|
+
import { SUnionStoreCommand } from "./sunionstore";
|
|
8
|
+
const client = newHttpClient();
|
|
9
|
+
|
|
10
|
+
const { newKey, cleanup } = keygen();
|
|
11
|
+
afterAll(cleanup);
|
|
12
|
+
|
|
13
|
+
test("writes the union to destination", async () => {
|
|
14
|
+
const key1 = newKey();
|
|
15
|
+
const key2 = newKey();
|
|
16
|
+
const dest = newKey();
|
|
17
|
+
|
|
18
|
+
const member1 = randomID();
|
|
19
|
+
const member2 = randomID();
|
|
20
|
+
|
|
21
|
+
await new SAddCommand([key1, member1]).exec(client);
|
|
22
|
+
await new SAddCommand([key2, member2]).exec(client);
|
|
23
|
+
const res = await new SUnionStoreCommand([dest, key1, key2]).exec(client);
|
|
24
|
+
expect(res).toEqual(2);
|
|
25
|
+
|
|
26
|
+
const res2 = await new SMembersCommand([dest]).exec(client);
|
|
27
|
+
|
|
28
|
+
expect(res2).toBeTruthy();
|
|
29
|
+
expect(res2.sort()).toEqual([member1, member2].sort());
|
|
30
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see https://redis.io/commands/sunionstore
|
|
6
|
+
*/
|
|
7
|
+
export class SUnionStoreCommand extends Command<number, number> {
|
|
8
|
+
constructor(
|
|
9
|
+
cmd: [destination: string, key: string, ...keys: string[]],
|
|
10
|
+
opts?: CommandOptions<number, number>
|
|
11
|
+
) {
|
|
12
|
+
super(["sunionstore", ...cmd], opts);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { newHttpClient } from "../test-utils";
|
|
3
|
+
|
|
4
|
+
import { TimeCommand } from "./time";
|
|
5
|
+
const client = newHttpClient();
|
|
6
|
+
|
|
7
|
+
test("returns the time", async () => {
|
|
8
|
+
const res = await new TimeCommand().exec(client);
|
|
9
|
+
|
|
10
|
+
expect(typeof res[0]).toBe("number");
|
|
11
|
+
expect(typeof res[1]).toBe("number");
|
|
12
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
/**
|
|
4
|
+
* @see https://redis.io/commands/time
|
|
5
|
+
*/
|
|
6
|
+
export class TimeCommand extends Command<[number, number], [number, number]> {
|
|
7
|
+
constructor(opts?: CommandOptions<[number, number], [number, number]>) {
|
|
8
|
+
super(["time"], opts);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { MSetCommand } from "./mset";
|
|
5
|
+
import { TouchCommand } from "./touch";
|
|
6
|
+
|
|
7
|
+
const client = newHttpClient();
|
|
8
|
+
|
|
9
|
+
const { newKey, cleanup } = keygen();
|
|
10
|
+
afterAll(cleanup);
|
|
11
|
+
|
|
12
|
+
test("returns the number of touched keys", async () => {
|
|
13
|
+
const key1 = newKey();
|
|
14
|
+
const key2 = newKey();
|
|
15
|
+
const kv: Record<string, string> = {};
|
|
16
|
+
kv[key1] = randomID();
|
|
17
|
+
kv[key2] = randomID();
|
|
18
|
+
await new MSetCommand([kv]).exec(client);
|
|
19
|
+
const res = await new TouchCommand([key1, key2]).exec(client);
|
|
20
|
+
expect(res).toEqual(2);
|
|
21
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see https://redis.io/commands/touch
|
|
6
|
+
*/
|
|
7
|
+
export class TouchCommand extends Command<number, number> {
|
|
8
|
+
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>) {
|
|
9
|
+
super(["touch", ...cmd], opts);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { keygen, newHttpClient } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { SetExCommand } from "./setex";
|
|
5
|
+
import { TtlCommand } from "./ttl";
|
|
6
|
+
const client = newHttpClient();
|
|
7
|
+
|
|
8
|
+
const { newKey, cleanup } = keygen();
|
|
9
|
+
afterAll(cleanup);
|
|
10
|
+
|
|
11
|
+
test("returns the ttl on a key", async () => {
|
|
12
|
+
const key = newKey();
|
|
13
|
+
const ttl = 60;
|
|
14
|
+
await new SetExCommand([key, ttl, "value"]).exec(client);
|
|
15
|
+
const res = await new TtlCommand([key]).exec(client);
|
|
16
|
+
expect(res).toEqual(ttl);
|
|
17
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see https://redis.io/commands/ttl
|
|
6
|
+
*/
|
|
7
|
+
export class TtlCommand extends Command<number, number> {
|
|
8
|
+
constructor(cmd: [key: string], opts?: CommandOptions<number, number>) {
|
|
9
|
+
super(["ttl", ...cmd], opts);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { keygen, newHttpClient, randomID } from "../test-utils";
|
|
2
|
+
|
|
3
|
+
import { afterAll, expect, test } from "bun:test";
|
|
4
|
+
import { HSetCommand } from "./hset";
|
|
5
|
+
import { LPushCommand } from "./lpush";
|
|
6
|
+
import { SAddCommand } from "./sadd";
|
|
7
|
+
import { SetCommand } from "./set";
|
|
8
|
+
import { TypeCommand } from "./type";
|
|
9
|
+
import { ZAddCommand } from "./zadd";
|
|
10
|
+
const client = newHttpClient();
|
|
11
|
+
|
|
12
|
+
const { newKey, cleanup } = keygen();
|
|
13
|
+
afterAll(cleanup);
|
|
14
|
+
|
|
15
|
+
test("string", () => {
|
|
16
|
+
test("returns the correct type", async () => {
|
|
17
|
+
const key = newKey();
|
|
18
|
+
const value = randomID();
|
|
19
|
+
await new SetCommand([key, value]).exec(client);
|
|
20
|
+
const res = await new TypeCommand([key]).exec(client);
|
|
21
|
+
expect(res).toEqual("string");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("list", () => {
|
|
26
|
+
test("returns the correct type", async () => {
|
|
27
|
+
const key = newKey();
|
|
28
|
+
const value = randomID();
|
|
29
|
+
await new LPushCommand([key, value]).exec(client);
|
|
30
|
+
const res = await new TypeCommand([key]).exec(client);
|
|
31
|
+
expect(res).toEqual("list");
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("set", () => {
|
|
36
|
+
test("returns the correct type", async () => {
|
|
37
|
+
const key = newKey();
|
|
38
|
+
const value = randomID();
|
|
39
|
+
await new SAddCommand([key, value]).exec(client);
|
|
40
|
+
const res = await new TypeCommand([key]).exec(client);
|
|
41
|
+
expect(res).toEqual("set");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("hash", () => {
|
|
46
|
+
test("returns the correct type", async () => {
|
|
47
|
+
const key = newKey();
|
|
48
|
+
const field = randomID();
|
|
49
|
+
const value = randomID();
|
|
50
|
+
await new HSetCommand([key, { [field]: value }]).exec(client);
|
|
51
|
+
const res = await new TypeCommand([key]).exec(client);
|
|
52
|
+
expect(res).toEqual("hash");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("zset", () => {
|
|
57
|
+
test("returns the correct type", async () => {
|
|
58
|
+
const key = newKey();
|
|
59
|
+
const member = randomID();
|
|
60
|
+
await new ZAddCommand([key, { score: 0, member }]).exec(client);
|
|
61
|
+
const res = await new TypeCommand([key]).exec(client);
|
|
62
|
+
expect(res).toEqual("zset");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("none", () => {
|
|
67
|
+
test("returns the correct type", async () => {
|
|
68
|
+
const key = newKey();
|
|
69
|
+
const res = await new TypeCommand([key]).exec(client);
|
|
70
|
+
expect(res).toEqual("none");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CommandOptions } from "./command";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
|
|
4
|
+
export type Type = "string" | "list" | "set" | "zset" | "hash" | "none";
|
|
5
|
+
/**
|
|
6
|
+
* @see https://redis.io/commands/type
|
|
7
|
+
*/
|
|
8
|
+
export class TypeCommand extends Command<Type, Type> {
|
|
9
|
+
constructor(cmd: [key: string], opts?: CommandOptions<Type, Type>) {
|
|
10
|
+
super(["type", ...cmd], opts);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export { type AppendCommand } from "./append";
|
|
2
|
+
export { type BitCountCommand } from "./bitcount";
|
|
3
|
+
export { type BitOpCommand } from "./bitop";
|
|
4
|
+
export { type BitPosCommand } from "./bitpos";
|
|
5
|
+
export { type CopyCommand } from "./copy";
|
|
6
|
+
export { type DBSizeCommand } from "./dbsize";
|
|
7
|
+
export { type DecrCommand } from "./decr";
|
|
8
|
+
export { type DecrByCommand } from "./decrby";
|
|
9
|
+
export { type DelCommand } from "./del";
|
|
10
|
+
export { type EchoCommand } from "./echo";
|
|
11
|
+
export { type EvalCommand } from "./eval";
|
|
12
|
+
export { type EvalshaCommand } from "./evalsha";
|
|
13
|
+
export { type ExistsCommand } from "./exists";
|
|
14
|
+
export { type ExpireCommand } from "./expire";
|
|
15
|
+
export { type ExpireAtCommand } from "./expireat";
|
|
16
|
+
export { type FlushAllCommand } from "./flushall";
|
|
17
|
+
export { type FlushDBCommand } from "./flushdb";
|
|
18
|
+
export { type GeoAddCommand, GeoAddCommandOptions, GeoMember } from "./geo_add";
|
|
19
|
+
export { type GeoDistCommand } from "./geo_dist";
|
|
20
|
+
export { type GeoHashCommand } from "./geo_hash";
|
|
21
|
+
export { type GeoPosCommand } from "./geo_pos";
|
|
22
|
+
export { type GeoSearchCommand } from "./geo_search";
|
|
23
|
+
export { type GeoSearchStoreCommand } from "./geo_search_store";
|
|
24
|
+
export { type GetCommand } from "./get";
|
|
25
|
+
export { type GetBitCommand } from "./getbit";
|
|
26
|
+
export { type GetDelCommand } from "./getdel";
|
|
27
|
+
export { type GetRangeCommand } from "./getrange";
|
|
28
|
+
export { type GetSetCommand } from "./getset";
|
|
29
|
+
export { type HDelCommand } from "./hdel";
|
|
30
|
+
export { type HExistsCommand } from "./hexists";
|
|
31
|
+
export { type HGetCommand } from "./hget";
|
|
32
|
+
export { type HGetAllCommand } from "./hgetall";
|
|
33
|
+
export { type HIncrByCommand } from "./hincrby";
|
|
34
|
+
export { type HIncrByFloatCommand } from "./hincrbyfloat";
|
|
35
|
+
export { type HKeysCommand } from "./hkeys";
|
|
36
|
+
export { type HLenCommand } from "./hlen";
|
|
37
|
+
export { type HMGetCommand } from "./hmget";
|
|
38
|
+
export { type HMSetCommand } from "./hmset";
|
|
39
|
+
export { type HRandFieldCommand } from "./hrandfield";
|
|
40
|
+
export { type HScanCommand } from "./hscan";
|
|
41
|
+
export { type HSetCommand } from "./hset";
|
|
42
|
+
export { type HSetNXCommand } from "./hsetnx";
|
|
43
|
+
export { type HStrLenCommand } from "./hstrlen";
|
|
44
|
+
export { type HValsCommand } from "./hvals";
|
|
45
|
+
export { type IncrCommand } from "./incr";
|
|
46
|
+
export { type IncrByCommand } from "./incrby";
|
|
47
|
+
export { type IncrByFloatCommand } from "./incrbyfloat";
|
|
48
|
+
export { type JsonArrAppendCommand } from "./json_arrappend";
|
|
49
|
+
export { type JsonArrIndexCommand } from "./json_arrindex";
|
|
50
|
+
export { type JsonArrInsertCommand } from "./json_arrinsert";
|
|
51
|
+
export { type JsonArrLenCommand } from "./json_arrlen";
|
|
52
|
+
export { type JsonArrPopCommand } from "./json_arrpop";
|
|
53
|
+
export { type JsonArrTrimCommand } from "./json_arrtrim";
|
|
54
|
+
export { type JsonClearCommand } from "./json_clear";
|
|
55
|
+
export { type JsonDelCommand } from "./json_del";
|
|
56
|
+
export { type JsonForgetCommand } from "./json_forget";
|
|
57
|
+
export { type JsonGetCommand } from "./json_get";
|
|
58
|
+
export { type JsonMGetCommand } from "./json_mget";
|
|
59
|
+
export { type JsonNumIncrByCommand } from "./json_numincrby";
|
|
60
|
+
export { type JsonNumMultByCommand } from "./json_nummultby";
|
|
61
|
+
export { type JsonObjKeysCommand } from "./json_objkeys";
|
|
62
|
+
export { type JsonObjLenCommand } from "./json_objlen";
|
|
63
|
+
export { type JsonRespCommand } from "./json_resp";
|
|
64
|
+
export { type JsonSetCommand } from "./json_set";
|
|
65
|
+
export { type JsonStrAppendCommand } from "./json_strappend";
|
|
66
|
+
export { type JsonStrLenCommand } from "./json_strlen";
|
|
67
|
+
export { type JsonToggleCommand } from "./json_toggle";
|
|
68
|
+
export { type JsonTypeCommand } from "./json_type";
|
|
69
|
+
export { type KeysCommand } from "./keys";
|
|
70
|
+
export { type LIndexCommand } from "./lindex";
|
|
71
|
+
export { type LInsertCommand } from "./linsert";
|
|
72
|
+
export { type LLenCommand } from "./llen";
|
|
73
|
+
export { type LMoveCommand } from "./lmove";
|
|
74
|
+
export { type LPopCommand } from "./lpop";
|
|
75
|
+
export { type LPushCommand } from "./lpush";
|
|
76
|
+
export { type LPushXCommand } from "./lpushx";
|
|
77
|
+
export { type LRangeCommand } from "./lrange";
|
|
78
|
+
export { type LRemCommand } from "./lrem";
|
|
79
|
+
export { type LSetCommand } from "./lset";
|
|
80
|
+
export { type LTrimCommand } from "./ltrim";
|
|
81
|
+
export { type MGetCommand } from "./mget";
|
|
82
|
+
export { type MSetCommand } from "./mset";
|
|
83
|
+
export { type MSetNXCommand } from "./msetnx";
|
|
84
|
+
export { type PersistCommand } from "./persist";
|
|
85
|
+
export { type PExpireCommand } from "./pexpire";
|
|
86
|
+
export { type PExpireAtCommand } from "./pexpireat";
|
|
87
|
+
export { type PingCommand } from "./ping";
|
|
88
|
+
export { type PSetEXCommand } from "./psetex";
|
|
89
|
+
export { type PTtlCommand } from "./pttl";
|
|
90
|
+
export { type PublishCommand } from "./publish";
|
|
91
|
+
export { type RandomKeyCommand } from "./randomkey";
|
|
92
|
+
export { type RenameCommand } from "./rename";
|
|
93
|
+
export { type RenameNXCommand } from "./renamenx";
|
|
94
|
+
export { type RPopCommand } from "./rpop";
|
|
95
|
+
export { type RPushCommand } from "./rpush";
|
|
96
|
+
export { type RPushXCommand } from "./rpushx";
|
|
97
|
+
export { type SAddCommand } from "./sadd";
|
|
98
|
+
export { type ScanCommand, ScanCommandOptions } from "./scan";
|
|
99
|
+
export { type SCardCommand } from "./scard";
|
|
100
|
+
export { type ScriptExistsCommand } from "./script_exists";
|
|
101
|
+
export { type ScriptFlushCommand } from "./script_flush";
|
|
102
|
+
export { type ScriptLoadCommand } from "./script_load";
|
|
103
|
+
export { type SDiffCommand } from "./sdiff";
|
|
104
|
+
export { type SDiffStoreCommand } from "./sdiffstore";
|
|
105
|
+
export { type SetCommand, SetCommandOptions } from "./set";
|
|
106
|
+
export { type SetBitCommand } from "./setbit";
|
|
107
|
+
export { type SetExCommand } from "./setex";
|
|
108
|
+
export { type SetNxCommand } from "./setnx";
|
|
109
|
+
export { type SetRangeCommand } from "./setrange";
|
|
110
|
+
export { type SInterCommand } from "./sinter";
|
|
111
|
+
export { type SInterStoreCommand } from "./sinterstore";
|
|
112
|
+
export { type SIsMemberCommand } from "./sismember";
|
|
113
|
+
export { type SMembersCommand } from "./smembers";
|
|
114
|
+
export { type SMIsMemberCommand } from "./smismember";
|
|
115
|
+
export { type SMoveCommand } from "./smove";
|
|
116
|
+
export { type SPopCommand } from "./spop";
|
|
117
|
+
export { type SRandMemberCommand } from "./srandmember";
|
|
118
|
+
export { type SRemCommand } from "./srem";
|
|
119
|
+
export { type SScanCommand } from "./sscan";
|
|
120
|
+
export { type StrLenCommand } from "./strlen";
|
|
121
|
+
export { type SUnionCommand } from "./sunion";
|
|
122
|
+
export { type SUnionStoreCommand } from "./sunionstore";
|
|
123
|
+
export { type TimeCommand } from "./time";
|
|
124
|
+
export { type TouchCommand } from "./touch";
|
|
125
|
+
export { type TtlCommand } from "./ttl";
|
|
126
|
+
export { Type, type TypeCommand } from "./type";
|
|
127
|
+
export { type UnlinkCommand } from "./unlink";
|
|
128
|
+
export { type XAddCommand } from "./xadd";
|
|
129
|
+
export { type XRangeCommand } from "./xrange";
|
|
130
|
+
export { ScoreMember, ZAddCommandOptions, type ZAddCommand } from "./zadd";
|
|
131
|
+
export { type ZCardCommand } from "./zcard";
|
|
132
|
+
export { type ZCountCommand } from "./zcount";
|
|
133
|
+
export { type ZDiffStoreCommand } from "./zdiffstore";
|
|
134
|
+
export { type ZIncrByCommand } from "./zincrby";
|
|
135
|
+
export { type ZInterStoreCommand, ZInterStoreCommandOptions } from "./zinterstore";
|
|
136
|
+
export { type ZLexCountCommand } from "./zlexcount";
|
|
137
|
+
export { type ZMScoreCommand } from "./zmscore";
|
|
138
|
+
export { type ZPopMaxCommand } from "./zpopmax";
|
|
139
|
+
export { type ZPopMinCommand } from "./zpopmin";
|
|
140
|
+
export { type ZRangeCommand, ZRangeCommandOptions } from "./zrange";
|
|
141
|
+
export { type ZRankCommand } from "./zrank";
|
|
142
|
+
export { type ZRemCommand } from "./zrem";
|
|
143
|
+
export { type ZRemRangeByLexCommand } from "./zremrangebylex";
|
|
144
|
+
export { type ZRemRangeByRankCommand } from "./zremrangebyrank";
|
|
145
|
+
export { type ZRemRangeByScoreCommand } from "./zremrangebyscore";
|
|
146
|
+
export { type ZRevRankCommand } from "./zrevrank";
|
|
147
|
+
export { type ZScanCommand } from "./zscan";
|
|
148
|
+
export { type ZScoreCommand } from "./zscore";
|
|
149
|
+
export { type ZUnionCommand, ZUnionCommandOptions } from "./zunion";
|
|
150
|
+
export { type ZUnionStoreCommand, ZUnionStoreCommandOptions } from "./zunionstore";
|