@squidcloud/client 1.0.206 → 1.0.208

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,10 +1,10 @@
1
1
  /** The supported AI model names. */
2
2
  export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "gpt-4-turbo-preview"];
3
3
  /** The supported AI image generation model names. */
4
- export declare const AI_IMAGE_GENERATION_MODEL_NAMES: readonly ["dall-e-3"];
4
+ export declare const AI_IMAGE_GENERATION_MODEL_NAMES: readonly ["dall-e-3", "stable-diffusion-core"];
5
5
  export type AiModelName = (typeof AI_MODEL_NAMES)[number];
6
6
  export type AiImageGenerationModelName = (typeof AI_IMAGE_GENERATION_MODEL_NAMES)[number];
7
- export type AiGenerateImageOptions = DallEOptions;
7
+ export type AiGenerateImageOptions = DallEOptions | StableDiffusionCoreOptions;
8
8
  export interface BaseAiGenerateImageOptions {
9
9
  modelName: AiImageGenerationModelName;
10
10
  }
@@ -14,6 +14,14 @@ export interface DallEOptions extends BaseAiGenerateImageOptions {
14
14
  size?: '1024x1024' | '1792x1024' | '1024x1792';
15
15
  numberOfImagesToGenerate?: 1;
16
16
  }
17
+ export interface StableDiffusionCoreOptions extends BaseAiGenerateImageOptions {
18
+ modelName: 'stable-diffusion-core';
19
+ aspectRatio?: '16:9' | '1:1' | '21:9' | '2:3' | '3:2' | '4:5' | '5:4' | '9:16' | '9:21';
20
+ negativePrompt?: string;
21
+ seed?: number;
22
+ stylePreset?: 'analog-film' | 'anime' | 'cinematic' | 'comic-book' | 'digital-art' | 'enhance' | 'fantasy-art' | 'isometric' | 'line-art' | 'low-poly' | 'modeling-compound' | 'neon-punk' | 'origami' | 'photographic' | 'pixel-art' | 'tile-texture';
23
+ outputFormat?: 'jpeg' | 'png' | 'webp';
24
+ }
17
25
  /** The possible sources for the LLM provider API key. */
18
26
  export type ApiKeySource = 'user' | 'system';
19
27
  export type OpenAiResponseFormat = 'text' | 'json_object';
@@ -1,5 +1,5 @@
1
1
  import { HttpStatus } from '../public-types/http-status.enum';
2
- export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT;
2
+ export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT | HttpStatus.INTERNAL_SERVER_ERROR;
3
3
  export declare class ValidationError extends Error {
4
4
  readonly statusCode: StatusCode;
5
5
  readonly details?: any;
@@ -25,6 +25,15 @@ export declare class AiChatbotClient {
25
25
  * that has been received so far.
26
26
  */
27
27
  chat(profileId: string, prompt: string, options?: AiChatbotChatOptions): Observable<string>;
28
+ /**
29
+ * Sends a prompt to the specified profile id and returns the response as a Promise of string.
30
+ *
31
+ * @param profileId - The profile id.
32
+ * @param prompt - The prompt.
33
+ * @param options - The options to send to the chat model.
34
+ * @returns A promise that resolves when the chat is complete. The resolved value is the entire response.
35
+ */
36
+ ask(profileId: string, prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<string>;
28
37
  private handleChatResponse;
29
38
  }
30
39
  export interface AiChatBotContextData {
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { DocumentReference } from '../document-reference';
3
- import { DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, SimpleCondition } from '../public-types';
3
+ import { DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, SerializedSimpleQuery, SimpleCondition } from '../public-types';
4
4
  import { Pagination, PaginationOptions } from './pagination';
5
5
  import { SnapshotEmitter } from './snapshot-emitter';
6
6
  /**
@@ -172,6 +172,7 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
172
172
  clone(): QueryBuilder<DocumentType>;
173
173
  addCompositeCondition(conditions: Array<SimpleCondition>): QueryBuilder<DocumentType>;
174
174
  flipSortOrder(): QueryBuilder<DocumentType>;
175
+ serialize(): SerializedSimpleQuery;
175
176
  paginate(options?: Partial<PaginationOptions>): Pagination<DocumentReference<DocumentType>>;
176
177
  }
177
178
  /** Describes the changes to a query result. */
@@ -1,4 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { SerializedQuery } from '../../../internal-common/src/public-types/serialized-query.public-types';
2
3
  import { Pagination, PaginationOptions } from './pagination';
3
4
  export interface SnapshotEmitter<ReturnType> {
4
5
  /**
@@ -31,4 +32,5 @@ export interface SnapshotEmitter<ReturnType> {
31
32
  * @param options The pagination options. Defaults to `{ subscribe: true, pageSize: 100 }`.
32
33
  */
33
34
  paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
35
+ serialize(): SerializedQuery;
34
36
  }
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
- export interface QueueManager {
2
+ export interface QueueManager<T> {
3
3
  /** Publish messages to the queue */
4
- produce(messages: unknown[]): Promise<void>;
4
+ produce(messages: T[]): Promise<void>;
5
5
  /** Consume messages from the queue */
6
- consume<T>(): Observable<T>;
6
+ consume(): Observable<T>;
7
7
  }
@@ -1,14 +1,14 @@
1
+ import { AiClient } from './ai.types';
2
+ import { ApiClient } from './api-client';
1
3
  import { CollectionReference } from './collection-reference';
2
4
  import { ConnectionDetails } from './connection-details';
3
5
  import { DistributedLock } from './distributed-lock.manager';
4
6
  import { GraphQLClient } from './graphql-client';
5
- import { SecretClient } from './secret.client';
6
- import { TransactionId } from './types';
7
- import { AiClient } from './ai.types';
8
7
  import { ApiEndpointId, ApiKey, AppId, CallApiOptions, CollectionName, DocumentData, EnvironmentId, IntegrationId, NativeApiCallResponse, SquidDeveloperId, SquidRegion } from './public-types';
9
8
  import { QueueManager } from './queue.manager';
10
- import { ApiClient } from './api-client';
9
+ import { SecretClient } from './secret.client';
11
10
  import { StorageClient } from './storage-client';
11
+ import { TransactionId } from './types';
12
12
  /** The different options that can be used to initialize a Squid instance. */
13
13
  export interface SquidOptions {
14
14
  /**
@@ -62,7 +62,7 @@ export interface SquidAuthProvider {
62
62
  * Optional Auth integration id.
63
63
  * Sent as a part of all Squid requests to the backend.
64
64
  */
65
- integrationId?: string;
65
+ integrationId: string;
66
66
  }
67
67
  /**
68
68
  * The main entry point to the Squid Client SDK.
@@ -239,7 +239,7 @@ export declare class Squid {
239
239
  * Returns a queue manager for the given topic name and integration id. Using the queue manager you can consume and
240
240
  * produce messages
241
241
  */
242
- queue(topicName: string, integrationId?: IntegrationId): QueueManager;
242
+ queue<T>(topicName: string, integrationId?: IntegrationId): QueueManager<T>;
243
243
  /**
244
244
  * Destructs the Squid Client. Unsubscribes from all ongoing queries or requests, and clears the local data.
245
245
  * After invoking this method, the Squid client will not be usable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.206",
3
+ "version": "1.0.208",
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",