skikrumb-api 2.1.6 → 2.1.8

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
@@ -17,6 +17,7 @@ declare class SkiKrumbRealtimeClient {
17
17
  private scheduleReconnect;
18
18
  disconnect(): void;
19
19
  ping(): void;
20
+ sendPong(): void;
20
21
  requestRefresh(): void;
21
22
  on(event: string, callback: Function): void;
22
23
  off(event: string, callback?: Function): void;
package/dist/index.js CHANGED
@@ -68,6 +68,10 @@ class SkiKrumbRealtimeClient {
68
68
  (_a = this.websocket) === null || _a === void 0 ? void 0 : _a.close();
69
69
  reject(new Error(`Connection failed: ${message.message || message.error}`));
70
70
  }
71
+ else if (message.type === 'ping') {
72
+ // Server-initiated ping - respond with pong
73
+ this.sendPong();
74
+ }
71
75
  else if (message.type === 'session_replaced') {
72
76
  this.emit('session_replaced', message);
73
77
  }
@@ -146,7 +150,6 @@ class SkiKrumbRealtimeClient {
146
150
  this.reconnectAttempts++;
147
151
  // Exponential backoff with 5-minute cap
148
152
  const delay = Math.min(this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1), this.maxReconnectDelay);
149
- console.log(`🔄 Scheduling reconnect attempt #${this.reconnectAttempts} in ${delay / 1000}s`);
150
153
  setTimeout(() => {
151
154
  this.connect().catch((error) => {
152
155
  // Errors are expected during reconnection, will keep trying
@@ -176,6 +179,11 @@ class SkiKrumbRealtimeClient {
176
179
  this.websocket.send(JSON.stringify({ type: 'ping', timestamp: new Date().toISOString() }));
177
180
  }
178
181
  }
182
+ sendPong() {
183
+ if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
184
+ this.websocket.send(JSON.stringify({ type: 'pong', timestamp: new Date().toISOString() }));
185
+ }
186
+ }
179
187
  requestRefresh() {
180
188
  if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
181
189
  this.websocket.send(JSON.stringify({
@@ -475,9 +483,7 @@ export const skiKrumb = (options = {
475
483
  'x-client': options.requestedWith,
476
484
  },
477
485
  });
478
- const response = await requestWithAuth
479
- .get('auth/profiles')
480
- .json();
486
+ const response = await requestWithAuth.get('auth/profiles').json();
481
487
  return response;
482
488
  };
483
489
  const getLatestDeviceData = async (serialNumber) => {
package/dist/models.d.ts CHANGED
@@ -103,6 +103,7 @@ export interface ExternalUserRequest {
103
103
  nickName?: string;
104
104
  providerId?: string;
105
105
  providerName?: string;
106
+ avatar?: string | null;
106
107
  }
107
108
  export interface ExternalUserResponse {
108
109
  success: boolean;
@@ -168,7 +169,7 @@ export interface SharePreviewResponse {
168
169
  account_id: string;
169
170
  name: string;
170
171
  email: string;
171
- avatar: string;
172
+ avatar: string | null;
172
173
  };
173
174
  share_type: 'admin' | 'specific_profiles';
174
175
  profiles: Array<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skikrumb-api",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "Wrapper for the skiKrumb API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",