@hlmr/sdk-js 1.0.22 → 1.0.25

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.
Files changed (45) hide show
  1. package/dist/cjs/client/HlmrClient.d.ts +11 -1
  2. package/dist/cjs/client/HlmrClient.d.ts.map +1 -1
  3. package/dist/cjs/client/HlmrClient.js +17 -0
  4. package/dist/cjs/client/HlmrClient.js.map +1 -1
  5. package/dist/cjs/index.d.ts +3 -1
  6. package/dist/cjs/index.d.ts.map +1 -1
  7. package/dist/cjs/index.js +4 -2
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/modules/events.d.ts +49 -0
  10. package/dist/cjs/modules/events.d.ts.map +1 -0
  11. package/dist/cjs/modules/events.js +405 -0
  12. package/dist/cjs/modules/events.js.map +1 -0
  13. package/dist/cjs/types/events.d.ts +86 -0
  14. package/dist/cjs/types/events.d.ts.map +1 -0
  15. package/dist/cjs/types/events.js +3 -0
  16. package/dist/cjs/types/events.js.map +1 -0
  17. package/dist/esm/client/HlmrClient.d.ts +11 -1
  18. package/dist/esm/client/HlmrClient.d.ts.map +1 -1
  19. package/dist/esm/client/HlmrClient.js +17 -0
  20. package/dist/esm/client/HlmrClient.js.map +1 -1
  21. package/dist/esm/index.d.ts +3 -1
  22. package/dist/esm/index.d.ts.map +1 -1
  23. package/dist/esm/index.js +2 -1
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/modules/events.d.ts +49 -0
  26. package/dist/esm/modules/events.d.ts.map +1 -0
  27. package/dist/esm/modules/events.js +401 -0
  28. package/dist/esm/modules/events.js.map +1 -0
  29. package/dist/esm/types/events.d.ts +86 -0
  30. package/dist/esm/types/events.d.ts.map +1 -0
  31. package/dist/esm/types/events.js +2 -0
  32. package/dist/esm/types/events.js.map +1 -0
  33. package/dist/types/client/HlmrClient.d.ts +11 -1
  34. package/dist/types/client/HlmrClient.d.ts.map +1 -1
  35. package/dist/types/index.d.ts +3 -1
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/types/modules/events.d.ts +49 -0
  38. package/dist/types/modules/events.d.ts.map +1 -0
  39. package/dist/types/types/events.d.ts +86 -0
  40. package/dist/types/types/events.d.ts.map +1 -0
  41. package/dist/umd/hlmr-sdk.js +419 -1
  42. package/dist/umd/hlmr-sdk.js.map +1 -1
  43. package/dist/umd/hlmr-sdk.min.js +1 -1
  44. package/dist/umd/hlmr-sdk.min.js.map +1 -1
  45. package/package.json +1 -1
@@ -4,13 +4,18 @@ import { AuthModule } from '../modules/auth';
4
4
  import { UserModule } from '../modules/user';
5
5
  import { SystemModule } from '../modules/system';
6
6
  import { AppsModule } from '../modules/apps';
7
+ import { EventsModule } from '../modules/events';
8
+ import type { EventsModuleConfig } from '../types/events';
7
9
  export declare class HlmrClient {
8
10
  private httpClient;
9
11
  readonly auth: AuthModule;
10
12
  readonly user: UserModule;
11
13
  readonly system: SystemModule;
12
14
  readonly apps: AppsModule;
13
- constructor(options: HlmrClientOptions);
15
+ readonly events: EventsModule;
16
+ constructor(options: HlmrClientOptions & {
17
+ eventsConfig?: EventsModuleConfig;
18
+ });
14
19
  private buildConfig;
15
20
  setBearerToken(token: string): void;
16
21
  clearBearerToken(): void;
@@ -27,5 +32,10 @@ export declare class HlmrClient {
27
32
  timeout?: number;
28
33
  headers?: Record<string, string>;
29
34
  }): Promise<import("../types/common").HttpResponse<T>>;
35
+ get<T>(path: string, options?: import('../types/common').RequestOptions): Promise<import("../types/common").HttpResponse<T>>;
36
+ post<T>(path: string, body?: any, options?: import('../types/common').RequestOptions): Promise<import("../types/common").HttpResponse<T>>;
37
+ put<T>(path: string, body?: any, options?: import('../types/common').RequestOptions): Promise<import("../types/common").HttpResponse<T>>;
38
+ patch<T>(path: string, body?: any, options?: import('../types/common').RequestOptions): Promise<import("../types/common").HttpResponse<T>>;
39
+ delete<T>(path: string, options?: import('../types/common').RequestOptions): Promise<import("../types/common").HttpResponse<T>>;
30
40
  }
31
41
  //# sourceMappingUR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I,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,cAAc;IAUvE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,cAAc;IAUpF,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,cAAc;IAUnF,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,cAAc;IASrF,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,cAAc;CAGjF"}
@@ -8,6 +8,7 @@ const auth_1 = require("../modules/auth");
8
8
  const user_1 = require("../modules/user");
9
9
  const system_1 = require("../modules/system");
10
10
  const apps_1 = require("../modules/apps");
11
+ const events_1 = require("../modules/events");
11
12
  class HlmrClient {
12
13
  constructor(options) {
13
14
  const config = this.buildConfig(options);
@@ -16,6 +17,7 @@ class HlmrClient {
16
17
  this.user = new user_1.UserModule(this.httpClient);
17
18
  this.system = new system_1.SystemModule(this.httpClient);
18
19
  this.apps = new apps_1.AppsModule(this.httpClient);
20
+ this.events = new events_1.EventsModule(this.httpClient, options.eventsConfig);
19
21
  }
20
22
  buildConfig(options) {
21
23
  var _a, _b, _c;
@@ -98,6 +100,21 @@ class HlmrClient {
98
100
  async directRequest(url, method = 'GET', body, options) {
99
101
  return this.httpClient.directRequest(url, method, body, options);
100
102
  }
103
+ async get(path, options) {
104
+ return this.httpClient.get(path, options);
105
+ }
106
+ async post(path, body, options) {
107
+ return this.httpClient.post(path, body, options);
108
+ }
109
+ async put(path, body, options) {
110
+ return this.httpClient.put(path, body, options);
111
+ }
112
+ async patch(path, body, options) {
113
+ return this.httpClient.patch(path, body, options);
114
+ }
115
+ async delete(path, options) {
116
+ return this.httpClient.delete(path, options);
117
+ }
101
118
  }
102
119
  exports.HlmrClient = HlmrClient;
103
120
  //# sourceMappingURL=HlmrClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HlmrClient.js","sourceRoot":"","sources":["../../../src/client/HlmrClient.ts"],"names":[],"mappings":";;;AAUA,4CAA+C;AAC/C,4CAA+C;AAC/C,wCAA2C;AAC3C,0CAA6C;AAC7C,0CAA6C;AAC7C,8CAAiD;AACjD,0CAA6C;AAK7C,MAAa,UAAU;IAerB,YAAY,OAA0B;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAU,CAAC,MAAM,CAAC,CAAC;QAGzC,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAKO,WAAW,CAAC,OAA0B;;QAC5C,IAAI,OAAe,CAAC;QAGpB,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,GAAI,qBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,MAAM,qBAAY,CAAC,WAAW,CAAC,wBAAwB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YAChF,CAAC;YACD,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC;QACpB,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K,CAAI,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAOD,KAAK,CAAC,MAAM,CAAI,IAAY,EAAE,OAAkD;QAC9E,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF;AA3OD,gCA2OC"}
@@ -5,12 +5,14 @@ export type { UserProfile } from './types/user';
5
5
  export type { SystemPingResponse, SystemPingOptions, SystemVersionResponse } from './types/system';
6
6
  export type { LogSessionOptions, LogSessionResponse } from './modules/apps';
7
7
  export { AppsModule } from './modules/apps';
8
+ export { EventsModule } from './modules/events';
9
+ export type { Subscription, SubscriptionOptions, SubscriptionFilters, EventNotification, SystemNotification, ConnectedMessage, SubscriptionConfirmedMessage, UnsubscribedMessage, ErrorMessage, WebSocketMessage, EventsModuleConfig, EventsModuleEvents } from './types/events';
8
10
  export { HlmrApiError } from './types/errors';
9
11
  export type { JSendResponse, JSendSuccessResponse, JSendFailResponse, JSendErrorResponse } from './types/errors';
10
12
  export type { HttpClient } from './utils/http';
11
13
  export { isJSendResponse, isJSendSuccess, isJSendFail, isJSendError } from './utils/jsend';
12
14
  export { clearAllCache, preventBackNavigation, performLogout } from './utils/auth';
13
15
  export type { LogoutOptions } from './utils/auth';
14
- export declare const SDK_VERSION = "1.0.0";
16
+ export declare const SDK_VERSION = "1.0.25";
15
17
  export declare const SDK_NAME = "hlmr-sdk-js";
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,WAAW,E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,EAAE,MAAM,kBAAkB,CAAC;AAEhD,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,UAAU,EACX,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG3F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnF,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,QAAQ,gBAAgB,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SDK_NAME = exports.SDK_VERSION = exports.performLogout = exports.preventBackNavigation = exports.clearAllCache = exports.isJSendError = exports.isJSendFail = exports.isJSendSuccess = exports.isJSendResponse = exports.HlmrApiError = exports.AppsModule = exports.HlmrClient = void 0;
3
+ exports.SDK_NAME = exports.SDK_VERSION = exports.performLogout = exports.preventBackNavigation = exports.clearAllCache = exports.isJSendError = exports.isJSendFail = exports.isJSendSuccess = exports.isJSendResponse = exports.HlmrApiError = exports.EventsModule = exports.AppsModule = exports.HlmrClient = void 0;
4
4
  var HlmrClient_1 = require("./client/HlmrClient");
5
5
  Object.defineProperty(exports, "HlmrClient", { enumerable: true, get: function () { return HlmrClient_1.HlmrClient; } });
6
6
  var apps_1 = require("./modules/apps");
7
7
  Object.defineProperty(exports, "AppsModule", { enumerable: true, get: function () { return apps_1.AppsModule; } });
8
+ var events_1 = require("./modules/events");
9
+ Object.defineProperty(exports, "EventsModule", { enumerable: true, get: function () { return events_1.EventsModule; } });
8
10
  var errors_1 = require("./types/errors");
9
11
  Object.defineProperty(exports, "HlmrApiError", { enumerable: true, get: function () { return errors_1.HlmrApiError; } });
10
12
  var jsend_1 = require("./utils/jsend");
@@ -16,6 +18,6 @@ var auth_1 = require("./utils/auth");
16
18
  Object.defineProperty(exports, "clearAllCache", { enumerable: true, get: function () { return auth_1.clearAllCache; } });
17
19
  Object.defineProperty(exports, "preventBackNavigation", { enumerable: true, get: function () { return auth_1.preventBackNavigation; } });
18
20
  Object.defineProperty(exports, "performLogout", { enumerable: true, get: function () { return auth_1.performLogout; } });
19
- exports.SDK_VERSION = '1.0.0';
21
+ exports.SDK_VERSION = '1.0.25';
20
22
  exports.SDK_NAME = 'hlmr-sdk-js';
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AASA,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AA6BnB,uCAA4C;AAAnC,kGAAA,UAAU,OAAA;AAGnB,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAerB,uCAA2F;AAAlF,wGAAA,eAAe,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,qGAAA,YAAY,OAAA;AAGnE,qCAAmF;AAA1E,qGAAA,aAAa,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,qGAAA,aAAa,OAAA;AAI/C,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,QAAQ,GAAG,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AASA,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AA6BnB,uCAA4C;AAAnC,kGAAA,UAAU,OAAA;AAGnB,2CAAgD;AAAvC,sGAAA,YAAY,OAAA;AAkBrB,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAerB,uCAA2F;AAAlF,wGAAA,eAAe,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,qGAAA,YAAY,OAAA;AAGnE,qCAAmF;AAA1E,qGAAA,aAAa,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,qGAAA,aAAa,OAAA;AAI/C,QAAA,WAAW,GAAG,QAAQ,CAAC;AACvB,QAAA,QAAQ,GAAG,aAAa,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { HttpClient } from '../utils/http';
2
+ import type { Subscription, SubscriptionOptions, ConnectedMessage, EventsModuleConfig, EventsModuleEvents } from '../types/events';
3
+ type EventCallback<K extends keyof EventsModuleEvents> = EventsModuleEvents[K];
4
+ export declare class EventsModule {
5
+ private http;
6
+ private config;
7
+ private ws;
8
+ private pingIntervalId;
9
+ private reconnectAttempts;
10
+ private reconnectTimeoutId;
11
+ private isConnecting;
12
+ private isManualDisconnect;
13
+ private subscriptions;
14
+ private pendingSubscriptions;
15
+ private listeners;
16
+ private userId;
17
+ private bearerToken;
18
+ private authResolve;
19
+ private authReject;
20
+ constructor(http: HttpClient, config?: EventsModuleConfig);
21
+ connect(): Promise<ConnectedMessage>;
22
+ private _connect;
23
+ disconnect(): void;
24
+ subscribe(domain: string, resource: string, options?: SubscriptionOptions): Promise<Subscription>;
25
+ unsubscribe(subscriptionId: string): Promise<void>;
26
+ on<K extends keyof EventsModuleEvents>(event: K, callback: EventCallback<K>): void;
27
+ off<K extends keyof EventsModuleEvents>(event: K, callback: EventCallback<K>): void;
28
+ get isConnected(): boolean;
29
+ get currentUserId(): string | null;
30
+ getSubscriptions(): Map<string, {
31
+ domain: string;
32
+ resource: string;
33
+ options?: SubscriptionOptions;
34
+ }>;
35
+ ping(): void;
36
+ updateConfig(config: Partial<EventsModuleConfig>): void;
37
+ private _buildWebSocketUrl;
38
+ private _handleMessage;
39
+ private _handleSubscriptionConfirmed;
40
+ private _emit;
41
+ private _startPingInterval;
42
+ private _stopPingInterval;
43
+ private _scheduleReconnect;
44
+ private _resubscribeAll;
45
+ private _cleanup;
46
+ private _generateId;
47
+ }
48
+ export {};
49
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/modules/events.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EAInB,gBAAgB,EAKhB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAYzB,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAK/E,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,cAAc,CAA+C;IACrE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,kBAAkB,CAA8C;IACxE,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,kBAAkB,CAAS;IAGnC,OAAO,CAAC,aAAa,CAA+F;IACpH,OAAO,CAAC,oBAAoB,CAMb;IAGf,OAAO,CAAC,SAAS,CAA2D;IAG5E,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,WAAW,CAAkD;IACrE,OAAO,CAAC,UAAU,CAAuC;gBAE7C,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAcnD,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC;YAgB5B,Q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connectAttempts: 5,
8
+ reconnectDelay: 1000,
9
+ maxReconnectDelay: 30000,
10
+ debug: false
11
+ };
12
+ class EventsModule {
13
+ constructor(http, config) {
14
+ this.ws = null;
15
+ this.pingIntervalId = null;
16
+ this.reconnectAttempts = 0;
17
+ this.reconnectTimeoutId = null;
18
+ this.isConnecting = false;
19
+ this.isManualDisconnect = false;
20
+ this.subscriptions = new Map();
21
+ this.pendingSubscriptions = new Map();
22
+ this.listeners = new Map();
23
+ this.userId = null;
24
+ this.bearerToken = null;
25
+ this.authResolve = null;
26
+ this.authReject = null;
27
+ this.http = http;
28
+ this.config = { ...DEFAULT_CONFIG, ...config };
29
+ const httpConfig = http.config;
30
+ this.bearerToken = httpConfig.bearerToken || null;
31
+ }
32
+ async connect() {
33
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
34
+ throw new Error('Already connected');
35
+ }
36
+ if (this.isConnecting) {
37
+ throw new Error('Connection in progress');
38
+ }
39
+ this.isConnecting = true;
40
+ this.isManualDisconnect = false;
41
+ this.reconnectAttempts = 0;
42
+ return this._connect();
43
+ }
44
+ async _connect() {
45
+ return new Promise((resolve, reject) => {
46
+ try {
47
+ this.authResolve = resolve;
48
+ this.authReject = reject;
49
+ const wsUrl = this._buildWebSocketUrl();
50
+ if (this.config.debug) {
51
+ console.log('[EventsModule] Connecting to:', wsUrl);
52
+ }
53
+ this.ws = new WebSocket(wsUrl);
54
+ const connectionTimeout = setTimeout(() => {
55
+ if (this.ws && this.ws.readyState !== WebSocket.OPEN) {
56
+ this.ws.close();
57
+ this.isConnecting = false;
58
+ this.authResolve = null;
59
+ this.authReject = null;
60
+ reject(new Error('Connection timeout'));
61
+ }
62
+ }, 10000);
63
+ this.ws.onopen = () => {
64
+ if (this.config.debug) {
65
+ console.log('[EventsModule] WebSocket connected, sending auth...');
66
+ }
67
+ clearTimeout(connectionTimeout);
68
+ if (this.bearerToken) {
69
+ const authMessage = {
70
+ type: 'auth',
71
+ token: this.bearerToken
72
+ };
73
+ this.ws.send(JSON.stringify(authMessage));
74
+ if (this.config.debug) {
75
+ console.log('[EventsModule] Sent auth message');
76
+ }
77
+ }
78
+ else {
79
+ this.isConnecting = false;
80
+ this.authResolve = null;
81
+ this.authReject = null;
82
+ this.ws.close(1008, 'Missing authentication token');
83
+ reject(new Error('Missing authentication token'));
84
+ }
85
+ };
86
+ this.ws.onmessage = (event) => {
87
+ try {
88
+ const message = JSON.parse(event.data);
89
+ this._handleMessage(message);
90
+ }
91
+ catch (err) {
92
+ if (this.config.debug) {
93
+ console.error('[EventsModule] Failed to parse message:', err);
94
+ }
95
+ }
96
+ };
97
+ this.ws.onerror = (error) => {
98
+ if (this.config.debug) {
99
+ console.error('[EventsModule] WebSocket error:', error);
100
+ }
101
+ clearTimeout(connectionTimeout);
102
+ this.isConnecting = false;
103
+ this.authResolve = null;
104
+ this.authReject = null;
105
+ this._emit('error', new Error('WebSocket error'));
106
+ reject(new Error('WebSocket error'));
107
+ };
108
+ this.ws.onclose = (event) => {
109
+ if (this.config.debug) {
110
+ console.log('[EventsModule] WebSocket closed:', event.code, event.reason);
111
+ }
112
+ clearTimeout(connectionTimeout);
113
+ this._stopPingInterval();
114
+ this.isConnecting = false;
115
+ if (this.authReject) {
116
+ this.authReject(new Error(event.reason || 'Connection closed before authentication'));
117
+ this.authResolve = null;
118
+ this.authReject = null;
119
+ }
120
+ this._emit('disconnect', event.reason || 'Connection closed');
121
+ if (!this.isManualDisconnect && this.config.autoReconnect) {
122
+ this._scheduleReconnect();
123
+ }
124
+ };
125
+ }
126
+ catch (err) {
127
+ this.isConnecting = false;
128
+ this.authResolve = null;
129
+ this.authReject = null;
130
+ reject(err);
131
+ }
132
+ });
133
+ }
134
+ disconnect() {
135
+ this.isManualDisconnect = true;
136
+ this._cleanup();
137
+ if (this.ws) {
138
+ this.ws.close(1000, 'Client disconnect');
139
+ this.ws = null;
140
+ }
141
+ if (this.config.debug) {
142
+ console.log('[EventsModule] Disconnected');
143
+ }
144
+ }
145
+ async subscribe(domain, resource, options) {
146
+ if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
147
+ throw new Error('Not connected');
148
+ }
149
+ const subscriptionId = this._generateId();
150
+ return new Promise((resolve, reject) => {
151
+ const subscriptionData = options
152
+ ? { domain, resource, options }
153
+ : { domain, resource };
154
+ const pendingData = {
155
+ resolve: (sub) => {
156
+ this.subscriptions.set(sub.id, subscriptionData);
157
+ resolve(sub);
158
+ },
159
+ reject,
160
+ ...subscriptionData
161
+ };
162
+ this.pendingSubscriptions.set(subscriptionId, pendingData);
163
+ const message = {
164
+ type: 'subscribe',
165
+ subscription_id: subscriptionId,
166
+ domain,
167
+ resource,
168
+ options: {
169
+ filters: (options === null || options === void 0 ? void 0 : options.filters) || {},
170
+ include_data: (options === null || options === void 0 ? void 0 : options.include_data) || false
171
+ }
172
+ };
173
+ this.ws.send(JSON.stringify(message));
174
+ if (this.config.debug) {
175
+ console.log('[EventsModule] Subscribing:', message);
176
+ }
177
+ setTimeout(() => {
178
+ if (this.pendingSubscriptions.has(subscriptionId)) {
179
+ this.pendingSubscriptions.delete(subscriptionId);
180
+ reject(new Error('Subscription timeout'));
181
+ }
182
+ }, 10000);
183
+ });
184
+ }
185
+ async unsubscribe(subscriptionId) {
186
+ if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
187
+ throw new Error('Not connected');
188
+ }
189
+ return new Promise((resolve, reject) => {
190
+ const message = {
191
+ type: 'unsubscribe',
192
+ subscription_id: subscriptionId
193
+ };
194
+ this.ws.send(JSON.stringify(message));
195
+ this.subscriptions.delete(subscriptionId);
196
+ if (this.config.debug) {
197
+ console.log('[EventsModule] Unsubscribing:', subscriptionId);
198
+ }
199
+ resolve();
200
+ });
201
+ }
202
+ on(event, callback) {
203
+ if (!this.listeners.has(event)) {
204
+ this.listeners.set(event, new Set());
205
+ }
206
+ this.listeners.get(event).add(callback);
207
+ }
208
+ off(event, callback) {
209
+ const listeners = this.listeners.get(event);
210
+ if (listeners) {
211
+ listeners.delete(callback);
212
+ }
213
+ }
214
+ get isConnected() {
215
+ return this.ws !== null && this.ws.readyState === WebSocket.OPEN;
216
+ }
217
+ get currentUserId() {
218
+ return this.userId;
219
+ }
220
+ getSubscriptions() {
221
+ return new Map(this.subscriptions);
222
+ }
223
+ ping() {
224
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
225
+ this.ws.send(JSON.stringify({ type: 'ping' }));
226
+ }
227
+ }
228
+ updateConfig(config) {
229
+ this.config = { ...this.config, ...config };
230
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
231
+ this._stopPingInterval();
232
+ this._startPingInterval();
233
+ }
234
+ }
235
+ _buildWebSocketUrl() {
236
+ const httpConfig = this.http.config;
237
+ const baseUrl = httpConfig.baseUrl;
238
+ const wsUrl = baseUrl
239
+ .replace('https://', 'wss://')
240
+ .replace('http://', 'ws://');
241
+ return `${wsUrl}/v1/events/ws`;
242
+ }
243
+ _handleMessage(message) {
244
+ var _a;
245
+ if (this.config.debug) {
246
+ console.log('[EventsModule] Message received:', message);
247
+ }
248
+ switch (message.type) {
249
+ case 'connected':
250
+ this.isConnecting = false;
251
+ this.userId = message.user_id;
252
+ this._emit('connect', message);
253
+ if (this.authResolve) {
254
+ this.authResolve(message);
255
+ this.authResolve = null;
256
+ this.authReject = null;
257
+ }
258
+ this._startPingInterval();
259
+ if (this.reconnectAttempts > 0) {
260
+ this._resubscribeAll();
261
+ }
262
+ this.reconnectAttempts = 0;
263
+ break;
264
+ case 'auth_error':
265
+ this.isConnecting = false;
266
+ const error = message.error || 'Authentication failed';
267
+ if (this.authReject) {
268
+ this.authReject(new Error(error));
269
+ this.authResolve = null;
270
+ this.authReject = null;
271
+ }
272
+ (_a = this.ws) === null || _a === void 0 ? void 0 : _a.close(1008, error);
273
+ break;
274
+ case 'subscription_confirmed':
275
+ this._handleSubscriptionConfirmed(message);
276
+ break;
277
+ case 'unsubscribed':
278
+ this.subscriptions.delete(message.subscription_id);
279
+ break;
280
+ case 'notification':
281
+ this._emit('notification', message);
282
+ break;
283
+ case 'system_notification':
284
+ this._emit('system_notification', message);
285
+ break;
286
+ case 'pong':
287
+ break;
288
+ case 'error':
289
+ this._emit('error', message);
290
+ break;
291
+ default:
292
+ if (this.config.debug) {
293
+ console.warn('[EventsModule] Unknown message type:', message.type);
294
+ }
295
+ }
296
+ }
297
+ _handleSubscriptionConfirmed(message) {
298
+ const pending = this.pendingSubscriptions.get(message.subscription_id);
299
+ if (pending) {
300
+ this.pendingSubscriptions.delete(message.subscription_id);
301
+ const subscription = {
302
+ id: message.subscription_id,
303
+ domain: message.domain,
304
+ resource: message.resource,
305
+ filters: message.filters
306
+ };
307
+ pending.resolve(subscription);
308
+ }
309
+ this._emit('subscription_confirmed', message);
310
+ }
311
+ _emit(event, ...args) {
312
+ const listeners = this.listeners.get(event);
313
+ if (listeners) {
314
+ listeners.forEach((callback) => {
315
+ try {
316
+ callback(...args);
317
+ }
318
+ catch (err) {
319
+ console.error(`[EventsModule] Error in ${event} listener:`, err);
320
+ }
321
+ });
322
+ }
323
+ }
324
+ _startPingInterval() {
325
+ if (this.config.pingInterval > 0) {
326
+ this.pingIntervalId = setInterval(() => {
327
+ this.ping();
328
+ }, this.config.pingInterval);
329
+ if (this.config.debug) {
330
+ console.log('[EventsModule] Ping interval started:', this.config.pingInterval);
331
+ }
332
+ }
333
+ }
334
+ _stopPingInterval() {
335
+ if (this.pingIntervalId) {
336
+ clearInterval(this.pingIntervalId);
337
+ this.pingIntervalId = null;
338
+ }
339
+ }
340
+ _scheduleReconnect() {
341
+ if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
342
+ if (this.config.debug) {
343
+ console.log('[EventsModule] Max reconnect attempts reached');
344
+ }
345
+ this._emit('error', new Error('Max reconnect attempts reached'));
346
+ return;
347
+ }
348
+ this.reconnectAttempts++;
349
+ const delay = Math.min(this.config.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1), this.config.maxReconnectDelay);
350
+ if (this.config.debug) {
351
+ console.log(`[EventsModule] Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts})`);
352
+ }
353
+ this._emit('reconnecting', this.reconnectAttempts);
354
+ this.reconnectTimeoutId = setTimeout(async () => {
355
+ try {
356
+ await this._connect();
357
+ }
358
+ catch (err) {
359
+ if (this.config.debug) {
360
+ console.error('[EventsModule] Reconnect failed:', err);
361
+ }
362
+ }
363
+ }, delay);
364
+ }
365
+ async _resubscribeAll() {
366
+ if (this.config.debug) {
367
+ console.log('[EventsModule] Re-subscribing to', this.subscriptions.size, 'subscriptions');
368
+ }
369
+ const subscriptionsToRestore = new Map(this.subscriptions);
370
+ this.subscriptions.clear();
371
+ for (const [id, sub] of subscriptionsToRestore) {
372
+ try {
373
+ await this.subscribe(sub.domain, sub.resource, sub.options);
374
+ if (this.config.debug) {
375
+ console.log('[EventsModule] Re-subscribed:', sub.domain, sub.resource);
376
+ }
377
+ }
378
+ catch (err) {
379
+ if (this.config.debug) {
380
+ console.error('[EventsModule] Failed to re-subscribe:', err);
381
+ }
382
+ }
383
+ }
384
+ }
385
+ _cleanup() {
386
+ this._stopPingInterval();
387
+ if (this.reconnectTimeoutId) {
388
+ clearTimeout(this.reconnectTimeoutId);
389
+ this.reconnectTimeoutId = null;
390
+ }
391
+ for (const pending of this.pendingSubscriptions.values()) {
392
+ pending.reject(new Error('Connection closed'));
393
+ }
394
+ this.pendingSubscriptions.clear();
395
+ }
396
+ _generateId() {
397
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
398
+ const r = (Math.random() * 16) | 0;
399
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
400
+ return v.toString(16);
401
+ });
402
+ }
403
+ }
404
+ exports.EventsModule = EventsModule;
405
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/modules/events.ts"],"names":[],"mappings":";;;AAgDA,MAAM,cAAc,GAAiC;IACnD,YAAY,EAAE,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