@spooled/sdk 1.0.29 → 1.0.30

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.
@@ -1086,7 +1086,11 @@ interface CreateScheduleParams {
1086
1086
  timezone?: string;
1087
1087
  /** Target queue name */
1088
1088
  queueName: string;
1089
- /** Job payload template */
1089
+ /**
1090
+ * Job payload template. Required: the API rejects a create without it
1091
+ * (HTTP 422), so this is typed as non-optional to surface the omission at
1092
+ * compile time rather than as a runtime 422.
1093
+ */
1090
1094
  payloadTemplate: JsonObject;
1091
1095
  /** Job priority (-100 to 100) */
1092
1096
  priority?: number;
@@ -1086,7 +1086,11 @@ interface CreateScheduleParams {
1086
1086
  timezone?: string;
1087
1087
  /** Target queue name */
1088
1088
  queueName: string;
1089
- /** Job payload template */
1089
+ /**
1090
+ * Job payload template. Required: the API rejects a create without it
1091
+ * (HTTP 422), so this is typed as non-optional to surface the omission at
1092
+ * compile time rather than as a runtime 422.
1093
+ */
1090
1094
  payloadTemplate: JsonObject;
1091
1095
  /** Job priority (-100 to 100) */
1092
1096
  priority?: number;
package/dist/index.cjs CHANGED
@@ -1857,16 +1857,16 @@ var WebSocketRealtimeClient = class {
1857
1857
  stateChangeHandlers = /* @__PURE__ */ new Set();
1858
1858
  constructor(options) {
1859
1859
  this.options = {
1860
- autoReconnect: true,
1861
- maxReconnectAttempts: 10,
1862
- reconnectDelay: 1e3,
1863
- maxReconnectDelay: 3e4,
1864
- debug: () => {
1865
- },
1866
1860
  ...options,
1861
+ autoReconnect: options.autoReconnect ?? true,
1862
+ maxReconnectAttempts: options.maxReconnectAttempts ?? 10,
1863
+ reconnectDelay: options.reconnectDelay ?? 1e3,
1864
+ maxReconnectDelay: options.maxReconnectDelay ?? 3e4,
1867
1865
  // Always resolve to a provider so reconnects can mint a fresh JWT.
1868
1866
  // Falls back to the static token when no provider is supplied.
1869
- tokenProvider: options.tokenProvider ?? (async () => options.token)
1867
+ tokenProvider: options.tokenProvider ?? (async () => options.token),
1868
+ debug: options.debug ?? (() => {
1869
+ })
1870
1870
  };
1871
1871
  }
1872
1872
  /**
@@ -2155,16 +2155,22 @@ var SseRealtimeClient = class {
2155
2155
  stateChangeHandlers = /* @__PURE__ */ new Set();
2156
2156
  constructor(options) {
2157
2157
  this.options = {
2158
- autoReconnect: true,
2159
- maxReconnectAttempts: 10,
2160
- reconnectDelay: 1e3,
2161
- maxReconnectDelay: 3e4,
2162
- debug: () => {
2163
- },
2164
2158
  ...options,
2159
+ autoReconnect: options.autoReconnect ?? true,
2160
+ maxReconnectAttempts: options.maxReconnectAttempts ?? 10,
2161
+ reconnectDelay: options.reconnectDelay ?? 1e3,
2162
+ maxReconnectDelay: options.maxReconnectDelay ?? 3e4,
2165
2163
  // Always resolve to a provider so reconnects can mint a fresh token.
2166
2164
  // Falls back to the static token when no provider is supplied.
2167
- tokenProvider: options.tokenProvider ?? (async () => options.token)
2165
+ tokenProvider: options.tokenProvider ?? (async () => options.token),
2166
+ // Coalesce debug to a no-op AFTER the spread. A caller that omits debug
2167
+ // still passes `debug: undefined` explicitly (e.g. via SpooledRealtime),
2168
+ // and spreading that would overwrite a pre-spread default with undefined,
2169
+ // making connect() call `this.options.debug(...)` on undefined and throw
2170
+ // "this.options.debug is not a function". Guarding here keeps it callable
2171
+ // regardless of what the caller passes.
2172
+ debug: options.debug ?? (() => {
2173
+ })
2168
2174
  };
2169
2175
  }
2170
2176
  /**
@@ -2962,7 +2968,11 @@ var SpooledClient = class _SpooledClient {
2962
2968
  // rather than reusing the short-lived token captured above.
2963
2969
  tokenProvider: () => this.getJwtToken(),
2964
2970
  ...options,
2965
- debug: this.config.debug ?? void 0
2971
+ // Only forward debug when the client actually has a logger, so we never
2972
+ // hand the realtime layer an explicit `debug: undefined`. The WS/SSE
2973
+ // constructors also guard against this, but keeping the undefined out of
2974
+ // the option object makes the intent clear at the call site.
2975
+ ...this.config.debug ? { debug: this.config.debug } : {}
2966
2976
  });
2967
2977
  }
2968
2978
  /**