@squidcloud/client 1.0.363 → 1.0.365
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 +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +26 -8
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +77 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +8 -8
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +14 -3
- package/dist/typescript-client/src/ai-client.d.ts +15 -1
- package/dist/typescript-client/src/collection-reference.d.ts +1 -1
- package/dist/typescript-client/src/document-reference.d.ts +1 -1
- package/dist/typescript-client/src/extraction-client.d.ts +8 -1
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +1 -1
- package/dist/typescript-client/src/squid.d.ts +6 -7
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/internal-common/src/metric-name.d.ts +0 -9
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -148
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -60
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -166
- package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -135
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +0 -1
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -59
- package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
- package/dist/internal-common/src/types/communication.types.d.ts +0 -1
- package/dist/internal-common/src/types/document.types.d.ts +0 -1
- package/dist/internal-common/src/types/file.types.d.ts +0 -6
- package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/observability.types.d.ts +0 -71
- package/dist/internal-common/src/types/query.types.d.ts +0 -13
- package/dist/internal-common/src/types/secret.types.d.ts +0 -2
- package/dist/internal-common/src/types/socket.types.d.ts +0 -1
- package/dist/internal-common/src/types/time-units.d.ts +0 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -41
- package/dist/internal-common/src/utils/array.d.ts +0 -1
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
- package/dist/internal-common/src/utils/http.d.ts +0 -2
- package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
- package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
- package/dist/internal-common/src/utils/object.d.ts +0 -49
- package/dist/internal-common/src/utils/serialization.d.ts +0 -10
- package/dist/internal-common/src/utils/squid.constants.d.ts +0 -1
- package/dist/internal-common/src/utils/validation.d.ts +0 -19
- package/dist/internal-common/src/websocket.impl.d.ts +0 -26
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { AiAgentId, AiContextId, IntegrationId } from './communication.public-types';
|
|
2
2
|
import { IntegrationType } from './integration.public-types';
|
|
3
3
|
import { AiFunctionId, AiFunctionIdWithContext } from './backend.public-types';
|
|
4
|
+
import { SecretKey } from './secret.public-types';
|
|
5
|
+
/** List of available AI provider types. See AiProviderType. */
|
|
6
|
+
export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "flux", "gemini", "openai", "squid", "stability", "voyage"];
|
|
7
|
+
/**
|
|
8
|
+
* Type of the AI provider.
|
|
9
|
+
* References a single AI service, regardless of the model or other AI function it provides (like
|
|
10
|
+
* chat/search/transcribe etc...).
|
|
11
|
+
*/
|
|
12
|
+
export type AiProviderType = (typeof AI_PROVIDER_TYPES)[number];
|
|
4
13
|
/**
|
|
5
14
|
* The supported OpenAI models.
|
|
6
15
|
* @category AI
|
|
@@ -128,6 +137,10 @@ export type OpenAiReasoningChatModelName = (typeof OPENAI_REASONING_CHAT_MODEL_N
|
|
|
128
137
|
* @category AI
|
|
129
138
|
*/
|
|
130
139
|
export type GeminiChatModelName = (typeof GEMINI_CHAT_MODEL_NAMES)[number];
|
|
140
|
+
/**
|
|
141
|
+
* @category AI
|
|
142
|
+
*/
|
|
143
|
+
export type SquidAiModelName = (typeof SQUID_AI_MODEL_NAMES)[number];
|
|
131
144
|
/**
|
|
132
145
|
* @category AI
|
|
133
146
|
*/
|
|
@@ -392,7 +405,7 @@ export interface AiChatPromptQuotas {
|
|
|
392
405
|
* The base AI agent chat options, should not be used directly.
|
|
393
406
|
* @category AI
|
|
394
407
|
*/
|
|
395
|
-
export interface
|
|
408
|
+
export interface BaseAiChatOptions {
|
|
396
409
|
/** The maximum number of tokens to use when making the request to the AI model. Defaults to the max tokens the model can accept. */
|
|
397
410
|
maxTokens?: number;
|
|
398
411
|
/** A unique chat ID, if the same chat ID is used again and history is not disabled, it will continue the conversation. */
|
|
@@ -447,7 +460,7 @@ export interface BaseAiAgentChatOptions {
|
|
|
447
460
|
* Chat options specific to Gemini models, extending base options.
|
|
448
461
|
* @category AI
|
|
449
462
|
*/
|
|
450
|
-
export interface GeminiChatOptions extends
|
|
463
|
+
export interface GeminiChatOptions extends BaseAiChatOptions {
|
|
451
464
|
/** The Gemini model to use for the chat. */
|
|
452
465
|
model?: GeminiChatModelName;
|
|
453
466
|
/** Enables grounding with web search for more informed responses; defaults to false. */
|
|
@@ -457,7 +470,7 @@ export interface GeminiChatOptions extends BaseAiAgentChatOptions {
|
|
|
457
470
|
* Chat options specific to OpenAI models, extending base options.
|
|
458
471
|
* @category AI
|
|
459
472
|
*/
|
|
460
|
-
export interface OpenAiChatOptions extends
|
|
473
|
+
export interface OpenAiChatOptions extends BaseAiChatOptions {
|
|
461
474
|
/** The OpenAI model to use for the chat. */
|
|
462
475
|
model?: OpenAiChatModelName;
|
|
463
476
|
/** An array of file URLs to include in the chat context. */
|
|
@@ -481,7 +494,7 @@ export interface OpenAiReasoningChatOptions extends OpenAiChatOptions {
|
|
|
481
494
|
* Chat options specific to Anthropic models, extending base options.
|
|
482
495
|
* @category AI
|
|
483
496
|
*/
|
|
484
|
-
export interface AnthropicChatOptions extends
|
|
497
|
+
export interface AnthropicChatOptions extends BaseAiChatOptions {
|
|
485
498
|
/** The Anthropic model to use for the chat. */
|
|
486
499
|
model?: AnthropicChatModelName;
|
|
487
500
|
/** The level of reasoning effort to apply. Defaults to no reasoning. */
|
|
@@ -506,12 +519,12 @@ export type AiSessionOptions = Partial<{
|
|
|
506
519
|
* the type is inferred from the provided overrideModel (or falls back to BaseAiAgentChatOptions).
|
|
507
520
|
* @category AI
|
|
508
521
|
*/
|
|
509
|
-
export type
|
|
522
|
+
export type AiChatOptions<T extends AiChatModelName | undefined = undefined> = T extends undefined ? BaseAiChatOptions | GeminiChatOptions | OpenAiReasoningChatOptions | OpenAiChatOptions | AnthropicChatOptions : T extends GeminiChatModelName ? GeminiChatOptions : T extends OpenAiReasoningChatModelName ? OpenAiReasoningChatOptions : T extends OpenAiChatModelName ? OpenAiChatOptions : T extends AnthropicChatModelName ? AnthropicChatOptions : T extends SquidAiModelName ? BaseAiChatOptions : never;
|
|
510
523
|
/**
|
|
511
524
|
* @category AI
|
|
512
525
|
*/
|
|
513
526
|
export type AllAiAgentChatOptions = {
|
|
514
|
-
[K in keyof
|
|
527
|
+
[K in keyof BaseAiChatOptions | keyof GeminiChatOptions | keyof OpenAiReasoningChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiChatOptions ? BaseAiChatOptions[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);
|
|
515
528
|
};
|
|
516
529
|
/**
|
|
517
530
|
* A definition of an AI agent with its properties and default chat options.
|
|
@@ -531,7 +544,7 @@ export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
|
|
|
531
544
|
/** Enables audit logging for the agent's activities if true; defaults to false. */
|
|
532
545
|
auditLog?: boolean;
|
|
533
546
|
/** The default chat options for the agent, overridable by the user during use. */
|
|
534
|
-
options:
|
|
547
|
+
options: AiChatOptions<T>;
|
|
535
548
|
/** The embedding model name used by the agent. */
|
|
536
549
|
embeddingModelName: AiEmbeddingsModelName;
|
|
537
550
|
}
|
|
@@ -539,7 +552,7 @@ export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
|
|
|
539
552
|
* @category AI
|
|
540
553
|
*/
|
|
541
554
|
export type UpsertAgentRequest = Omit<AiAgent, 'createdAt' | 'updatedAt' | 'options' | 'embeddingModelName'> & {
|
|
542
|
-
options?:
|
|
555
|
+
options?: AiChatOptions;
|
|
543
556
|
embeddingModelName?: AiEmbeddingsModelName;
|
|
544
557
|
};
|
|
545
558
|
/**
|
|
@@ -783,4 +796,9 @@ export interface AiTranscribeAndAskResponse {
|
|
|
783
796
|
/** The transcribed text from the audio input. */
|
|
784
797
|
transcribedPrompt: string;
|
|
785
798
|
}
|
|
799
|
+
/** Per application AI settings. */
|
|
800
|
+
export interface ApplicationAiSettings {
|
|
801
|
+
/** Maps AI provider name to API key secret name that must be used for any request made by the application. */
|
|
802
|
+
apiKeys: Partial<Record<AiProviderType, SecretKey>>;
|
|
803
|
+
}
|
|
786
804
|
export {};
|
|
@@ -92,3 +92,80 @@ export interface ExtractDataFromDocumentResponse {
|
|
|
92
92
|
*/
|
|
93
93
|
pages: Array<ExtractDataFromDocumentPage>;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Create PDF request type.
|
|
97
|
+
*/
|
|
98
|
+
export type CreatePdfType = 'html' | 'url';
|
|
99
|
+
/** The type of output options to apply when creating a PDF document. */
|
|
100
|
+
export type CreatePdfOutputOptionsType = 'format' | 'dimensions';
|
|
101
|
+
/** Base interface for PDF output options. This is used to define the type of output options. */
|
|
102
|
+
export interface BaseCreatePdfOutputOptions {
|
|
103
|
+
/** The type of output options, either 'format' or 'dimensions'. */
|
|
104
|
+
type: CreatePdfOutputOptionsType;
|
|
105
|
+
}
|
|
106
|
+
/** Output options by format */
|
|
107
|
+
export interface CreatePdfOutputFormatOptions extends BaseCreatePdfOutputOptions {
|
|
108
|
+
/** The type of output options, always 'format' for this interface. */
|
|
109
|
+
type: 'format';
|
|
110
|
+
/** The type of formatting, always 'format' for this interface. */
|
|
111
|
+
format: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
|
|
112
|
+
}
|
|
113
|
+
/** Output options by custom dimensions */
|
|
114
|
+
export interface CreatePdfOutputDimensionsOptions extends BaseCreatePdfOutputOptions {
|
|
115
|
+
/** The type of formatting, always 'dimensions' for this interface. */
|
|
116
|
+
type: 'dimensions';
|
|
117
|
+
/** The width of the PDF document in pixels. */
|
|
118
|
+
width: number;
|
|
119
|
+
/** The height of the PDF document in pixels. */
|
|
120
|
+
height: number;
|
|
121
|
+
}
|
|
122
|
+
/** Combined formatting options for creating a PDF document. */
|
|
123
|
+
export type CreatePdfOutputOptions = CreatePdfOutputFormatOptions | CreatePdfOutputDimensionsOptions;
|
|
124
|
+
/**
|
|
125
|
+
* Base request for creating a PDF document.
|
|
126
|
+
*/
|
|
127
|
+
export interface BaseCreatePdfRequest {
|
|
128
|
+
/**
|
|
129
|
+
* The type of PDF creation to perform, either from HTML or a URL.
|
|
130
|
+
*/
|
|
131
|
+
type: CreatePdfType;
|
|
132
|
+
/** The formatting options for the PDF document. Can be either a predefined format (like 'letter') or custom dimensions. */
|
|
133
|
+
outputOptions?: CreatePdfOutputOptions;
|
|
134
|
+
/** Optional title for the PDF document. */
|
|
135
|
+
title?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Request payload for creating a PDF from a URL.
|
|
139
|
+
*/
|
|
140
|
+
export interface CreatePdfFromUrlRequest extends BaseCreatePdfRequest {
|
|
141
|
+
/** The type of PDF creation, always 'url' for this request. */
|
|
142
|
+
type: 'url';
|
|
143
|
+
/**
|
|
144
|
+
* The URL of the webpage to convert into a PDF.
|
|
145
|
+
*/
|
|
146
|
+
url: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Request payload for creating a PDF from HTML content.
|
|
150
|
+
*/
|
|
151
|
+
export interface CreatePdfFromHtmlRequest extends BaseCreatePdfRequest {
|
|
152
|
+
/** The type of PDF creation, always 'html' for this request. */
|
|
153
|
+
type: 'html';
|
|
154
|
+
/** The HTML content to convert into a PDF. Should not contain <html>, <body>, <head>, should just include the inner HTML */
|
|
155
|
+
innerHtml: string;
|
|
156
|
+
/** Optional URL for CSS styles to apply to the HTML content. */
|
|
157
|
+
cssUrl?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Combined request type for creating a PDF, which can be either from a URL or HTML content.
|
|
161
|
+
*/
|
|
162
|
+
export type CreatePdfRequest = CreatePdfFromUrlRequest | CreatePdfFromHtmlRequest;
|
|
163
|
+
/**
|
|
164
|
+
* Response type for the PDF creation operation, containing the URL of the generated PDF.
|
|
165
|
+
*/
|
|
166
|
+
export interface CreatePdfResponse {
|
|
167
|
+
/**
|
|
168
|
+
* The publicly accessible URL where the generated PDF can be downloaded.
|
|
169
|
+
*/
|
|
170
|
+
url: string;
|
|
171
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AgentContextRequest, AiAgent,
|
|
1
|
+
import { AgentContextRequest, AiAgent, AiAgentContext, AiChatModelName, AiConnectedAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, GuardrailsOptions, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for creating or updating an AI agent.
|
|
6
6
|
* Excludes the `id` field, as it is derived from the agent instance.
|
|
@@ -90,11 +90,11 @@ export declare class AiAgentReference {
|
|
|
90
90
|
/**
|
|
91
91
|
* Sends a prompt to the agent and receives streamed text responses.
|
|
92
92
|
*/
|
|
93
|
-
chat(prompt: string, options?:
|
|
93
|
+
chat<T extends AiChatModelName | undefined>(prompt: string, options?: AiChatOptionsWithoutVoice<T>): Observable<string>;
|
|
94
94
|
/**
|
|
95
95
|
* Transcribes the given file and performs a chat interaction.
|
|
96
96
|
*/
|
|
97
|
-
transcribeAndChat(fileToTranscribe: File, options?:
|
|
97
|
+
transcribeAndChat(fileToTranscribe: File, options?: AiChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
|
|
98
98
|
/**
|
|
99
99
|
* Performs a semantic search using the agent's knowledge base.
|
|
100
100
|
*/
|
|
@@ -102,7 +102,7 @@ export declare class AiAgentReference {
|
|
|
102
102
|
/**
|
|
103
103
|
* Sends a prompt and receives a full string response.
|
|
104
104
|
*/
|
|
105
|
-
ask(prompt: string, options?:
|
|
105
|
+
ask<T extends AiChatModelName | undefined = undefined>(prompt: string, options?: AiAskOptions<T>): Promise<string>;
|
|
106
106
|
/**
|
|
107
107
|
* Observes live status messages from the agent.
|
|
108
108
|
*/
|
|
@@ -110,15 +110,15 @@ export declare class AiAgentReference {
|
|
|
110
110
|
/**
|
|
111
111
|
* Transcribes audio and sends it to the agent for response.
|
|
112
112
|
*/
|
|
113
|
-
transcribeAndAsk(fileToTranscribe: File, options?:
|
|
113
|
+
transcribeAndAsk<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptions<T>): Promise<AiTranscribeAndAskResponse>;
|
|
114
114
|
/**
|
|
115
115
|
* Transcribes audio and gets both text and voice response from the agent.
|
|
116
116
|
*/
|
|
117
|
-
transcribeAndAskWithVoiceResponse(fileToTranscribe: File, options?:
|
|
117
|
+
transcribeAndAskWithVoiceResponse<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptionsWithVoice<T>): Promise<TranscribeAndAskWithVoiceResponse>;
|
|
118
118
|
/**
|
|
119
119
|
* Sends a prompt and gets both text and voice response from the agent.
|
|
120
120
|
*/
|
|
121
|
-
askWithVoiceResponse(prompt: string, options?:
|
|
121
|
+
askWithVoiceResponse<T extends AiChatModelName | undefined>(prompt: string, options?: AiAskOptionsWithVoice<T>): Promise<AskWithVoiceResponse>;
|
|
122
122
|
private askInternal;
|
|
123
123
|
private createStatusSubject;
|
|
124
124
|
private chatInternal;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AiChatModelName, AiChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
/**
|
|
4
4
|
* Response format for transcribing audio and generating a chat response.
|
|
@@ -39,9 +39,20 @@ export interface AskWithVoiceResponse {
|
|
|
39
39
|
* Chat options that exclude voice-specific configurations.
|
|
40
40
|
* @category AI
|
|
41
41
|
*/
|
|
42
|
-
export type
|
|
42
|
+
export type AiChatOptionsWithoutVoice<T extends AiChatModelName | undefined = undefined> = Omit<AiChatOptions<T>, 'voiceOptions'> & {
|
|
43
|
+
model?: T;
|
|
44
|
+
};
|
|
43
45
|
/**
|
|
44
46
|
* Options for AI-generated responses that exclude voice-specific settings and smooth typing behavior.
|
|
45
47
|
* @category AI
|
|
46
48
|
*/
|
|
47
|
-
export type
|
|
49
|
+
export type AiAskOptions<T extends AiChatModelName | undefined = undefined> = Omit<AiChatOptions<T>, 'voiceOptions' | 'smoothTyping'> & {
|
|
50
|
+
model?: T;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Options for AI-generated responses that include voice-specific settings but excludes smooth typing.
|
|
54
|
+
* @category AI
|
|
55
|
+
*/
|
|
56
|
+
export type AiAskOptionsWithVoice<T extends AiChatModelName | undefined = undefined> = Omit<AiChatOptions<T>, 'smoothTyping'> & {
|
|
57
|
+
model?: T;
|
|
58
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AiAssistantClient } from './ai-assistant-client';
|
|
2
|
-
import { AiAgent, AiAgentId, IntegrationId } from './public-types';
|
|
2
|
+
import { AiAgent, AiAgentId, AiProviderType, ApplicationAiSettings, IntegrationId, SecretKey } from './public-types';
|
|
3
3
|
import { AiImageClient } from './ai-image-client';
|
|
4
4
|
import { AiAudioClient } from './ai-audio-client';
|
|
5
5
|
import { AiMatchMakingClient } from './ai-matchmaking-client';
|
|
@@ -83,4 +83,18 @@ export declare class AiClient {
|
|
|
83
83
|
* Allows specifying allowed endpoints and whether to provide an explanation.
|
|
84
84
|
*/
|
|
85
85
|
executeAiApiCall(integrationId: IntegrationId, prompt: string, allowedEndpoints?: string[], provideExplanation?: boolean): Promise<ExecuteAiApiResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns name of the secret that stores API key for the given AI provider type.
|
|
88
|
+
* This API key is used for all requests to the AI provider done from the application.
|
|
89
|
+
*/
|
|
90
|
+
getApplicationAiSettings(): Promise<ApplicationAiSettings>;
|
|
91
|
+
/** Sets new application AI settings. Overwrites the existing value. */
|
|
92
|
+
setApplicationAiSettings(settings: ApplicationAiSettings): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the name of the secret that stores API key for the given AI provider type.
|
|
95
|
+
* This API key is used for all requests to the AI provider done from the application.
|
|
96
|
+
* To delete the existing secret key use 'undefined' for the name of the secret.
|
|
97
|
+
* Returns the updated state of the AI application settings.
|
|
98
|
+
*/
|
|
99
|
+
setAiProviderApiKeySecret(providerType: AiProviderType, secretKey: SecretKey | undefined): Promise<ApplicationAiSettings>;
|
|
86
100
|
}
|
|
@@ -23,7 +23,7 @@ export interface DocIdAndData<T extends DocumentData> {
|
|
|
23
23
|
* collection in a NoSQL database.
|
|
24
24
|
*
|
|
25
25
|
* Read more about collection references in the
|
|
26
|
-
* {@link https://docs.getsquid.ai/docs/client-sdk/database/collection-reference documentation}.
|
|
26
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/collection-reference documentation}.
|
|
27
27
|
* @typeParam T The type of the document data.
|
|
28
28
|
* @category Database
|
|
29
29
|
*/
|
|
@@ -9,7 +9,7 @@ import { DeepRecord, Paths } from '../../internal-common/src/public-types/typesc
|
|
|
9
9
|
* use to create a new document.
|
|
10
10
|
*
|
|
11
11
|
* Read more about document references in the
|
|
12
|
-
* {@link https://docs.getsquid.ai/docs/client-sdk/database/document-reference documentation}.
|
|
12
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/document-reference documentation}.
|
|
13
13
|
* @typeParam T The type of the document data.
|
|
14
14
|
* @category Database
|
|
15
15
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtractDataFromDocumentOptions, ExtractDataFromDocumentResponse } from '../../internal-common/src/public-types/extraction.public-types';
|
|
1
|
+
import { CreatePdfRequest, CreatePdfResponse, ExtractDataFromDocumentOptions, ExtractDataFromDocumentResponse } from '../../internal-common/src/public-types/extraction.public-types';
|
|
2
2
|
/**
|
|
3
3
|
* ExtractionClient provides methods for extracting structured data
|
|
4
4
|
* from document files using AI-driven processing.
|
|
@@ -22,4 +22,11 @@ export declare class ExtractionClient {
|
|
|
22
22
|
* @returns A promise that resolves with the extracted document data.
|
|
23
23
|
*/
|
|
24
24
|
extractDataFromDocumentUrl(url: string, options?: ExtractDataFromDocumentOptions): Promise<ExtractDataFromDocumentResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a PDF document from the provided request parameters.
|
|
27
|
+
* @param request - The request containing details for PDF creation, such as content or url.
|
|
28
|
+
* @return A promise that resolves with the response containing the URL of the created PDF. The url will expire after
|
|
29
|
+
* 1 hour.
|
|
30
|
+
*/
|
|
31
|
+
createPdf(request: CreatePdfRequest): Promise<CreatePdfResponse>;
|
|
25
32
|
}
|
|
@@ -71,7 +71,7 @@ export interface HasGrouped {
|
|
|
71
71
|
/**
|
|
72
72
|
* A query builder that can participate in a join.
|
|
73
73
|
* To learn more about join queries, see the
|
|
74
|
-
* {@link https://docs.getsquid.ai/docs/client-sdk/database/queries#joining-data-across-collections-and-
|
|
74
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/queries#joining-data-across-collections-and-connectors
|
|
75
75
|
* documentation}.
|
|
76
76
|
* @category Database
|
|
77
77
|
*/
|
|
@@ -89,7 +89,6 @@ export interface SquidAuthProvider {
|
|
|
89
89
|
export declare class Squid {
|
|
90
90
|
readonly options: SquidOptions;
|
|
91
91
|
private readonly socketManager;
|
|
92
|
-
private readonly rpcManager;
|
|
93
92
|
private readonly dataManager;
|
|
94
93
|
private readonly documentReferenceFactory;
|
|
95
94
|
private readonly documentStore;
|
|
@@ -153,7 +152,7 @@ export declare class Squid {
|
|
|
153
152
|
* If the integrationId is not provided, the `built_in_db` integration id will be used.
|
|
154
153
|
*
|
|
155
154
|
* For more information on the CollectionReference object, please refer to the
|
|
156
|
-
* {@link https://docs.getsquid.ai/docs/client-sdk/database/collection-reference documentation}.
|
|
155
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/collection-reference documentation}.
|
|
157
156
|
*
|
|
158
157
|
* @param collectionName The name of the collection.
|
|
159
158
|
* @param integrationId The id of the integration, default to `built_in_db`.
|
|
@@ -166,7 +165,7 @@ export declare class Squid {
|
|
|
166
165
|
* will be atomic. Note that mutations for different integrations will not be atomic.
|
|
167
166
|
*
|
|
168
167
|
* For more information about transactions in Squid, please refer to the
|
|
169
|
-
* {@link https://docs.getsquid.ai/docs/client-sdk/database/transactions documentation}.
|
|
168
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/transactions documentation}.
|
|
170
169
|
*
|
|
171
170
|
* @param fn The callback to run as an atomic change. The function receives a transactionId that should be used for
|
|
172
171
|
* all the mutations that should be atomic. The function should return a promise.
|
|
@@ -179,7 +178,7 @@ export declare class Squid {
|
|
|
179
178
|
* the result.
|
|
180
179
|
*
|
|
181
180
|
* For detailed information on backend functions in Squid, see the
|
|
182
|
-
* {@link https://docs.getsquid.ai/docs/backend/executables
|
|
181
|
+
* {@link https://docs.getsquid.ai/docs/sdk/backend-sdk/executables documentation}.
|
|
183
182
|
*
|
|
184
183
|
* Files support:
|
|
185
184
|
* - To send a file to the backend, simply include it as one of the parameters; it will be received as a `SquidFile`
|
|
@@ -195,7 +194,7 @@ export declare class Squid {
|
|
|
195
194
|
executeFunction<T = any>(functionNameOrOptions: string | ExecuteFunctionOptions<T>, ...params: Array<any | File>): Promise<T>;
|
|
196
195
|
/**
|
|
197
196
|
* Executes a native relational query with the given parameters and returns a promise with the result.
|
|
198
|
-
* See https://docs.getsquid.ai/docs/client-sdk/database/native-queries.
|
|
197
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries.
|
|
199
198
|
*
|
|
200
199
|
* @param integrationId The id of the integration that the query is associated with.
|
|
201
200
|
* @param query The raw SQL or other database-specific query to execute.
|
|
@@ -205,7 +204,7 @@ export declare class Squid {
|
|
|
205
204
|
executeNativeRelationalQuery<T = any>(integrationId: IntegrationId, query: string, params?: Record<string, any>): Promise<Array<T>>;
|
|
206
205
|
/**
|
|
207
206
|
* Executes a native Mongo/built-in-db query with the given pipeline and returns a promise with the result.
|
|
208
|
-
* See https://docs.getsquid.ai/docs/client-sdk/database/native-queries#native-mongodb-queries.
|
|
207
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries#native-mongodb-queries.
|
|
209
208
|
*
|
|
210
209
|
* @param integrationId The id of the integration that the query is associated with.
|
|
211
210
|
* @param collectionName The collection to query.
|
|
@@ -215,7 +214,7 @@ export declare class Squid {
|
|
|
215
214
|
executeNativeMongoQuery<T = any>(integrationId: IntegrationId, collectionName: string, aggregationPipeline: Array<any | undefined>): Promise<Array<T>>;
|
|
216
215
|
/**
|
|
217
216
|
* Executes a native Elasticsearch query against the given index and endpoint.
|
|
218
|
-
* See https://docs.getsquid.ai/docs/client-sdk/database/native-queries
|
|
217
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries.
|
|
219
218
|
*
|
|
220
219
|
* @param integrationId The id of the integration that the query is associated with.
|
|
221
220
|
* @param index The Elasticsearch index to query.
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Names of the Squid metrics.
|
|
3
|
-
* Should be in sync with MetricName.kt.
|
|
4
|
-
* See MetricName.kt for documentation on each value.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_aiIntegrationApi_count", "squid_aiIntegrationApi_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_aiContextUpsert_count", "squid_aiContextDelete_count", "squid_built_in_db_size", "squid_codeInitialization_count", "squid_codeInitialization_time", "squid_deleteApiKey_count", "squid_deleteApiKey_time", "squid_deleteSecret_count", "squid_deleteSecret_time", "squid_discoverGraphQLConnectionSchema_count", "squid_discoverGraphQLConnectionSchema_time", "squid_discoverOpenApiSchema_count", "squid_discoverOpenApiSchema_time", "squid_discoverOpenApiSchemaFromFile_count", "squid_discoverOpenApiSchemaFromFile_time", "squid_executeBackendFunction_count", "squid_executeBackendFunction_time", "squid_getAiChatbotProfiles_count", "squid_getAiChatbotProfiles_time", "squid_getAllApiKeys_count", "squid_getAllApiKeys_time", "squid_getAllSecrets_count", "squid_getAllSecrets_time", "squid_getAppApiKey_count", "squid_getAppApiKey_time", "squid_getSecret_count", "squid_getSecret_time", "squid_graphql_count", "squid_graphql_time", "squid_graphqlQuery_count", "squid_graphqlQuery_time", "squid_integrationCount_value", "squid_acquireLock_count", "squid_releaseLock_count", "squid_mutate_count", "squid_mutate_time", "squid_metricQuery_count", "squid_metricQuery_time", "squid_metricReport_count", "squid_metricReport_time", "squid_nativeQuery_count", "squid_nativeQuery_time", "squid_openapi_count", "squid_openapi_time", "squid_produceTopicMessage_count", "squid_produceTopicMessage_time", "squid_query_count", "squid_query_time", "squid_registerQuery_count", "squid_registerQuery_time", "squid_rerankChunks_count", "squid_rerankChunks_time", "squid_schedulerJob_count", "squid_schedulerJob_time", "squid_schema_size", "squid_secrets_entries", "squid_storageDeleteFiles_count", "squid_storageDeleteFiles_time", "squid_storageGetDownloadUrl_count", "squid_storageGetDownloadUrl_time", "squid_storageGetFileMetadata_count", "squid_storageGetFileMetadata_time", "squid_storageListDirectoryContents_count", "squid_storageListDirectoryContents_time", "squid_storageUploadFile_count", "squid_storageUploadFile_time", "squid_subscribeToTopic_count", "squid_subscribeToTopic_time", "squid_testGraphQLConnection_count", "squid_testGraphQLConnection_time", "squid_trigger_count", "squid_trigger_time", "squid_upsertApiKey_count", "squid_upsertApiKey_time", "squid_upsertSecret_count", "squid_upsertSecret_time", "squid_vectorChunks_count", "squid_vectorChunks_time", "squid_webhook_count", "squid_webhook_time"];
|
|
7
|
-
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
8
|
-
/** Common prefix for all Squid metrics. */
|
|
9
|
-
export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
|
|
2
|
-
import { IntegrationId } from '../public-types/communication.public-types';
|
|
3
|
-
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
4
|
-
/** The headers of an API call. */
|
|
5
|
-
export type ApiHeaders = Record<string, string | number | boolean>;
|
|
6
|
-
/** The context of an API call. */
|
|
7
|
-
export declare class ApiCallContext {
|
|
8
|
-
readonly integrationId: IntegrationId;
|
|
9
|
-
readonly endpointId: ApiEndpointId;
|
|
10
|
-
readonly url: string;
|
|
11
|
-
readonly method: HttpMethod;
|
|
12
|
-
readonly body: unknown;
|
|
13
|
-
readonly options: ApiOptions;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Represents a request to call an API through a specified integration and endpoint.
|
|
17
|
-
* Includes optional method override and additional request options.
|
|
18
|
-
*/
|
|
19
|
-
export interface CallApiRequest<BodyType = any> {
|
|
20
|
-
/** The identifier of the integration through which the API is called. */
|
|
21
|
-
integrationId: IntegrationId;
|
|
22
|
-
/** Target API endpoint to invoke. */
|
|
23
|
-
endpointId: ApiEndpointId;
|
|
24
|
-
/** Optional request payload. */
|
|
25
|
-
body?: BodyType;
|
|
26
|
-
/** Optional HTTP method override. Default is POST. */
|
|
27
|
-
overrideMethod?: HttpMethod;
|
|
28
|
-
/** Additional request options. */
|
|
29
|
-
options: ApiOptions;
|
|
30
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { Paths } from '../public-types/typescript.public-types';
|
|
2
|
-
import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
|
|
3
|
-
/**
|
|
4
|
-
* The mutation type.
|
|
5
|
-
* @category Database
|
|
6
|
-
*/
|
|
7
|
-
export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
|
|
8
|
-
/**
|
|
9
|
-
* @category Database
|
|
10
|
-
*/
|
|
11
|
-
export type MutationType = (typeof MUTATION_TYPES)[number];
|
|
12
|
-
interface BaseMutation {
|
|
13
|
-
type: MutationType;
|
|
14
|
-
squidDocIdObj: SquidDocIdObj;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* A mutation on a document.
|
|
18
|
-
* @category Database
|
|
19
|
-
*/
|
|
20
|
-
export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
|
|
21
|
-
/**
|
|
22
|
-
* Represents a delete mutation on a document.
|
|
23
|
-
* @category Database
|
|
24
|
-
*/
|
|
25
|
-
export interface DeleteMutation extends BaseMutation {
|
|
26
|
-
/** Specifies that the mutation is a deletion. */
|
|
27
|
-
type: 'delete';
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Represents an update mutation on a document.
|
|
31
|
-
* @category Database
|
|
32
|
-
*/
|
|
33
|
-
export interface UpdateMutation<T = any> extends BaseMutation {
|
|
34
|
-
/** Specifies that the mutation is an update. */
|
|
35
|
-
type: 'update';
|
|
36
|
-
/** The updated properties */
|
|
37
|
-
properties: {
|
|
38
|
-
[key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Represents an insert mutation on a document.
|
|
43
|
-
* @category Database
|
|
44
|
-
*/
|
|
45
|
-
export interface InsertMutation<T = any> extends BaseMutation {
|
|
46
|
-
/** Specifies that the mutation is an insertion. */
|
|
47
|
-
type: 'insert';
|
|
48
|
-
/** The inserted document */
|
|
49
|
-
properties: T;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* A representation of a single property update.
|
|
53
|
-
* @category Database
|
|
54
|
-
*/
|
|
55
|
-
export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
|
|
56
|
-
/**
|
|
57
|
-
* A value update property mutation.
|
|
58
|
-
* @category Database
|
|
59
|
-
*/
|
|
60
|
-
export interface ValueUpdatePropertyMutation<Value = any> {
|
|
61
|
-
/** Specifies that the mutation updates a value. */
|
|
62
|
-
type: 'update';
|
|
63
|
-
/** New value to be set. */
|
|
64
|
-
value: Value;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Applying a numeric function to a property.
|
|
68
|
-
* @category Database
|
|
69
|
-
*/
|
|
70
|
-
export interface ApplyNumericFnPropertyMutation {
|
|
71
|
-
/** Specifies that the mutation applies a numeric function. */
|
|
72
|
-
type: 'applyNumericFn';
|
|
73
|
-
/** Numeric function to apply. */
|
|
74
|
-
fn: 'increment';
|
|
75
|
-
/** Value to use in the numeric function. */
|
|
76
|
-
value: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A property update that removes a property from a document.
|
|
80
|
-
* @category Database
|
|
81
|
-
*/
|
|
82
|
-
export interface RemovePropertyMutation {
|
|
83
|
-
/** Specifies that the mutation removes a property. */
|
|
84
|
-
type: 'removeProperty';
|
|
85
|
-
}
|
|
86
|
-
interface ApplyExtendString {
|
|
87
|
-
/** Specifies that the mutation applies a string function. */
|
|
88
|
-
type: 'applyStringFn';
|
|
89
|
-
/** String function to extend the existing string. */
|
|
90
|
-
fn: 'extendString';
|
|
91
|
-
/** String value to append. */
|
|
92
|
-
value: string;
|
|
93
|
-
}
|
|
94
|
-
interface ApplyTrimString {
|
|
95
|
-
/** Specifies that the mutation applies a string function. */
|
|
96
|
-
type: 'applyStringFn';
|
|
97
|
-
/** String function to trim the existing string. */
|
|
98
|
-
fn: 'trim';
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* A property mutation that modifies a string.
|
|
102
|
-
* @category Database
|
|
103
|
-
*/
|
|
104
|
-
export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
|
|
105
|
-
/**
|
|
106
|
-
* The before and after documents of a document change.
|
|
107
|
-
* @category Database
|
|
108
|
-
*/
|
|
109
|
-
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
110
|
-
/** Document state before the mutation. */
|
|
111
|
-
before: T | undefined;
|
|
112
|
-
/** Document state after the mutation. */
|
|
113
|
-
after: T | undefined;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* The mutation context that will be provided to the security function.
|
|
117
|
-
* @category Database
|
|
118
|
-
*/
|
|
119
|
-
export declare class MutationContext<T = any> {
|
|
120
|
-
readonly mutation: Mutation<T>;
|
|
121
|
-
readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
|
|
122
|
-
readonly serverTimeStamp: Date;
|
|
123
|
-
/**
|
|
124
|
-
* Returns the type of the mutation (insert, update, or delete).
|
|
125
|
-
*/
|
|
126
|
-
getMutationType(): MutationType;
|
|
127
|
-
/**
|
|
128
|
-
* Returns the state of the document before the mutation was applied.
|
|
129
|
-
*/
|
|
130
|
-
get before(): T | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Returns the state of the document after the mutation was applied.
|
|
133
|
-
*/
|
|
134
|
-
get after(): T | undefined;
|
|
135
|
-
/** Returns true if the mutation affects the provided path. */
|
|
136
|
-
affectsPath(path: Paths<T>): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Find all affected paths starting from a root path.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* doc before - { a: { b: 1, c: 2 }, d: 3 }
|
|
142
|
-
* doc after - { a: { b: 1, c: 3 }, d: 4 }
|
|
143
|
-
* doc.affectedPaths('a') // ['a.c']
|
|
144
|
-
*/
|
|
145
|
-
affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
|
|
146
|
-
private checkPath;
|
|
147
|
-
}
|
|
148
|
-
export {};
|