@axiom-lattice/queue-redis 1.0.1 → 1.0.3

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,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/queue-redis@1.0.1 build /home/runner/work/agentic/agentic/packages/queue-redis
2
+ > @axiom-lattice/queue-redis@1.0.3 build /home/runner/work/agentic/agentic/packages/queue-redis
3
3
  > tsup src/index.ts --format cjs,esm --dts --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,11 +10,11 @@
10
10
  ESM Build start
11
11
  CJS dist/index.js 3.72 KB
12
12
  CJS dist/index.js.map 5.58 KB
13
- CJS ⚡️ Build success in 64ms
13
+ CJS ⚡️ Build success in 118ms
14
14
  ESM dist/index.mjs 2.69 KB
15
15
  ESM dist/index.mjs.map 5.48 KB
16
- ESM ⚡️ Build success in 66ms
16
+ ESM ⚡️ Build success in 123ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 27643ms
18
+ DTS ⚡️ Build success in 27571ms
19
19
  DTS dist/index.d.ts 1.14 KB
20
20
  DTS dist/index.d.mts 1.14 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @axiom-lattice/queue-redis
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d9beb3a]
8
+ - @axiom-lattice/protocols@2.1.4
9
+
10
+ ## 1.0.2
11
+
12
+ ### Patch Changes
13
+
14
+ - ce6fc7c: fix issue
15
+ - Updated dependencies [ce6fc7c]
16
+ - @axiom-lattice/protocols@2.1.3
17
+
3
18
  ## 1.0.1
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -74,3 +74,4 @@ The Redis queue client can be configured via:
74
74
 
75
75
  MIT
76
76
 
77
+
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/RedisQueueClient.ts"],"sourcesContent":["export * from \"./RedisQueueClient\";\n","/**\n * RedisQueueClient\n *\n * Redis-based queue service implementation\n */\n\nimport { createClient, RedisClientType } from \"redis\";\nimport { QueueClient, QueueResult } from \"@axiom-lattice/protocols\";\n\n/**\n * Redis queue client options\n */\nexport interface RedisQueueClientOptions {\n redisUrl?: string;\n redisPassword?: string;\n}\n\n/**\n * Redis-based queue client implementation\n */\nexport class RedisQueueClient implements QueueClient {\n private queueName: string;\n private redisUrl?: string;\n private redisPassword?: string;\n private redisClient: RedisClientType | null = null;\n private isConnecting = false;\n private connectionPromise: Promise<void> | null = null;\n\n constructor(queueName: string = \"tasks\", options?: RedisQueueClientOptions) {\n this.queueName = queueName;\n this.redisUrl =\n options?.redisUrl || process.env.REDIS_URL || \"redis://localhost:6379\";\n this.redisPassword = options?.redisPassword || process.env.REDIS_PASSWORD;\n }\n\n /**\n * Lazy initialization of Redis client\n */\n private async getRedisClient(): Promise<RedisClientType> {\n // If client is already connected, return it\n if (this.redisClient?.isOpen) {\n return this.redisClient;\n }\n\n // If connection is in progress, wait for it\n if (this.isConnecting && this.connectionPromise) {\n await this.connectionPromise;\n if (this.redisClient?.isOpen) {\n return this.redisClient;\n }\n }\n\n // Create and connect to Redis client\n this.isConnecting = true;\n this.connectionPromise = (async () => {\n try {\n const redisOptions: any = {\n url: this.redisUrl,\n password: this.redisPassword,\n };\n\n this.redisClient = createClient(redisOptions) as RedisClientType;\n\n this.redisClient.on(\"error\", (err: Error) =>\n console.error(\"Redis Client Error\", err)\n );\n\n await this.redisClient.connect();\n console.log(\"Redis connection successful\");\n this.isConnecting = false;\n } catch (error) {\n console.error(\"Redis connection failed:\", error);\n this.isConnecting = false;\n throw error;\n }\n })();\n\n await this.connectionPromise;\n return this.redisClient!;\n }\n\n /**\n * Enqueue message\n */\n async push(item: any): Promise<QueueResult<number>> {\n try {\n const client = await this.getRedisClient();\n // Push message to queue\n const result = await client.lPush(this.queueName, JSON.stringify(item));\n console.log(\"lPush\", result);\n return { data: result, error: null };\n } catch (error) {\n console.error(error);\n return { data: null, error };\n }\n }\n\n /**\n * Dequeue message\n */\n async pop(): Promise<QueueResult<any>> {\n try {\n const client = await this.getRedisClient();\n // Get message from queue\n const message = await client.rPop(this.queueName);\n if (message) {\n return { data: JSON.parse(message), error: null };\n }\n return { data: null, error: null };\n } catch (error) {\n console.error(error);\n return { data: null, error };\n }\n }\n\n /**\n * Create queue (Redis doesn't need explicit queue creation, but we keep this function for API compatibility)\n */\n async createQueue(): Promise<{\n success: boolean;\n queue_name?: string;\n error?: any;\n }> {\n try {\n const client = await this.getRedisClient();\n const exists = await client.exists(this.queueName);\n return { success: true, queue_name: this.queueName };\n } catch (error) {\n console.error(error);\n return { success: false, error };\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,mBAA8C;AAcvC,IAAM,mBAAN,MAA8C;AAAA,EAQnD,YAAY,YAAoB,SAAS,SAAmC;AAJ5E,SAAQ,cAAsC;AAC9C,SAAQ,eAAe;AACvB,SAAQ,oBAA0C;AAGhD,SAAK,YAAY;AACjB,SAAK,WACH,SAAS,YAAY,QAAQ,IAAI,aAAa;AAChD,SAAK,gBAAgB,SAAS,iBAAiB,QAAQ,IAAI;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,iBAA2C;AAEvD,QAAI,KAAK,aAAa,QAAQ;AAC5B,aAAO,KAAK;AAAA,IACd;AAGA,QAAI,KAAK,gBAAgB,KAAK,mBAAmB;AAC/C,YAAM,KAAK;AACX,UAAI,KAAK,aAAa,QAAQ;AAC5B,eAAO,KAAK;AAAA,MACd;AAAA,IACF;AAGA,SAAK,eAAe;AACpB,SAAK,qBAAqB,YAAY;AACpC,UAAI;AACF,cAAM,eAAoB;AAAA,UACxB,KAAK,KAAK;AAAA,UACV,UAAU,KAAK;AAAA,QACjB;AAEA,aAAK,kBAAc,2BAAa,YAAY;AAE5C,aAAK,YAAY;AAAA,UAAG;AAAA,UAAS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AO;AACd,cAAQ,MAAM,KAAK;AACnB,aAAO,EAAE,SAAS,OAAO,MAAM;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/RedisQueueClient.ts"],"sourcesContent":["export * from \"./RedisQueueClient\";\n\n","/**\n * RedisQueueClient\n *\n * Redis-based queue service implementation\n */\n\nimport { createClient, RedisClientType } from \"redis\";\nimport { QueueClient, QueueResult } from \"@axiom-lattice/protocols\";\n\n/**\n * Redis queue client options\n */\nexport interface RedisQueueClientOptions {\n redisUrl?: string;\n redisPassword?: string;\n}\n\n/**\n * Redis-based queue client implementation\n */\nexport class RedisQueueClient implements QueueClient {\n private queueName: string;\n private redisUrl?: string;\n private redisPassword?: string;\n private redisClient: RedisClientType | null = null;\n private isConnecting = false;\n private connectionPromise: Promise<void> | null = null;\n\n constructor(queueName: string = \"tasks\", options?: RedisQueueClientOptions) {\n this.queueName = queueName;\n this.redisUrl =\n options?.redisUrl || process.env.REDIS_URL || \"redis://localhost:6379\";\n this.redisPassword = options?.redisPassword || process.env.REDIS_PASSWORD;\n }\n\n /**\n * Lazy initialization of Redis client\n */\n private async getRedisClient(): Promise<RedisClientType> {\n // If client is already connected, return it\n if (this.redisClient?.isOpen) {\n return this.redisClient;\n }\n\n // If connection is in progress, wait for it\n if (this.isConnecting && this.connectionPromise) {\n await this.connectionPromise;\n if (this.redisClient?.isOpen) {\n return this.redisClient;\n }\n }\n\n // Create and connect to Redis client\n this.isConnecting = true;\n this.connectionPromise = (async () => {\n try {\n const redisOptions: any = {\n url: this.redisUrl,\n password: this.redisPassword,\n };\n\n this.redisClient = createClient(redisOptions) as RedisClientType;\n\n this.redisClient.on(\"error\", (err: Error) =>\n console.error(\"Redis Client Error\", err)\n );\n\n await this.redisClient.connect();\n console.log(\"Redis connection successful\");\n this.isConnecting = false;\n } catch (error) {\n console.error(\"Redis connection failed:\", error);\n this.isConnecting = false;\n throw error;\n }\n })();\n\n await this.connectionPromise;\n return this.redisClient!;\n }\n\n /**\n * Enqueue message\n */\n async push(item: any): Promise<QueueResult<number>> {\n try {\n const client = await this.getRedisClient();\n // Push message to queue\n const result = await client.lPush(this.queueName, JSON.stringify(item));\n console.log(\"lPush\", result);\n return { data: result, error: null };\n } catch (error) {\n console.error(error);\n return { data: null, error };\n }\n }\n\n /**\n * Dequeue message\n */\n async pop(): Promise<QueueResult<any>> {\n try {\n const client = await this.getRedisClient();\n // Get message from queue\n const message = await client.rPop(this.queueName);\n if (message) {\n return { data: JSON.parse(message), error: null };\n }\n return { data: null, error: null };\n } catch (error) {\n console.error(error);\n return { data: null, error };\n }\n }\n\n /**\n * Create queue (Redis doesn't need explicit queue creation, but we keep this function for API compatibility)\n */\n async createQueue(): Promise<{\n success: boolean;\n queue_name?: string;\n error?: any;\n }> {\n try {\n const client = await this.getRedisClient();\n const exists = await client.exists(this.queueName);\n return { success: true, queue_name: this.queueName };\n } catch (error) {\n console.error(error);\n return { success: false, error };\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,mBAA8C;AAcvC,IAAM,mBAAN,MAA8C;AAAA,EAQnD,YAAY,YAAoB,SAAS,SAAmC;AAJ5E,SAAQ,cAAsC;AAC9C,SAAQ,eAAe;AACvB,SAAQ,oBAA0C;AAGhD,SAAK,YAAY;AACjB,SAAK,WACH,SAAS,YAAY,QAAQ,IAAI,aAAa;AAChD,SAAK,gBAAgB,SAAS,iBAAiB,QAAQ,IAAI;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,iBAA2C;AAEvD,QAAI,KAAK,aAAa,QAAQ;AAC5B,aAAO,KAAK;AAAA,IACd;AAGA,QAAI,KAAK,gBAAgB,KAAK,mBAAmB;AAC/C,YAAM,KAAK;AACX,UAAI,KAAK,aAAa,QAAQ;AAC5B,eAAO,KAAK;AAAA,MACd;AAAA,IACF;AAGA,SAAK,eAAe;AACpB,SAAK,qBAAqB,YAA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IH;AACD,QAAI;AACF,YAAM,SAAS,MAAM,KAAK,eAAe;AACzC,YAAM,SAAS,MAAM,OAAO,OAAO,KAAK,SAAS;AACjD,aAAO,EAAE,SAAS,MAAM,YAAY,KAAK,UAAU;AAAA,IACrD,SAAS,OAAO;AACd,cAAQ,MAAM,KAAK;AACnB,aAAO,EAAE,SAAS,OAAO,MAAM;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/queue-redis",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Redis queue client implementation for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,7 +22,7 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "redis": "^5.0.1",
25
- "@axiom-lattice/protocols": "2.1.2"
25
+ "@axiom-lattice/protocols": "2.1.4"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^20.11.24",
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./RedisQueueClient";
2
+
package/tsconfig.json CHANGED
@@ -22,3 +22,4 @@
22
22
  "exclude": ["node_modules", "dist"]
23
23
  }
24
24
 
25
+