@fishjam-cloud/js-server-sdk 0.29.0-rc.1 → 0.29.0-rc.2

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.
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@fishjam-cloud/js-server-sdk",
4
- version: "0.29.0-rc.1",
4
+ version: "0.29.0-rc.2",
5
5
  description: "Fishjam server SDK for JavaScript",
6
6
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
7
7
  author: "Fishjam Team",
package/dist/index.js CHANGED
@@ -6226,7 +6226,7 @@ var mapException = (error, entity) => {
6226
6226
  // package.json
6227
6227
  var package_default = {
6228
6228
  name: "@fishjam-cloud/js-server-sdk",
6229
- version: "0.29.0-rc.1",
6229
+ version: "0.29.0-rc.2",
6230
6230
  description: "Fishjam server SDK for JavaScript",
6231
6231
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
6232
6232
  author: "Fishjam Team",
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-VLMRJKOY.mjs";
3
+ } from "./chunk-ZKMES6M4.mjs";
4
4
 
5
5
  // ../fishjam-openapi/dist/index.js
6
6
  import globalAxios2 from "axios";
@@ -6,10 +6,37 @@ import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
6
6
  * This module is a separate entry point (`@fishjam-cloud/js-server-sdk/gemini`),
7
7
  * so `@google/genai` is only loaded when the consumer imports this module.
8
8
  *
9
+ * Does not verify the API key against Google — use {@link createClientAndValidate}
10
+ * or call {@link checkCredentials} afterwards for that.
11
+ *
9
12
  * @param options Configuration for the GoogleGenAI client.
10
13
  * @returns A GoogleGenAI instance.
11
14
  */
12
15
  declare const createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
16
+ /**
17
+ * Verifies the API key by making a single lightweight authenticated call
18
+ * (`models.list`). Resolves on success; throws if the call fails — either
19
+ * because the key was rejected or because the request itself failed (e.g.
20
+ * network/connectivity). The original error is preserved as `cause`.
21
+ *
22
+ * Note: this catches the common cases (invalid / unauthorized / wrong-project /
23
+ * region-blocked keys). It does not guarantee the key can use a specific Live
24
+ * native-audio model — such model-specific rejections still surface only via the
25
+ * `live.connect` session callbacks (`onerror`/`onclose`).
26
+ *
27
+ * @param client A GoogleGenAI instance, e.g. from {@link createClient}.
28
+ */
29
+ declare const checkCredentials: (client: GoogleGenAI) => Promise<void>;
30
+ /**
31
+ * Creates a GoogleGenAI client and verifies the API key before returning it,
32
+ * so misconfiguration fails fast.
33
+ *
34
+ * Throws if the key is rejected (see {@link checkCredentials}).
35
+ *
36
+ * @param options Configuration for the GoogleGenAI client.
37
+ * @returns A validated GoogleGenAI instance.
38
+ */
39
+ declare const createClientAndValidate: (options: GoogleGenAIOptions) => Promise<GoogleGenAI>;
13
40
  /**
14
41
  * Predefined audio settings for the agent's output track,
15
42
  * configured for Gemini's 24kHz audio output.
@@ -32,4 +59,4 @@ declare const geminiInputAudioSettings: {
32
59
  */
33
60
  declare const inputMimeType: "audio/pcm;rate=16000";
34
61
 
35
- export { createClient, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
62
+ export { checkCredentials, createClient, createClientAndValidate, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
@@ -6,10 +6,37 @@ import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
6
6
  * This module is a separate entry point (`@fishjam-cloud/js-server-sdk/gemini`),
7
7
  * so `@google/genai` is only loaded when the consumer imports this module.
8
8
  *
9
+ * Does not verify the API key against Google — use {@link createClientAndValidate}
10
+ * or call {@link checkCredentials} afterwards for that.
11
+ *
9
12
  * @param options Configuration for the GoogleGenAI client.
10
13
  * @returns A GoogleGenAI instance.
11
14
  */
12
15
  declare const createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
16
+ /**
17
+ * Verifies the API key by making a single lightweight authenticated call
18
+ * (`models.list`). Resolves on success; throws if the call fails — either
19
+ * because the key was rejected or because the request itself failed (e.g.
20
+ * network/connectivity). The original error is preserved as `cause`.
21
+ *
22
+ * Note: this catches the common cases (invalid / unauthorized / wrong-project /
23
+ * region-blocked keys). It does not guarantee the key can use a specific Live
24
+ * native-audio model — such model-specific rejections still surface only via the
25
+ * `live.connect` session callbacks (`onerror`/`onclose`).
26
+ *
27
+ * @param client A GoogleGenAI instance, e.g. from {@link createClient}.
28
+ */
29
+ declare const checkCredentials: (client: GoogleGenAI) => Promise<void>;
30
+ /**
31
+ * Creates a GoogleGenAI client and verifies the API key before returning it,
32
+ * so misconfiguration fails fast.
33
+ *
34
+ * Throws if the key is rejected (see {@link checkCredentials}).
35
+ *
36
+ * @param options Configuration for the GoogleGenAI client.
37
+ * @returns A validated GoogleGenAI instance.
38
+ */
39
+ declare const createClientAndValidate: (options: GoogleGenAIOptions) => Promise<GoogleGenAI>;
13
40
  /**
14
41
  * Predefined audio settings for the agent's output track,
15
42
  * configured for Gemini's 24kHz audio output.
@@ -32,4 +59,4 @@ declare const geminiInputAudioSettings: {
32
59
  */
33
60
  declare const inputMimeType: "audio/pcm;rate=16000";
34
61
 
35
- export { createClient, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
62
+ export { checkCredentials, createClient, createClientAndValidate, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
@@ -20,7 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/integrations/gemini.ts
21
21
  var gemini_exports = {};
22
22
  __export(gemini_exports, {
23
+ checkCredentials: () => checkCredentials,
23
24
  createClient: () => createClient,
25
+ createClientAndValidate: () => createClientAndValidate,
24
26
  geminiInputAudioSettings: () => geminiInputAudioSettings,
25
27
  geminiOutputAudioSettings: () => geminiOutputAudioSettings,
26
28
  inputMimeType: () => inputMimeType
@@ -31,7 +33,7 @@ var import_genai = require("@google/genai");
31
33
  // package.json
32
34
  var package_default = {
33
35
  name: "@fishjam-cloud/js-server-sdk",
34
- version: "0.29.0-rc.1",
36
+ version: "0.29.0-rc.2",
35
37
  description: "Fishjam server SDK for JavaScript",
36
38
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
37
39
  author: "Fishjam Team",
@@ -140,6 +142,21 @@ var createClient = (options) => {
140
142
  };
141
143
  return new import_genai.GoogleGenAI(finalOptions);
142
144
  };
145
+ var checkCredentials = async (client) => {
146
+ try {
147
+ await client.models.list();
148
+ } catch (error) {
149
+ throw new Error(
150
+ "Could not verify the Gemini API key. The key may be invalid/unauthorized (check the key and that the Gemini API is enabled for its project/region), or the request to Gemini failed (e.g. network connectivity). See the cause for details.",
151
+ { cause: error }
152
+ );
153
+ }
154
+ };
155
+ var createClientAndValidate = async (options) => {
156
+ const client = createClient(options);
157
+ await checkCredentials(client);
158
+ return client;
159
+ };
143
160
  var geminiOutputAudioSettings = {
144
161
  encoding: "pcm16",
145
162
  channels: 1,
@@ -152,7 +169,9 @@ var geminiInputAudioSettings = {
152
169
  var inputMimeType = "audio/pcm;rate=16000";
153
170
  // Annotate the CommonJS export names for ESM import in node:
154
171
  0 && (module.exports = {
172
+ checkCredentials,
155
173
  createClient,
174
+ createClientAndValidate,
156
175
  geminiInputAudioSettings,
157
176
  geminiOutputAudioSettings,
158
177
  inputMimeType
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunk-VLMRJKOY.mjs";
3
+ } from "../chunk-ZKMES6M4.mjs";
4
4
 
5
5
  // src/integrations/gemini.ts
6
6
  import { GoogleGenAI } from "@google/genai";
@@ -19,6 +19,21 @@ var createClient = (options) => {
19
19
  };
20
20
  return new GoogleGenAI(finalOptions);
21
21
  };
22
+ var checkCredentials = async (client) => {
23
+ try {
24
+ await client.models.list();
25
+ } catch (error) {
26
+ throw new Error(
27
+ "Could not verify the Gemini API key. The key may be invalid/unauthorized (check the key and that the Gemini API is enabled for its project/region), or the request to Gemini failed (e.g. network connectivity). See the cause for details.",
28
+ { cause: error }
29
+ );
30
+ }
31
+ };
32
+ var createClientAndValidate = async (options) => {
33
+ const client = createClient(options);
34
+ await checkCredentials(client);
35
+ return client;
36
+ };
22
37
  var geminiOutputAudioSettings = {
23
38
  encoding: "pcm16",
24
39
  channels: 1,
@@ -30,7 +45,9 @@ var geminiInputAudioSettings = {
30
45
  };
31
46
  var inputMimeType = "audio/pcm;rate=16000";
32
47
  export {
48
+ checkCredentials,
33
49
  createClient,
50
+ createClientAndValidate,
34
51
  geminiInputAudioSettings,
35
52
  geminiOutputAudioSettings,
36
53
  inputMimeType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/js-server-sdk",
3
- "version": "0.29.0-rc.1",
3
+ "version": "0.29.0-rc.2",
4
4
  "description": "Fishjam server SDK for JavaScript",
5
5
  "homepage": "https://github.com/fishjam-cloud/js-server-sdk",
6
6
  "author": "Fishjam Team",
@@ -74,8 +74,8 @@
74
74
  }
75
75
  },
76
76
  "devDependencies": {
77
- "@fishjam-cloud/fishjam-openapi": "0.29.0-rc.1",
78
- "@fishjam-cloud/fishjam-proto": "0.29.0-rc.1",
77
+ "@fishjam-cloud/fishjam-openapi": "0.29.0-rc.2",
78
+ "@fishjam-cloud/fishjam-proto": "0.29.0-rc.2",
79
79
  "@openapitools/openapi-generator-cli": "^2.18.4",
80
80
  "@types/node": "^22.13.16",
81
81
  "@types/websocket": "^1.0.10",