@squidcloud/client 1.0.106 → 1.0.108

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
@@ -26616,6 +26616,8 @@ var IntegrationType;
26616
26616
  IntegrationType["redis"] = "redis";
26617
26617
  IntegrationType["xata"] = "xata";
26618
26618
  IntegrationType["azure_sql"] = "azure_sql";
26619
+ IntegrationType["azure_postgresql"] = "azure_postgresql";
26620
+ IntegrationType["azure_cosmosdb"] = "azure_cosmosdb";
26619
26621
  })(IntegrationType || (IntegrationType = {}));
26620
26622
  var IntegrationSchemaType;
26621
26623
  (function (IntegrationSchemaType) {
@@ -32196,6 +32198,7 @@ class AiAssistantClient {
32196
32198
  this.socketManager = socketManager;
32197
32199
  this.integrationId = integrationId;
32198
32200
  this.ongoingChatRequests = {};
32201
+ this.ongoingChatSequences = {};
32199
32202
  this.socketManager
32200
32203
  .observeNotifications()
32201
32204
  .pipe((0,external_rxjs_namespaceObject.filter)((notification) => notification.type === 'aiAssistant'), map_map((n) => n))
@@ -32229,7 +32232,27 @@ class AiAssistantClient {
32229
32232
  chat(profileId, prompt) {
32230
32233
  const clientRequestId = generateId();
32231
32234
  const subject = new external_rxjs_namespaceObject.BehaviorSubject('');
32235
+ const tokenSequence = new external_rxjs_namespaceObject.Subject();
32232
32236
  this.ongoingChatRequests[clientRequestId] = subject;
32237
+ this.ongoingChatSequences[clientRequestId] = tokenSequence;
32238
+ tokenSequence
32239
+ .pipe((0,external_rxjs_namespaceObject.concatMap)(({ value, complete }) => {
32240
+ if (complete) {
32241
+ return (0,external_rxjs_namespaceObject.of)({ value, complete });
32242
+ }
32243
+ return (0,external_rxjs_namespaceObject.of)(value).pipe((0,external_rxjs_namespaceObject.delay)(5), map_map((char) => ({ value: char, complete: false })));
32244
+ }), (0,external_rxjs_namespaceObject.takeWhile)(({ complete }) => !complete, true))
32245
+ .subscribe({
32246
+ next: ({ value }) => {
32247
+ subject.next(subject.value + value);
32248
+ },
32249
+ error: (e) => {
32250
+ console.error(e);
32251
+ },
32252
+ complete: () => {
32253
+ subject.complete();
32254
+ },
32255
+ });
32233
32256
  const request = {
32234
32257
  profileId,
32235
32258
  prompt,
@@ -32242,18 +32265,22 @@ class AiAssistantClient {
32242
32265
  });
32243
32266
  return subject.pipe((0,external_rxjs_namespaceObject.finalize)(() => {
32244
32267
  delete this.ongoingChatRequests[clientRequestId];
32268
+ delete this.ongoingChatSequences[clientRequestId];
32245
32269
  }), (0,external_rxjs_namespaceObject.share)());
32246
32270
  }
32247
- handleChatResponse(message) {
32248
- const subject = this.ongoingChatRequests[message.clientRequestId];
32249
- if (!subject) {
32271
+ async handleChatResponse(message) {
32272
+ const tokenSequence = this.ongoingChatSequences[message.clientRequestId];
32273
+ if (!tokenSequence) {
32250
32274
  return;
32251
32275
  }
32252
- if (message.payload.complete) {
32253
- subject.complete();
32276
+ const { token, complete } = message.payload;
32277
+ if (complete && !token.length) {
32278
+ tokenSequence.next({ value: '', complete: true });
32254
32279
  }
32255
32280
  else {
32256
- subject.next(subject.value + message.payload.token);
32281
+ for (let i = 0; i < token.length; i++) {
32282
+ tokenSequence.next({ value: token[i], complete: complete && i === token.length - 1 });
32283
+ }
32257
32284
  }
32258
32285
  }
32259
32286
  }
@@ -32300,17 +32327,19 @@ class AiAssistantProfileReference {
32300
32327
  *
32301
32328
  * @param data An object containing options for creating the profile.
32302
32329
  * @param data.modelName - The name of the OpenAI model (`gpt-3.5 or `gpt-4`).
32330
+ * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
32303
32331
  * @returns A promise that resolves when the profile is successfully created.
32304
32332
  */
32305
32333
  insert(data) {
32306
32334
  // TODO: Investigate support strictContext.
32307
- const { modelName } = data;
32335
+ const { modelName, isPublic = false } = data;
32308
32336
  const request = {
32309
32337
  type: 'insert',
32310
32338
  resource: 'profile',
32311
32339
  profileId: this.profileId,
32312
32340
  payload: {
32313
32341
  modelName,
32342
+ isPublic,
32314
32343
  strictContext: false,
32315
32344
  },
32316
32345
  integrationId: this.integrationId,
@@ -32323,16 +32352,18 @@ class AiAssistantProfileReference {
32323
32352
  *
32324
32353
  * @param data An object containing options for updating the profile.
32325
32354
  * @param data.modelName - The name of the OpenAI model (`gpt-3.5 or `gpt-4`).
32355
+ * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
32326
32356
  * @returns A promise that resolves when the profile is successfully updated.
32327
32357
  */
32328
32358
  update(data) {
32329
- const { modelName } = data;
32359
+ const { modelName, isPublic } = data;
32330
32360
  const request = {
32331
32361
  type: 'update',
32332
32362
  resource: 'profile',
32333
32363
  profileId: this.profileId,
32334
32364
  payload: {
32335
32365
  modelName,
32366
+ isPublic,
32336
32367
  strictContext: false,
32337
32368
  },
32338
32369
  integrationId: this.integrationId,
@@ -1,4 +1,5 @@
1
1
  import { BaseIntegrationConfig, IntegrationType } from './index';
2
+ import { OpenAiModelName } from '../ai-assistant.types';
2
3
  export interface AiAssistantIntegrationConfig extends BaseIntegrationConfig {
3
4
  type: IntegrationType.ai_assistant;
4
5
  configuration: AiAssistantConfiguration;
@@ -7,7 +8,8 @@ export type AiAssistantConfiguration = {
7
8
  apiKey?: string;
8
9
  };
9
10
  export type AiAssistantProfileMetadata = {
10
- modelName: string;
11
+ modelName: OpenAiModelName;
12
+ isPublic: boolean;
11
13
  strictContext: boolean;
12
14
  instructions: Record<string, string>;
13
15
  };
@@ -53,7 +53,9 @@ export declare enum IntegrationType {
53
53
  'oracledb' = "oracledb",
54
54
  'redis' = "redis",
55
55
  'xata' = "xata",
56
- 'azure_sql' = "azure_sql"
56
+ 'azure_sql' = "azure_sql",
57
+ 'azure_postgresql' = "azure_postgresql",
58
+ 'azure_cosmosdb' = "azure_cosmosdb"
57
59
  }
58
60
  export declare enum IntegrationSchemaType {
59
61
  'data' = "data",
@@ -7,6 +7,7 @@ export declare class AiAssistantClient {
7
7
  private readonly socketManager;
8
8
  private readonly integrationId;
9
9
  private readonly ongoingChatRequests;
10
+ private readonly ongoingChatSequences;
10
11
  constructor(rpcManager: RpcManager, socketManager: SocketManager, integrationId: IntegrationId);
11
12
  /**
12
13
  * Retrieves a profile reference for the provided id. A profile reference
@@ -64,10 +65,12 @@ declare class AiAssistantProfileReference {
64
65
  *
65
66
  * @param data An object containing options for creating the profile.
66
67
  * @param data.modelName - The name of the OpenAI model (`gpt-3.5 or `gpt-4`).
68
+ * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
67
69
  * @returns A promise that resolves when the profile is successfully created.
68
70
  */
69
71
  insert(data: {
70
72
  modelName: OpenAiModelName;
73
+ isPublic: boolean;
71
74
  }): Promise<void>;
72
75
  /**
73
76
  * Updates an existing assistant profile. This will result in an error if a profile has not yet been created for the
@@ -75,10 +78,12 @@ declare class AiAssistantProfileReference {
75
78
  *
76
79
  * @param data An object containing options for updating the profile.
77
80
  * @param data.modelName - The name of the OpenAI model (`gpt-3.5 or `gpt-4`).
81
+ * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
78
82
  * @returns A promise that resolves when the profile is successfully updated.
79
83
  */
80
84
  update(data: {
81
- modelName: OpenAiModelName;
85
+ modelName?: OpenAiModelName;
86
+ isPublic?: boolean;
82
87
  }): Promise<void>;
83
88
  /**
84
89
  * Deletes an existing assistant profile. This will result in an error if a profile has not yet been created for the
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
7
6
  "types": "dist/typescript-client/src/index.d.ts",
8
7
  "files": [
9
8
  "dist/**/*"