@squidcloud/client 1.0.337 → 1.0.338

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.
@@ -206,6 +206,9 @@ export type AiSessionOptions = Partial<{
206
206
  agentId: string;
207
207
  }>;
208
208
  export type AiAgentChatOptions<T extends AiChatModelName | undefined = undefined> = T extends undefined ? BaseAiAgentChatOptions | GeminiChatOptions | OpenAiReasoningChatOptions | OpenAiChatOptions | AnthropicChatOptions : T extends GeminiChatModelName ? GeminiChatOptions : T extends OpenAiReasoningChatModelName ? OpenAiReasoningChatOptions : T extends OpenAiChatModelName ? OpenAiChatOptions : T extends AnthropicChatModelName ? AnthropicChatOptions : never;
209
+ export type AllAiAgentChatOptions = {
210
+ [K in keyof BaseAiAgentChatOptions | keyof GeminiChatOptions | keyof OpenAiReasoningChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiAgentChatOptions ? BaseAiAgentChatOptions[K] : never) | (K extends keyof GeminiChatOptions ? GeminiChatOptions[K] : never) | (K extends keyof OpenAiReasoningChatOptions ? OpenAiReasoningChatOptions[K] : never) | (K extends keyof OpenAiChatOptions ? OpenAiChatOptions[K] : never) | (K extends keyof AnthropicChatOptions ? AnthropicChatOptions[K] : never);
211
+ };
209
212
  /** A definition of an AI agent. */
210
213
  export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
211
214
  id: AiAgentId;
@@ -1,6 +1,10 @@
1
1
  import { AgentContextRequest, AiAgent, AiAgentChatOptions, AiAgentContext, AiChatModelName, AiConnectedAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResponse, AiStatusMessage, AiTranscribeAndAskResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
2
  import { Observable } from 'rxjs';
3
3
  import { AskOptionsWithoutVoice, AskWithVoiceResponse, ChatOptionsWithoutVoice, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
4
+ /**
5
+ * Parameters for creating or updating an AI agent.
6
+ * Excludes the `id` field, as it is derived from the agent instance.
7
+ */
4
8
  export type UpsertAgentRequestParams = Omit<UpsertAgentRequest, 'id'>;
5
9
  /**
6
10
  * AiAgentReference provides methods for managing AI agents, including
@@ -1,17 +1,40 @@
1
1
  import { AiAgentChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
2
  import { Observable } from 'rxjs';
3
+ /**
4
+ * Response format for transcribing audio and generating a chat response.
5
+ * Contains the transcribed text and a stream of AI-generated responses.
6
+ */
3
7
  export interface TranscribeAndChatResponse {
8
+ /** Transcribed text from the audio input. */
4
9
  transcribedPrompt: string;
10
+ /** Stream of AI-generated responses. */
5
11
  responseStream: Observable<string>;
6
12
  }
13
+ /**
14
+ * Response format for transcribing audio and generating a text and voice response.
15
+ * Includes the transcribed prompt, the AI-generated response as text, and an audio file.
16
+ */
7
17
  export interface TranscribeAndAskWithVoiceResponse {
18
+ /** Transcribed text from the audio input. */
8
19
  transcribedPrompt: string;
20
+ /** AI-generated response as a string. */
9
21
  responseString: string;
22
+ /** AI-generated voice response as an audio file. */
10
23
  voiceResponseFile: File;
11
24
  }
25
+ /**
26
+ * Response format for AI-generated voice responses.
27
+ * Contains the AI-generated text response and the corresponding audio file.
28
+ */
12
29
  export interface AskWithVoiceResponse {
30
+ /** AI-generated response as a string. */
13
31
  responseString: string;
32
+ /** AI-generated voice response as an audio file. */
14
33
  voiceResponseFile: File;
15
34
  }
35
+ /** Chat options that exclude voice-specific configurations. */
16
36
  export type ChatOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions'>;
37
+ /**
38
+ * Options for AI-generated responses that exclude voice-specific settings and smooth typing behavior.
39
+ */
17
40
  export type AskOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions' | 'smoothTyping'>;
@@ -1,34 +1,76 @@
1
1
  import { AiChatModelName, ApiOptions, IntegrationId } from './public-types';
2
+ /**
3
+ * Request to execute an AI query using a specific integration.
4
+ * Supports additional query execution options.
5
+ */
2
6
  export interface ExecuteAiQueryRequest {
7
+ /** ID of the integration to execute the AI query. */
3
8
  integrationId: IntegrationId;
9
+ /** User-provided prompt for the AI query. */
4
10
  prompt: string;
11
+ /** Additional options for query execution. */
5
12
  options?: ExecuteAiQueryOptions;
6
13
  }
14
+ /**
15
+ * Request to execute an AI query across multiple integrations.
16
+ * Allows querying multiple sources simultaneously.
17
+ */
7
18
  export interface ExecuteAiQueryMultiRequest {
19
+ /** IDs of multiple integrations to execute the AI query across. */
8
20
  integrationIds: Array<IntegrationId>;
21
+ /** User-provided prompt for the AI query. */
9
22
  prompt: string;
23
+ /** Additional options for query execution. */
10
24
  options?: ExecuteAiQueryOptions;
11
25
  }
26
+ /**
27
+ * Request to execute an AI-powered API call.
28
+ * Allows specifying allowed endpoints and whether to provide an explanation.
29
+ */
12
30
  export interface ExecuteAiApiRequest {
31
+ /** ID of the integration used for executing the API call. */
13
32
  integrationId: IntegrationId;
33
+ /** User-provided prompt for the AI-powered API request. */
14
34
  prompt: string;
35
+ /** List of allowed API endpoints for execution. */
15
36
  allowedEndpoints?: string[];
37
+ /** Whether to provide an explanation for the API response. */
16
38
  provideExplanation?: boolean;
17
39
  }
40
+ /**
41
+ * Options for configuring AI query execution.
42
+ * Includes instructions, model overrides, and additional execution settings.
43
+ */
18
44
  export interface ExecuteAiQueryOptions {
45
+ /** Custom instructions to modify AI query behavior. */
19
46
  instructions?: string;
47
+ /** List of collections to use in the AI query. */
20
48
  collectionsToUse?: Array<string>;
49
+ /** Whether to enable raw results output. */
21
50
  enableRawResults?: boolean;
51
+ /** Whether to enable code interpreter for query execution. */
22
52
  enableCodeInterpreter?: boolean;
53
+ /** Specific AI model override for the query execution. */
23
54
  overrideModel?: AiChatModelName;
55
+ /** Whether to generate a step-by-step walkthrough for the response. */
24
56
  generateWalkthrough?: boolean;
25
57
  }
58
+ /**
59
+ * Response from an AI query execution.
60
+ * Contains the generated answer, optional explanation, and executed query details.
61
+ */
26
62
  export interface ExecuteAiQueryResponse {
63
+ /** AI-generated answer for the query. */
27
64
  answer: string;
65
+ /** Optional explanation for the AI-generated answer. */
28
66
  explanation?: string;
67
+ /** Query executed by the AI, if applicable. */
29
68
  executedQuery?: string;
69
+ /** Markdown format type of the executed query response. */
30
70
  queryMarkdownType?: string;
71
+ /** URL to access raw results from the query execution. */
31
72
  rawResultsUrl?: string;
73
+ /** Indicates whether the query execution was successful. */
32
74
  success: boolean;
33
75
  }
34
76
  interface ExecutedQuery {
@@ -36,10 +78,18 @@ interface ExecutedQuery {
36
78
  markdownType: string;
37
79
  rawResultsUrl?: string;
38
80
  }
81
+ /**
82
+ * Response from executing an AI query across multiple integrations.
83
+ * Includes answers and explanations for each executed query.
84
+ */
39
85
  export interface ExecuteAiQueryMultiResponse {
86
+ /** AI-generated answer for the multi-integration query. */
40
87
  answer: string;
88
+ /** Optional explanation for the AI-generated response. */
41
89
  explanation?: string;
90
+ /** List of executed queries with details. */
42
91
  executedQueries: Array<ExecutedQuery>;
92
+ /** Indicates whether the query execution was successful. */
43
93
  success: boolean;
44
94
  }
45
95
  interface ApiResult {
@@ -49,11 +99,20 @@ interface ApiResult {
49
99
  requestBody: any;
50
100
  requestOptions: ApiOptions;
51
101
  }
102
+ /**
103
+ * Response from executing an AI-powered API request.
104
+ * Includes the AI-generated answer and details of executed API calls.
105
+ */
52
106
  export interface ExecuteAiApiResponse {
107
+ /** AI-generated answer for the API request. */
53
108
  answer: string;
109
+ /** Optional explanation for the AI-generated API response. */
54
110
  explanation?: string;
111
+ /** List of executed API requests and their results. */
55
112
  executedApis?: Array<ApiResult>;
113
+ /** Markdown format type of the executed query response. */
56
114
  queryMarkdownType?: string;
115
+ /** Indicates whether the API request execution was successful. */
57
116
  success: boolean;
58
117
  }
59
118
  export {};
@@ -1,6 +1,8 @@
1
1
  import { IntegrationId } from './public-types';
2
2
  /** Holds authentication token for the specified integration. */
3
3
  export interface AuthData {
4
+ /** Authentication token for the specified integration. */
4
5
  token: string | undefined;
6
+ /** Optional integration ID associated with the authentication. */
5
7
  integrationId?: IntegrationId;
6
8
  }
@@ -11,7 +11,9 @@ import { SnapshotEmitter } from './query/snapshot-emitter';
11
11
  * documentation}.
12
12
  */
13
13
  export interface DocIdAndData<T extends DocumentData> {
14
+ /** Optional document ID. If not provided, it may be generated by the server. */
14
15
  id?: DocIdOrDocIdObj;
16
+ /** Data associated with the document. */
15
17
  data: T;
16
18
  }
17
19
  /**
@@ -1,5 +1 @@
1
- import { DocTimestamp } from './public-types';
2
- export interface DocTimestampMetadata {
3
- timestamp: DocTimestamp;
4
- expireTimestamp?: number;
5
- }
1
+ export {};
@@ -1,4 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
+ /**
3
+ * A function that performs cleanup or resource deallocation.
4
+ * Can return a promise for asynchronous cleanup.
5
+ */
2
6
  export type DestructorFn = () => Promise<void> | void;
3
7
  /**
4
8
  * DestructManager handles the execution of pre-destruction and destruction
@@ -7,12 +7,24 @@ import { SnapshotEmitter } from './snapshot-emitter';
7
7
  type WithDocumentReferences<T extends Record<any, DocumentData>> = {
8
8
  [k in keyof T]: DocumentReference<Required<T>[k]>;
9
9
  };
10
+ /**
11
+ * Defines the fields used for joining two collections in a query.
12
+ * Specifies the left and right fields that establish the join relationship.
13
+ */
10
14
  export interface JoinFields<ReturnType> {
15
+ /** Field from the left collection to be used in the join. */
11
16
  left: FieldName;
17
+ /** Field from the right collection to be used in the join. */
12
18
  right: keyof ReturnType & FieldName;
13
19
  }
20
+ /**
21
+ * Options for configuring a join query.
22
+ * Specifies aliasing and whether the join is inner or outer.
23
+ */
14
24
  export interface JoinOptions {
25
+ /** Alias for the left collection in the join. */
15
26
  leftAlias: Alias;
27
+ /** Whether the join should be an inner join (default is outer join). */
16
28
  isInner?: boolean;
17
29
  }
18
30
  type Grouped<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, RootAlias extends Alias> = Aliases[RootAlias] extends [] ? Required<ReturnType>[RootAlias] : Record<RootAlias, Required<ReturnType>[RootAlias]> & OtherGroups<Aliases, ReturnType, Aliases[RootAlias]>;
@@ -1,2 +1,12 @@
1
+ /**
2
+ * Number of additional results to fetch beyond the query limit.
3
+ * This is used to handle cases where the client may need more data
4
+ * than initially requested, allowing for smooth pagination.
5
+ */
1
6
  export declare const FETCH_BEYOND_LIMIT = 100;
7
+ /**
8
+ * Threshold for triggering a re-fetch when the number of available
9
+ * results falls below this value. Helps ensure that queries maintain
10
+ * an adequate number of results in memory.
11
+ */
2
12
  export declare const LIMIT_UNDERFLOW_TRIGGER = 20;
@@ -6,55 +6,102 @@ import { Alias, ClientRequestId, JoinCondition, Query, SquidDocument } from '../
6
6
  * underflow handling for dynamic data fetching.
7
7
  */
8
8
  export interface OngoingQuery {
9
+ /** Unique client request identifier for the query. */
9
10
  clientRequestId: ClientRequestId;
11
+ /** Query definition specifying filters, conditions, and requested data. */
10
12
  query: Query;
13
+ /** All the queries that depend on this query. A.join(B) ==> B depends on A. */
11
14
  supportedQueries: Array<OngoingQuery>;
15
+ /** The query this query supports. A.join(B) ==> B supporting A. */
12
16
  supportingOngoingQuery?: OngoingQuery;
17
+ /** Whether the first response has arrived. */
13
18
  gotInitialResponse: boolean;
19
+ /** Whether the query is ready - relevant for joins. */
14
20
  activated: boolean;
21
+ /** The join condition with the supporting ongoing query. */
15
22
  joinCondition?: JoinCondition;
23
+ /** Alias used for identifying this query in joins. */
16
24
  alias: Alias;
25
+ /** Subject emitting the documents retrieved by the query. */
17
26
  dataSubject: BehaviorSubject<Array<SquidDocument> | null>;
27
+ /** Tracks whether the query has been registered with the system. */
18
28
  queryRegistered: BehaviorSubject<boolean>;
19
29
  /**
20
- * In case that this query is a parent of another query (that is, the other query is a subset of this query), this
21
- * query should not be unsubscribed from the server until we registered the child query in the server.
30
+ * In case that this query is a parent of another query (that is, the other query is a subset of this query),
31
+ * this query should not be unsubscribed from the server until we registered the child query in the server.
22
32
  */
23
33
  unsubscribeBlockerCount: BehaviorSubject<number>;
34
+ /** Whether the query should be subscribed to and actively fetch data. */
24
35
  subscribe: boolean;
25
36
  /**
26
- * In case of joins, and if this ongoing query is the root, this field emits all the supported observables
27
- * for example `A.join(B, {...some join condition...}).join(C, {...some join condition}`.
28
- * This field will emit [A.subject.pipe(), B.subject.pipe(), C.subject.pipe()]. Any new supported queries will be
29
- * added here.
37
+ * In case of joins, and if this ongoing query is the root, this field emits all the supported observables.
38
+ *
39
+ * For example:
40
+ * `A.join(B, {...some join condition...}).join(C, {...some join condition})`
41
+ * This field will emit `[A.subject.pipe(), B.subject.pipe(), C.subject.pipe()]`. Any new supported queries
42
+ * will be added here.
30
43
  */
31
44
  allObservables?: ReplaySubject<Array<Observable<DocsAndAlias>>>;
45
+ /** Indicates whether this query has an empty result set in the context of a join. */
32
46
  isEmptyForJoin: boolean;
33
47
  /**
34
48
  * If the query is a supporting query (right side of the join) and the query has '==' condition on the join column,
35
- * there is no need to emit a new query when additional values are added to the left side of the join since the right
36
- * side will not change.
49
+ * there is no need to emit a new query when additional values are added to the left side of the join
50
+ * since the right side will not change.
37
51
  */
38
52
  canExpandForJoin: boolean;
53
+ /** Whether this query has completed execution. */
39
54
  done: boolean;
55
+ /** Indicates if the query is currently in-flight (waiting for a response). */
40
56
  isInFlight: boolean;
57
+ /** Forces fetching fresh results from the server instead of using cached data. */
41
58
  forceFetchFromServer: boolean;
42
59
  /**
43
60
  * If there's a limit, we request `limit + FETCH_BEYOND_LIMIT` documents from the server.
44
- * If we got that many documents, that means there may be even more. In that case, if our result set goes below
45
- * `limit + LIMIT_UNDERFLOW_TRIGGER` documents (due to local or remote deletions), we need to resend the query to the
46
- * server to potentially get more documents.
47
- * If the number of documents is less than `limit + FETCH_BEYOND_LIMIT`, that means there are not that many documents
48
- * on the server, so we don't need to resend the query regardless of how small our result size is or becomes.
61
+ *
62
+ * - If we got that many documents, that means there may be even more.
63
+ * - If our result set goes below `limit + LIMIT_UNDERFLOW_TRIGGER` (due to local or remote deletions),
64
+ * we need to resend the query to the server to potentially get more documents.
65
+ * - If the number of documents is less than `limit + FETCH_BEYOND_LIMIT`, that means there are
66
+ * not that many documents on the server, so we don't need to resend the query regardless of
67
+ * how small our result size is or becomes.
49
68
  */
50
69
  limitUnderflowState: LimitUnderflowState;
51
70
  }
71
+ /**
72
+ * Represents the state of a query when handling limit underflows.
73
+ * Determines whether the client should re-fetch data when the number
74
+ * of stored documents drops below a certain threshold.
75
+ */
52
76
  export declare enum LimitUnderflowState {
77
+ /**
78
+ * The state is unknown, and the system should determine whether to re-fetch
79
+ * data based on observed conditions.
80
+ */
53
81
  UNKNOWN = 0,
82
+ /**
83
+ * Limit underflow handling is disabled. The query will not trigger
84
+ * a re-fetch even if the number of results falls below the threshold.
85
+ */
54
86
  DISABLED = 1,
87
+ /**
88
+ * Limit underflow handling is enabled. If the number of documents
89
+ * falls below the defined threshold, the system will attempt to fetch
90
+ * additional results from the server.
91
+ */
55
92
  ENABLED = 2
56
93
  }
94
+ /**
95
+ * Represents a collection of documents associated with a specific alias
96
+ * in a query, typically used in joined query results.
97
+ */
57
98
  export interface DocsAndAlias {
99
+ /**
100
+ * An array of documents retrieved as part of the query.
101
+ */
58
102
  docs: Array<SquidDocument>;
103
+ /**
104
+ * The alias associated with the documents in a joined query context.
105
+ */
59
106
  alias: Alias;
60
107
  }
@@ -1,6 +1,10 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { SerializedQuery } from '../../../internal-common/src/public-types/serialized-query.public-types';
3
3
  import { Pagination, PaginationOptions } from './pagination';
4
+ /**
5
+ * Interface for emitting query results in a reactive manner,
6
+ * supporting both synchronous and asynchronous access.
7
+ */
4
8
  export interface SnapshotEmitter<ReturnType> {
5
9
  /**
6
10
  * Returns a promise that resolves to the query results.
@@ -1,4 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
+ /**
3
+ * Interface defining the operations available for a queue manager.
4
+ * Allows producing and consuming messages from a queue.
5
+ */
2
6
  export interface QueueManager<T> {
3
7
  /** Publish messages to the queue */
4
8
  produce(messages: T[]): Promise<void>;
@@ -1,7 +1,11 @@
1
1
  /** A response object with type T for the body. */
2
2
  export interface HttpResponse<BodyType = unknown> {
3
+ /** HTTP status code of the response. */
3
4
  status: number;
5
+ /** HTTP status text of the response. */
4
6
  statusText: string;
7
+ /** Headers included in the response. */
5
8
  headers: Record<string, string>;
9
+ /** Response body, typed as `BodyType`. */
6
10
  body: BodyType;
7
11
  }
@@ -1,43 +1,94 @@
1
1
  import { IntegrationId } from '../../internal-common/src/public-types/communication.public-types';
2
+ /**
3
+ * Represents a request to upload a file to a specified directory within the storage bucket.
4
+ */
2
5
  export interface StorageFileUploadRequest {
6
+ /** The ID of the integration where the file will be uploaded. */
3
7
  integrationId: IntegrationId;
8
+ /** The directory path within the bucket where the file should be stored. */
4
9
  dirPathInBucket: string;
10
+ /** Optional expiration time in seconds for the uploaded file. */
5
11
  expirationInSeconds?: number;
6
12
  }
13
+ /**
14
+ * Represents a request to retrieve metadata for a specific file stored in the bucket.
15
+ */
7
16
  export interface GetFileMetadataRequest {
17
+ /** The ID of the integration where the file is stored. */
8
18
  integrationId: IntegrationId;
19
+ /** The path of the file within the bucket. */
9
20
  filePathInBucket: string;
10
21
  }
22
+ /**
23
+ * Represents the metadata details of a file stored in the bucket.
24
+ */
11
25
  export interface GetFileMetadataResponse {
26
+ /** The name of the file. */
12
27
  filename: string;
28
+ /** The size of the file in bytes. */
13
29
  size: number;
30
+ /** The last modified timestamp of the file. */
14
31
  lastModified: Date;
32
+ /** Additional metadata associated with the file. */
15
33
  metadata: Record<string, string>;
16
34
  }
35
+ /**
36
+ * Represents a request to generate a temporary download URL for a file.
37
+ */
17
38
  export interface GetDownloadUrlRequest {
39
+ /** The ID of the integration where the file is stored. */
18
40
  integrationId: IntegrationId;
41
+ /** The path of the file within the bucket. */
19
42
  filePathInBucket: string;
43
+ /** Optional expiration time in seconds for the generated URL. */
20
44
  urlExpirationInSeconds?: number;
21
45
  }
46
+ /**
47
+ * Represents the response containing a generated download URL for a file.
48
+ */
22
49
  export interface GetDownloadUrlResponse {
50
+ /** The temporary URL for downloading the file. */
23
51
  url: string;
24
52
  }
53
+ /**
54
+ * Represents a request to delete multiple files from the storage bucket.
55
+ */
25
56
  export interface DeleteFilesRequest {
57
+ /** The ID of the integration where the files are stored. */
26
58
  integrationId: IntegrationId;
59
+ /** An array of file paths within the bucket to be deleted. */
27
60
  filePathsInBucket: Array<string>;
28
61
  }
62
+ /**
63
+ * Represents a request to list the contents of a directory within the storage bucket.
64
+ */
29
65
  export interface ListDirectoryContentsRequest {
66
+ /** The ID of the integration where the directory is located. */
30
67
  integrationId: IntegrationId;
68
+ /** The path of the directory within the bucket. */
31
69
  dirPathInBucket: string;
32
70
  }
71
+ /**
72
+ * Represents details of a file within a directory in the storage bucket.
73
+ */
33
74
  export interface FileInDirectory {
75
+ /** The name of the file. */
34
76
  filename: string;
77
+ /** The absolute path of the file within the bucket. */
35
78
  absoluteFilePathInBucket: string;
79
+ /** The size of the file in bytes. */
36
80
  size: number;
81
+ /** The last modified timestamp of the file. */
37
82
  lastModified: Date;
38
83
  }
84
+ /**
85
+ * Represents the response containing a list of directories and files within a specified directory in the storage
86
+ * bucket.
87
+ */
39
88
  export interface ListDirectoryContentsResponse {
89
+ /** An array of directory names present in the specified directory. */
40
90
  directories: Array<string>;
91
+ /** An array of files present in the specified directory. */
41
92
  files: Array<FileInDirectory>;
42
93
  }
43
94
  /**
@@ -1 +1,2 @@
1
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.337";
1
+ /** The current version of the SquidCloud client package. */
2
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.338";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.337",
3
+ "version": "1.0.338",
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",