@zintrust/queue-redis 2.0.0 → 2.1.4

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,4 +1,4 @@
1
- import type { BullMQPayload, QueueMessage } from '@zintrust/core';
1
+ import type { BullMQPayload, QueueMessage } from '@zintrust/core/queue';
2
2
  import { Queue } from 'bullmq';
3
3
  interface IQueueDriver {
4
4
  enqueue(queue: string, payload: BullMQPayload): Promise<string>;
@@ -1,4 +1,11 @@
1
- import { Cloudflare, createLockProvider, createRedisConnection, Env, ErrorFactory, generateUuid, getBullMQSafeQueueName, getLockProvider, Logger, queueConfig, registerLockProvider, resolveDeduplicationLockKey, resolveLockPrefix, ZintrustLang, } from '@zintrust/core';
1
+ import { Cloudflare } from '@zintrust/core/cloudflare';
2
+ import { Env, queueConfig } from '@zintrust/core/config';
3
+ import { ErrorFactory } from '@zintrust/core/errors';
4
+ import { isNullish, isUndefinedOrNull } from '@zintrust/core/helper';
5
+ import { Logger } from '@zintrust/core/logger';
6
+ import { createLockProvider, getLockProvider, registerLockProvider, resolveDeduplicationLockKey, resolveLockPrefix, } from '@zintrust/core/queue';
7
+ import { createRedisConnection, getBullMQSafeQueueName } from '@zintrust/core/redis';
8
+ import { generateUuid, ZintrustLang } from '@zintrust/core/utils';
2
9
  import { Queue } from 'bullmq';
3
10
  import { HttpQueueDriver } from './HttpQueueDriver.js';
4
11
  export const shouldUseHttpProxyDriver = () => {
@@ -42,21 +49,27 @@ export const BullMQRedisQueue = (() => {
42
49
  }
43
50
  };
44
51
  const resolveQueueRedisConfig = () => {
45
- const workersHost = Cloudflare.getWorkersVar('WORKERS_REDIS_HOST');
46
- const workersPortRaw = Cloudflare.getWorkersVar('WORKERS_REDIS_PORT');
47
- const workersPassword = Cloudflare.getWorkersVar('WORKERS_REDIS_PASSWORD');
48
- const workersDbRaw = Cloudflare.getWorkersVar('WORKERS_REDIS_QUEUE_DB');
52
+ let workersHost = Cloudflare.getWorkersVar('WORKERS_REDIS_HOST');
53
+ let workersPortRaw = Cloudflare.getWorkersVar('WORKERS_REDIS_PORT');
54
+ let workersPassword = Cloudflare.getWorkersVar('WORKERS_REDIS_PASSWORD');
55
+ let workersDbRaw = Cloudflare.getWorkersVar('WORKERS_REDIS_QUEUE_DB');
56
+ if (isUndefinedOrNull(workersPassword) || isNullish(workersPassword)) {
57
+ workersPassword = Env.get('REDIS_PASSWORD', '');
58
+ }
59
+ if (isUndefinedOrNull(workersPortRaw) || isNullish(workersPortRaw)) {
60
+ workersPortRaw = Env.get('REDIS_PORT', '6379');
61
+ }
62
+ if (isUndefinedOrNull(workersHost) || isNullish(workersHost)) {
63
+ workersHost = Env.get('REDIS_HOST', '127.0.0.1');
64
+ }
65
+ if (isUndefinedOrNull(workersDbRaw) || isNullish(workersDbRaw)) {
66
+ workersDbRaw = Env.get('REDIS_QUEUE_DB', '0');
67
+ }
49
68
  return {
50
- host: workersHost !== null && workersHost.trim() !== '' ? workersHost.trim() : Env.REDIS_HOST,
51
- port: workersPortRaw !== null && Number.isFinite(Number.parseInt(workersPortRaw, 10))
52
- ? Number.parseInt(workersPortRaw, 10)
53
- : Env.REDIS_PORT,
54
- password: workersPassword !== null && workersPassword.trim() !== ''
55
- ? workersPassword
56
- : Env.REDIS_PASSWORD,
57
- database: workersDbRaw !== null && Number.isFinite(Number.parseInt(workersDbRaw, 10))
58
- ? Number.parseInt(workersDbRaw, 10)
59
- : Env.getInt('REDIS_QUEUE_DB', 0),
69
+ host: workersHost,
70
+ port: Number(workersPortRaw),
71
+ password: workersPassword,
72
+ database: Number(workersDbRaw),
60
73
  };
61
74
  };
62
75
  const assertWorkersHostIsReachable = (isWorkersRuntime, redisConfig) => {
@@ -1,4 +1,4 @@
1
- import type { BullMQPayload, QueueMessage } from '@zintrust/core';
1
+ import type { BullMQPayload, QueueMessage } from '@zintrust/core/queue';
2
2
  export type QueueRpcAction = 'enqueue' | 'dequeue' | 'ack' | 'length' | 'drain';
3
3
  export interface IQueueDriver {
4
4
  enqueue(queue: string, payload: BullMQPayload): Promise<string>;
@@ -1,4 +1,9 @@
1
- import { Env, ErrorFactory, JobStateTracker, Logger, SignedRequest, TimeoutManager, generateUuid, } from '@zintrust/core';
1
+ import { Env } from '@zintrust/core/config';
2
+ import { ErrorFactory } from '@zintrust/core/errors';
3
+ import { Logger } from '@zintrust/core/logger';
4
+ import { JobStateTracker, TimeoutManager } from '@zintrust/core/queue';
5
+ import { SignedRequest } from '@zintrust/core/security';
6
+ import { generateUuid } from '@zintrust/core/utils';
2
7
  const DEFAULT_PROXY_URL = 'http://127.0.0.1:7772';
3
8
  const DEFAULT_ROUTE_PATH = '/api/_sys/queue/rpc';
4
9
  const createTimeoutSignal = (timeoutMs) => {
@@ -1,4 +1,4 @@
1
- import type { IRouter } from '@zintrust/core';
1
+ import type { IRouter } from '@zintrust/core/http';
2
2
  type QueueGatewaySettings = {
3
3
  basePath: string;
4
4
  keyId: string;
@@ -1,4 +1,8 @@
1
- import { Env, ErrorFactory, Logger, Router, SignedRequest } from '@zintrust/core';
1
+ import { Env } from '@zintrust/core/config';
2
+ import { ErrorFactory } from '@zintrust/core/errors';
3
+ import { Router } from '@zintrust/core/http';
4
+ import { Logger } from '@zintrust/core/logger';
5
+ import { SignedRequest } from '@zintrust/core/security';
2
6
  import BullMQRedisQueue, { runWithDirectQueueDriver } from './BullMQRedisQueue.js';
3
7
  const nonces = new Map();
4
8
  const nowMs = () => Date.now();
@@ -1,4 +1,7 @@
1
- import { Env, ErrorFactory, ZintrustLang, createRedisConnection } from '@zintrust/core';
1
+ import { Env } from '@zintrust/core/config';
2
+ import { ErrorFactory } from '@zintrust/core/errors';
3
+ import { createRedisConnection } from '@zintrust/core/redis';
4
+ import { ZintrustLang } from '@zintrust/core/utils';
2
5
  const createSharedRedisConnection = createRedisConnection;
3
6
  let publishClientInstance = null;
4
7
  let publishClientConnected = false;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { BullMQRedisQueue } from './BullMQRedisQueue';
2
2
  export { HttpQueueDriver } from './HttpQueueDriver';
3
3
  export { QueueHttpGateway } from './QueueHttpGateway';
4
4
  export { createRedisPublishClient, resetPublishClient, type RedisPublishClient, } from './RedisPublishClient';
5
- export type { QueueMessage } from '@zintrust/core';
5
+ export type { QueueMessage } from '@zintrust/core/queue';
6
6
  /**
7
7
  * Package version and build metadata
8
8
  * Available at runtime for debugging and health checks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/queue-redis",
3
- "version": "2.0.0",
3
+ "version": "2.1.4",
4
4
  "description": "Redis queue driver for ZinTrust.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -43,4 +43,4 @@
43
43
  "ioredis": "^5.10.1",
44
44
  "redis": "^5.12.1"
45
45
  }
46
- }
46
+ }
@@ -1,76 +0,0 @@
1
- {
2
- "name": "@zintrust/queue-redis",
3
- "version": "2.0.0",
4
- "buildDate": "2026-05-20T20:03:36.748Z",
5
- "buildEnvironment": {
6
- "node": "v20.20.2",
7
- "platform": "linux",
8
- "arch": "x64"
9
- },
10
- "git": {
11
- "commit": "be96835b",
12
- "branch": "master"
13
- },
14
- "package": {
15
- "engines": {
16
- "node": ">=20.0.0"
17
- },
18
- "dependencies": [
19
- "ioredis",
20
- "redis"
21
- ],
22
- "peerDependencies": [
23
- "@zintrust/core"
24
- ]
25
- },
26
- "files": {
27
- "BullMQRedisQueue.d.ts": {
28
- "size": 1062,
29
- "sha256": "52fb0f688cd17cc7d8e8128e60df6f5eea4c803282382ac75550e6aacee7cbb0"
30
- },
31
- "BullMQRedisQueue.js": {
32
- "size": 23135,
33
- "sha256": "17a005057335d49977a897d7b3d81248aad5f9780d7a6978aad617843f31f0d1"
34
- },
35
- "HttpQueueDriver.d.ts": {
36
- "size": 835,
37
- "sha256": "31735e10a83cf905ca48f3bf1c79f40029b9ac7c0ce6c26751ad646fa77bc764"
38
- },
39
- "HttpQueueDriver.js": {
40
- "size": 9116,
41
- "sha256": "28f10537bf9520772d8546c956fdaa7d3c489abd5be38ca78ee4eca41d8c9907"
42
- },
43
- "QueueHttpGateway.d.ts": {
44
- "size": 432,
45
- "sha256": "16c32e2179c3286569714233a9f84f32a64056593fe502a381dc9bc45e972e3a"
46
- },
47
- "QueueHttpGateway.js": {
48
- "size": 8066,
49
- "sha256": "ad4b78c5a40221aa6cf1f5959729f7ad9f6b0321c443723fff481c7dbfb91239"
50
- },
51
- "RedisPublishClient.d.ts": {
52
- "size": 451,
53
- "sha256": "341a68a3b8603b453146dc721f9d2eaf0d65bb6a1acb67908a9c6f9542b9fd2d"
54
- },
55
- "RedisPublishClient.js": {
56
- "size": 5464,
57
- "sha256": "18b785c47b4df689f9969625880d1b559e6cf8c95bb8c3cd3a4112fa75e0d870"
58
- },
59
- "index.d.ts": {
60
- "size": 565,
61
- "sha256": "7bc063419989a39530b3a4213627e0aea33fbaacac8c307d9e7e654c99bd5b8d"
62
- },
63
- "index.js": {
64
- "size": 676,
65
- "sha256": "66c2f6ba893c8d2c2f65a3244729dd06594fb83d96d513f90302ac0af22b1019"
66
- },
67
- "register.d.ts": {
68
- "size": 170,
69
- "sha256": "e10ca97976730171bfaaaa25f484a30d06c6dca57c7cd85d700c202e0785a0b7"
70
- },
71
- "register.js": {
72
- "size": 593,
73
- "sha256": "9a4ca56fc5d0ae9ca9c5d6c89731b3331749d3e254e583992f311e3ec7add80b"
74
- }
75
- }
76
- }