@bejibun/redis 0.1.11 → 0.1.13

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.
@@ -1,3 +1,4 @@
1
+ import type { RedisPipeline, RedisSubscribe } from "@/types/redis";
1
2
  import { RedisClient } from "bun";
2
3
  export default class RedisBuilder {
3
4
  private static clients;
@@ -3,6 +3,7 @@ import { defineValue, isEmpty, isNotEmpty } from "@bejibun/core";
3
3
  import { RedisClient } from "bun";
4
4
  import { EventEmitter } from "events";
5
5
  import config from "../config/redis";
6
+ import RedisException from "../exceptions/RedisException";
6
7
  class RedisBuilder {
7
8
  static connection(name) {
8
9
  return {
@@ -1,12 +1,12 @@
1
1
  const config = {
2
- default: process.env.REDIS_CONNECTION,
2
+ default: "local",
3
3
  connections: {
4
4
  local: {
5
- host: process.env.REDIS_HOST,
6
- port: process.env.REDIS_PORT,
7
- password: process.env.REDIS_PASSWORD,
8
- database: process.env.REDIS_DATABASE,
9
- maxRetries: Number(process.env.REDIS_MAX_RETRIES)
5
+ host: "127.0.0.1",
6
+ port: 6379,
7
+ password: "",
8
+ database: 0,
9
+ maxRetries: 10
10
10
  }
11
11
  }
12
12
  };
@@ -1,3 +1,4 @@
1
+ import type { RedisPipeline, RedisSubscribe } from "@/types/redis";
1
2
  import { RedisClient } from "bun";
2
3
  export default class Redis {
3
4
  static connection(name: string): Record<string, Function>;
@@ -1,4 +1,4 @@
1
- import RedisBuilder from "./builders/RedisBuilder";
1
+ import RedisBuilder from "../builders/RedisBuilder";
2
2
  export default class Redis {
3
3
  static connection(name) {
4
4
  return RedisBuilder.connection(name);
@@ -0,0 +1,2 @@
1
+ import Redis from "./facades/Redis";
2
+ export default Redis;
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import Redis from "./facades/Redis";
2
+ export default Redis;
@@ -0,0 +1 @@
1
+ export * from "@/types/redis";
@@ -0,0 +1,16 @@
1
+ export type RedisConfig = {
2
+ host: string;
3
+ port: number;
4
+ password?: string | null;
5
+ database?: number;
6
+ maxRetries?: number;
7
+ };
8
+ export type RedisPipeline = {
9
+ del: (key: string) => void;
10
+ get: (key: string) => void;
11
+ set: (key: string, value: any, ttl?: number) => void;
12
+ };
13
+ export type RedisSubscribe = {
14
+ client: RedisClient;
15
+ unsubscribe: () => Promise<boolean>;
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bejibun/redis",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Redis for Bejibun Framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -27,6 +27,18 @@
27
27
  ".": {
28
28
  "import": "./dist/index.js",
29
29
  "types": "./dist/index.d.ts"
30
+ },
31
+ "./exceptions/*": {
32
+ "import": "./dist/exceptions/*.js",
33
+ "types": "./dist/exceptions/*.d.ts"
34
+ },
35
+ "./facades/*": {
36
+ "import": "./dist/facades/*.js",
37
+ "types": "./dist/facades/*.d.ts"
38
+ },
39
+ "./types/*": {
40
+ "import": "./dist/types/*.js",
41
+ "types": "./dist/types/*.d.ts"
30
42
  }
31
43
  },
32
44
  "files": [
@@ -34,10 +46,11 @@
34
46
  ],
35
47
  "scripts": {
36
48
  "clean": "rm -rf dist",
37
- "build": "bun run clean && tsc -p tsconfig.json && tsc-alias -p tsconfig.json"
49
+ "build": "bun run clean && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && cp -rf src/types dist/types",
50
+ "deploy": "bun run build && npm publish --access public"
38
51
  },
39
52
  "dependencies": {
40
- "@bejibun/core": "^0.1.20"
53
+ "@bejibun/core": "^0.1.23"
41
54
  },
42
55
  "devDependencies": {
43
56
  "@types/bun": "latest",