@kadoa/node-sdk 0.19.4-beta.1 → 0.19.4-beta.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.
package/dist/index.d.mts CHANGED
@@ -7594,6 +7594,8 @@ interface RealtimeConfig {
7594
7594
  heartbeatInterval?: number;
7595
7595
  reconnectDelay?: number;
7596
7596
  missedHeartbeatsLimit?: number;
7597
+ /** Subscribe source mode. Use 'stream' for CloudEvents mode. */
7598
+ source?: "stream";
7597
7599
  }
7598
7600
  declare class Realtime {
7599
7601
  private socket?;
@@ -7604,6 +7606,7 @@ declare class Realtime {
7604
7606
  private missedHeartbeatsLimit;
7605
7607
  private missedHeartbeatCheckTimer?;
7606
7608
  private apiKey?;
7609
+ private source?;
7607
7610
  private eventListeners;
7608
7611
  private connectionListeners;
7609
7612
  private errorListeners;
@@ -7838,6 +7841,8 @@ interface KadoaClientConfig {
7838
7841
  reconnectDelay?: number;
7839
7842
  /** Heartbeat interval in ms (default: 10000) */
7840
7843
  heartbeatInterval?: number;
7844
+ /** Subscribe source mode. Use 'stream' for CloudEvents mode. */
7845
+ source?: "stream";
7841
7846
  };
7842
7847
  }
7843
7848
  interface NotificationDomain {
@@ -7873,6 +7878,7 @@ declare class KadoaClient {
7873
7878
  private readonly _timeout;
7874
7879
  private readonly _apiKey;
7875
7880
  private _realtime?;
7881
+ private _realtimeConfig?;
7876
7882
  private _extractionBuilderService;
7877
7883
  readonly extraction: ExtractionService;
7878
7884
  readonly workflow: WorkflowsCoreService;
package/dist/index.d.ts CHANGED
@@ -7594,6 +7594,8 @@ interface RealtimeConfig {
7594
7594
  heartbeatInterval?: number;
7595
7595
  reconnectDelay?: number;
7596
7596
  missedHeartbeatsLimit?: number;
7597
+ /** Subscribe source mode. Use 'stream' for CloudEvents mode. */
7598
+ source?: "stream";
7597
7599
  }
7598
7600
  declare class Realtime {
7599
7601
  private socket?;
@@ -7604,6 +7606,7 @@ declare class Realtime {
7604
7606
  private missedHeartbeatsLimit;
7605
7607
  private missedHeartbeatCheckTimer?;
7606
7608
  private apiKey?;
7609
+ private source?;
7607
7610
  private eventListeners;
7608
7611
  private connectionListeners;
7609
7612
  private errorListeners;
@@ -7838,6 +7841,8 @@ interface KadoaClientConfig {
7838
7841
  reconnectDelay?: number;
7839
7842
  /** Heartbeat interval in ms (default: 10000) */
7840
7843
  heartbeatInterval?: number;
7844
+ /** Subscribe source mode. Use 'stream' for CloudEvents mode. */
7845
+ source?: "stream";
7841
7846
  };
7842
7847
  }
7843
7848
  interface NotificationDomain {
@@ -7873,6 +7878,7 @@ declare class KadoaClient {
7873
7878
  private readonly _timeout;
7874
7879
  private readonly _apiKey;
7875
7880
  private _realtime?;
7881
+ private _realtimeConfig?;
7876
7882
  private _extractionBuilderService;
7877
7883
  readonly extraction: ExtractionService;
7878
7884
  readonly workflow: WorkflowsCoreService;
package/dist/index.js CHANGED
@@ -5975,6 +5975,7 @@ var Realtime = class {
5975
5975
  this.heartbeatInterval = config.heartbeatInterval || 1e4;
5976
5976
  this.reconnectDelay = config.reconnectDelay || 5e3;
5977
5977
  this.missedHeartbeatsLimit = config.missedHeartbeatsLimit || 3e4;
5978
+ this.source = config.source;
5978
5979
  }
5979
5980
  async connect() {
5980
5981
  if (this.isConnecting) return;
@@ -5999,7 +6000,8 @@ var Realtime = class {
5999
6000
  this.socket.send(
6000
6001
  JSON.stringify({
6001
6002
  action: "subscribe",
6002
- channel: team_id
6003
+ channel: team_id,
6004
+ ...this.source && { source: this.source }
6003
6005
  })
6004
6006
  );
6005
6007
  debug5("Connected to WebSocket");
@@ -6991,6 +6993,7 @@ var KadoaClient = class {
6991
6993
  };
6992
6994
  this.validation = createValidationDomain(coreService, rulesService);
6993
6995
  this.crawler = createCrawlerDomain(this);
6996
+ this._realtimeConfig = config.realtimeConfig;
6994
6997
  if (config.enableRealtime && config.realtimeConfig?.autoConnect !== false) {
6995
6998
  this.connectRealtime();
6996
6999
  }
@@ -7089,7 +7092,18 @@ var KadoaClient = class {
7089
7092
  */
7090
7093
  connectRealtime() {
7091
7094
  if (!this._realtime) {
7092
- this._realtime = new Realtime({ apiKey: this._apiKey });
7095
+ this._realtime = new Realtime({
7096
+ apiKey: this._apiKey,
7097
+ ...this._realtimeConfig?.reconnectDelay != null && {
7098
+ reconnectDelay: this._realtimeConfig.reconnectDelay
7099
+ },
7100
+ ...this._realtimeConfig?.heartbeatInterval != null && {
7101
+ heartbeatInterval: this._realtimeConfig.heartbeatInterval
7102
+ },
7103
+ ...this._realtimeConfig?.source && {
7104
+ source: this._realtimeConfig.source
7105
+ }
7106
+ });
7093
7107
  this._realtime.connect();
7094
7108
  }
7095
7109
  return this._realtime;