@squidcloud/client 1.0.150 → 1.0.151

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/cjs/index.js CHANGED
@@ -41749,10 +41749,15 @@ class AuthManager {
41749
41749
  async getAuthData() {
41750
41750
  var _a;
41751
41751
  return {
41752
- token: this.authProvider && (await this.authProvider.getToken()),
41752
+ token: await this.getTokenFromAuthProvider(),
41753
41753
  integrationId: (_a = this.authProvider) === null || _a === void 0 ? void 0 : _a.integrationId,
41754
41754
  };
41755
41755
  }
41756
+ async getTokenFromAuthProvider() {
41757
+ var _a;
41758
+ const promiseOrPrimitive = (_a = this.authProvider) === null || _a === void 0 ? void 0 : _a.getToken();
41759
+ return typeof promiseOrPrimitive === 'object' ? await promiseOrPrimitive : promiseOrPrimitive;
41760
+ }
41756
41761
  getApiKey() {
41757
41762
  return this.apiKey;
41758
41763
  }
@@ -41766,7 +41771,7 @@ class AuthManager {
41766
41771
  if (this.apiKey) {
41767
41772
  return { type: 'ApiKey', token: this.apiKey };
41768
41773
  }
41769
- const token = this.authProvider && (await this.authProvider.getToken());
41774
+ const token = await this.getTokenFromAuthProvider();
41770
41775
  if (!token)
41771
41776
  return undefined;
41772
41777
  return { type: 'Bearer', token, integrationId: (_a = this.authProvider) === null || _a === void 0 ? void 0 : _a.integrationId };
@@ -18,10 +18,12 @@ export interface AiChatbotFileContext extends AiChatbotContextBase {
18
18
  type: 'file';
19
19
  }
20
20
  export type AiChatbotContext = AiChatbotTextContext | AiChatbotUrlContext | AiChatbotFileContext;
21
+ export type OpenAiResponseFormat = 'text' | 'json_object';
21
22
  export interface AiChatbotChatOptions {
22
23
  maxTokens?: number;
23
24
  chatId?: string;
24
25
  disableHistory?: boolean;
25
26
  includeReference?: boolean;
27
+ responseFormat?: OpenAiResponseFormat;
26
28
  }
27
29
  export {};
@@ -16,6 +16,7 @@ export declare class AuthManager {
16
16
  */
17
17
  setAuthProvider(authProvider: SquidAuthProvider): void;
18
18
  getAuthData(): Promise<AuthData>;
19
+ private getTokenFromAuthProvider;
19
20
  getApiKey(): ApiKey | undefined;
20
21
  /**
21
22
  * Returns a valid AuthToken.
@@ -56,10 +56,10 @@ export interface SquidOptions {
56
56
  /** Authentication data provider for Squid requests. */
57
57
  export interface SquidAuthProvider {
58
58
  /**
59
- * Returns a valid AccessToken.
59
+ * Returns a valid AccessToken or undefined if there is no active authorized session.
60
60
  * Called by Squid every time a Squid client makes requests to the Squid backend.
61
61
  */
62
- getToken(): Promise<string | undefined>;
62
+ getToken(): Promise<string | undefined> | string | undefined;
63
63
  /**
64
64
  * Optional Auth integration id.
65
65
  * Sent as a part of all Squid requests to the backend.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.150",
3
+ "version": "1.0.151",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "license": "ISC",
34
34
  "dependencies": {
35
35
  "@apollo/client": "^3.7.4",
36
- "@squidcloud/common": "1.0.150",
36
+ "@squidcloud/common": "1.0.151",
37
37
  "@supercharge/promise-pool": "^2.3.2",
38
38
  "axios": "^1.6.2",
39
39
  "cross-fetch": "^3.1.5",