@queuedash/sdk 0.2.0 → 1.0.0

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/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export { QueueDashClient } from "./client";
2
- export { attachToBullMQ } from "./integrations/bullmq";
3
- export { attachToBull } from "./integrations/bull";
4
- export { attachToBeeQueue } from "./integrations/bee";
5
- export type { QueueDashClientOptions, JobData, SyncResponse } from "./types";
1
+ export { Queuedash } from "./client";
2
+ export type { QueuedashOptions, JobData, SyncResponse } from "./types";
6
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachToBeeQueue = exports.attachToBull = exports.attachToBullMQ = exports.QueueDashClient = void 0;
3
+ exports.Queuedash = void 0;
4
4
  var client_1 = require("./client");
5
- Object.defineProperty(exports, "QueueDashClient", { enumerable: true, get: function () { return client_1.QueueDashClient; } });
6
- var bullmq_1 = require("./integrations/bullmq");
7
- Object.defineProperty(exports, "attachToBullMQ", { enumerable: true, get: function () { return bullmq_1.attachToBullMQ; } });
8
- var bull_1 = require("./integrations/bull");
9
- Object.defineProperty(exports, "attachToBull", { enumerable: true, get: function () { return bull_1.attachToBull; } });
10
- var bee_1 = require("./integrations/bee");
11
- Object.defineProperty(exports, "attachToBeeQueue", { enumerable: true, get: function () { return bee_1.attachToBeeQueue; } });
5
+ Object.defineProperty(exports, "Queuedash", { enumerable: true, get: function () { return client_1.Queuedash; } });
package/dist/types.d.ts CHANGED
@@ -1,13 +1,20 @@
1
- export interface QueueDashClientOptions {
1
+ export interface QueuedashOptions {
2
+ /** Your Queuedash API key */
2
3
  apiKey: string;
4
+ /** Override the API URL (defaults to https://api.queuedash.com in production) */
5
+ baseUrl?: string;
6
+ /** Number of jobs to batch before syncing (default: 50) */
3
7
  batchSize?: number;
8
+ /** How often to flush batched jobs in ms (default: 100) */
4
9
  flushInterval?: number;
10
+ /** Max retry attempts for failed syncs (default: 5) */
5
11
  maxRetries?: number;
12
+ /** HTTP request timeout in ms (default: 30000) */
6
13
  requestTimeout?: number;
14
+ /** Max jobs to queue in memory (default: 10000) */
7
15
  maxQueueSize?: number;
16
+ /** Custom error handler */
8
17
  onError?: (error: Error) => void;
9
- /** @internal - Not for public use. Override API URL for staging environments only. */
10
- __dangerouslyOverrideApiUrl?: string;
11
18
  }
12
19
  export interface JobData {
13
20
  jobId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,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SDK for real-time queue monitoring",
3
+ "version": "1.0.0",
4
+ "description": "Queuedash SDK for real-time queue monitoring",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -13,15 +13,16 @@
13
13
  "bullmq",
14
14
  "bull",
15
15
  "bee-queue",
16
+ "groupmq",
16
17
  "monitoring",
17
18
  "dashboard"
18
19
  ],
19
- "author": "QueueDash",
20
+ "author": "Alex Budure",
20
21
  "license": "MIT",
21
22
  "peerDependencies": {
22
- "bullmq": ">=5.0.0",
23
+ "bee-queue": ">=1.0.0",
23
24
  "bull": ">=4.0.0",
24
- "bee-queue": ">=1.0.0"
25
+ "bullmq": ">=5.0.0"
25
26
  },
26
27
  "peerDependenciesMeta": {
27
28
  "bullmq": {
@@ -35,10 +36,24 @@
35
36
  }
36
37
  },
37
38
  "devDependencies": {
38
- "@types/node": "^20.0.0",
39
+ "@changesets/changelog-github": "^0.5.1",
40
+ "@changesets/cli": "^2.29.7",
41
+ "@types/jest": "^29.5.14",
42
+ "@types/node": "^22.14.0",
43
+ "husky": "^9.1.7",
44
+ "jest": "^29.7.0",
45
+ "lint-staged": "^16.2.7",
46
+ "prettier": "^3.7.1",
47
+ "ts-jest": "^29.2.5",
39
48
  "typescript": "^5.9.3"
40
49
  },
41
50
  "scripts": {
42
- "build": "tsc"
51
+ "build": "tsc",
52
+ "test": "jest",
53
+ "test:watch": "jest --watch",
54
+ "test:cov": "jest --coverage",
55
+ "format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
56
+ "release": "pnpm build && changeset publish",
57
+ "preinstall": "npx only-allow pnpm"
43
58
  }
44
59
  }
@@ -1,8 +0,0 @@
1
- import { QueueDashClient } from "../client";
2
- type BeeQueue = any;
3
- /**
4
- * Attach QueueDash monitoring to a Bee-Queue
5
- */
6
- export declare function attachToBeeQueue(queue: BeeQueue, client: QueueDashClient): void;
7
- export {};
8
- //# sourceMappingURL=bee.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bee.d.ts","sourceRoot":"","sources":["../../src/integrations/bee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,KAAK,QAAQ,GAAG,GAAG,CAAC;AAGpB;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,eAAe,GACtB,IAAI,CAwCN"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachToBeeQueue = attachToBeeQueue;
4
- /**
5
- * Attach QueueDash monitoring to a Bee-Queue
6
- */
7
- function attachToBeeQueue(queue, client) {
8
- const queueName = queue.name;
9
- const extractJobData = (job) => {
10
- return {
11
- jobId: String(job.id),
12
- name: "default", // Bee-Queue doesn't have job names
13
- queueName,
14
- data: job.data,
15
- opts: job.options || {},
16
- addedAt: job.options?.timestamp
17
- ? new Date(job.options.timestamp)
18
- : new Date(),
19
- processedAt: null,
20
- finishedAt: null,
21
- priority: null,
22
- delay: job.options?.delay,
23
- };
24
- };
25
- // Listen to queue events
26
- queue.on("succeeded", (job) => {
27
- const jobData = extractJobData(job);
28
- jobData.finishedAt = new Date();
29
- client.syncJob(jobData);
30
- });
31
- queue.on("failed", (job, err) => {
32
- const jobData = extractJobData(job);
33
- jobData.failedReason = err.message;
34
- jobData.stacktrace = err.stack ? [err.stack] : undefined;
35
- jobData.finishedAt = new Date();
36
- client.syncJob(jobData);
37
- });
38
- queue.on("retrying", (job) => {
39
- const jobData = extractJobData(job);
40
- jobData.retriedAt = new Date();
41
- client.syncJob(jobData);
42
- });
43
- }
@@ -1,7 +0,0 @@
1
- import { QueueDashClient } from "../client";
2
- import { type Queue as BullQueue } from "bull";
3
- /**
4
- * Attach QueueDash monitoring to a Bull queue
5
- */
6
- export declare function attachToBull(queue: BullQueue, client: QueueDashClient): void;
7
- //# sourceMappingURL=bull.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bull.d.ts","sourceRoot":"","sources":["../../src/integrations/bull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,KAAK,KAAK,IAAI,SAAS,EAAuB,MAAM,MAAM,CAAC;AAEpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CA6C5E"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachToBull = attachToBull;
4
- /**
5
- * Attach QueueDash monitoring to a Bull queue
6
- */
7
- function attachToBull(queue, client) {
8
- const queueName = queue.name;
9
- const extractJobData = (job) => {
10
- return {
11
- jobId: job.id,
12
- name: job.name || "default",
13
- queueName,
14
- data: job.data,
15
- // @ts-expect-error
16
- opts: job.opts,
17
- addedAt: new Date(job.timestamp),
18
- processedAt: job.processedOn ? new Date(job.processedOn) : null,
19
- finishedAt: job.finishedOn ? new Date(job.finishedOn) : null,
20
- failedReason: job.failedReason,
21
- stacktrace: job.stacktrace,
22
- priority: job.opts?.priority,
23
- delay: job.opts?.delay,
24
- timestamp: job.timestamp,
25
- progress: job.progress(),
26
- };
27
- };
28
- // Listen to queue events
29
- queue.on("global:completed", (job) => {
30
- client.syncJob(extractJobData(job));
31
- });
32
- queue.on("global:failed", (job) => {
33
- if (job) {
34
- client.syncJob(extractJobData(job));
35
- }
36
- });
37
- queue.on("active", (job) => {
38
- client.syncJob(extractJobData(job));
39
- });
40
- queue.on("progress", (job) => {
41
- client.syncJob(extractJobData(job));
42
- });
43
- queue.on("removed", (job) => {
44
- client.syncJob(extractJobData(job));
45
- });
46
- }
@@ -1,7 +0,0 @@
1
- import { QueueDashClient } from "../client";
2
- import { type Queue as BullMQQueue, type QueueEvents } from "bullmq";
3
- /**
4
- * Attach QueueDash monitoring to a BullMQ queue
5
- */
6
- export declare function attachToBullMQ(queue: BullMQQueue, events: QueueEvents, client: QueueDashClient): void;
7
- //# sourceMappingURL=bullmq.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bullmq.d.ts","sourceRoot":"","sources":["../../src/integrations/bullmq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EACL,KAAK,KAAK,IAAI,WAAW,EAEzB,KAAK,WAAW,EACjB,MAAM,QAAQ,CAAC;AAEhB;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,eAAe,GACtB,IAAI,CA2CN"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachToBullMQ = attachToBullMQ;
4
- /**
5
- * Attach QueueDash monitoring to a BullMQ queue
6
- */
7
- function attachToBullMQ(queue, events, client) {
8
- const queueName = queue.name;
9
- const extractJobData = (job) => {
10
- return {
11
- jobId: job.id,
12
- name: job.name,
13
- queueName,
14
- data: job.data,
15
- // @ts-expect-error
16
- opts: job.opts,
17
- addedAt: new Date(job.timestamp),
18
- processedAt: job.processedOn ? new Date(job.processedOn) : null,
19
- finishedAt: job.finishedOn ? new Date(job.finishedOn) : null,
20
- failedReason: job.failedReason,
21
- stacktrace: job.stacktrace,
22
- priority: job.opts?.priority,
23
- delay: job.opts?.delay,
24
- timestamp: job.timestamp,
25
- progress: typeof job.progress === "number" ? job.progress : null,
26
- };
27
- };
28
- const syncJobById = (jobId) => {
29
- queue.getJob(jobId).then((job) => {
30
- if (job) {
31
- client.syncJob(extractJobData(job));
32
- }
33
- });
34
- };
35
- events.on("waiting", async ({ jobId }) => syncJobById(jobId));
36
- events.on("progress", async ({ jobId }) => syncJobById(jobId));
37
- events.on("completed", async ({ jobId }) => syncJobById(jobId));
38
- events.on("failed", async ({ jobId }) => syncJobById(jobId));
39
- events.on("waiting-children", async ({ jobId }) => syncJobById(jobId));
40
- events.on("added", async ({ jobId }) => syncJobById(jobId));
41
- events.on("active", async ({ jobId }) => syncJobById(jobId));
42
- events.on("delayed", async ({ jobId }) => syncJobById(jobId));
43
- events.on("deduplicated", async ({ jobId }) => syncJobById(jobId));
44
- events.on("removed", async ({ jobId }) => client.deleteJob(jobId, queueName));
45
- events.on("stalled", async ({ jobId }) => syncJobById(jobId));
46
- events.on("retries-exhausted", async ({ jobId }) => syncJobById(jobId));
47
- }