@spooled/sdk 1.2.0 → 1.2.1

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.
@@ -107,11 +107,11 @@ declare const DEFAULT_CONFIG: {
107
107
  successThreshold: number;
108
108
  timeout: number;
109
109
  };
110
- readonly userAgent: "@spooled/sdk-nodejs/1.2.0";
110
+ readonly userAgent: "@spooled/sdk-nodejs/1.2.1";
111
111
  readonly autoRefreshToken: true;
112
112
  };
113
113
  /** SDK version */
114
- declare const SDK_VERSION = "1.2.0";
114
+ declare const SDK_VERSION = "1.2.1";
115
115
  /** API version prefix */
116
116
  declare const API_VERSION = "v1";
117
117
  /**
@@ -107,11 +107,11 @@ declare const DEFAULT_CONFIG: {
107
107
  successThreshold: number;
108
108
  timeout: number;
109
109
  };
110
- readonly userAgent: "@spooled/sdk-nodejs/1.2.0";
110
+ readonly userAgent: "@spooled/sdk-nodejs/1.2.1";
111
111
  readonly autoRefreshToken: true;
112
112
  };
113
113
  /** SDK version */
114
- declare const SDK_VERSION = "1.2.0";
114
+ declare const SDK_VERSION = "1.2.1";
115
115
  /** API version prefix */
116
116
  declare const API_VERSION = "v1";
117
117
  /**
package/dist/index.cjs CHANGED
@@ -50,10 +50,10 @@ var DEFAULT_CONFIG = {
50
50
  successThreshold: 3,
51
51
  timeout: 3e4
52
52
  },
53
- userAgent: "@spooled/sdk-nodejs/1.2.0",
53
+ userAgent: "@spooled/sdk-nodejs/1.2.1",
54
54
  autoRefreshToken: true
55
55
  };
56
- var SDK_VERSION = "1.2.0";
56
+ var SDK_VERSION = "1.2.1";
57
57
  var API_VERSION = "v1";
58
58
  var API_BASE_PATH = `/api/${API_VERSION}`;
59
59
  function normalizeCredential(value) {
@@ -2461,6 +2461,19 @@ function isAuthFailureEvent(event) {
2461
2461
  }
2462
2462
 
2463
2463
  // src/realtime/sse.ts
2464
+ var SSE_EVENT_NAMES = [
2465
+ "job.created",
2466
+ "job.status",
2467
+ "job.completed",
2468
+ "job.failed",
2469
+ "queue.stats",
2470
+ "worker.heartbeat",
2471
+ "worker.registered",
2472
+ "worker.deregistered",
2473
+ "system.health",
2474
+ "ping",
2475
+ "error"
2476
+ ];
2464
2477
  var SseRealtimeClient = class {
2465
2478
  options;
2466
2479
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2552,6 +2565,11 @@ var SseRealtimeClient = class {
2552
2565
  this.eventSource.onmessage = (event) => {
2553
2566
  this.handleMessage(event.data);
2554
2567
  };
2568
+ for (const name of SSE_EVENT_NAMES) {
2569
+ this.eventSource.addEventListener(name, (event) => {
2570
+ if (typeof event?.data === "string") this.handleMessage(event.data);
2571
+ });
2572
+ }
2555
2573
  this.eventSource.onerror = () => {
2556
2574
  this.options.debug("SSE error");
2557
2575
  if (this.state === "connecting") {
@@ -2632,7 +2650,7 @@ var SseRealtimeClient = class {
2632
2650
  return `${this.options.baseUrl}/api/v1/events/jobs/${encodeURIComponent(filter.jobId)}`;
2633
2651
  }
2634
2652
  if (filter?.queueName) {
2635
- return `${this.options.baseUrl}/api/v1/events/queues/${encodeURIComponent(filter.queueName)}`;
2653
+ return `${this.options.baseUrl}/api/v1/events?queue=${encodeURIComponent(filter.queueName)}`;
2636
2654
  }
2637
2655
  return `${this.options.baseUrl}/api/v1/events`;
2638
2656
  }