@speechos/core 0.2.7 → 0.2.9

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.cts CHANGED
@@ -7,7 +7,7 @@
7
7
  export { speechOS } from "./speechos.js";
8
8
  export { events, SpeechOSEventEmitter } from "./events.js";
9
9
  export { state, createStateManager } from "./state.js";
10
- export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, DEFAULT_HOST, } from "./config.js";
10
+ export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, getSettingsToken, clearSettingsToken, DEFAULT_HOST, } from "./config.js";
11
11
  export { livekit, Deferred } from "./livekit.js";
12
12
  export { websocket } from "./websocket.js";
13
13
  export { getBackend } from "./backend.js";
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  export { speechOS } from "./speechos.js";
8
8
  export { events, SpeechOSEventEmitter } from "./events.js";
9
9
  export { state, createStateManager } from "./state.js";
10
- export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, DEFAULT_HOST, } from "./config.js";
10
+ export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, getSettingsToken, clearSettingsToken, DEFAULT_HOST, } from "./config.js";
11
11
  export { livekit, Deferred } from "./livekit.js";
12
12
  export { websocket } from "./websocket.js";
13
13
  export { getBackend } from "./backend.js";
package/dist/index.js CHANGED
@@ -13,7 +13,8 @@ const defaultConfig = {
13
13
  userId: "",
14
14
  host: DEFAULT_HOST,
15
15
  debug: false,
16
- webSocketFactory: void 0
16
+ webSocketFactory: void 0,
17
+ settingsToken: void 0
17
18
  };
18
19
  /**
19
20
  * Validates and merges user config with defaults
@@ -21,13 +22,14 @@ const defaultConfig = {
21
22
  * @returns Validated and merged configuration
22
23
  */
23
24
  function validateConfig(userConfig) {
24
- if (!userConfig.apiKey) throw new Error("SpeechOS requires an apiKey. Get one from your team dashboard at /a/<team-slug>/.");
25
+ if (!userConfig.apiKey) throw new Error("SpeechOS requires an apiKey. Get one from your team dashboard at /a/.");
25
26
  return {
26
27
  apiKey: userConfig.apiKey,
27
28
  userId: userConfig.userId ?? defaultConfig.userId,
28
29
  host: userConfig.host ?? defaultConfig.host,
29
30
  debug: userConfig.debug ?? defaultConfig.debug,
30
- webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory
31
+ webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory,
32
+ settingsToken: userConfig.settingsToken ?? defaultConfig.settingsToken
31
33
  };
32
34
  }
33
35
  /**
@@ -64,6 +66,22 @@ function updateUserId(userId) {
64
66
  };
65
67
  }
66
68
  /**
69
+ * Get the settings token from the current configuration
70
+ * @returns The settings token or undefined if not configured
71
+ */
72
+ function getSettingsToken() {
73
+ return currentConfig.settingsToken;
74
+ }
75
+ /**
76
+ * Clear the settings token (e.g., when it expires)
77
+ */
78
+ function clearSettingsToken() {
79
+ currentConfig = {
80
+ ...currentConfig,
81
+ settingsToken: void 0
82
+ };
83
+ }
84
+ /**
67
85
  * LocalStorage key for anonymous ID persistence
68
86
  */
69
87
  const ANONYMOUS_ID_KEY = "speechos_anonymous_id";
@@ -2243,5 +2261,5 @@ function getBackend() {
2243
2261
  const VERSION = "0.1.0";
2244
2262
 
2245
2263
  //#endregion
2246
- export { DEFAULT_HOST, Deferred, SpeechOSEventEmitter, VERSION, createStateManager, events, getBackend, getConfig, livekit, resetConfig, setConfig, speechOS, state, updateUserId, validateConfig, websocket };
2264
+ export { DEFAULT_HOST, Deferred, SpeechOSEventEmitter, VERSION, clearSettingsToken, createStateManager, events, getBackend, getConfig, getSettingsToken, livekit, resetConfig, setConfig, speechOS, state, updateUserId, validateConfig, websocket };
2247
2265
  //# sourceMappingURL=index.js.map