js-redis-server 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +235 -30
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +191 -0
- package/dist/cli.js.map +1 -0
- package/dist/cluster.d.ts +30 -0
- package/dist/cluster.d.ts.map +1 -0
- package/dist/cluster.js +131 -0
- package/dist/cluster.js.map +1 -0
- package/dist/commands/cluster.d.ts +8 -0
- package/dist/commands/cluster.d.ts.map +1 -0
- package/dist/commands/cluster.js +190 -0
- package/dist/commands/cluster.js.map +1 -0
- package/dist/commands/command.d.ts +6 -0
- package/dist/commands/command.d.ts.map +1 -0
- package/dist/commands/command.js +381 -0
- package/dist/commands/command.js.map +1 -0
- package/dist/commands/connection.d.ts +24 -0
- package/dist/commands/connection.d.ts.map +1 -0
- package/dist/commands/connection.js +406 -0
- package/dist/commands/connection.js.map +1 -0
- package/dist/commands/hashes.d.ts +64 -0
- package/dist/commands/hashes.d.ts.map +1 -0
- package/dist/commands/hashes.js +276 -0
- package/dist/commands/hashes.js.map +1 -0
- package/dist/commands/helpers.d.ts +16 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +77 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/index.d.ts +23 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +177 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/introspection.d.ts +17 -0
- package/dist/commands/introspection.d.ts.map +1 -0
- package/dist/commands/introspection.js +54 -0
- package/dist/commands/introspection.js.map +1 -0
- package/dist/commands/keys.d.ts +47 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.js +238 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/lists.d.ts +60 -0
- package/dist/commands/lists.d.ts.map +1 -0
- package/dist/commands/lists.js +333 -0
- package/dist/commands/lists.js.map +1 -0
- package/dist/commands/scan.d.ts +24 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +316 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/scripts.d.ts +22 -0
- package/dist/commands/scripts.d.ts.map +1 -0
- package/dist/commands/scripts.js +195 -0
- package/dist/commands/scripts.js.map +1 -0
- package/dist/commands/sets.d.ts +61 -0
- package/dist/commands/sets.d.ts.map +1 -0
- package/dist/commands/sets.js +411 -0
- package/dist/commands/sets.js.map +1 -0
- package/dist/commands/strings.d.ts +91 -0
- package/dist/commands/strings.d.ts.map +1 -0
- package/dist/commands/strings.js +537 -0
- package/dist/commands/strings.js.map +1 -0
- package/dist/commands/transactions.d.ts +9 -0
- package/dist/commands/transactions.d.ts.map +1 -0
- package/dist/commands/transactions.js +89 -0
- package/dist/commands/transactions.js.map +1 -0
- package/dist/commands/zsets.d.ts +72 -0
- package/dist/commands/zsets.d.ts.map +1 -0
- package/dist/commands/zsets.js +360 -0
- package/dist/commands/zsets.js.map +1 -0
- package/dist/core/client-session.d.ts +60 -0
- package/dist/core/client-session.d.ts.map +1 -0
- package/dist/core/client-session.js +210 -0
- package/dist/core/client-session.js.map +1 -0
- package/dist/core/command-definition.d.ts +64 -0
- package/dist/core/command-definition.d.ts.map +1 -0
- package/dist/core/command-definition.js +10 -0
- package/dist/core/command-definition.js.map +1 -0
- package/dist/core/command-executor.d.ts +24 -0
- package/dist/core/command-executor.d.ts.map +1 -0
- package/dist/core/command-executor.js +168 -0
- package/dist/core/command-executor.js.map +1 -0
- package/dist/core/command-registry.d.ts +16 -0
- package/dist/core/command-registry.d.ts.map +1 -0
- package/dist/core/command-registry.js +35 -0
- package/dist/core/command-registry.js.map +1 -0
- package/dist/core/command-schema.d.ts +40 -0
- package/dist/core/command-schema.d.ts.map +1 -0
- package/dist/core/command-schema.js +188 -0
- package/dist/core/command-schema.js.map +1 -0
- package/dist/core/execution-policies/cluster-policy.d.ts +8 -0
- package/dist/core/execution-policies/cluster-policy.d.ts.map +1 -0
- package/dist/core/execution-policies/cluster-policy.js +61 -0
- package/dist/core/execution-policies/cluster-policy.js.map +1 -0
- package/dist/core/execution-policies/index.d.ts +16 -0
- package/dist/core/execution-policies/index.d.ts.map +1 -0
- package/dist/core/execution-policies/index.js +8 -0
- package/dist/core/execution-policies/index.js.map +1 -0
- package/dist/core/execution-policies/transaction-policy.d.ts +3 -0
- package/dist/core/execution-policies/transaction-policy.d.ts.map +1 -0
- package/dist/core/execution-policies/transaction-policy.js +25 -0
- package/dist/core/execution-policies/transaction-policy.js.map +1 -0
- package/dist/core/lua-runtime.d.ts +15 -0
- package/dist/core/lua-runtime.d.ts.map +1 -0
- package/dist/core/lua-runtime.js +173 -0
- package/dist/core/lua-runtime.js.map +1 -0
- package/dist/core/redis-context.d.ts +41 -0
- package/dist/core/redis-context.d.ts.map +1 -0
- package/dist/core/redis-context.js +46 -0
- package/dist/core/redis-context.js.map +1 -0
- package/dist/core/redis-error.d.ts +83 -0
- package/dist/core/redis-error.d.ts.map +1 -0
- package/dist/core/redis-error.js +186 -0
- package/dist/core/redis-error.js.map +1 -0
- package/dist/core/redis-result.d.ts +15 -0
- package/dist/core/redis-result.d.ts.map +1 -0
- package/dist/core/redis-result.js +26 -0
- package/dist/core/redis-result.js.map +1 -0
- package/dist/core/redis-value.d.ts +61 -0
- package/dist/core/redis-value.d.ts.map +1 -0
- package/dist/core/redis-value.js +41 -0
- package/dist/core/redis-value.js.map +1 -0
- package/dist/core/resp-encoder.d.ts +9 -0
- package/dist/core/resp-encoder.d.ts.map +1 -0
- package/dist/core/resp-encoder.js +159 -0
- package/dist/core/resp-encoder.js.map +1 -0
- package/dist/core/response-stream.d.ts +17 -0
- package/dist/core/response-stream.d.ts.map +1 -0
- package/dist/core/response-stream.js +10 -0
- package/dist/core/response-stream.js.map +1 -0
- package/dist/core/transports/connection-transport.d.ts +12 -0
- package/dist/core/transports/connection-transport.d.ts.map +1 -0
- package/dist/core/transports/connection-transport.js +3 -0
- package/dist/core/transports/connection-transport.js.map +1 -0
- package/dist/core/transports/in-memory-connection-transport.d.ts +28 -0
- package/dist/core/transports/in-memory-connection-transport.d.ts.map +1 -0
- package/dist/core/transports/in-memory-connection-transport.js +111 -0
- package/dist/core/transports/in-memory-connection-transport.js.map +1 -0
- package/dist/core/transports/resp2/decoder.d.ts +15 -0
- package/dist/core/transports/resp2/decoder.d.ts.map +1 -0
- package/dist/core/transports/resp2/decoder.js +209 -0
- package/dist/core/transports/resp2/decoder.js.map +1 -0
- package/dist/core/transports/resp2/index.d.ts +2 -12
- package/dist/core/transports/resp2/index.d.ts.map +1 -1
- package/dist/core/transports/resp2/index.js +9 -0
- package/dist/core/transports/resp2/index.js.map +1 -0
- package/dist/core/transports/resp2/server.d.ts +26 -0
- package/dist/core/transports/resp2/server.d.ts.map +1 -0
- package/dist/core/transports/resp2/server.js +83 -0
- package/dist/core/transports/resp2/server.js.map +1 -0
- package/dist/core/transports/resp2/session-adapter.d.ts +24 -0
- package/dist/core/transports/resp2/session-adapter.d.ts.map +1 -0
- package/dist/core/transports/resp2/session-adapter.js +86 -0
- package/dist/core/transports/resp2/session-adapter.js.map +1 -0
- package/dist/core/transports/socket-connection-transport.d.ts +20 -0
- package/dist/core/transports/socket-connection-transport.d.ts.map +1 -0
- package/dist/core/transports/socket-connection-transport.js +64 -0
- package/dist/core/transports/socket-connection-transport.js.map +1 -0
- package/dist/core/turn-queue.d.ts +15 -0
- package/dist/core/turn-queue.d.ts.map +1 -0
- package/dist/core/turn-queue.js +51 -0
- package/dist/core/turn-queue.js.map +1 -0
- package/dist/index.d.ts +35 -347
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +3 -0
- package/dist/logger.js.map +1 -0
- package/dist/state/cluster-topology.d.ts +30 -0
- package/dist/state/cluster-topology.d.ts.map +1 -0
- package/dist/state/cluster-topology.js +88 -0
- package/dist/state/cluster-topology.js.map +1 -0
- package/dist/state/data-types.d.ts +40 -0
- package/dist/state/data-types.d.ts.map +1 -0
- package/dist/state/data-types.js +67 -0
- package/dist/state/data-types.js.map +1 -0
- package/dist/state/database.d.ts +44 -0
- package/dist/state/database.d.ts.map +1 -0
- package/dist/state/database.js +116 -0
- package/dist/state/database.js.map +1 -0
- package/dist/state/index.d.ts +14 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +27 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/keyspace.d.ts +45 -0
- package/dist/state/keyspace.d.ts.map +1 -0
- package/dist/state/keyspace.js +180 -0
- package/dist/state/keyspace.js.map +1 -0
- package/dist/state/mutation-events.d.ts +37 -0
- package/dist/state/mutation-events.d.ts.map +1 -0
- package/dist/state/mutation-events.js +74 -0
- package/dist/state/mutation-events.js.map +1 -0
- package/dist/state/pubsub-broker.d.ts +4 -0
- package/dist/state/pubsub-broker.d.ts.map +1 -0
- package/dist/state/pubsub-broker.js +10 -0
- package/dist/state/pubsub-broker.js.map +1 -0
- package/dist/state/script-cache.d.ts +10 -0
- package/dist/state/script-cache.d.ts.map +1 -0
- package/dist/state/script-cache.js +33 -0
- package/dist/state/script-cache.js.map +1 -0
- package/dist/state/server-state.d.ts +24 -0
- package/dist/state/server-state.d.ts.map +1 -0
- package/dist/state/server-state.js +42 -0
- package/dist/state/server-state.js.map +1 -0
- package/package.json +18 -22
- package/dist/cli.mjs +0 -5923
- package/dist/cli.mjs.map +0 -1
- package/dist/commanders/custom/base-commander.d.ts +0 -19
- package/dist/commanders/custom/base-commander.d.ts.map +0 -1
- package/dist/commanders/custom/cluster-router.d.ts +0 -57
- package/dist/commanders/custom/cluster-router.d.ts.map +0 -1
- package/dist/commanders/custom/clusterCommander.d.ts +0 -39
- package/dist/commanders/custom/clusterCommander.d.ts.map +0 -1
- package/dist/commanders/custom/commander.d.ts +0 -12
- package/dist/commanders/custom/commander.d.ts.map +0 -1
- package/dist/commanders/custom/commands/metadata.d.ts +0 -101
- package/dist/commanders/custom/commands/metadata.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/client/clientSetName.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/client/clientSetName.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/client/index.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/client/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/cluster/clusterInfo.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/cluster/clusterInfo.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/cluster/clusterNodes.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/cluster/clusterNodes.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/cluster/clusterShards.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/cluster/clusterShards.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/cluster/clusterSlots.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/cluster/clusterSlots.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/cluster/index.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/cluster/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/command/index.d.ts +0 -6
- package/dist/commanders/custom/commands/redis/command/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hdel.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/hashes/hdel.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hexists.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/hashes/hexists.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hget.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/hashes/hget.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hgetall.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/hashes/hgetall.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hincrby.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/hashes/hincrby.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hincrbyfloat.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/hashes/hincrbyfloat.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hkeys.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/hashes/hkeys.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hlen.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/hashes/hlen.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hmget.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/hashes/hmget.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hmset.d.ts +0 -10
- package/dist/commanders/custom/commands/redis/data/hashes/hmset.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hset.d.ts +0 -10
- package/dist/commanders/custom/commands/redis/data/hashes/hset.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/hvals.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/hashes/hvals.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/hashes/index.d.ts +0 -13
- package/dist/commanders/custom/commands/redis/data/hashes/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/index.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/data/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/dbsize.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/keys/dbsize.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/del.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/keys/del.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/exists.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/keys/exists.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/expire.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/keys/expire.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/expireat.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/keys/expireat.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/flushall.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/keys/flushall.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/flushdb.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/keys/flushdb.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/index.d.ts +0 -11
- package/dist/commanders/custom/commands/redis/data/keys/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/pttl.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/keys/pttl.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/ttl.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/keys/ttl.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/keys/type.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/keys/type.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/index.d.ts +0 -11
- package/dist/commanders/custom/commands/redis/data/lists/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/lindex.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/lists/lindex.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/llen.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/lists/llen.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/lpop.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/lists/lpop.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/lpush.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/lists/lpush.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/lrange.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/lists/lrange.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/lrem.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/lists/lrem.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/lset.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/lists/lset.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/ltrim.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/lists/ltrim.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/rpop.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/lists/rpop.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/lists/rpush.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/lists/rpush.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/index.d.ts +0 -12
- package/dist/commanders/custom/commands/redis/data/sets/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/sadd.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/sets/sadd.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/scard.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/sets/scard.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/sdiff.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/sets/sdiff.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/sinter.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/sets/sinter.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/sismember.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/sets/sismember.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/smembers.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/sets/smembers.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/smove.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/sets/smove.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/spop.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/sets/spop.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/srandmember.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/sets/srandmember.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/srem.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/sets/srem.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/sets/sunion.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/sets/sunion.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/append.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/strings/append.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/decr.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/strings/decr.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/decrby.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/strings/decrby.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/get.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/strings/get.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/getset.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/strings/getset.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/incr.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/strings/incr.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/incrby.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/strings/incrby.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/incrbyfloat.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/strings/incrbyfloat.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/index.d.ts +0 -14
- package/dist/commanders/custom/commands/redis/data/strings/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/mget.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/strings/mget.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/mset.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/strings/mset.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/msetnx.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/strings/msetnx.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/set.d.ts +0 -29
- package/dist/commanders/custom/commands/redis/data/strings/set.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/strings/strlen.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/strings/strlen.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/index.d.ts +0 -12
- package/dist/commanders/custom/commands/redis/data/zsets/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zadd.d.ts +0 -10
- package/dist/commanders/custom/commands/redis/data/zsets/zadd.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zcard.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/data/zsets/zcard.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zincrby.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/zsets/zincrby.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zrange.d.ts +0 -10
- package/dist/commanders/custom/commands/redis/data/zsets/zrange.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zrangebyscore.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/zsets/zrangebyscore.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zrank.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/zsets/zrank.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zrem.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/zsets/zrem.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zremrangebyscore.d.ts +0 -9
- package/dist/commanders/custom/commands/redis/data/zsets/zremrangebyscore.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zrevrange.d.ts +0 -10
- package/dist/commanders/custom/commands/redis/data/zsets/zrevrange.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zrevrank.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/zsets/zrevrank.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/data/zsets/zscore.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/data/zsets/zscore.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/index.d.ts +0 -39
- package/dist/commanders/custom/commands/redis/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/info.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/info.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/monitor.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/monitor.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/ping.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/ping.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/quit.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/quit.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/debug.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/script/debug.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/eval.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/script/eval.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/evalsha.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/script/evalsha.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/exists.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/script/exists.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/flush.d.ts +0 -7
- package/dist/commanders/custom/commands/redis/script/flush.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/help.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/script/help.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/index.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/script/index.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/kill.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/script/kill.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/load.d.ts +0 -5
- package/dist/commanders/custom/commands/redis/script/load.d.ts.map +0 -1
- package/dist/commanders/custom/commands/redis/script/lua-reply.d.ts +0 -8
- package/dist/commanders/custom/commands/redis/script/lua-reply.d.ts.map +0 -1
- package/dist/commanders/custom/commands/registry.d.ts +0 -84
- package/dist/commanders/custom/commands/registry.d.ts.map +0 -1
- package/dist/commanders/custom/data-structures/hash.d.ts +0 -16
- package/dist/commanders/custom/data-structures/hash.d.ts.map +0 -1
- package/dist/commanders/custom/data-structures/list.d.ts +0 -15
- package/dist/commanders/custom/data-structures/list.d.ts.map +0 -1
- package/dist/commanders/custom/data-structures/set.d.ts +0 -16
- package/dist/commanders/custom/data-structures/set.d.ts.map +0 -1
- package/dist/commanders/custom/data-structures/stream.d.ts +0 -3
- package/dist/commanders/custom/data-structures/stream.d.ts.map +0 -1
- package/dist/commanders/custom/data-structures/string.d.ts +0 -5
- package/dist/commanders/custom/data-structures/string.d.ts.map +0 -1
- package/dist/commanders/custom/data-structures/zset.d.ts +0 -17
- package/dist/commanders/custom/data-structures/zset.d.ts.map +0 -1
- package/dist/commanders/custom/db.d.ts +0 -67
- package/dist/commanders/custom/db.d.ts.map +0 -1
- package/dist/commanders/custom/execution-context.d.ts +0 -12
- package/dist/commanders/custom/execution-context.d.ts.map +0 -1
- package/dist/commanders/custom/lua-runtime.d.ts +0 -16
- package/dist/commanders/custom/lua-runtime.d.ts.map +0 -1
- package/dist/commanders/custom/redis-kernel.d.ts +0 -46
- package/dist/commanders/custom/redis-kernel.d.ts.map +0 -1
- package/dist/commanders/custom/schema/builder.d.ts +0 -24
- package/dist/commanders/custom/schema/builder.d.ts.map +0 -1
- package/dist/commanders/custom/schema/command-adapter.d.ts +0 -25
- package/dist/commanders/custom/schema/command-adapter.d.ts.map +0 -1
- package/dist/commanders/custom/schema/index.d.ts +0 -7
- package/dist/commanders/custom/schema/index.d.ts.map +0 -1
- package/dist/commanders/custom/schema/input-mapper.d.ts +0 -28
- package/dist/commanders/custom/schema/input-mapper.d.ts.map +0 -1
- package/dist/commanders/custom/schema/registry.d.ts +0 -13
- package/dist/commanders/custom/schema/registry.d.ts.map +0 -1
- package/dist/commanders/custom/schema/resp-input-mapper.d.ts +0 -20
- package/dist/commanders/custom/schema/resp-input-mapper.d.ts.map +0 -1
- package/dist/commanders/custom/schema/types.d.ts +0 -43
- package/dist/commanders/custom/schema/types.d.ts.map +0 -1
- package/dist/core/cluster/network.d.ts +0 -24
- package/dist/core/cluster/network.d.ts.map +0 -1
- package/dist/core/errors.d.ts +0 -87
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/transports/buffered-transport.d.ts +0 -14
- package/dist/core/transports/buffered-transport.d.ts.map +0 -1
- package/dist/core/transports/capturing-transport.d.ts +0 -19
- package/dist/core/transports/capturing-transport.d.ts.map +0 -1
- package/dist/core/transports/command-validator.d.ts +0 -12
- package/dist/core/transports/command-validator.d.ts.map +0 -1
- package/dist/core/transports/resp2/adapter.d.ts +0 -32
- package/dist/core/transports/resp2/adapter.d.ts.map +0 -1
- package/dist/core/transports/session-state.d.ts +0 -76
- package/dist/core/transports/session-state.d.ts.map +0 -1
- package/dist/core/transports/session.d.ts +0 -36
- package/dist/core/transports/session.d.ts.map +0 -1
- package/dist/index.cjs +0 -5759
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs +0 -5749
- package/dist/index.mjs.map +0 -1
- package/dist/types.d.ts +0 -54
- package/dist/types.d.ts.map +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedisDatabase = exports.RedisClusterTopology = exports.REDIS_CLUSTER_SLOT_COUNT = exports.SerialTurnQueue = exports.isResponseStream = exports.encodeRedisValue = exports.encodeRedisResult = exports.RedisResult = exports.RedisValue = exports.luaReplyToRedisValue = exports.getDefaultRedisLuaRuntime = exports.createRedisLuaRuntime = exports.RedisLuaRuntime = exports.createNoopParkHandler = exports.createDefaultParkHandler = exports.createTransactionPolicy = exports.createClusterPolicy = exports.HashValueNotFloatError = exports.HashValueNotIntegerError = exports.NoSuchKeyError = exports.IndexOutOfRangeError = exports.WrongTypeRedisError = exports.WrongNumberOfArgumentsError = exports.WrongNumberOfKeysError = exports.WatchInsideMultiError = exports.UnknownScriptSubcommandError = exports.UnknownRedisCommandError = exports.UnknownClusterSubcommandError = exports.TransactionDiscardedError = exports.RedisSyntaxError = exports.ScriptUnknownCommandError = exports.ScriptFlushOptionError = exports.ScriptCallNoCommandError = exports.ScriptDebugModeError = exports.RedisMovedError = exports.RedisCommandError = exports.RedisCrossSlotError = exports.RedisClusterDownError = exports.NoScriptError = exports.InvalidExpireTimeError = exports.ExecWithoutMultiError = exports.DiscardWithoutMultiError = exports.ExpectedIntegerError = exports.ExpectedFloatError = exports.parseCommandArgs = exports.t = exports.defineCommand = exports.CommandRegistry = exports.CommandExecutor = exports.ClientSession = void 0;
|
|
4
|
+
exports.typeCommand = exports.ttlCommand = exports.transactionCommands = exports.stringsCommands = exports.sscanCommand = exports.scriptsCommands = exports.scriptCommand = exports.setCommand = exports.selectCommand = exports.scanCommands = exports.scanCommand = exports.redisCommandDefinitions = exports.quitCommand = exports.pttlCommand = exports.pingCommand = exports.pexpireCommand = exports.persistCommand = exports.multiCommand = exports.mgetCommand = exports.keysCommands = exports.keysCommand = exports.hscanCommand = exports.getCommand = exports.flushdbCommand = exports.flushallCommand = exports.expireCommand = exports.execCommand = exports.evalshaCommand = exports.evalCommand = exports.existsCommand = exports.discardCommand = exports.delCommand = exports.dbsizeCommand = exports.createClusterCommand = exports.commandCommand = exports.createRedisCommandRegistry = exports.createRedisCommandExecutor = exports.connectionCommands = exports.createStringData = exports.createSortedSetData = exports.createSetData = exports.createListData = exports.createHashData = exports.cloneRedisDataValue = exports.WrongRedisTypeError = exports.RedisServerState = exports.RedisScriptCache = exports.RedisPubSubBroker = exports.RedisMutationBus = exports.RedisKeyspace = void 0;
|
|
5
|
+
exports.computeSlotRange = exports.buildRedisCluster = exports.RedisCluster = exports.SocketConnectionTransport = exports.InMemoryConnectionTransport = exports.Resp2Server = exports.Resp2SessionAdapter = exports.Resp2ParseError = exports.Resp2CommandDecoder = exports.zscanCommand = exports.watchCommand = exports.unwatchCommand = void 0;
|
|
6
|
+
var client_session_1 = require("./core/client-session");
|
|
7
|
+
Object.defineProperty(exports, "ClientSession", { enumerable: true, get: function () { return client_session_1.ClientSession; } });
|
|
8
|
+
var command_executor_1 = require("./core/command-executor");
|
|
9
|
+
Object.defineProperty(exports, "CommandExecutor", { enumerable: true, get: function () { return command_executor_1.CommandExecutor; } });
|
|
10
|
+
var command_registry_1 = require("./core/command-registry");
|
|
11
|
+
Object.defineProperty(exports, "CommandRegistry", { enumerable: true, get: function () { return command_registry_1.CommandRegistry; } });
|
|
12
|
+
var command_definition_1 = require("./core/command-definition");
|
|
13
|
+
Object.defineProperty(exports, "defineCommand", { enumerable: true, get: function () { return command_definition_1.defineCommand; } });
|
|
14
|
+
var command_schema_1 = require("./core/command-schema");
|
|
15
|
+
Object.defineProperty(exports, "t", { enumerable: true, get: function () { return command_schema_1.t; } });
|
|
16
|
+
Object.defineProperty(exports, "parseCommandArgs", { enumerable: true, get: function () { return command_schema_1.parseCommandArgs; } });
|
|
17
|
+
var redis_error_1 = require("./core/redis-error");
|
|
18
|
+
Object.defineProperty(exports, "ExpectedFloatError", { enumerable: true, get: function () { return redis_error_1.ExpectedFloatError; } });
|
|
19
|
+
Object.defineProperty(exports, "ExpectedIntegerError", { enumerable: true, get: function () { return redis_error_1.ExpectedIntegerError; } });
|
|
20
|
+
Object.defineProperty(exports, "DiscardWithoutMultiError", { enumerable: true, get: function () { return redis_error_1.DiscardWithoutMultiError; } });
|
|
21
|
+
Object.defineProperty(exports, "ExecWithoutMultiError", { enumerable: true, get: function () { return redis_error_1.ExecWithoutMultiError; } });
|
|
22
|
+
Object.defineProperty(exports, "InvalidExpireTimeError", { enumerable: true, get: function () { return redis_error_1.InvalidExpireTimeError; } });
|
|
23
|
+
Object.defineProperty(exports, "NoScriptError", { enumerable: true, get: function () { return redis_error_1.NoScriptError; } });
|
|
24
|
+
Object.defineProperty(exports, "RedisClusterDownError", { enumerable: true, get: function () { return redis_error_1.RedisClusterDownError; } });
|
|
25
|
+
Object.defineProperty(exports, "RedisCrossSlotError", { enumerable: true, get: function () { return redis_error_1.RedisCrossSlotError; } });
|
|
26
|
+
Object.defineProperty(exports, "RedisCommandError", { enumerable: true, get: function () { return redis_error_1.RedisCommandError; } });
|
|
27
|
+
Object.defineProperty(exports, "RedisMovedError", { enumerable: true, get: function () { return redis_error_1.RedisMovedError; } });
|
|
28
|
+
Object.defineProperty(exports, "ScriptDebugModeError", { enumerable: true, get: function () { return redis_error_1.ScriptDebugModeError; } });
|
|
29
|
+
Object.defineProperty(exports, "ScriptCallNoCommandError", { enumerable: true, get: function () { return redis_error_1.ScriptCallNoCommandError; } });
|
|
30
|
+
Object.defineProperty(exports, "ScriptFlushOptionError", { enumerable: true, get: function () { return redis_error_1.ScriptFlushOptionError; } });
|
|
31
|
+
Object.defineProperty(exports, "ScriptUnknownCommandError", { enumerable: true, get: function () { return redis_error_1.ScriptUnknownCommandError; } });
|
|
32
|
+
Object.defineProperty(exports, "RedisSyntaxError", { enumerable: true, get: function () { return redis_error_1.RedisSyntaxError; } });
|
|
33
|
+
Object.defineProperty(exports, "TransactionDiscardedError", { enumerable: true, get: function () { return redis_error_1.TransactionDiscardedError; } });
|
|
34
|
+
Object.defineProperty(exports, "UnknownClusterSubcommandError", { enumerable: true, get: function () { return redis_error_1.UnknownClusterSubcommandError; } });
|
|
35
|
+
Object.defineProperty(exports, "UnknownRedisCommandError", { enumerable: true, get: function () { return redis_error_1.UnknownRedisCommandError; } });
|
|
36
|
+
Object.defineProperty(exports, "UnknownScriptSubcommandError", { enumerable: true, get: function () { return redis_error_1.UnknownScriptSubcommandError; } });
|
|
37
|
+
Object.defineProperty(exports, "WatchInsideMultiError", { enumerable: true, get: function () { return redis_error_1.WatchInsideMultiError; } });
|
|
38
|
+
Object.defineProperty(exports, "WrongNumberOfKeysError", { enumerable: true, get: function () { return redis_error_1.WrongNumberOfKeysError; } });
|
|
39
|
+
Object.defineProperty(exports, "WrongNumberOfArgumentsError", { enumerable: true, get: function () { return redis_error_1.WrongNumberOfArgumentsError; } });
|
|
40
|
+
Object.defineProperty(exports, "WrongTypeRedisError", { enumerable: true, get: function () { return redis_error_1.WrongTypeRedisError; } });
|
|
41
|
+
Object.defineProperty(exports, "IndexOutOfRangeError", { enumerable: true, get: function () { return redis_error_1.IndexOutOfRangeError; } });
|
|
42
|
+
Object.defineProperty(exports, "NoSuchKeyError", { enumerable: true, get: function () { return redis_error_1.NoSuchKeyError; } });
|
|
43
|
+
Object.defineProperty(exports, "HashValueNotIntegerError", { enumerable: true, get: function () { return redis_error_1.HashValueNotIntegerError; } });
|
|
44
|
+
Object.defineProperty(exports, "HashValueNotFloatError", { enumerable: true, get: function () { return redis_error_1.HashValueNotFloatError; } });
|
|
45
|
+
var execution_policies_1 = require("./core/execution-policies");
|
|
46
|
+
Object.defineProperty(exports, "createClusterPolicy", { enumerable: true, get: function () { return execution_policies_1.createClusterPolicy; } });
|
|
47
|
+
Object.defineProperty(exports, "createTransactionPolicy", { enumerable: true, get: function () { return execution_policies_1.createTransactionPolicy; } });
|
|
48
|
+
var redis_context_1 = require("./core/redis-context");
|
|
49
|
+
Object.defineProperty(exports, "createDefaultParkHandler", { enumerable: true, get: function () { return redis_context_1.createDefaultParkHandler; } });
|
|
50
|
+
Object.defineProperty(exports, "createNoopParkHandler", { enumerable: true, get: function () { return redis_context_1.createNoopParkHandler; } });
|
|
51
|
+
var lua_runtime_1 = require("./core/lua-runtime");
|
|
52
|
+
Object.defineProperty(exports, "RedisLuaRuntime", { enumerable: true, get: function () { return lua_runtime_1.RedisLuaRuntime; } });
|
|
53
|
+
Object.defineProperty(exports, "createRedisLuaRuntime", { enumerable: true, get: function () { return lua_runtime_1.createRedisLuaRuntime; } });
|
|
54
|
+
Object.defineProperty(exports, "getDefaultRedisLuaRuntime", { enumerable: true, get: function () { return lua_runtime_1.getDefaultRedisLuaRuntime; } });
|
|
55
|
+
Object.defineProperty(exports, "luaReplyToRedisValue", { enumerable: true, get: function () { return lua_runtime_1.luaReplyToRedisValue; } });
|
|
56
|
+
var redis_value_1 = require("./core/redis-value");
|
|
57
|
+
Object.defineProperty(exports, "RedisValue", { enumerable: true, get: function () { return redis_value_1.RedisValue; } });
|
|
58
|
+
var redis_result_1 = require("./core/redis-result");
|
|
59
|
+
Object.defineProperty(exports, "RedisResult", { enumerable: true, get: function () { return redis_result_1.RedisResult; } });
|
|
60
|
+
var resp_encoder_1 = require("./core/resp-encoder");
|
|
61
|
+
Object.defineProperty(exports, "encodeRedisResult", { enumerable: true, get: function () { return resp_encoder_1.encodeRedisResult; } });
|
|
62
|
+
Object.defineProperty(exports, "encodeRedisValue", { enumerable: true, get: function () { return resp_encoder_1.encodeRedisValue; } });
|
|
63
|
+
var response_stream_1 = require("./core/response-stream");
|
|
64
|
+
Object.defineProperty(exports, "isResponseStream", { enumerable: true, get: function () { return response_stream_1.isResponseStream; } });
|
|
65
|
+
var turn_queue_1 = require("./core/turn-queue");
|
|
66
|
+
Object.defineProperty(exports, "SerialTurnQueue", { enumerable: true, get: function () { return turn_queue_1.SerialTurnQueue; } });
|
|
67
|
+
var state_1 = require("./state");
|
|
68
|
+
Object.defineProperty(exports, "REDIS_CLUSTER_SLOT_COUNT", { enumerable: true, get: function () { return state_1.REDIS_CLUSTER_SLOT_COUNT; } });
|
|
69
|
+
Object.defineProperty(exports, "RedisClusterTopology", { enumerable: true, get: function () { return state_1.RedisClusterTopology; } });
|
|
70
|
+
Object.defineProperty(exports, "RedisDatabase", { enumerable: true, get: function () { return state_1.RedisDatabase; } });
|
|
71
|
+
Object.defineProperty(exports, "RedisKeyspace", { enumerable: true, get: function () { return state_1.RedisKeyspace; } });
|
|
72
|
+
Object.defineProperty(exports, "RedisMutationBus", { enumerable: true, get: function () { return state_1.RedisMutationBus; } });
|
|
73
|
+
Object.defineProperty(exports, "RedisPubSubBroker", { enumerable: true, get: function () { return state_1.RedisPubSubBroker; } });
|
|
74
|
+
Object.defineProperty(exports, "RedisScriptCache", { enumerable: true, get: function () { return state_1.RedisScriptCache; } });
|
|
75
|
+
Object.defineProperty(exports, "RedisServerState", { enumerable: true, get: function () { return state_1.RedisServerState; } });
|
|
76
|
+
Object.defineProperty(exports, "WrongRedisTypeError", { enumerable: true, get: function () { return state_1.WrongRedisTypeError; } });
|
|
77
|
+
Object.defineProperty(exports, "cloneRedisDataValue", { enumerable: true, get: function () { return state_1.cloneRedisDataValue; } });
|
|
78
|
+
Object.defineProperty(exports, "createHashData", { enumerable: true, get: function () { return state_1.createHashData; } });
|
|
79
|
+
Object.defineProperty(exports, "createListData", { enumerable: true, get: function () { return state_1.createListData; } });
|
|
80
|
+
Object.defineProperty(exports, "createSetData", { enumerable: true, get: function () { return state_1.createSetData; } });
|
|
81
|
+
Object.defineProperty(exports, "createSortedSetData", { enumerable: true, get: function () { return state_1.createSortedSetData; } });
|
|
82
|
+
Object.defineProperty(exports, "createStringData", { enumerable: true, get: function () { return state_1.createStringData; } });
|
|
83
|
+
var commands_1 = require("./commands");
|
|
84
|
+
Object.defineProperty(exports, "connectionCommands", { enumerable: true, get: function () { return commands_1.connectionCommands; } });
|
|
85
|
+
Object.defineProperty(exports, "createRedisCommandExecutor", { enumerable: true, get: function () { return commands_1.createRedisCommandExecutor; } });
|
|
86
|
+
Object.defineProperty(exports, "createRedisCommandRegistry", { enumerable: true, get: function () { return commands_1.createRedisCommandRegistry; } });
|
|
87
|
+
Object.defineProperty(exports, "commandCommand", { enumerable: true, get: function () { return commands_1.commandCommand; } });
|
|
88
|
+
Object.defineProperty(exports, "createClusterCommand", { enumerable: true, get: function () { return commands_1.createClusterCommand; } });
|
|
89
|
+
Object.defineProperty(exports, "dbsizeCommand", { enumerable: true, get: function () { return commands_1.dbsizeCommand; } });
|
|
90
|
+
Object.defineProperty(exports, "delCommand", { enumerable: true, get: function () { return commands_1.delCommand; } });
|
|
91
|
+
Object.defineProperty(exports, "discardCommand", { enumerable: true, get: function () { return commands_1.discardCommand; } });
|
|
92
|
+
Object.defineProperty(exports, "existsCommand", { enumerable: true, get: function () { return commands_1.existsCommand; } });
|
|
93
|
+
Object.defineProperty(exports, "evalCommand", { enumerable: true, get: function () { return commands_1.evalCommand; } });
|
|
94
|
+
Object.defineProperty(exports, "evalshaCommand", { enumerable: true, get: function () { return commands_1.evalshaCommand; } });
|
|
95
|
+
Object.defineProperty(exports, "execCommand", { enumerable: true, get: function () { return commands_1.execCommand; } });
|
|
96
|
+
Object.defineProperty(exports, "expireCommand", { enumerable: true, get: function () { return commands_1.expireCommand; } });
|
|
97
|
+
Object.defineProperty(exports, "flushallCommand", { enumerable: true, get: function () { return commands_1.flushallCommand; } });
|
|
98
|
+
Object.defineProperty(exports, "flushdbCommand", { enumerable: true, get: function () { return commands_1.flushdbCommand; } });
|
|
99
|
+
Object.defineProperty(exports, "getCommand", { enumerable: true, get: function () { return commands_1.getCommand; } });
|
|
100
|
+
Object.defineProperty(exports, "hscanCommand", { enumerable: true, get: function () { return commands_1.hscanCommand; } });
|
|
101
|
+
Object.defineProperty(exports, "keysCommand", { enumerable: true, get: function () { return commands_1.keysCommand; } });
|
|
102
|
+
Object.defineProperty(exports, "keysCommands", { enumerable: true, get: function () { return commands_1.keysCommands; } });
|
|
103
|
+
Object.defineProperty(exports, "mgetCommand", { enumerable: true, get: function () { return commands_1.mgetCommand; } });
|
|
104
|
+
Object.defineProperty(exports, "multiCommand", { enumerable: true, get: function () { return commands_1.multiCommand; } });
|
|
105
|
+
Object.defineProperty(exports, "persistCommand", { enumerable: true, get: function () { return commands_1.persistCommand; } });
|
|
106
|
+
Object.defineProperty(exports, "pexpireCommand", { enumerable: true, get: function () { return commands_1.pexpireCommand; } });
|
|
107
|
+
Object.defineProperty(exports, "pingCommand", { enumerable: true, get: function () { return commands_1.pingCommand; } });
|
|
108
|
+
Object.defineProperty(exports, "pttlCommand", { enumerable: true, get: function () { return commands_1.pttlCommand; } });
|
|
109
|
+
Object.defineProperty(exports, "quitCommand", { enumerable: true, get: function () { return commands_1.quitCommand; } });
|
|
110
|
+
Object.defineProperty(exports, "redisCommandDefinitions", { enumerable: true, get: function () { return commands_1.redisCommandDefinitions; } });
|
|
111
|
+
Object.defineProperty(exports, "scanCommand", { enumerable: true, get: function () { return commands_1.scanCommand; } });
|
|
112
|
+
Object.defineProperty(exports, "scanCommands", { enumerable: true, get: function () { return commands_1.scanCommands; } });
|
|
113
|
+
Object.defineProperty(exports, "selectCommand", { enumerable: true, get: function () { return commands_1.selectCommand; } });
|
|
114
|
+
Object.defineProperty(exports, "setCommand", { enumerable: true, get: function () { return commands_1.setCommand; } });
|
|
115
|
+
Object.defineProperty(exports, "scriptCommand", { enumerable: true, get: function () { return commands_1.scriptCommand; } });
|
|
116
|
+
Object.defineProperty(exports, "scriptsCommands", { enumerable: true, get: function () { return commands_1.scriptsCommands; } });
|
|
117
|
+
Object.defineProperty(exports, "sscanCommand", { enumerable: true, get: function () { return commands_1.sscanCommand; } });
|
|
118
|
+
Object.defineProperty(exports, "stringsCommands", { enumerable: true, get: function () { return commands_1.stringsCommands; } });
|
|
119
|
+
Object.defineProperty(exports, "transactionCommands", { enumerable: true, get: function () { return commands_1.transactionCommands; } });
|
|
120
|
+
Object.defineProperty(exports, "ttlCommand", { enumerable: true, get: function () { return commands_1.ttlCommand; } });
|
|
121
|
+
Object.defineProperty(exports, "typeCommand", { enumerable: true, get: function () { return commands_1.typeCommand; } });
|
|
122
|
+
Object.defineProperty(exports, "unwatchCommand", { enumerable: true, get: function () { return commands_1.unwatchCommand; } });
|
|
123
|
+
Object.defineProperty(exports, "watchCommand", { enumerable: true, get: function () { return commands_1.watchCommand; } });
|
|
124
|
+
Object.defineProperty(exports, "zscanCommand", { enumerable: true, get: function () { return commands_1.zscanCommand; } });
|
|
125
|
+
// Transport
|
|
126
|
+
var resp2_1 = require("./core/transports/resp2");
|
|
127
|
+
Object.defineProperty(exports, "Resp2CommandDecoder", { enumerable: true, get: function () { return resp2_1.Resp2CommandDecoder; } });
|
|
128
|
+
Object.defineProperty(exports, "Resp2ParseError", { enumerable: true, get: function () { return resp2_1.Resp2ParseError; } });
|
|
129
|
+
Object.defineProperty(exports, "Resp2SessionAdapter", { enumerable: true, get: function () { return resp2_1.Resp2SessionAdapter; } });
|
|
130
|
+
var server_1 = require("./core/transports/resp2/server");
|
|
131
|
+
Object.defineProperty(exports, "Resp2Server", { enumerable: true, get: function () { return server_1.Resp2Server; } });
|
|
132
|
+
var in_memory_connection_transport_1 = require("./core/transports/in-memory-connection-transport");
|
|
133
|
+
Object.defineProperty(exports, "InMemoryConnectionTransport", { enumerable: true, get: function () { return in_memory_connection_transport_1.InMemoryConnectionTransport; } });
|
|
134
|
+
var socket_connection_transport_1 = require("./core/transports/socket-connection-transport");
|
|
135
|
+
Object.defineProperty(exports, "SocketConnectionTransport", { enumerable: true, get: function () { return socket_connection_transport_1.SocketConnectionTransport; } });
|
|
136
|
+
// Cluster builder (new core)
|
|
137
|
+
var cluster_1 = require("./cluster");
|
|
138
|
+
Object.defineProperty(exports, "RedisCluster", { enumerable: true, get: function () { return cluster_1.RedisCluster; } });
|
|
139
|
+
Object.defineProperty(exports, "buildRedisCluster", { enumerable: true, get: function () { return cluster_1.buildRedisCluster; } });
|
|
140
|
+
Object.defineProperty(exports, "computeSlotRange", { enumerable: true, get: function () { return cluster_1.computeSlotRange; } });
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AA+DA,wDAAqD;AAA5C,+GAAA,aAAa,OAAA;AACtB,4DAA8E;AAArE,mHAAA,eAAe,OAAA;AACxB,4DAAyD;AAAhD,mHAAA,eAAe,OAAA;AACxB,gEAAyD;AAAhD,mHAAA,aAAa,OAAA;AACtB,wDAA2D;AAAlD,mGAAA,CAAC,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAC5B,kDA4B2B;AA3BzB,iHAAA,kBAAkB,OAAA;AAClB,mHAAA,oBAAoB,OAAA;AACpB,uHAAA,wBAAwB,OAAA;AACxB,oHAAA,qBAAqB,OAAA;AACrB,qHAAA,sBAAsB,OAAA;AACtB,4GAAA,aAAa,OAAA;AACb,oHAAA,qBAAqB,OAAA;AACrB,kHAAA,mBAAmB,OAAA;AACnB,gHAAA,iBAAiB,OAAA;AACjB,8GAAA,eAAe,OAAA;AACf,mHAAA,oBAAoB,OAAA;AACpB,uHAAA,wBAAwB,OAAA;AACxB,qHAAA,sBAAsB,OAAA;AACtB,wHAAA,yBAAyB,OAAA;AACzB,+GAAA,gBAAgB,OAAA;AAChB,wHAAA,yBAAyB,OAAA;AACzB,4HAAA,6BAA6B,OAAA;AAC7B,uHAAA,wBAAwB,OAAA;AACxB,2HAAA,4BAA4B,OAAA;AAC5B,oHAAA,qBAAqB,OAAA;AACrB,qHAAA,sBAAsB,OAAA;AACtB,0HAAA,2BAA2B,OAAA;AAC3B,kHAAA,mBAAmB,OAAA;AACnB,mHAAA,oBAAoB,OAAA;AACpB,6GAAA,cAAc,OAAA;AACd,uHAAA,wBAAwB,OAAA;AACxB,qHAAA,sBAAsB,OAAA;AAExB,gEAGkC;AAFhC,yHAAA,mBAAmB,OAAA;AACnB,6HAAA,uBAAuB,OAAA;AAEzB,sDAG6B;AAF3B,yHAAA,wBAA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AAK,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC7D,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC9D"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type RedisClusterNodeRole = 'master' | 'replica';
|
|
2
|
+
export type RedisClusterNode = {
|
|
3
|
+
id: string;
|
|
4
|
+
role: RedisClusterNodeRole;
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
masterId?: string;
|
|
8
|
+
slots: Array<[number, number]>;
|
|
9
|
+
};
|
|
10
|
+
export declare const REDIS_CLUSTER_SLOT_COUNT = 16384;
|
|
11
|
+
export declare class RedisClusterTopology {
|
|
12
|
+
readonly nodes: readonly RedisClusterNode[];
|
|
13
|
+
constructor(nodes?: readonly RedisClusterNode[]);
|
|
14
|
+
calculateSlot(key: Buffer): number;
|
|
15
|
+
calculateSlotForKeys(keys: readonly Buffer[]): number | null;
|
|
16
|
+
getNode(id: string): RedisClusterNode | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the master node owning the slot. Replicas are never returned —
|
|
19
|
+
* MOVED must always direct the client to a master. Returns undefined if
|
|
20
|
+
* the slot is unassigned.
|
|
21
|
+
*/
|
|
22
|
+
getSlotOwner(slot: number): RedisClusterNode | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Returns whether the node is the master serving the slot. Replicas never
|
|
25
|
+
* own slots for routing purposes — keyed commands sent directly to a
|
|
26
|
+
* replica must redirect to the master via MOVED.
|
|
27
|
+
*/
|
|
28
|
+
nodeOwnsSlot(nodeId: string, slot: number): boolean;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cluster-topology.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-topology.d.ts","sourceRoot":"","sources":["../../src/state/cluster-topology.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,oBAAoB,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,wBAAwB,QAAQ,CAAA;AAE7C,qBAAa,oBAAoB;aACH,KAAK,EAAE,SAAS,gBAAgB,EAAE;gBAAlC,KAAK,GAAE,SAAS,gBAAgB,EAAO;IAInE,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIlC,oBAAoB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI;IAQ5D,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAUjD;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAcxD;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO;CAIpD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RedisClusterTopology = exports.REDIS_CLUSTER_SLOT_COUNT = void 0;
|
|
7
|
+
const cluster_key_slot_1 = __importDefault(require("cluster-key-slot"));
|
|
8
|
+
exports.REDIS_CLUSTER_SLOT_COUNT = 16384;
|
|
9
|
+
class RedisClusterTopology {
|
|
10
|
+
nodes;
|
|
11
|
+
constructor(nodes = []) {
|
|
12
|
+
this.nodes = nodes;
|
|
13
|
+
validateTopology(nodes);
|
|
14
|
+
}
|
|
15
|
+
calculateSlot(key) {
|
|
16
|
+
return (0, cluster_key_slot_1.default)(key);
|
|
17
|
+
}
|
|
18
|
+
calculateSlotForKeys(keys) {
|
|
19
|
+
if (keys.length === 0) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return cluster_key_slot_1.default.generateMulti([...keys]);
|
|
23
|
+
}
|
|
24
|
+
getNode(id) {
|
|
25
|
+
for (const node of this.nodes) {
|
|
26
|
+
if (node.id === id) {
|
|
27
|
+
return node;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the master node owning the slot. Replicas are never returned —
|
|
34
|
+
* MOVED must always direct the client to a master. Returns undefined if
|
|
35
|
+
* the slot is unassigned.
|
|
36
|
+
*/
|
|
37
|
+
getSlotOwner(slot) {
|
|
38
|
+
for (const node of this.nodes) {
|
|
39
|
+
if (node.role !== 'master') {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (nodeOwnsSlot(node, slot)) {
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns whether the node is the master serving the slot. Replicas never
|
|
50
|
+
* own slots for routing purposes — keyed commands sent directly to a
|
|
51
|
+
* replica must redirect to the master via MOVED.
|
|
52
|
+
*/
|
|
53
|
+
nodeOwnsSlot(nodeId, slot) {
|
|
54
|
+
const node = this.getNode(nodeId);
|
|
55
|
+
return node && node.role === 'master' ? nodeOwnsSlot(node, slot) : false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.RedisClusterTopology = RedisClusterTopology;
|
|
59
|
+
function validateTopology(nodes) {
|
|
60
|
+
const ids = new Set();
|
|
61
|
+
for (const node of nodes) {
|
|
62
|
+
if (ids.has(node.id)) {
|
|
63
|
+
throw new Error(`Duplicate cluster node id ${node.id}`);
|
|
64
|
+
}
|
|
65
|
+
ids.add(node.id);
|
|
66
|
+
for (const [min, max] of node.slots) {
|
|
67
|
+
if (!Number.isInteger(min) ||
|
|
68
|
+
!Number.isInteger(max) ||
|
|
69
|
+
min < 0 ||
|
|
70
|
+
max >= exports.REDIS_CLUSTER_SLOT_COUNT ||
|
|
71
|
+
min > max) {
|
|
72
|
+
throw new Error(`Invalid slot range [${min}, ${max}] on node ${node.id}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (node.role === 'replica' && !node.masterId) {
|
|
76
|
+
throw new Error(`Replica node ${node.id} is missing masterId`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function nodeOwnsSlot(node, slot) {
|
|
81
|
+
for (const [min, max] of node.slots) {
|
|
82
|
+
if (slot >= min && slot <= max) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=cluster-topology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-topology.js","sourceRoot":"","sources":["../../src/state/cluster-topology.ts"],"names":[],"mappings":";;;;;;AAAA,wEAA6C;AAahC,QAAA,wBAAwB,GAAG,KAAK,CAAA;AAE7C,MAAa,oBAAoB;IACH;IAA5B,YAA4B,QAAqC,EAAE;QAAvC,UAAK,GAAL,KAAK,CAAkC;QACjE,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED,aAAa,CAAC,GAAW;Q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buffer;
|
|
5
|
+
};
|
|
6
|
+
export type RedisHashData = {
|
|
7
|
+
type: 'hash';
|
|
8
|
+
fields: Map<string, RedisHashField>;
|
|
9
|
+
};
|
|
10
|
+
export type RedisHashField = {
|
|
11
|
+
field: Buffer;
|
|
12
|
+
value: Buffer;
|
|
13
|
+
};
|
|
14
|
+
export type RedisListData = {
|
|
15
|
+
type: 'list';
|
|
16
|
+
values: Buffer[];
|
|
17
|
+
};
|
|
18
|
+
export type RedisSetData = {
|
|
19
|
+
type: 'set';
|
|
20
|
+
members: Map<string, Buffer>;
|
|
21
|
+
};
|
|
22
|
+
export type RedisSortedSetData = {
|
|
23
|
+
type: 'zset';
|
|
24
|
+
members: Map<string, RedisSortedSetMember>;
|
|
25
|
+
};
|
|
26
|
+
export type RedisSortedSetMember = {
|
|
27
|
+
member: Buffer;
|
|
28
|
+
score: number;
|
|
29
|
+
};
|
|
30
|
+
export type RedisStreamData = {
|
|
31
|
+
type: 'stream';
|
|
32
|
+
};
|
|
33
|
+
export type RedisDataValue = RedisStringData | RedisHashData | RedisListData | RedisSetData | RedisSortedSetData | RedisStreamData;
|
|
34
|
+
export declare function cloneRedisDataValue(value: RedisDataValue): RedisDataValue;
|
|
35
|
+
export declare function createStringData(value: Buffer): RedisStringData;
|
|
36
|
+
export declare function createHashData(): RedisHashData;
|
|
37
|
+
export declare function createListData(): RedisListData;
|
|
38
|
+
export declare function createSetData(): RedisSetData;
|
|
39
|
+
export declare function createSortedSetData(): RedisSortedSetData;
|
|
40
|
+
//# sourceMappingURL=data-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types.d.ts","sourceRoot":"","sources":["../../src/state/data-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,GACN,QAAQ,CAAA;AAEZ,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,QAAQ,C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,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloneRedisDataValue = cloneRedisDataValue;
|
|
4
|
+
exports.createStringData = createStringData;
|
|
5
|
+
exports.createHashData = createHashData;
|
|
6
|
+
exports.createListData = createListData;
|
|
7
|
+
exports.createSetData = createSetData;
|
|
8
|
+
exports.createSortedSetData = createSortedSetData;
|
|
9
|
+
function cloneRedisDataValue(value) {
|
|
10
|
+
switch (value.type) {
|
|
11
|
+
case 'string':
|
|
12
|
+
return { type: 'string', value: Buffer.from(value.value) };
|
|
13
|
+
case 'hash':
|
|
14
|
+
return {
|
|
15
|
+
type: 'hash',
|
|
16
|
+
fields: new Map(Array.from(value.fields, ([id, field]) => [
|
|
17
|
+
id,
|
|
18
|
+
{
|
|
19
|
+
field: Buffer.from(field.field),
|
|
20
|
+
value: Buffer.from(field.value),
|
|
21
|
+
},
|
|
22
|
+
])),
|
|
23
|
+
};
|
|
24
|
+
case 'list':
|
|
25
|
+
return {
|
|
26
|
+
type: 'list',
|
|
27
|
+
values: value.values.map(item => Buffer.from(item)),
|
|
28
|
+
};
|
|
29
|
+
case 'set':
|
|
30
|
+
return {
|
|
31
|
+
type: 'set',
|
|
32
|
+
members: new Map(Array.from(value.members, ([id, member]) => [
|
|
33
|
+
id,
|
|
34
|
+
Buffer.from(member),
|
|
35
|
+
])),
|
|
36
|
+
};
|
|
37
|
+
case 'zset':
|
|
38
|
+
return {
|
|
39
|
+
type: 'zset',
|
|
40
|
+
members: new Map(Array.from(value.members, ([id, member]) => [
|
|
41
|
+
id,
|
|
42
|
+
{
|
|
43
|
+
member: Buffer.from(member.member),
|
|
44
|
+
score: member.score,
|
|
45
|
+
},
|
|
46
|
+
])),
|
|
47
|
+
};
|
|
48
|
+
case 'stream':
|
|
49
|
+
return { type: 'stream' };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function createStringData(value) {
|
|
53
|
+
return { type: 'string', value: Buffer.from(value) };
|
|
54
|
+
}
|
|
55
|
+
function createHashData() {
|
|
56
|
+
return { type: 'hash', fields: new Map() };
|
|
57
|
+
}
|
|
58
|
+
function createListData() {
|
|
59
|
+
return { type: 'list', values: [] };
|
|
60
|
+
}
|
|
61
|
+
function createSetData() {
|
|
62
|
+
return { type: 'set', members: new Map() };
|
|
63
|
+
}
|
|
64
|
+
function createSortedSetData() {
|
|
65
|
+
return { type: 'zset', members: new Map() };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=data-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types.js","sourceRoot":"","sources":["../../src/state/data-types.ts"],"names":[],"mappings":";;AAuDA,kDAgDC;AAED,4CAEC;AAED,wCAEC;AAED,wCAEC;AAED,sCAEC;AAED,kDAEC;AApED,SAAgB,mBAAmB,CAAC,KAAqB;IACvD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAA;QAC5D,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,IAAI,GAAG,CACb,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;oBACxC,EAAE;oBACF;wBACE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;wBAC/B,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;qBAChC;iBACF,CAAC,CACH;aACF,CAAA;QACH,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EA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EAAE,EAAE,CAAA;AAC5C,CAAC;AAED,SAAgB,mBAAmB;IACjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,CAAA;AAC7C,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type RedisDataValue, type RedisHashData, type RedisListData, type RedisSetData, type RedisSortedSetData } from './data-types';
|
|
2
|
+
import { ExpirationState, KeyspaceEntry, SetOptions } from './keyspace';
|
|
3
|
+
import { RedisMutationBus, RedisMutationListener, Unsubscribe } from './mutation-events';
|
|
4
|
+
import { type RedisTurnQueue } from '../core/turn-queue';
|
|
5
|
+
export declare class RedisDatabase {
|
|
6
|
+
readonly id: number;
|
|
7
|
+
readonly mutations: RedisMutationBus;
|
|
8
|
+
/**
|
|
9
|
+
* Per-database serialization turn. All sessions targeting this database
|
|
10
|
+
* acquire turns from here so writes do not interleave. Sessions on other
|
|
11
|
+
* databases run on independent queues, which means the mock allows
|
|
12
|
+
* cross-database parallelism — real Redis is single-threaded across all
|
|
13
|
+
* databases. Acceptable for a mock; do not rely on cross-database
|
|
14
|
+
* serialization in tests.
|
|
15
|
+
*/
|
|
16
|
+
readonly turnQueue: RedisTurnQueue;
|
|
17
|
+
private readonly keyspace;
|
|
18
|
+
constructor(id: number);
|
|
19
|
+
get(key: Buffer): RedisDataValue | null;
|
|
20
|
+
getString(key: Buffer): Buffer | null;
|
|
21
|
+
getType(key: Buffer): RedisDataValue['type'] | null;
|
|
22
|
+
set(key: Buffer, value: RedisDataValue, options?: SetOptions): void;
|
|
23
|
+
setString(key: Buffer, value: Buffer, options?: SetOptions): void;
|
|
24
|
+
delete(key: Buffer): boolean;
|
|
25
|
+
expire(key: Buffer, expiresAt: number): boolean;
|
|
26
|
+
persist(key: Buffer): boolean;
|
|
27
|
+
getExpiration(key: Buffer): ExpirationState;
|
|
28
|
+
getHash(key: Buffer): RedisHashData | null;
|
|
29
|
+
getList(key: Buffer): RedisListData | null;
|
|
30
|
+
getSet(key: Buffer): RedisSetData | null;
|
|
31
|
+
getSortedSet(key: Buffer): RedisSortedSetData | null;
|
|
32
|
+
updateHash<TResult>(key: Buffer, mutator: (hash: RedisHashData) => TResult): TResult;
|
|
33
|
+
updateList<TResult>(key: Buffer, mutator: (list: RedisListData) => TResult): TResult;
|
|
34
|
+
updateSet<TResult>(key: Buffer, mutator: (set: RedisSetData) => TResult): TResult;
|
|
35
|
+
updateSortedSet<TResult>(key: Buffer, mutator: (zset: RedisSortedSetData) => TResult): TResult;
|
|
36
|
+
private getTyped;
|
|
37
|
+
private updateTyped;
|
|
38
|
+
flush(): void;
|
|
39
|
+
size(): number;
|
|
40
|
+
entriesSnapshot(): KeyspaceEntry[];
|
|
41
|
+
subscribe(listener: RedisMutationListener): Unsubscribe;
|
|
42
|
+
subscribeKey(key: Buffer, listener: RedisMutationListener): Unsubscribe;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/state/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,eAAe,EACf,aAAa,EAEb,UAAU,EAEX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGzE,qBAAa,aAAa;aAaI,EAAE,EAAE,MAAM;IAZtC,QAAQ,CAAC,SAAS,mBAAyB;IAC3C;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAEZ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;IAIV,eAAe,CAAC,OAAO,EACrB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,GAC7C,OAAO;IAIV,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,WAAW;IAcnB,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,MAAM;IAId,eAAe,IAAI,aAAa,EAAE;IAIlC,SAAS,CAAC,QAAQ,EAAE,qBAAqB,GAAG,WAAW;IAIvD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,GAAG,WAAW;CAGxE"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedisDatabase = void 0;
|
|
4
|
+
const data_types_1 = require("./data-types");
|
|
5
|
+
const keyspace_1 = require("./keyspace");
|
|
6
|
+
const mutation_events_1 = require("./mutation-events");
|
|
7
|
+
const turn_queue_1 = require("../core/turn-queue");
|
|
8
|
+
const redis_error_1 = require("../core/redis-error");
|
|
9
|
+
class RedisDatabase {
|
|
10
|
+
id;
|
|
11
|
+
mutations = new mutation_events_1.RedisMutationBus();
|
|
12
|
+
/**
|
|
13
|
+
* Per-database serialization turn. All sessions targeting this database
|
|
14
|
+
* acquire turns from here so writes do not interleave. Sessions on other
|
|
15
|
+
* databases run on independent queues, which means the mock allows
|
|
16
|
+
* cross-database parallelism — real Redis is single-threaded across all
|
|
17
|
+
* databases. Acceptable for a mock; do not rely on cross-database
|
|
18
|
+
* serialization in tests.
|
|
19
|
+
*/
|
|
20
|
+
turnQueue = new turn_queue_1.SerialTurnQueue();
|
|
21
|
+
keyspace;
|
|
22
|
+
constructor(id) {
|
|
23
|
+
this.id = id;
|
|
24
|
+
this.keyspace = new keyspace_1.RedisKeyspace(this.id, this.mutations);
|
|
25
|
+
}
|
|
26
|
+
get(key) {
|
|
27
|
+
return this.keyspace.get(key);
|
|
28
|
+
}
|
|
29
|
+
getString(key) {
|
|
30
|
+
const value = this.keyspace.get(key);
|
|
31
|
+
if (!value || value.type !== 'string') {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return Buffer.from(value.value);
|
|
35
|
+
}
|
|
36
|
+
getType(key) {
|
|
37
|
+
return this.keyspace.getType(key);
|
|
38
|
+
}
|
|
39
|
+
set(key, value, options) {
|
|
40
|
+
this.keyspace.set(key, value, options);
|
|
41
|
+
}
|
|
42
|
+
setString(key, value, options) {
|
|
43
|
+
this.keyspace.set(key, (0, data_types_1.createStringData)(value), options);
|
|
44
|
+
}
|
|
45
|
+
delete(key) {
|
|
46
|
+
return this.keyspace.delete(key);
|
|
47
|
+
}
|
|
48
|
+
expire(key, expiresAt) {
|
|
49
|
+
return this.keyspace.expire(key, expiresAt);
|
|
50
|
+
}
|
|
51
|
+
persist(key) {
|
|
52
|
+
return this.keyspace.persist(key);
|
|
53
|
+
}
|
|
54
|
+
getExpiration(key) {
|
|
55
|
+
return this.keyspace.getExpiration(key);
|
|
56
|
+
}
|
|
57
|
+
getHash(key) {
|
|
58
|
+
return this.getTyped(key, 'hash');
|
|
59
|
+
}
|
|
60
|
+
getList(key) {
|
|
61
|
+
return this.getTyped(key, 'list');
|
|
62
|
+
}
|
|
63
|
+
getSet(key) {
|
|
64
|
+
return this.getTyped(key, 'set');
|
|
65
|
+
}
|
|
66
|
+
getSortedSet(key) {
|
|
67
|
+
return this.getTyped(key, 'zset');
|
|
68
|
+
}
|
|
69
|
+
updateHash(key, mutator) {
|
|
70
|
+
return this.updateTyped(key, 'hash', data_types_1.createHashData, mutator);
|
|
71
|
+
}
|
|
72
|
+
updateList(key, mutator) {
|
|
73
|
+
return this.updateTyped(key, 'list', data_types_1.createListData, mutator);
|
|
74
|
+
}
|
|
75
|
+
updateSet(key, mutator) {
|
|
76
|
+
return this.updateTyped(key, 'set', data_types_1.createSetData, mutator);
|
|
77
|
+
}
|
|
78
|
+
updateSortedSet(key, mutator) {
|
|
79
|
+
return this.updateTyped(key, 'zset', data_types_1.createSortedSetData, mutator);
|
|
80
|
+
}
|
|
81
|
+
getTyped(key, expectedType) {
|
|
82
|
+
const value = this.keyspace.get(key);
|
|
83
|
+
if (!value)
|
|
84
|
+
return null;
|
|
85
|
+
if (value.type !== expectedType)
|
|
86
|
+
throw new redis_error_1.WrongTypeRedisError();
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
updateTyped(key, expectedType, createValue, mutator) {
|
|
90
|
+
try {
|
|
91
|
+
return this.keyspace.update(key, expectedType, createValue, mutator);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err instanceof keyspace_1.WrongRedisTypeError)
|
|
95
|
+
throw new redis_error_1.WrongTypeRedisError();
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
flush() {
|
|
100
|
+
this.keyspace.flush();
|
|
101
|
+
}
|
|
102
|
+
size() {
|
|
103
|
+
return this.keyspace.size();
|
|
104
|
+
}
|
|
105
|
+
entriesSnapshot() {
|
|
106
|
+
return this.keyspace.entriesSnapshot();
|
|
107
|
+
}
|
|
108
|
+
subscribe(listener) {
|
|
109
|
+
return this.mutations.subscribe(listener);
|
|
110
|
+
}
|
|
111
|
+
subscribeKey(key, listener) {
|
|
112
|
+
return this.mutations.subscribeKey(key, listener);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.RedisDatabase = RedisDatabase;
|
|
116
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/state/database.ts"],"names":[],"mappings":";;;AAAA,6CAWqB;AACrB,yCAMmB;AACnB,uDAI0B;AAC1B,mDAAyE;AACzE,qDAAyD;AAEzD,MAAa,aAAa;IAaI;IAZnB,SAAS,GAAG,IAAI,kCAAgB,EAAE,CAAA;IAC3C;;;;;;;OAOG;IACM,SAAS,GAAmB,IA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B;QAE5B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QACvB,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;YAAE,MAAM,IAAI,iCAAmB,EAAE,CAAA;QAChE,OAAO,KAAe,CAAA;IACxB,CAAC;IAEO,WAAW,CACjB,GAAW,EACX,YAA4B,EAC5B,WAAyB,EACzB,OAAmC;QAEnC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;QACtE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,8BAAmB;gBAAE,MAAM,IAAI,iCAAmB,EAAE,CAAA;YACvE,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC7B,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAA;IACxC,CAAC;IAED,SAAS,CAAC,QAA+B;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC3C,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,QAA+B;QACvD,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACnD,CAAC;CACF;AAjJD,sCAiJC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { RedisDataTypeName, RedisDataValue, RedisHashData, RedisHashField, RedisListData, RedisSetData, RedisSortedSetData, RedisSortedSetMember, RedisStreamData, RedisStringData, } from './data-types';
|
|
2
|
+
export { cloneRedisDataValue, createHashData, createListData, createSetData, createSortedSetData, createStringData, } from './data-types';
|
|
3
|
+
export type { RedisMutationEvent, RedisMutationListener, Unsubscribe, } from './mutation-events';
|
|
4
|
+
export { RedisMutationBus } from './mutation-events';
|
|
5
|
+
export type { ExpirationState, KeyspaceEntry, SetOptions } from './keyspace';
|
|
6
|
+
export { RedisKeyspace, WrongRedisTypeError } from './keyspace';
|
|
7
|
+
export { RedisDatabase } from './database';
|
|
8
|
+
export { RedisScriptCache } from './script-cache';
|
|
9
|
+
export { RedisPubSubBroker } from './pubsub-broker';
|
|
10
|
+
export type { RedisClusterNode, RedisClusterNodeRole } from './cluster-topology';
|
|
11
|
+
export { REDIS_CLUSTER_SLOT_COUNT, RedisClusterTopology, } from './cluster-topology';
|
|
12
|
+
export type { RedisServerStateOptions } from './server-state';
|
|
13
|
+
export { RedisServerState } from './server-state';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA"}
|