├── .gitattributes
├── sources
├── command
│ ├── utils
│ │ └── index.ts
│ ├── basic.ts
│ ├── save.ts
│ ├── reset.ts
│ ├── flushdb.ts
│ ├── unwatch.ts
│ ├── acl.save.ts
│ ├── flushall.ts
│ ├── bgrewriteaof.ts
│ ├── script.kill.ts
│ ├── function.kill.ts
│ ├── memory.purge.ts
│ ├── slowlog.reset.ts
│ ├── sync.ts
│ ├── acl.whoami.ts
│ ├── client.unpause.ts
│ ├── config.rewrite.ts
│ ├── dbsize.ts
│ ├── acl.help.ts
│ ├── acl.list.ts
│ ├── acl.users.ts
│ ├── config.resetstat.ts
│ ├── lastsave.ts
│ ├── client.id.ts
│ ├── slowlog.len.ts
│ ├── client.info.ts
│ ├── command.count.ts
│ ├── pubsub.numpat.ts
│ ├── select.ts
│ ├── ttl.ts
│ ├── watch.ts
│ ├── client.getredir.ts
│ ├── decr.ts
│ ├── function.dump.ts
│ ├── hlen.ts
│ ├── incr.ts
│ ├── llen.ts
│ ├── memory.doctor.ts
│ ├── pttl.ts
│ ├── scard.ts
│ ├── xlen.ts
│ ├── zcard.ts
│ ├── client.help.ts
│ ├── client.kill.ts
│ ├── config.help.ts
│ ├── latency.doctor.ts
│ ├── memory.help.ts
│ ├── module.help.ts
│ ├── module.unload.ts
│ ├── object.help.ts
│ ├── pubsub.help.ts
│ ├── randomkey.ts
│ ├── script.help.ts
│ ├── strlen.ts
│ ├── xinfo.help.ts
│ ├── bf.card.ts
│ ├── command.help.ts
│ ├── latency.help.ts
│ ├── persist.ts
│ ├── slowlog.help.ts
│ ├── del.ts
│ ├── expiretime.ts
│ ├── memory.malloc-stats.ts
│ ├── touch.ts
│ ├── unlink.ts
│ ├── client.getname.ts
│ ├── client.trackinginfo.ts
│ ├── dump.ts
│ ├── echo.ts
│ ├── get.ts
│ ├── hkeys.ts
│ ├── hvals.ts
│ ├── lpop.ts
│ ├── pexpiretime.ts
│ ├── pfcount.ts
│ ├── rpop.ts
│ ├── spop.ts
│ ├── exists.ts
│ ├── function.delete.ts
│ ├── smembers.ts
│ ├── append.ts
│ ├── getdel.ts
│ ├── rename.ts
│ ├── replicaof.ts
│ ├── script.load.ts
│ ├── client.setname.ts
│ ├── swapdb.ts
│ ├── move.ts
│ ├── httl.ts
│ ├── keys.ts
│ ├── hpttl.ts
│ ├── script.debug.ts
│ ├── sdiff.ts
│ ├── acl.deluser.ts
│ ├── cf.count.ts
│ ├── client.caching.ts
│ ├── client.no-evict.ts
│ ├── client.no-touch.ts
│ ├── hexists.ts
│ ├── hstrlen.ts
│ ├── object.encoding.ts
│ ├── sinter.ts
│ ├── sunion.ts
│ ├── xdel.ts
│ ├── getbit.ts
│ ├── hpersist.ts
│ ├── hgetall.ts
│ ├── renamenx.ts
│ ├── sismember.ts
│ ├── subscribe.ts
│ ├── client.reply.ts
│ ├── hexpiretime.ts
│ ├── hpexpiretime.ts
│ ├── psubscribe.ts
│ ├── ssubscribe.ts
│ ├── unsubscribe.ts
│ ├── xtrim.ts
│ ├── config.set.ts
│ ├── mget.ts
│ ├── punsubscribe.ts
│ ├── sunsubscribe.ts
│ ├── bgsave.ts
│ ├── acl.genpass.ts
│ ├── bf.add.ts
│ ├── cf.add.ts
│ ├── cf.del.ts
│ ├── hget.ts
│ ├── script.exists.ts
│ ├── bf.exists.ts
│ ├── cf.addnx.ts
│ ├── cf.exists.ts
│ ├── expire.ts
│ ├── hdel.ts
│ ├── pfadd.ts
│ ├── sadd.ts
│ ├── srem.ts
│ ├── zrem.ts
│ ├── decrby.ts
│ ├── incrby.ts
│ ├── lpushx.ts
│ ├── pfmerge.ts
│ ├── ping.ts
│ ├── acl.setuser.ts
│ ├── bf.madd.ts
│ ├── client.setinfo.ts
│ ├── lpush.ts
│ ├── publish.ts
│ ├── rpush.ts
│ ├── latency.graph.ts
│ ├── lindex.ts
│ ├── ltrim.ts
│ ├── spublish.ts
│ ├── bf.mexists.ts
│ ├── lset.ts
│ ├── incrbyfloat.ts
│ ├── setnx.ts
│ ├── xgroup.destroy.ts
│ ├── replconf.ts
│ ├── sdiffstore.ts
│ ├── wait.ts
│ ├── xack.ts
│ ├── zcount.ts
│ ├── zlexcount.ts
│ ├── acl.cat.ts
│ ├── function.flush.ts
│ ├── sinterstore.ts
│ ├── sunionstore.ts
│ ├── bf.loadchunk.ts
│ ├── cf.loadchunk.ts
│ ├── debug.ts
│ ├── ts.deleterule.ts
│ ├── zadd.ts
│ ├── lrem.ts
│ ├── zremrangebylex.ts
│ ├── getrange.ts
│ ├── hexpire.ts
│ ├── zdiffstore.ts
│ ├── config.get.ts
│ ├── object.freq.ts
│ ├── rpoplpush.ts
│ ├── hincrby.ts
│ ├── json.del.ts
│ ├── json.toggle.ts
│ ├── lrange.ts
│ ├── zremrangebyscore.ts
│ ├── zrevrangebylex.ts
│ ├── hexpireat.ts
│ ├── json.clear.ts
│ ├── zincrby.ts
│ ├── zrevrange.ts
│ ├── hmget.ts
│ ├── json.forget.ts
│ ├── json.mget.ts
│ ├── object.idletime.ts
│ ├── object.refcount.ts
│ ├── command.getkeys.ts
│ ├── zrevrangebyscore.ts
│ ├── hincrbyfloat.ts
│ ├── rpushx.ts
│ ├── json.numincrby.ts
│ ├── json.nummultby.ts
│ ├── msetnx.ts
│ ├── pubsub.channels.ts
│ ├── smove.ts
│ ├── hpexpire.ts
│ ├── setbit.ts
│ ├── smismember.ts
│ ├── pubsub.shardchannels.ts
│ ├── evalsha.ts
│ ├── sintercard.ts
│ ├── acl.dryrun.ts
│ ├── eval.ro.ts
│ ├── eval.ts
│ ├── module.load.ts
│ ├── evalsha.ro.ts
│ ├── json.mset.ts
│ ├── latency.reset.ts
│ ├── setex.ts
│ ├── ts.del.ts
│ ├── hset.ts
│ ├── json.arrappend.ts
│ ├── zrank.ts
│ ├── zscore.ts
│ ├── hpexpireat.ts
│ ├── hsetnx.ts
│ ├── xgroup.delconsumer.ts
│ ├── brpoplpush.ts
│ ├── function.load.ts
│ ├── mset.ts
│ ├── psetex.ts
│ ├── zrevrank.ts
│ ├── json.merge.ts
│ ├── xgroup.createconsumer.ts
│ ├── setrange.ts
│ ├── ts.alter.ts
│ ├── ts.create.ts
│ ├── fcall.ts
│ ├── fcall.ro.ts
│ ├── json.arrlen.ts
│ ├── json.objkeys.ts
│ ├── json.objlen.ts
│ ├── json.strlen.ts
│ ├── script.flush.ts
│ ├── xadd.ts
│ ├── json.resp.ts
│ ├── get.buffer.ts
│ ├── auth.ts
│ ├── module.list.ts
│ ├── json.arrinsert.ts
│ ├── expireat.ts
│ ├── xrange.ts
│ ├── client.pause.ts
│ ├── ts.madd.ts
│ ├── json.strappend.ts
│ ├── linsert.ts
│ ├── json.arrpop.ts
│ ├── pexpire.ts
│ ├── xgroup.setid.ts
│ ├── json.arrtrim.ts
│ ├── lolwut.ts
│ ├── time.ts
│ ├── ts.decrby.ts
│ ├── ts.incrby.ts
│ ├── bitop.ts
│ ├── getset.ts
│ ├── pexpireat.ts
│ ├── cf.mexists.ts
│ ├── pipeline.ts
│ ├── bitfield.ro.ts
│ ├── zinterstore.ts
│ ├── client.list.ts
│ ├── lmove.ts
│ ├── zunionstore.ts
│ ├── xgroup.help.ts
│ ├── function.help.ts
│ ├── geodist.ts
│ ├── zrangebylex.ts
│ ├── ts.add.ts
│ ├── srandmember.ts
│ ├── command.list.ts
│ ├── ts.info.ts
│ ├── xsetid.ts
│ ├── module.loadex.ts
│ ├── ts.queryindex.ts
│ ├── function.restore.ts
│ ├── xrevrange.ts
│ ├── client.unblock.ts
│ ├── zintercard.ts
│ ├── blmove.ts
│ ├── hmset.ts
│ ├── shutdown.ts
│ ├── xgroup.create.ts
│ ├── bitcount.ts
│ ├── copy.ts
│ ├── bf.reserve.ts
│ ├── zrangestore.ts
│ ├── scan.ts
│ ├── type.ts
│ ├── pubsub.numsub.ts
│ ├── sscan.ts
│ ├── bf.scandump.ts
│ ├── json.arrindex.ts
│ ├── bitpos.ts
│ ├── ts.createrule.ts
│ ├── cf.reserve.ts
│ ├── pubsub.shardnumsub.ts
│ ├── geohash.ts
│ ├── json.set.ts
│ ├── cf.insert.ts
│ ├── cf.insertnx.ts
│ ├── blpop.ts
│ ├── brpop.ts
│ ├── failover.ts
│ ├── json.get.ts
│ ├── geosearchstore.ts
│ └── geoadd.ts
├── common
│ ├── index.ts
│ └── utils
│ │ ├── index.ts
│ │ └── debug.ts
├── types
│ └── index.ts
└── index.ts
├── website
├── app
│ ├── favicon.ico
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── apple-touch-icon.png
│ ├── android-chrome-192x192.png
│ └── android-chrome-512x512.png
├── postcss.config.mjs
├── public
│ ├── vercel.svg
│ ├── window.svg
│ ├── file.svg
│ └── globe.svg
├── next.config.ts
├── lib
│ └── utils.ts
├── next-env.d.ts
├── i18n
│ └── request.ts
├── components.json
├── tsconfig.json
└── components
│ └── language-switcher.tsx
├── scripts
└── esm
│ └── register.js
├── .npmignore
├── .vscode
├── extensions.json
└── settings.json
├── .editorconfig
├── .gitignore
├── tsconfig.json
└── .github
└── workflows
└── build.yaml
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto eol=lf
2 |
--------------------------------------------------------------------------------
/sources/command/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from './command.ts';
2 | export * from './reply.ts';
3 |
--------------------------------------------------------------------------------
/sources/common/index.ts:
--------------------------------------------------------------------------------
1 | export * from './constants.ts';
2 | export * from './utils/index.ts';
3 |
--------------------------------------------------------------------------------
/website/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vcms-io/solidis/HEAD/website/app/favicon.ico
--------------------------------------------------------------------------------
/website/app/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vcms-io/solidis/HEAD/website/app/favicon-16x16.png
--------------------------------------------------------------------------------
/website/app/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vcms-io/solidis/HEAD/website/app/favicon-32x32.png
--------------------------------------------------------------------------------
/scripts/esm/register.js:
--------------------------------------------------------------------------------
1 | import { register } from 'node:module';
2 |
3 | register('./loader.js', import.meta.url);
4 |
--------------------------------------------------------------------------------
/website/app/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vcms-io/solidis/HEAD/website/app/apple-touch-icon.png
--------------------------------------------------------------------------------
/sources/types/index.ts:
--------------------------------------------------------------------------------
1 | export * from './command.ts';
2 | export * from './resp.ts';
3 | export * from './solidis.ts';
4 |
--------------------------------------------------------------------------------
/website/app/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vcms-io/solidis/HEAD/website/app/android-chrome-192x192.png
--------------------------------------------------------------------------------
/website/app/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vcms-io/solidis/HEAD/website/app/android-chrome-512x512.png
--------------------------------------------------------------------------------
/website/postcss.config.mjs:
--------------------------------------------------------------------------------
1 | const config = {
2 | plugins: ["@tailwindcss/postcss"],
3 | };
4 |
5 | export default config;
6 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | *
2 |
3 | !LICENSE
4 | !README.md
5 | !package.json
6 |
7 | !distributions/**
8 |
9 | distributions/tsconfig.tsbuildinfo
10 |
--------------------------------------------------------------------------------
/website/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sources/common/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from './debug.ts';
2 | export * from './error.ts';
3 | export * from './reply.ts';
4 | export * from './request.ts';
5 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "biomejs.biome",
4 | "ms-vscode.vscode-typescript-next",
5 | "github.vscode-github-actions"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/sources/command/basic.ts:
--------------------------------------------------------------------------------
1 | export { auth } from './auth.ts';
2 | export { hello } from './hello.ts';
3 | export { info } from './info.ts';
4 | export { select } from './select.ts';
5 |
--------------------------------------------------------------------------------
/website/next.config.ts:
--------------------------------------------------------------------------------
1 | import type { NextConfig } from "next";
2 |
3 | const nextConfig: NextConfig = {
4 | /* config options here */
5 | };
6 |
7 | export default nextConfig;
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/website/lib/utils.ts:
--------------------------------------------------------------------------------
1 | import { clsx, type ClassValue } from "clsx"
2 | import { twMerge } from "tailwind-merge"
3 |
4 | export function cn(...inputs: ClassValue[]) {
5 | return twMerge(clsx(inputs))
6 | }
7 |
--------------------------------------------------------------------------------
/website/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
6 |
--------------------------------------------------------------------------------
/sources/command/save.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SAVE'];
5 | }
6 |
7 | export async function save(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/reset.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['RESET'];
5 | }
6 |
7 | export async function reset(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/flushdb.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['FLUSHDB'];
5 | }
6 |
7 | export async function flushdb(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/unwatch.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['UNWATCH'];
5 | }
6 |
7 | export async function unwatch(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/acl.save.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['ACL', 'SAVE'];
5 | }
6 |
7 | export async function aclSave(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/flushall.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['FLUSHALL'];
5 | }
6 |
7 | export async function flushall(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/bgrewriteaof.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['BGREWRITEAOF'];
5 | }
6 |
7 | export async function bgrewriteaof(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/script.kill.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SCRIPT', 'KILL'];
5 | }
6 |
7 | export async function scriptKill(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/function.kill.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['FUNCTION', 'KILL'];
5 | }
6 |
7 | export async function functionKill(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/memory.purge.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['MEMORY', 'PURGE'];
5 | }
6 |
7 | export async function memoryPurge(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/slowlog.reset.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SLOWLOG', 'RESET'];
5 | }
6 |
7 | export async function slowlogReset(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/sync.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SYNC'];
5 | }
6 |
7 | export async function sync(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/acl.whoami.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['ACL', 'WHOAMI'];
5 | }
6 |
7 | export async function aclWhoami(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.unpause.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'UNPAUSE'];
5 | }
6 |
7 | export async function clientUnpause(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/config.rewrite.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CONFIG', 'REWRITE'];
5 | }
6 |
7 | export async function configRewrite(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/dbsize.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['DBSIZE'];
5 | }
6 |
7 | export async function dbsize(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/acl.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['ACL', 'HELP'];
5 | }
6 |
7 | export async function aclHelp(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/acl.list.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['ACL', 'LIST'];
5 | }
6 |
7 | export async function aclList(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/acl.users.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['ACL', 'USERS'];
5 | }
6 |
7 | export async function aclUsers(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/config.resetstat.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CONFIG', 'RESETSTAT'];
5 | }
6 |
7 | export async function configResetstat(this: T) {
8 | return await executeCommand(this, createCommand(), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/lastsave.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['LASTSAVE'];
5 | }
6 |
7 | export async function lastsave(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/index.ts:
--------------------------------------------------------------------------------
1 | export * from './client.ts';
2 | export * from './common/index.ts';
3 | export * from './modules/connection.ts';
4 | export * from './modules/debug.ts';
5 | export * from './modules/parser.ts';
6 | export * from './modules/pubsub.ts';
7 | export * from './modules/requester.ts';
8 | export * from './types/index.ts';
9 |
--------------------------------------------------------------------------------
/sources/command/client.id.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'ID'];
5 | }
6 |
7 | export async function clientId(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/slowlog.len.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SLOWLOG', 'LEN'];
5 | }
6 |
7 | export async function slowlogLen(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.info.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'INFO'];
5 | }
6 |
7 | export async function clientInfo(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/command.count.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['COMMAND', 'COUNT'];
5 | }
6 |
7 | export async function commandCount(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/pubsub.numpat.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['PUBSUB', 'NUMPAT'];
5 | }
6 |
7 | export async function pubsubNumpat(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/select.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(index: number) {
4 | return ['SELECT', `${index}`];
5 | }
6 |
7 | export async function select(this: T, index: number) {
8 | return await executeCommand(this, createCommand(index), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/ttl.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['TTL', key];
5 | }
6 |
7 | export async function ttl(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/watch.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['WATCH', ...keys];
5 | }
6 |
7 | export async function watch(this: T, ...keys: string[]) {
8 | return await executeCommand(this, createCommand(...keys), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Distributions
2 | distributions
3 |
4 | # Windows
5 | Desktop.ini
6 | Thumbs.db
7 | $RECYCLE.BIN/
8 | *.lnk
9 |
10 | # Mac OS X
11 | .DS_Store
12 | .AppleDouble
13 | .LSOverride
14 | ._*
15 |
16 | # IDE
17 | .idea/
18 | *.swp
19 | *.swo
20 |
21 | # Node.js
22 | node_modules
23 |
24 | # Next.js
25 | .next/
26 | *.tsbuildinfo
27 |
--------------------------------------------------------------------------------
/sources/command/client.getredir.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'GETREDIR'];
5 | }
6 |
7 | export async function clientGetredir(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/decr.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['DECR', key];
5 | }
6 |
7 | export async function decr(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/function.dump.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['FUNCTION', 'DUMP'];
5 | }
6 |
7 | export async function functionDump(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/hlen.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['HLEN', key];
5 | }
6 |
7 | export async function hlen(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/incr.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['INCR', key];
5 | }
6 |
7 | export async function incr(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/llen.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['LLEN', key];
5 | }
6 |
7 | export async function llen(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/memory.doctor.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['MEMORY', 'DOCTOR'];
5 | }
6 |
7 | export async function memoryDoctor(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/pttl.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['PTTL', key];
5 | }
6 |
7 | export async function pttl(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/scard.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['SCARD', key];
5 | }
6 |
7 | export async function scard(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/xlen.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['XLEN', key];
5 | }
6 |
7 | export async function xlen(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/zcard.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['ZCARD', key];
5 | }
6 |
7 | export async function zcard(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'HELP'];
5 | }
6 |
7 | export async function clientHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.kill.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(id: number) {
4 | return ['CLIENT', 'KILL', 'ID', `${id}`];
5 | }
6 |
7 | export async function clientKill(this: T, id: number) {
8 | return await executeCommand(this, createCommand(id), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/config.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CONFIG', 'HELP'];
5 | }
6 |
7 | export async function configHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/latency.doctor.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['LATENCY', 'DOCTOR'];
5 | }
6 |
7 | export async function latencyDoctor(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/memory.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['MEMORY', 'HELP'];
5 | }
6 |
7 | export async function memoryHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/module.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['MODULE', 'HELP'];
5 | }
6 |
7 | export async function moduleHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/module.unload.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(name: string) {
4 | return ['MODULE', 'UNLOAD', name];
5 | }
6 |
7 | export async function moduleUnload(this: T, name: string) {
8 | return await executeCommand(this, createCommand(name), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/object.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['OBJECT', 'HELP'];
5 | }
6 |
7 | export async function objectHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/pubsub.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['PUBSUB', 'HELP'];
5 | }
6 |
7 | export async function pubsubHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/randomkey.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['RANDOMKEY'];
5 | }
6 |
7 | export async function randomkey(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/script.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SCRIPT', 'HELP'];
5 | }
6 |
7 | export async function scriptHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/strlen.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['STRLEN', key];
5 | }
6 |
7 | export async function strlen(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/xinfo.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['XINFO', 'HELP'];
5 | }
6 |
7 | export async function xinfoHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/bf.card.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['BF.CARD', key];
5 | }
6 |
7 | export async function bfCard(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/command.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['COMMAND', 'HELP'];
5 | }
6 |
7 | export async function commandHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/latency.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['LATENCY', 'HELP'];
5 | }
6 |
7 | export async function latencyHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/persist.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['PERSIST', key];
5 | }
6 |
7 | export async function persist(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/slowlog.help.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['SLOWLOG', 'HELP'];
5 | }
6 |
7 | export async function slowlogHelp(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/del.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['DEL', ...keys];
5 | }
6 |
7 | export async function del(this: T, ...keys: string[]): Promise {
8 | return await executeCommand(this, createCommand(...keys), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/expiretime.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['EXPIRETIME', key];
5 | }
6 |
7 | export async function expiretime(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/memory.malloc-stats.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['MEMORY', 'MALLOC-STATS'];
5 | }
6 |
7 | export async function memoryMallocStats(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/touch.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(keys: string[]) {
4 | return ['TOUCH', ...keys];
5 | }
6 |
7 | export async function touch(this: T, keys: string[]): Promise {
8 | return await executeCommand(this, createCommand(keys), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/unlink.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(keys: string[]) {
4 | return ['UNLINK', ...keys];
5 | }
6 |
7 | export async function unlink(this: T, keys: string[]): Promise {
8 | return await executeCommand(this, createCommand(keys), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.getname.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'GETNAME'];
5 | }
6 |
7 | export async function clientGetname(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.trackinginfo.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand() {
4 | return ['CLIENT', 'TRACKINGINFO'];
5 | }
6 |
7 | export async function clientTrackinginfo(this: T): Promise {
8 | return await executeCommand(this, createCommand(), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/dump.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['DUMP', key];
5 | }
6 |
7 | export async function dump(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/echo.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand(message: string) {
4 | return ['ECHO', message];
5 | }
6 |
7 | export async function echo(this: T, message: string): Promise {
8 | return await executeCommand(this, createCommand(message), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/get.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['GET', key];
5 | }
6 |
7 | export async function get(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/hkeys.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['HKEYS', key];
5 | }
6 |
7 | export async function hkeys(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/hvals.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['HVALS', key];
5 | }
6 |
7 | export async function hvals(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/lpop.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['LPOP', key];
5 | }
6 |
7 | export async function lpop(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/pexpiretime.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['PEXPIRETIME', key];
5 | }
6 |
7 | export async function pexpiretime(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/pfcount.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(keys: string[]) {
4 | return ['PFCOUNT', ...keys];
5 | }
6 |
7 | export async function pfcount(this: T, keys: string[]): Promise {
8 | return await executeCommand(this, createCommand(keys), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/rpop.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['RPOP', key];
5 | }
6 |
7 | export async function rpop(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/spop.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['SPOP', key];
5 | }
6 |
7 | export async function spop(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/exists.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['EXISTS', ...keys];
5 | }
6 |
7 | export async function exists(this: T, ...keys: string[]): Promise {
8 | return await executeCommand(this, createCommand(...keys), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/function.delete.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(library: string) {
4 | return ['FUNCTION', 'DELETE', library];
5 | }
6 |
7 | export async function functionDelete(this: T, library: string) {
8 | return await executeCommand(this, createCommand(library), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/smembers.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['SMEMBERS', key];
5 | }
6 |
7 | export async function smembers(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringArray);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/append.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, value: string) {
4 | return ['APPEND', key, value];
5 | }
6 |
7 | export async function append(this: T, key: string, value: string) {
8 | return await executeCommand(this, createCommand(key, value), tryReplyNumber);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/getdel.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['GETDEL', key];
5 | }
6 |
7 | export async function getdel(this: T, key: string): Promise {
8 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/rename.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, newkey: string) {
4 | return ['RENAME', key, newkey];
5 | }
6 |
7 | export async function rename(this: T, key: string, newkey: string) {
8 | return await executeCommand(this, createCommand(key, newkey), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/replicaof.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(host: string, port: number) {
4 | return ['REPLICAOF', host, `${port}`];
5 | }
6 |
7 | export async function replicaof(this: T, host: string, port: number) {
8 | return await executeCommand(this, createCommand(host, port), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/script.load.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand(script: string) {
4 | return ['SCRIPT', 'LOAD', script];
5 | }
6 |
7 | export async function scriptLoad(this: T, script: string): Promise {
8 | return await executeCommand(this, createCommand(script), tryReplyToString);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/client.setname.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(connectionName: string) {
4 | return ['CLIENT', 'SETNAME', connectionName];
5 | }
6 |
7 | export async function clientSetname(this: T, connectionName: string) {
8 | return await executeCommand(this, createCommand(connectionName), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/sources/command/swapdb.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(index1: number, index2: number) {
4 | return ['SWAPDB', `${index1}`, `${index2}`];
5 | }
6 |
7 | export async function swapdb(this: T, index1: number, index2: number) {
8 | return await executeCommand(this, createCommand(index1, index2), tryReplyOK);
9 | }
10 |
--------------------------------------------------------------------------------
/website/public/window.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/website/public/file.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sources/command/move.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, db: number) {
4 | return ['MOVE', key, `${db}`];
5 | }
6 |
7 | export async function move(
8 | this: T,
9 | key: string,
10 | db: number,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, db), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/httl.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HTTL', key, field];
5 | }
6 |
7 | export async function httl(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/keys.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(pattern: string) {
4 | return ['KEYS', pattern];
5 | }
6 |
7 | export async function keys(this: T, pattern: string): Promise {
8 | return await executeCommand(
9 | this,
10 | createCommand(pattern),
11 | tryReplyToStringArray,
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/hpttl.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HPTTL', key, field];
5 | }
6 |
7 | export async function hpttl(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/script.debug.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | import type { RespYesOrNo } from '../index.ts';
4 |
5 | export function createCommand(mode: RespYesOrNo) {
6 | return ['SCRIPT', 'DEBUG', mode];
7 | }
8 |
9 | export async function scriptDebug(this: T, mode: RespYesOrNo) {
10 | return await executeCommand(this, createCommand(mode), tryReplyOK);
11 | }
12 |
--------------------------------------------------------------------------------
/sources/command/sdiff.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['SDIFF', ...keys];
5 | }
6 |
7 | export async function sdiff(this: T, ...keys: string[]): Promise {
8 | return await executeCommand(
9 | this,
10 | createCommand(...keys),
11 | tryReplyToStringArray,
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/acl.deluser.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(...usernames: string[]) {
4 | return ['ACL', 'DELUSER', ...usernames];
5 | }
6 |
7 | export async function aclDeluser(this: T, ...usernames: string[]) {
8 | return await executeCommand(
9 | this,
10 | createCommand(...usernames),
11 | tryReplyNumber,
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/cf.count.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['CF.COUNT', key, item];
5 | }
6 |
7 | export async function cfCount(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, item), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/client.caching.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | import type { RespYesOrNo } from '../index.ts';
4 |
5 | export function createCommand(mode: RespYesOrNo) {
6 | return ['CLIENT', 'CACHING', mode];
7 | }
8 |
9 | export async function clientCaching(this: T, mode: RespYesOrNo) {
10 | return await executeCommand(this, createCommand(mode), tryReplyOK);
11 | }
12 |
--------------------------------------------------------------------------------
/sources/command/client.no-evict.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | import type { RespOnOrOff } from '../index.ts';
4 |
5 | export function createCommand(mode: RespOnOrOff) {
6 | return ['CLIENT', 'NO-EVICT', mode];
7 | }
8 |
9 | export async function clientNoEvict(this: T, mode: RespOnOrOff) {
10 | return await executeCommand(this, createCommand(mode), tryReplyOK);
11 | }
12 |
--------------------------------------------------------------------------------
/sources/command/client.no-touch.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | import type { RespOnOrOff } from '../index.ts';
4 |
5 | export function createCommand(mode: RespOnOrOff) {
6 | return ['CLIENT', 'NO-TOUCH', mode];
7 | }
8 |
9 | export async function clientNoTouch(this: T, mode: RespOnOrOff) {
10 | return await executeCommand(this, createCommand(mode), tryReplyOK);
11 | }
12 |
--------------------------------------------------------------------------------
/sources/command/hexists.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HEXISTS', key, field];
5 | }
6 |
7 | export async function hexists(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/hstrlen.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HSTRLEN', key, field];
5 | }
6 |
7 | export async function hstrlen(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/object.encoding.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string) {
4 | return ['OBJECT', 'ENCODING', key];
5 | }
6 |
7 | export async function objectEncoding(
8 | this: T,
9 | key: string,
10 | ): Promise {
11 | return await executeCommand(this, createCommand(key), tryReplyToStringOrNull);
12 | }
13 |
--------------------------------------------------------------------------------
/sources/command/sinter.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['SINTER', ...keys];
5 | }
6 |
7 | export async function sinter(this: T, ...keys: string[]): Promise {
8 | return await executeCommand(
9 | this,
10 | createCommand(...keys),
11 | tryReplyToStringArray,
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/sunion.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['SUNION', ...keys];
5 | }
6 |
7 | export async function sunion(this: T, ...keys: string[]): Promise {
8 | return await executeCommand(
9 | this,
10 | createCommand(...keys),
11 | tryReplyToStringArray,
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/xdel.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...ids: string[]) {
4 | return ['XDEL', key, ...ids];
5 | }
6 |
7 | export async function xdel(
8 | this: T,
9 | key: string,
10 | ...ids: string[]
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, ...ids), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/getbit.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, offset: number) {
4 | return ['GETBIT', key, `${offset}`];
5 | }
6 |
7 | export async function getbit(
8 | this: T,
9 | key: string,
10 | offset: number,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, offset), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/hpersist.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HPERSIST', key, field];
5 | }
6 |
7 | export async function hpersist(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/hgetall.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringRecord } from './utils/index.ts';
2 |
3 | import type { RespHashField } from '../index.ts';
4 |
5 | export function createCommand(key: string) {
6 | return ['HGETALL', key];
7 | }
8 |
9 | export async function hgetall(this: T, key: string): Promise {
10 | return await executeCommand(this, createCommand(key), tryReplyToStringRecord);
11 | }
12 |
--------------------------------------------------------------------------------
/sources/command/renamenx.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, newkey: string) {
4 | return ['RENAMENX', key, newkey];
5 | }
6 |
7 | export async function renamenx(
8 | this: T,
9 | key: string,
10 | newkey: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, newkey), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/sismember.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, member: string) {
4 | return ['SISMEMBER', key, member];
5 | }
6 |
7 | export async function sismember(
8 | this: T,
9 | key: string,
10 | member: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, member), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/subscribe.ts:
--------------------------------------------------------------------------------
1 | import { guard } from './utils/index.ts';
2 |
3 | export function createCommand(...channels: string[]) {
4 | return ['SUBSCRIBE', ...channels];
5 | }
6 |
7 | export async function subscribe(
8 | this: T,
9 | ...channels: string[]
10 | ): Promise {
11 | if (!guard(this)) {
12 | return undefined as never;
13 | }
14 |
15 | await this.send([createCommand(...channels)]);
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/client.reply.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | import type { RespClientReplyMode } from '../index.ts';
4 |
5 | export function createCommand(mode: RespClientReplyMode) {
6 | return ['CLIENT', 'REPLY', mode];
7 | }
8 |
9 | export async function clientReply(this: T, mode: RespClientReplyMode) {
10 | return await executeCommand(this, createCommand(mode), tryReplyOK);
11 | }
12 |
--------------------------------------------------------------------------------
/sources/command/hexpiretime.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HEXPIRETIME', key, field];
5 | }
6 |
7 | export async function hexpiretime(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/hpexpiretime.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HPEXPIRETIME', key, field];
5 | }
6 |
7 | export async function hpexpiretime(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, field), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/psubscribe.ts:
--------------------------------------------------------------------------------
1 | import { guard } from './utils/index.ts';
2 |
3 | export function createCommand(...patterns: string[]) {
4 | return ['PSUBSCRIBE', ...patterns];
5 | }
6 |
7 | export async function psubscribe(
8 | this: T,
9 | ...patterns: string[]
10 | ): Promise {
11 | if (!guard(this)) {
12 | return undefined as never;
13 | }
14 |
15 | await this.send([createCommand(...patterns)]);
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/ssubscribe.ts:
--------------------------------------------------------------------------------
1 | import { guard } from './utils/index.ts';
2 |
3 | export function createCommand(...channels: string[]) {
4 | return ['SSUBSCRIBE', ...channels];
5 | }
6 |
7 | export async function ssubscribe(
8 | this: T,
9 | ...channels: string[]
10 | ): Promise {
11 | if (!guard(this)) {
12 | return undefined as never;
13 | }
14 |
15 | await this.send([createCommand(...channels)]);
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/unsubscribe.ts:
--------------------------------------------------------------------------------
1 | import { guard } from './utils/index.ts';
2 |
3 | export function createCommand(...channels: string[]) {
4 | return ['UNSUBSCRIBE', ...channels];
5 | }
6 |
7 | export async function unsubscribe(
8 | this: T,
9 | ...channels: string[]
10 | ): Promise {
11 | if (!guard(this)) {
12 | return undefined as never;
13 | }
14 |
15 | await this.send([createCommand(...channels)]);
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/xtrim.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, maxlen: number) {
4 | return ['XTRIM', key, 'MAXLEN', `${maxlen}`];
5 | }
6 |
7 | export async function xtrim(
8 | this: T,
9 | key: string,
10 | maxlen: number,
11 | ): Promise {
12 | return await executeCommand(this, createCommand(key, maxlen), tryReplyNumber);
13 | }
14 |
--------------------------------------------------------------------------------
/sources/common/utils/debug.ts:
--------------------------------------------------------------------------------
1 | import type { SolidisDebugLogType, SolidisDebugMemory } from '../../index.ts';
2 |
3 | export function generateDebugHandle(debugMemory?: SolidisDebugMemory) {
4 | if (!debugMemory) {
5 | return;
6 | }
7 |
8 | return (type: SolidisDebugLogType, message: string, data?: unknown) => {
9 | debugMemory.write({
10 | type,
11 | message,
12 | data,
13 | });
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/sources/command/config.set.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(parameter: string, value: string) {
4 | return ['CONFIG', 'SET', parameter, value];
5 | }
6 |
7 | export async function configSet(this: T, parameter: string, value: string) {
8 | return await executeCommand(
9 | this,
10 | createCommand(parameter, value),
11 | tryReplyOK,
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/sources/command/mget.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringArray } from './utils/index.ts';
2 |
3 | export function createCommand(...keys: string[]) {
4 | return ['MGET', ...keys];
5 | }
6 |
7 | export async function mget(
8 | this: T,
9 | ...keys: string[]
10 | ): Promise<(string | null)[]> {
11 | return await executeCommand(
12 | this,
13 | createCommand(...keys),
14 | tryReplyToStringArray,
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/punsubscribe.ts:
--------------------------------------------------------------------------------
1 | import { guard } from './utils/index.ts';
2 |
3 | export function createCommand(...patterns: string[]) {
4 | return ['PUNSUBSCRIBE', ...patterns];
5 | }
6 |
7 | export async function punsubscribe(
8 | this: T,
9 | ...patterns: string[]
10 | ): Promise {
11 | if (!guard(this)) {
12 | return undefined as never;
13 | }
14 |
15 | await this.send([createCommand(...patterns)]);
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/sunsubscribe.ts:
--------------------------------------------------------------------------------
1 | import { guard } from './utils/index.ts';
2 |
3 | export function createCommand(...channels: string[]) {
4 | return ['SUNSUBSCRIBE', ...channels];
5 | }
6 |
7 | export async function sunsubscribe(
8 | this: T,
9 | ...channels: string[]
10 | ): Promise {
11 | if (!guard(this)) {
12 | return undefined as never;
13 | }
14 |
15 | await this.send([createCommand(...channels)]);
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/bgsave.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(schedule?: boolean) {
4 | const command = ['BGSAVE'];
5 |
6 | if (schedule) {
7 | command.push('SCHEDULE');
8 | }
9 |
10 | return command;
11 | }
12 |
13 | export async function bgsave(this: T, schedule?: boolean) {
14 | return await executeCommand(this, createCommand(schedule), tryReplyOK);
15 | }
16 |
--------------------------------------------------------------------------------
/sources/command/acl.genpass.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand(bits?: number) {
4 | const command = ['ACL', 'GENPASS'];
5 |
6 | if (bits) {
7 | command.push(`${bits}`);
8 | }
9 |
10 | return command;
11 | }
12 |
13 | export async function aclGenpass(this: T, bits?: number) {
14 | return await executeCommand(this, createCommand(bits), tryReplyToString);
15 | }
16 |
--------------------------------------------------------------------------------
/sources/command/bf.add.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToBoolean } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['BF.ADD', key, item];
5 | }
6 |
7 | export async function bfAdd(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, item),
15 | tryReplyToBoolean,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/cf.add.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToBoolean } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['CF.ADD', key, item];
5 | }
6 |
7 | export async function cfAdd(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, item),
15 | tryReplyToBoolean,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/cf.del.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToBoolean } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['CF.DEL', key, item];
5 | }
6 |
7 | export async function cfDel(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, item),
15 | tryReplyToBoolean,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/website/i18n/request.ts:
--------------------------------------------------------------------------------
1 | import { getRequestConfig } from 'next-intl/server';
2 | import { cookies } from 'next/headers';
3 |
4 | export default getRequestConfig(async () => {
5 | // Get locale from cookie or default to 'en'
6 | const cookieStore = await cookies();
7 | const locale = cookieStore.get('locale')?.value || 'en';
8 |
9 | return {
10 | locale,
11 | messages: (await import(`./messages/${locale}.json`)).default
12 | };
13 | });
14 |
--------------------------------------------------------------------------------
/sources/command/hget.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, field: string) {
4 | return ['HGET', key, field];
5 | }
6 |
7 | export async function hget(
8 | this: T,
9 | key: string,
10 | field: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, field),
15 | tryReplyToString,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/script.exists.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToNumberArray } from './utils/index.ts';
2 |
3 | export function createCommand(sha1s: string[]) {
4 | return ['SCRIPT', 'EXISTS', ...sha1s];
5 | }
6 |
7 | export async function scriptExists(
8 | this: T,
9 | sha1s: string[],
10 | ): Promise {
11 | return await executeCommand(
12 | this,
13 | createCommand(sha1s),
14 | tryReplyToNumberArray,
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/sources/command/bf.exists.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToBoolean } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['BF.EXISTS', key, item];
5 | }
6 |
7 | export async function bfExists(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, item),
15 | tryReplyToBoolean,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/cf.addnx.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToBoolean } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['CF.ADDNX', key, item];
5 | }
6 |
7 | export async function cfAddnx(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, item),
15 | tryReplyToBoolean,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/cf.exists.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToBoolean } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, item: string) {
4 | return ['CF.EXISTS', key, item];
5 | }
6 |
7 | export async function cfExists(
8 | this: T,
9 | key: string,
10 | item: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, item),
15 | tryReplyToBoolean,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/expire.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, seconds: number) {
4 | return ['EXPIRE', key, `${seconds}`];
5 | }
6 |
7 | export async function expire(
8 | this: T,
9 | key: string,
10 | seconds: number,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, seconds),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/hdel.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...fields: string[]) {
4 | return ['HDEL', key, ...fields];
5 | }
6 |
7 | export async function hdel(
8 | this: T,
9 | key: string,
10 | ...fields: string[]
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, ...fields),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/pfadd.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, elements: string[]) {
4 | return ['PFADD', key, ...elements];
5 | }
6 |
7 | export async function pfadd(
8 | this: T,
9 | key: string,
10 | elements: string[],
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, elements),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/sadd.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...members: string[]) {
4 | return ['SADD', key, ...members];
5 | }
6 |
7 | export async function sadd(
8 | this: T,
9 | key: string,
10 | ...members: string[]
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, ...members),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/srem.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...members: string[]) {
4 | return ['SREM', key, ...members];
5 | }
6 |
7 | export async function srem(
8 | this: T,
9 | key: string,
10 | ...members: string[]
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, ...members),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/zrem.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...members: string[]) {
4 | return ['ZREM', key, ...members];
5 | }
6 |
7 | export async function zrem(
8 | this: T,
9 | key: string,
10 | ...members: string[]
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, ...members),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/decrby.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, decrement: number) {
4 | return ['DECRBY', key, `${decrement}`];
5 | }
6 |
7 | export async function decrby(
8 | this: T,
9 | key: string,
10 | decrement: number,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, decrement),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/incrby.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, increment: number) {
4 | return ['INCRBY', key, `${increment}`];
5 | }
6 |
7 | export async function incrby(
8 | this: T,
9 | key: string,
10 | increment: number,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, increment),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/lpushx.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, elements: string[]) {
4 | return ['LPUSHX', key, ...elements];
5 | }
6 |
7 | export async function lpushx(
8 | this: T,
9 | key: string,
10 | elements: string[],
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, elements),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/pfmerge.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(destkey: string, sourcekeys: string[]) {
4 | return ['PFMERGE', destkey, ...sourcekeys];
5 | }
6 |
7 | export async function pfmerge(
8 | this: T,
9 | destkey: string,
10 | sourcekeys: string[],
11 | ) {
12 | return await executeCommand(
13 | this,
14 | createCommand(destkey, sourcekeys),
15 | tryReplyOK,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/ping.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | export function createCommand(message?: string) {
4 | const command = ['PING'];
5 |
6 | if (message !== undefined) {
7 | command.push(message);
8 | }
9 |
10 | return command;
11 | }
12 |
13 | export async function ping(this: T, message?: string): Promise {
14 | return await executeCommand(this, createCommand(message), tryReplyToString);
15 | }
16 |
--------------------------------------------------------------------------------
/sources/command/acl.setuser.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(username: string, ...rules: string[]) {
4 | return ['ACL', 'SETUSER', username, ...rules];
5 | }
6 |
7 | export async function aclSetuser(
8 | this: T,
9 | username: string,
10 | ...rules: string[]
11 | ) {
12 | return await executeCommand(
13 | this,
14 | createCommand(username, ...rules),
15 | tryReplyOK,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/bf.madd.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToNumberArray } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, items: string[]) {
4 | return ['BF.MADD', key, ...items];
5 | }
6 |
7 | export async function bfMadd(
8 | this: T,
9 | key: string,
10 | items: string[],
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, items),
15 | tryReplyToNumberArray,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/client.setinfo.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyOK } from './utils/index.ts';
2 |
3 | export function createCommand(attribute: string, value: string) {
4 | return ['CLIENT', 'SETINFO', attribute, value];
5 | }
6 |
7 | export async function clientSetinfo(
8 | this: T,
9 | attribute: string,
10 | value: string,
11 | ) {
12 | return await executeCommand(
13 | this,
14 | createCommand(attribute, value),
15 | tryReplyOK,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/lpush.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...elements: string[]) {
4 | return ['LPUSH', key, ...elements];
5 | }
6 |
7 | export async function lpush(
8 | this: T,
9 | key: string,
10 | ...elements: string[]
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, ...elements),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/publish.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(channel: string, message: string) {
4 | return ['PUBLISH', channel, message];
5 | }
6 |
7 | export async function publish(
8 | this: T,
9 | channel: string,
10 | message: string,
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(channel, message),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/rpush.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyNumber } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, ...elements: string[]) {
4 | return ['RPUSH', key, ...elements];
5 | }
6 |
7 | export async function rpush(
8 | this: T,
9 | key: string,
10 | ...elements: string[]
11 | ): Promise {
12 | return await executeCommand(
13 | this,
14 | createCommand(key, ...elements),
15 | tryReplyNumber,
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/sources/command/latency.graph.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToString } from './utils/index.ts';
2 |
3 | import type { RespLatencyEvent } from '../index.ts';
4 |
5 | export function createCommand(event: RespLatencyEvent) {
6 | return ['LATENCY', 'GRAPH', event];
7 | }
8 |
9 | export async function latencyGraph(
10 | this: T,
11 | event: RespLatencyEvent,
12 | ): Promise {
13 | return await executeCommand(this, createCommand(event), tryReplyToString);
14 | }
15 |
--------------------------------------------------------------------------------
/sources/command/lindex.ts:
--------------------------------------------------------------------------------
1 | import { executeCommand, tryReplyToStringOrNull } from './utils/index.ts';
2 |
3 | export function createCommand(key: string, index: number) {
4 | return ['LINDEX', key, `${index}`];
5 | }
6 |
7 | export async function lindex(
8 | this: T,
9 | key: string,
10 | index: number,
11 | ): Promise