@squidcloud/client 1.0.473 → 1.0.475
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/metric-name.d.ts +14 -0
- package/dist/internal-common/src/public-types/ai-agent-integrations.public-types.d.ts +17 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +35 -1
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +3 -3
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +66 -11
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +148 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +72 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +190 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +242 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +202 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +59 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +17 -0
- package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +5 -0
- package/dist/internal-common/src/types/observability.types.d.ts +162 -0
- package/dist/internal-common/src/types/query.types.d.ts +15 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/internal-common/src/types/time-units.d.ts +1 -0
- package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http.d.ts +11 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +86 -0
- package/dist/internal-common/src/utils/serialization.d.ts +18 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +6 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +19 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/ai-client.d.ts +4 -1
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +9 -1
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names of the Squid metrics.
|
|
3
|
+
*
|
|
4
|
+
* This list and its Kotlin counterpart (MetricName.kt) may diverge:
|
|
5
|
+
* each side declares only the metrics that its own backend emits.
|
|
6
|
+
* However, metrics emitted by both backends MUST use identical names on both sides —
|
|
7
|
+
* otherwise dashboards and metric queries that mix data from both sources will break.
|
|
8
|
+
*
|
|
9
|
+
* See MetricName.kt for documentation on each value.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatReasoningTokens_count", "squid_aiChatbotChatCacheReadInputTokens_count", "squid_aiChatbotChatCacheWriteInputTokens_count", "squid_aiChatbotChatCostUsd_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_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_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_eventHandler_count", "squid_eventHandler_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_testAgentProtocolConnection_count", "squid_testAgentProtocolConnection_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", "squid_acquireLock_count", "squid_acquireLock_time", "squid_releaseLock_count", "squid_releaseLock_time"];
|
|
12
|
+
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
13
|
+
/** Common prefix for all Squid metrics. */
|
|
14
|
+
export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
|
|
@@ -24,6 +24,23 @@ export interface AiAgentApiIntegrationOptions {
|
|
|
24
24
|
verboseStatusUpdates?: boolean;
|
|
25
25
|
/** If provided, this agent will be used to generate API calls. */
|
|
26
26
|
generateApiCallAgentId?: AiAgentId;
|
|
27
|
+
/** Full AI API options for advanced configuration of the API call execution. */
|
|
28
|
+
aiApiOptions?: AiApiOptions;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Options for configuring AI API call execution.
|
|
32
|
+
* @category AI
|
|
33
|
+
*/
|
|
34
|
+
export interface AiApiOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Custom instructions appended to the endpoint-selection, body-construction, and response-analysis prompts.
|
|
37
|
+
*/
|
|
38
|
+
instructions?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum number of distinct API calls the AI is allowed to make for one
|
|
41
|
+
* user prompt. Default 4.
|
|
42
|
+
*/
|
|
43
|
+
maxIterations?: number;
|
|
27
44
|
}
|
|
28
45
|
/**
|
|
29
46
|
* Configuration options for AI agent MCP integration.
|
|
@@ -304,6 +304,11 @@ export interface AiConnectedKnowledgeBaseMetadata {
|
|
|
304
304
|
description: string;
|
|
305
305
|
/** Whether to include document metadata when providing KB search results to the agent. Defaults to false. */
|
|
306
306
|
includeMetadata?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* When true, the chat agent gets a tool to enumerate/search this KB's metadata field values on
|
|
309
|
+
* demand. Off by default. (Chat surface only for now; MCP/CLI is not wired.)
|
|
310
|
+
*/
|
|
311
|
+
enableMetadataInspection?: boolean;
|
|
307
312
|
}
|
|
308
313
|
/**
|
|
309
314
|
* Quotas for a single AI chat prompt (`ask()` method call).
|
|
@@ -417,6 +422,16 @@ export interface BaseAiChatOptions {
|
|
|
417
422
|
maxOutputTokens?: number;
|
|
418
423
|
/** The context ID to use for the request. If not provided, the agent's default context will be used. */
|
|
419
424
|
memoryOptions?: AiAgentMemoryOptions;
|
|
425
|
+
/**
|
|
426
|
+
* Names a shared working directory for CLI-backed agents (`claude-code`, `codex`). When set, the agent
|
|
427
|
+
* runs in `/data/workspaces/<sharedWorkspaceId>` on the app's shared storage, so files created in
|
|
428
|
+
* one ask persist and are visible to later asks reusing the same id — including across providers.
|
|
429
|
+
*
|
|
430
|
+
* Pass the same id consistently for a conversation; changing it points the agent at a different
|
|
431
|
+
* directory (and, for Claude Code, starts a fresh transcript). Must match `[A-Za-z0-9_-]` (1-200 chars).
|
|
432
|
+
* Ignored by non-CLI agents and when shared storage is unavailable (falls back to an ephemeral dir).
|
|
433
|
+
*/
|
|
434
|
+
sharedWorkspaceId?: string;
|
|
420
435
|
/** Whether to disable the whole context for the request. Default to false. */
|
|
421
436
|
disableContext?: boolean;
|
|
422
437
|
/**
|
|
@@ -604,7 +619,7 @@ export type AiVerbosityLevel = 'low' | 'medium' | 'high';
|
|
|
604
619
|
* **Example:**
|
|
605
620
|
* ```typescript
|
|
606
621
|
* {
|
|
607
|
-
* model: 'claude-sonnet-
|
|
622
|
+
* model: 'claude-sonnet-5',
|
|
608
623
|
* responseFormat: {
|
|
609
624
|
* type: 'json_schema',
|
|
610
625
|
* schema: {
|
|
@@ -680,6 +695,25 @@ export declare const AGENT_STATUS_TITLE_AGENT_RESPONSE = "Agent Response";
|
|
|
680
695
|
* @category AI
|
|
681
696
|
*/
|
|
682
697
|
export declare const AGENT_STATUS_TITLE_ACCESSING_KB = "Accessing Knowledge Base";
|
|
698
|
+
/**
|
|
699
|
+
* Status update title broadcast when the agent invokes an AI function callable
|
|
700
|
+
* (a backend `@aiFunction`). Lets a caller detect that a function was actually
|
|
701
|
+
* called, independent of how the model renders the result in its final answer.
|
|
702
|
+
* @category AI
|
|
703
|
+
*/
|
|
704
|
+
export declare const AGENT_STATUS_TITLE_CALLING_AI_FUNCTION = "Calling AI Function";
|
|
705
|
+
/**
|
|
706
|
+
* Status update title broadcast when the agent invokes a knowledge-base metadata-inspection callable
|
|
707
|
+
* (the opt-in `enableMetadataInspection` tool). Distinct from {@link AGENT_STATUS_TITLE_ACCESSING_KB}
|
|
708
|
+
* so a caller can tell a metadata-value inspection apart from an ordinary KB search.
|
|
709
|
+
* @category AI
|
|
710
|
+
*/
|
|
711
|
+
export declare const AGENT_STATUS_TITLE_INSPECTING_KB_METADATA = "Inspecting Knowledge Base Metadata";
|
|
712
|
+
/**
|
|
713
|
+
* Status update title broadcast when the agent queries a spreadsheet file callable.
|
|
714
|
+
* @category AI
|
|
715
|
+
*/
|
|
716
|
+
export declare const AGENT_STATUS_TITLE_QUERYING_SPREADSHEET = "Querying Spreadsheet";
|
|
683
717
|
/**
|
|
684
718
|
* A status message from an AI agent operation.
|
|
685
719
|
* @category AI
|
|
@@ -34,17 +34,17 @@ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemin
|
|
|
34
34
|
* Public Grok chat model names (active models only).
|
|
35
35
|
* @category AI
|
|
36
36
|
*/
|
|
37
|
-
export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
37
|
+
export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
38
38
|
/**
|
|
39
39
|
* Public Anthropic chat model names (active models only).
|
|
40
40
|
* @category AI
|
|
41
41
|
*/
|
|
42
|
-
export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-
|
|
42
|
+
export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-5"];
|
|
43
43
|
/**
|
|
44
44
|
* The supported AI model names.
|
|
45
45
|
* @category AI
|
|
46
46
|
*/
|
|
47
|
-
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-
|
|
47
|
+
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.5-flash", "gemini-3.1-flash-lite", "grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
48
48
|
/** Checks if the given model name is a global AI chat model name. */
|
|
49
49
|
export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
|
|
50
50
|
/**
|
|
@@ -31,6 +31,12 @@ export interface AiKnowledgeBase {
|
|
|
31
31
|
embeddingModel: AiEmbeddingsModelSelection;
|
|
32
32
|
/** The model name that should be used when asking questions of this knowledge base. */
|
|
33
33
|
chatModel: AiChatModelSelection;
|
|
34
|
+
/**
|
|
35
|
+
* The vector store backend this knowledge base reads/writes from. Set at creation (defaulting to
|
|
36
|
+
* the server's `SQUID_DEFAULT_VECTOR_DB_TYPE`, otherwise `'postgres'`) and immutable thereafter.
|
|
37
|
+
* Optional on the read type for backwards compatibility with older records.
|
|
38
|
+
*/
|
|
39
|
+
vectorDbType?: VectorDbType;
|
|
34
40
|
/** The timestamp the knowledge base was last updated */
|
|
35
41
|
updatedAt: Date;
|
|
36
42
|
}
|
|
@@ -54,6 +60,12 @@ export interface AiKnowledgeBaseMetadataField {
|
|
|
54
60
|
* Also, it will be used for auto filtering when a prompt is sent to an AI agent.
|
|
55
61
|
*/
|
|
56
62
|
description?: string;
|
|
63
|
+
/**
|
|
64
|
+
* True when {@link description} was AI-generated (via `generateMetadataFieldDescriptions`). Undefined or
|
|
65
|
+
* false means the description was authored by a human or has not been generated yet; it clears back to
|
|
66
|
+
* false once a human edits the description.
|
|
67
|
+
*/
|
|
68
|
+
descriptionGeneratedByAi?: boolean;
|
|
57
69
|
}
|
|
58
70
|
/**
|
|
59
71
|
* A record of metadata key-value pairs for AI context, where values are primitive types or undefined.
|
|
@@ -93,6 +105,17 @@ export type AiContextMetadataAndFilter = MetadataAndFilter;
|
|
|
93
105
|
* @deprecated Use {@link MetadataOrFilter} from `metadata-filter.public-types` instead.
|
|
94
106
|
*/
|
|
95
107
|
export type AiContextMetadataOrFilter = MetadataOrFilter;
|
|
108
|
+
/**
|
|
109
|
+
* Retrieval mode for a knowledge-base search.
|
|
110
|
+
* - `'vector'`: dense-only similarity.
|
|
111
|
+
* - `'hybrid'`: native fusion of dense + lexical (only distinct on backends with native fusion, e.g.
|
|
112
|
+
* Mongo Atlas; on pgvector it degrades to dense + a legacy app-side keyword fallback).
|
|
113
|
+
* - `'keyword'`: embedding-free lexical retrieval; the mechanism is backend-specific — native Lucene BM25
|
|
114
|
+
* on Mongo Atlas (ranked, term-optional: a partial-term query still matches), and a boolean substring
|
|
115
|
+
* filter on pgvector (every term must appear literally; unranked).
|
|
116
|
+
* @category AI
|
|
117
|
+
*/
|
|
118
|
+
export type AiKnowledgeBaseSearchMode = 'vector' | 'hybrid' | 'keyword';
|
|
96
119
|
/**
|
|
97
120
|
* The options for the AI knowledgebase search method.
|
|
98
121
|
* @category AI
|
|
@@ -118,10 +141,19 @@ export interface AiKnowledgeBaseChatOptions {
|
|
|
118
141
|
* (Mongo Atlas uses `$rankFusion`; backends without native fusion fall back to dense-only with
|
|
119
142
|
* the legacy app-side keyword fallback).
|
|
120
143
|
* - `'vector'`: dense-only — skips native fusion even on backends that support it.
|
|
144
|
+
* - `'keyword'`: embedding-free lexical retrieval; the mechanism is backend-specific. On Mongo Atlas it
|
|
145
|
+
* is native Lucene BM25 (`$search`): results are ranked by relevance and term-optional — a partial-term
|
|
146
|
+
* query still returns its best matches. On Postgres it is a boolean substring filter (`ILIKE ALL`):
|
|
147
|
+
* every whitespace-separated term must appear in a chunk as a literal, case-insensitive substring,
|
|
148
|
+
* matched independently (order, adjacency and relevance are NOT considered), so results are unranked and
|
|
149
|
+
* for broad terms the returned top-k is arbitrary. Both skip embedding, dense, reranking and the
|
|
150
|
+
* app-side keyword fallback. Lets an agent (or an eval) target exact tokens — identifiers, names, codes
|
|
151
|
+
* — that dense retrieval tends to miss.
|
|
121
152
|
*
|
|
122
|
-
* Intended to let A/B evaluations compare dense-only
|
|
153
|
+
* Intended to let A/B evaluations compare dense-only, hybrid and boolean-keyword candidate generation
|
|
154
|
+
* on the same backend.
|
|
123
155
|
*/
|
|
124
|
-
searchMode?:
|
|
156
|
+
searchMode?: AiKnowledgeBaseSearchMode;
|
|
125
157
|
/**
|
|
126
158
|
* Per-pipeline weights for native hybrid fusion (Mongo `$rankFusion.combination.weights`). Only
|
|
127
159
|
* applies when `searchMode` is `'hybrid'` on a backend with native fusion; ignored otherwise.
|
|
@@ -321,10 +353,19 @@ export interface AiKnowledgeBaseSearchOptions {
|
|
|
321
353
|
* (Mongo Atlas uses `$rankFusion`; backends without native fusion fall back to dense-only with
|
|
322
354
|
* the legacy app-side keyword fallback).
|
|
323
355
|
* - `'vector'`: dense-only — skips native fusion even on backends that support it.
|
|
356
|
+
* - `'keyword'`: embedding-free lexical retrieval; the mechanism is backend-specific. On Mongo Atlas it
|
|
357
|
+
* is native Lucene BM25 (`$search`): results are ranked by relevance and term-optional — a partial-term
|
|
358
|
+
* query still returns its best matches. On Postgres it is a boolean substring filter (`ILIKE ALL`):
|
|
359
|
+
* every whitespace-separated term must appear in a chunk as a literal, case-insensitive substring,
|
|
360
|
+
* matched independently (order, adjacency and relevance are NOT considered), so results are unranked and
|
|
361
|
+
* for broad terms the returned top-k is arbitrary. Both skip embedding, dense, reranking and the
|
|
362
|
+
* app-side keyword fallback. Lets an agent (or an eval) target exact tokens — identifiers, names, codes
|
|
363
|
+
* — that dense retrieval tends to miss.
|
|
324
364
|
*
|
|
325
|
-
* Intended to let A/B evaluations compare dense-only
|
|
365
|
+
* Intended to let A/B evaluations compare dense-only, hybrid and boolean-keyword candidate generation
|
|
366
|
+
* on the same backend.
|
|
326
367
|
*/
|
|
327
|
-
searchMode?:
|
|
368
|
+
searchMode?: AiKnowledgeBaseSearchMode;
|
|
328
369
|
/**
|
|
329
370
|
* Per-pipeline weights for native hybrid fusion (Mongo `$rankFusion.combination.weights`). Only
|
|
330
371
|
* applies when `searchMode` is `'hybrid'` on a backend with native fusion; ignored otherwise.
|
|
@@ -455,13 +496,6 @@ export type AiEmbeddingsModelWithOptionalFields = Omit<AiKnowledgeBase, 'chatMod
|
|
|
455
496
|
chatModel?: AiKnowledgeBase['chatModel'];
|
|
456
497
|
name?: string;
|
|
457
498
|
embeddingModel?: AiEmbeddingsModelSelection;
|
|
458
|
-
/**
|
|
459
|
-
* The vector store backend for this knowledge base. Optional: when omitted, newly-created KBs use
|
|
460
|
-
* the server's default backend (`SQUID_DEFAULT_VECTOR_DB_TYPE`, otherwise `'postgres'`). The backend
|
|
461
|
-
* cannot be changed once the KB exists, so on re-upsert this must either be omitted or match the
|
|
462
|
-
* existing value.
|
|
463
|
-
*/
|
|
464
|
-
vectorDbType?: VectorDbType;
|
|
465
499
|
};
|
|
466
500
|
/**
|
|
467
501
|
* API request for deleting an AiKnowledgeBase
|
|
@@ -513,4 +547,25 @@ export interface ListAiKnowledgeBasesResponse {
|
|
|
513
547
|
/** All AI knowledge bases defined for the application. */
|
|
514
548
|
knowledgeBases: Array<AiKnowledgeBase>;
|
|
515
549
|
}
|
|
550
|
+
/** Request to AI-generate descriptions for a KB's metadata fields and return them (the caller persists). */
|
|
551
|
+
export interface GenerateMetadataFieldDescriptionsRequest {
|
|
552
|
+
/** The id of the AiKnowledgeBase. */
|
|
553
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
554
|
+
/** Limit generation to these fields; omitted ⇒ all declared fields. */
|
|
555
|
+
fieldNames?: string[];
|
|
556
|
+
/** When true, regenerate fields that already have a description; default false (fill empties only). */
|
|
557
|
+
overwriteExisting?: boolean;
|
|
558
|
+
}
|
|
559
|
+
/** Response for the AI-generated metadata field descriptions. */
|
|
560
|
+
export interface GenerateMetadataFieldDescriptionsResponse {
|
|
561
|
+
/** The (re)generated fields with their new descriptions; not persisted — the caller saves them. */
|
|
562
|
+
fields: Array<GeneratedMetadataFieldDescription>;
|
|
563
|
+
}
|
|
564
|
+
/** A generated description for a single metadata field. */
|
|
565
|
+
export interface GeneratedMetadataFieldDescription {
|
|
566
|
+
/** The name of the metadata field. */
|
|
567
|
+
name: string;
|
|
568
|
+
/** The AI-generated description for the field. */
|
|
569
|
+
description: string;
|
|
570
|
+
}
|
|
516
571
|
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
2
|
+
import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
|
|
3
|
+
import { IntegrationId } from '../public-types/communication.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
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
|
|
2
|
+
import { Paths } from '../public-types/typescript.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 state of the document before the mutation was applied.
|
|
125
|
+
*/
|
|
126
|
+
get before(): T | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Returns the state of the document after the mutation was applied.
|
|
129
|
+
*/
|
|
130
|
+
get after(): T | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the type of the mutation (insert, update, or delete).
|
|
133
|
+
*/
|
|
134
|
+
getMutationType(): MutationType;
|
|
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 {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the type of native query request, either relational, elastic or MongoDB.
|
|
4
|
+
* @category Database
|
|
5
|
+
*/
|
|
6
|
+
export type NativeQueryRequestType = 'relational' | 'mongo' | 'elasticsearch' | 'pure';
|
|
7
|
+
interface BaseNativeQueryContext {
|
|
8
|
+
/** Type of the native query request. */
|
|
9
|
+
type: NativeQueryRequestType;
|
|
10
|
+
/** Identifier for the integration. */
|
|
11
|
+
integrationId: IntegrationId;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Context for executing a relational database query.
|
|
15
|
+
* @category Database
|
|
16
|
+
*/
|
|
17
|
+
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
18
|
+
/** Specifies that the query is for a relational database. */
|
|
19
|
+
type: 'relational';
|
|
20
|
+
/** SQL query string to be executed. */
|
|
21
|
+
query: string;
|
|
22
|
+
/** Parameters to be used in the query. */
|
|
23
|
+
params: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Context for executing a MongoDB query.
|
|
27
|
+
* @category Database
|
|
28
|
+
*/
|
|
29
|
+
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
30
|
+
/** Specifies that the query is for a Mongo database. */
|
|
31
|
+
type: 'mongo';
|
|
32
|
+
/** Name of the MongoDB collection to query. */
|
|
33
|
+
collectionName: string;
|
|
34
|
+
/** Array of aggregation pipeline stages. */
|
|
35
|
+
aggregationPipeline: Array<any | undefined>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Context for executing an Elasticsearch query.
|
|
39
|
+
* @category Database
|
|
40
|
+
*/
|
|
41
|
+
export interface ElasticsearchNativeQueryContext {
|
|
42
|
+
/** Specifies that the query is for an Elasticsearch database. */
|
|
43
|
+
type: 'elasticsearch';
|
|
44
|
+
/** Elasticsearch index to query. */
|
|
45
|
+
index: string;
|
|
46
|
+
/** Elasticsearch query string. */
|
|
47
|
+
endpoint?: string;
|
|
48
|
+
/** HTTP method to use for the request. */
|
|
49
|
+
method?: 'GET' | 'POST';
|
|
50
|
+
/** Body of the request. */
|
|
51
|
+
body: Record<string, any>;
|
|
52
|
+
/** Headers to include in the request. */
|
|
53
|
+
integrationId: IntegrationId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Context for executing a pure database query.
|
|
57
|
+
* @category Database
|
|
58
|
+
*/
|
|
59
|
+
export interface PureNativeQueryContext extends BaseNativeQueryContext {
|
|
60
|
+
/** Specifies that the query is for a relational database. */
|
|
61
|
+
type: 'pure';
|
|
62
|
+
/** SQL query string to be executed. */
|
|
63
|
+
query: string;
|
|
64
|
+
/** Parameters to be used in the query. */
|
|
65
|
+
params: Record<string, any>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Union type representing either a relational or MongoDB native query context.
|
|
69
|
+
* @category Database
|
|
70
|
+
*/
|
|
71
|
+
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext;
|
|
72
|
+
export {};
|