@speechos/core 0.2.7 → 0.2.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/config.d.cts +19 -1
- package/dist/config.d.ts +19 -1
- package/dist/index.cjs +32 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +60 -2
- package/dist/types.d.ts +60 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
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, getFetchHandler, 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";
|
|
14
14
|
export type { VoiceBackend } from "./backend.js";
|
|
15
|
-
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, } from "./types.js";
|
|
15
|
+
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, FetchOptions, FetchResponse, FetchHandler, } from "./types.js";
|
|
16
16
|
export declare const VERSION = "0.1.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
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, getFetchHandler, 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";
|
|
14
14
|
export type { VoiceBackend } from "./backend.js";
|
|
15
|
-
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, } from "./types.js";
|
|
15
|
+
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, FetchOptions, FetchResponse, FetchHandler, } from "./types.js";
|
|
16
16
|
export declare const VERSION = "0.1.0";
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,9 @@ const defaultConfig = {
|
|
|
13
13
|
userId: "",
|
|
14
14
|
host: DEFAULT_HOST,
|
|
15
15
|
debug: false,
|
|
16
|
-
webSocketFactory: void 0
|
|
16
|
+
webSocketFactory: void 0,
|
|
17
|
+
fetchHandler: void 0,
|
|
18
|
+
settingsToken: void 0
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* Validates and merges user config with defaults
|
|
@@ -27,7 +29,9 @@ function validateConfig(userConfig) {
|
|
|
27
29
|
userId: userConfig.userId ?? defaultConfig.userId,
|
|
28
30
|
host: userConfig.host ?? defaultConfig.host,
|
|
29
31
|
debug: userConfig.debug ?? defaultConfig.debug,
|
|
30
|
-
webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory
|
|
32
|
+
webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory,
|
|
33
|
+
fetchHandler: userConfig.fetchHandler ?? defaultConfig.fetchHandler,
|
|
34
|
+
settingsToken: userConfig.settingsToken ?? defaultConfig.settingsToken
|
|
31
35
|
};
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
@@ -64,6 +68,29 @@ function updateUserId(userId) {
|
|
|
64
68
|
};
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
71
|
+
* Get the settings token from the current configuration
|
|
72
|
+
* @returns The settings token or undefined if not configured
|
|
73
|
+
*/
|
|
74
|
+
function getSettingsToken() {
|
|
75
|
+
return currentConfig.settingsToken;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Clear the settings token (e.g., when it expires)
|
|
79
|
+
*/
|
|
80
|
+
function clearSettingsToken() {
|
|
81
|
+
currentConfig = {
|
|
82
|
+
...currentConfig,
|
|
83
|
+
settingsToken: void 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the fetch handler from the current configuration
|
|
88
|
+
* @returns The fetch handler or undefined if not configured
|
|
89
|
+
*/
|
|
90
|
+
function getFetchHandler() {
|
|
91
|
+
return currentConfig.fetchHandler;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
67
94
|
* LocalStorage key for anonymous ID persistence
|
|
68
95
|
*/
|
|
69
96
|
const ANONYMOUS_ID_KEY = "speechos_anonymous_id";
|
|
@@ -2243,5 +2270,5 @@ function getBackend() {
|
|
|
2243
2270
|
const VERSION = "0.1.0";
|
|
2244
2271
|
|
|
2245
2272
|
//#endregion
|
|
2246
|
-
export { DEFAULT_HOST, Deferred, SpeechOSEventEmitter, VERSION, createStateManager, events, getBackend, getConfig, livekit, resetConfig, setConfig, speechOS, state, updateUserId, validateConfig, websocket };
|
|
2273
|
+
export { DEFAULT_HOST, Deferred, SpeechOSEventEmitter, VERSION, clearSettingsToken, createStateManager, events, getBackend, getConfig, getFetchHandler, getSettingsToken, livekit, resetConfig, setConfig, speechOS, state, updateUserId, validateConfig, websocket };
|
|
2247
2274
|
//# sourceMappingURL=index.js.map
|