@squidcloud/client 1.0.498 → 1.0.500
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/ai/system-openai-compatible.d.ts +35 -0
- package/dist/internal-common/src/metric-name.d.ts +5 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +42 -8
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +2 -2
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +106 -14
- package/dist/internal-common/src/public-types/langgraph.public-types.d.ts +7 -0
- 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 +161 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +304 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +639 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -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 +45 -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 +19 -0
- package/dist/internal-common/src/types/observability.types.d.ts +296 -0
- package/dist/internal-common/src/types/query.types.d.ts +21 -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-utils.d.ts +15 -0
- package/dist/internal-common/src/utils/http.d.ts +4 -0
- package/dist/internal-common/src/utils/integration-access-tokens.d.ts +15 -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 +93 -0
- package/dist/internal-common/src/utils/serialization.d.ts +30 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +3 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +21 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +3 -1
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +5 -3
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +9 -7
- package/dist/typescript-client/src/langgraph-client.d.ts +4 -4
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System-level OpenAI-compatible backends ("slots") for Squid's own internal AI calls.
|
|
3
|
+
*
|
|
4
|
+
* Generic plumbing for pointing an internal model at ANY OpenAI-compatible HTTP endpoint —
|
|
5
|
+
* primarily Squid's own self-hosted models, but any OpenAI-compatible backend works. The
|
|
6
|
+
* non-secret part of a slot (base URL, optional headers/extra body) is hardcoded here on purpose
|
|
7
|
+
* (changing a backend is a reviewed code change); only the API key lives in Vault under
|
|
8
|
+
* `SystemSecrets['openai-compatible'][slotName].apiKey`.
|
|
9
|
+
*
|
|
10
|
+
* NOT the customer-facing `openai_compatible` Integration (per-app, console-configured). Models
|
|
11
|
+
* served through these slots are declared in `AI_CHAT_MODEL_REGISTRY` with
|
|
12
|
+
* `providerType: 'openai-compatible'` + `openAiCompatibleSlot`, and resolve only with
|
|
13
|
+
* `keyType: 'system'` (see `AiProviderFactory.getChatProviderForModel`) — never customer-reachable.
|
|
14
|
+
*
|
|
15
|
+
* No slots are defined yet (foundation only). To wire one up:
|
|
16
|
+
* 1. add a slot below, e.g. `'my-model': { baseUrl: 'https://llm.internal.squid/v1' }`;
|
|
17
|
+
* 2. seed its key in `SystemSecrets['openai-compatible']['my-model'].apiKey`;
|
|
18
|
+
* 3. add a model entry in ai-model.registry.ts pointing `openAiCompatibleSlot: 'my-model'`.
|
|
19
|
+
*/
|
|
20
|
+
/** Non-secret configuration of one system OpenAI-compatible backend. */
|
|
21
|
+
export interface SystemOpenAiCompatibleSlotConfig {
|
|
22
|
+
/** Base URL of the OpenAI-compatible API, e.g. a self-hosted 'https://llm.internal.squid/v1'. */
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
/** Extra HTTP headers sent with every request. */
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
/** Extra JSON body fields merged into every request — reserved wire fields are dropped by the provider. */
|
|
27
|
+
extraBody?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/** Name of a system OpenAI-compatible slot (a key of `SYSTEM_OPENAI_COMPATIBLE_SLOTS`). */
|
|
30
|
+
export type SystemOpenAiCompatibleSlotName = string;
|
|
31
|
+
/**
|
|
32
|
+
* Registered system OpenAI-compatible slots, keyed by name. Empty by design — add a self-hosted
|
|
33
|
+
* (or any other) OpenAI-compatible backend here; see the module doc above.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SYSTEM_OPENAI_COMPATIBLE_SLOTS: Record<SystemOpenAiCompatibleSlotName, SystemOpenAiCompatibleSlotConfig>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Names of the Squid metrics; dashboards and metric queries key on these exact strings. */
|
|
2
|
+
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_aiSpendInputTokens_count", "squid_aiSpendOutputTokens_count", "squid_aiSpendReasoningTokens_count", "squid_aiSpendCacheReadTokens_count", "squid_aiSpendCacheWriteTokens_count", "squid_aiSpendPages_count", "squid_aiSpendImages_count", "squid_aiSpendAudioSeconds_count", "squid_aiSpendCharacters_count", "squid_aiSpendSearches_count", "squid_aiSpendCostUsd_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_aiVoiceCreateSession_count", "squid_aiVoiceCreateSession_time", "squid_aiVoiceAnswerOpenAiCall_count", "squid_aiVoiceAnswerOpenAiCall_time", "squid_aiVoiceStartOpenAiWebCall_count", "squid_aiVoiceStartOpenAiWebCall_time", "squid_aiOpenAiChatCompletions_count", "squid_aiOpenAiChatCompletions_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_sourceCodeAnalysis_count", "squid_sourceCodeAnalysis_time", "squid_sourceCodeWorkspaceBytes_value", "squid_sourceCodeInputTokens_count", "squid_sourceCodeOutputTokens_count", "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_apiControllerCall_count", "squid_apiControllerCall_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_queueMessageHandler_count", "squid_queueMessageHandler_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_tenantDependencyResolved_count", "squid_tenantBrowserSpawnAttempt_count", "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"];
|
|
3
|
+
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
4
|
+
/** Common prefix for all Squid metrics. */
|
|
5
|
+
export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
|
|
@@ -421,7 +421,7 @@ export interface IntegrationModelSpec {
|
|
|
421
421
|
*/
|
|
422
422
|
export type AiChatModelSelection = AiChatModelName | IntegrationModelSpec;
|
|
423
423
|
/**
|
|
424
|
-
* Lets a routing model pick which of several vendor models answers an `ask` request. The routing model
|
|
424
|
+
* Lets a routing model pick which of several vendor models answers an `ask` or `chat` request. The routing model
|
|
425
425
|
* sees the question, the agent's instructions and a card per candidate (price, tier, reasoning,
|
|
426
426
|
* context window) and names the one that should answer; that model then serves the request.
|
|
427
427
|
* @category AI
|
|
@@ -433,12 +433,27 @@ export interface AiModelRoutingOptions {
|
|
|
433
433
|
routingModel: VendorAiChatModelName;
|
|
434
434
|
}
|
|
435
435
|
/**
|
|
436
|
-
* The model of an `ask` request: a concrete model, or a set of models a routing model chooses from.
|
|
436
|
+
* The model of an `ask` or `chat` request: a concrete model, or a set of models a routing model chooses from.
|
|
437
437
|
* @category AI
|
|
438
438
|
*/
|
|
439
439
|
export type AiAskModelSelection = AiChatModelSelection | AiModelRoutingOptions;
|
|
440
440
|
/**
|
|
441
|
-
*
|
|
441
|
+
* What a `chat` job resolves to once its stream has ended; read it with `squid.jobs().awaitJob(jobId)`.
|
|
442
|
+
* @category AI
|
|
443
|
+
*/
|
|
444
|
+
export interface AiChatJobResult {
|
|
445
|
+
/** Set when `model` was an {@link AiModelRoutingOptions}: which model answered and what routing cost. */
|
|
446
|
+
routing?: AiModelRoutingResult;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Chat options as a request carries them: the model may also be a routing choice between several models.
|
|
450
|
+
* @category AI
|
|
451
|
+
*/
|
|
452
|
+
export type AiChatRequestOptions = Omit<AllAiAgentChatOptions, 'model'> & {
|
|
453
|
+
model?: AiAskModelSelection;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* How a request whose `model` was an {@link AiModelRoutingOptions} was routed.
|
|
442
457
|
* @category AI
|
|
443
458
|
*/
|
|
444
459
|
export interface AiModelRoutingResult {
|
|
@@ -473,11 +488,28 @@ export interface BackupModelOptions {
|
|
|
473
488
|
/** Response length and detail level; supported by OpenAI models only. */
|
|
474
489
|
verbosity?: AiVerbosityLevel;
|
|
475
490
|
}
|
|
476
|
-
/**
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
491
|
+
/** Configures independent answer validation and bounded correction. @category AI */
|
|
492
|
+
export interface AiAnswerValidationOptions {
|
|
493
|
+
/** Judge model; defaults to the model that produced the initial answer. */
|
|
494
|
+
model?: AiChatModelSelection;
|
|
495
|
+
/** Additional acceptance criteria for the judge. */
|
|
496
|
+
instructions?: string;
|
|
497
|
+
/** Maximum answer attempts, including the initial answer. Defaults to 2; accepts 1–5. */
|
|
498
|
+
maxAttempts?: number;
|
|
499
|
+
}
|
|
500
|
+
/** Reports the judge's verdict for the returned answer. @category AI */
|
|
501
|
+
export interface AiAnswerValidationResult {
|
|
502
|
+
/** Whether the returned answer passed validation; false also covers incomplete validation. */
|
|
503
|
+
passed: boolean;
|
|
504
|
+
/** Concise explanation of the verdict or validation failure. */
|
|
505
|
+
summary: string;
|
|
506
|
+
/** Actionable defects or reasons validation could not complete. */
|
|
507
|
+
issues: Array<string>;
|
|
508
|
+
}
|
|
509
|
+
/** Shared options for agent chat requests. @category AI */
|
|
480
510
|
export interface BaseAiChatOptions {
|
|
511
|
+
/** Enables validation for non-CLI models; an empty object uses defaults. Judge read-only behavior is instruction-based. */
|
|
512
|
+
validation?: AiAnswerValidationOptions;
|
|
481
513
|
/**
|
|
482
514
|
* The maximum number of input tokens that Squid can use when making the request to the AI model.
|
|
483
515
|
* Defaults to the max tokens the model can accept.
|
|
@@ -783,7 +815,7 @@ export type AiVerbosityLevel = 'low' | 'medium' | 'high';
|
|
|
783
815
|
* **Example:**
|
|
784
816
|
* ```typescript
|
|
785
817
|
* {
|
|
786
|
-
* model: 'claude-sonnet-5',
|
|
818
|
+
* model: 'claude-sonnet-5-5',
|
|
787
819
|
* responseFormat: {
|
|
788
820
|
* type: 'json_schema',
|
|
789
821
|
* schema: {
|
|
@@ -1430,6 +1462,8 @@ export interface DeleteAgentRequest {
|
|
|
1430
1462
|
* @category AI
|
|
1431
1463
|
*/
|
|
1432
1464
|
export interface AiAskResponse {
|
|
1465
|
+
/** Judge verdict, present when answer validation is enabled. */
|
|
1466
|
+
validation?: AiAnswerValidationResult;
|
|
1433
1467
|
/** The response string from the agent */
|
|
1434
1468
|
responseString: string;
|
|
1435
1469
|
/** Optional annotations (e.g., file references) in the response */
|
|
@@ -61,12 +61,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.6", "grok-4-1-fast
|
|
|
61
61
|
* Public Anthropic chat model names (active models only).
|
|
62
62
|
* @category AI
|
|
63
63
|
*/
|
|
64
|
-
export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5"];
|
|
64
|
+
export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5-5"];
|
|
65
65
|
/**
|
|
66
66
|
* The supported AI model names.
|
|
67
67
|
* @category AI
|
|
68
68
|
*/
|
|
69
|
-
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-luna", "gpt-6.1-sol", "claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.8-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
69
|
+
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-luna", "gpt-6.1-sol", "claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5-5", "gemini-3.1-pro", "gemini-3.8-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
70
70
|
/** Checks if the given model name is a global AI chat model name. */
|
|
71
71
|
export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
|
|
72
72
|
/**
|
|
@@ -1189,6 +1189,11 @@ export interface GeneratedMetadataFieldDescription {
|
|
|
1189
1189
|
export interface GetKnowledgeBaseGraphStatusRequest {
|
|
1190
1190
|
/** The id of the AiKnowledgeBase. */
|
|
1191
1191
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
1192
|
+
/**
|
|
1193
|
+
* Whether to include the topic table (`topics`, `topicEdges`). Default true. A poller that reads only the
|
|
1194
|
+
* build state can pass false: on a large graph the table runs to thousands of topics.
|
|
1195
|
+
*/
|
|
1196
|
+
includeTopics?: boolean;
|
|
1192
1197
|
}
|
|
1193
1198
|
/**
|
|
1194
1199
|
* Response structure for a knowledge base's GraphRAG build/readiness status. Drives the ai-eval
|
|
@@ -1552,17 +1557,20 @@ export interface RebuildKnowledgeBaseGraphRequest {
|
|
|
1552
1557
|
*/
|
|
1553
1558
|
ignoreActiveBulkJobs?: boolean;
|
|
1554
1559
|
}
|
|
1560
|
+
/** Hard ceiling on the nodes one graph explore returns: a larger `nodeLimit` is clamped down to this value. */
|
|
1561
|
+
export declare const KNOWLEDGE_BASE_GRAPH_EXPLORE_MAX_NODES = 1000;
|
|
1562
|
+
/** Longest `search` text a graph explore accepts; a longer one is rejected. */
|
|
1563
|
+
export declare const KNOWLEDGE_BASE_GRAPH_SEARCH_MAX_LENGTH = 200;
|
|
1555
1564
|
/**
|
|
1556
|
-
* Request structure for exploring a bounded subgraph of a knowledge base's graph (
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
* here once implemented.
|
|
1565
|
+
* Request structure for exploring a bounded subgraph of a knowledge base's graph (visualization). By default
|
|
1566
|
+
* it returns the highest-degree entities and the relationships among them; `topicId`, `entityId` and `search`
|
|
1567
|
+
* select other entity pools, and `contextMetadataFilter` narrows any of them.
|
|
1560
1568
|
* @category AI
|
|
1561
1569
|
*/
|
|
1562
1570
|
export interface ExploreKnowledgeBaseGraphRequest {
|
|
1563
1571
|
/** The id of the AiKnowledgeBase. */
|
|
1564
1572
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
1565
|
-
/** Hard cap on returned nodes. Default 200,
|
|
1573
|
+
/** Hard cap on returned nodes. Default 200, at most {@link KNOWLEDGE_BASE_GRAPH_EXPLORE_MAX_NODES}. */
|
|
1566
1574
|
nodeLimit?: number;
|
|
1567
1575
|
/**
|
|
1568
1576
|
* Restricts the subgraph to entities under the given topic node id — any hierarchy level; an entity
|
|
@@ -1570,6 +1578,30 @@ export interface ExploreKnowledgeBaseGraphRequest {
|
|
|
1570
1578
|
* `TOPIC_NOT_FOUND`. Ids come from {@link KnowledgeBaseGraphTopic.id} and churn on rebuild.
|
|
1571
1579
|
*/
|
|
1572
1580
|
topicId?: string;
|
|
1581
|
+
/**
|
|
1582
|
+
* Centers the subgraph on one entity: the entity plus its neighbors, strongest relationships first. Ids
|
|
1583
|
+
* come from {@link KnowledgeBaseGraphNode.id} and churn on rebuild; an unknown id fails with
|
|
1584
|
+
* `ENTITY_NOT_FOUND`. Cannot be combined with `topicId` or `search`.
|
|
1585
|
+
*/
|
|
1586
|
+
entityId?: string;
|
|
1587
|
+
/**
|
|
1588
|
+
* Finds entities by name: exact names and aliases first, then prefixes, then substrings, each by degree.
|
|
1589
|
+
* When no name matches, returns the entities nearest in meaning instead (`searchMatch: 'similar'`).
|
|
1590
|
+
* At most {@link KNOWLEDGE_BASE_GRAPH_SEARCH_MAX_LENGTH} characters. Cannot be combined with `topicId` or
|
|
1591
|
+
* `entityId`.
|
|
1592
|
+
*/
|
|
1593
|
+
search?: string;
|
|
1594
|
+
/**
|
|
1595
|
+
* Keeps only the entities mentioned by contexts matching the filter. Without `entityId` or `search`, they
|
|
1596
|
+
* are ranked by how many matching contexts mention them. Filters on context-record metadata only, not on
|
|
1597
|
+
* per-chunk keys.
|
|
1598
|
+
*/
|
|
1599
|
+
contextMetadataFilter?: AiContextMetadataFilter;
|
|
1600
|
+
/**
|
|
1601
|
+
* Whether to attach the topic table (`topics`). Default true. A caller that already holds it can pass false:
|
|
1602
|
+
* on a large graph the table runs to thousands of topics.
|
|
1603
|
+
*/
|
|
1604
|
+
includeTopics?: boolean;
|
|
1573
1605
|
}
|
|
1574
1606
|
/** A node in an {@link ExploreKnowledgeBaseGraphResponse}. @category AI */
|
|
1575
1607
|
export interface KnowledgeBaseGraphNode {
|
|
@@ -1608,14 +1640,32 @@ export interface KnowledgeBaseGraphEdge {
|
|
|
1608
1640
|
export interface ExploreKnowledgeBaseGraphResponse {
|
|
1609
1641
|
/** The subgraph nodes. */
|
|
1610
1642
|
nodes: Array<KnowledgeBaseGraphNode>;
|
|
1611
|
-
/**
|
|
1643
|
+
/**
|
|
1644
|
+
* The subgraph edges (outgoing only, both endpoints present in `nodes`). Capped: past the cap only the
|
|
1645
|
+
* heaviest are returned and {@link edgesTruncated} is set.
|
|
1646
|
+
*/
|
|
1612
1647
|
edges: Array<KnowledgeBaseGraphEdge>;
|
|
1648
|
+
/** True when the nodes are linked by more relationships than `edges` carries. */
|
|
1649
|
+
edgesTruncated?: boolean;
|
|
1613
1650
|
/**
|
|
1614
1651
|
* The KB's topic (theme) nodes — the id→name/hierarchy table for the nodes' `topicPath` ids, so a
|
|
1615
1652
|
* visualization can label and group by theme without extra round trips. Present when the concept
|
|
1616
|
-
* layer has been built (a rebuild ran).
|
|
1653
|
+
* layer has been built (a rebuild ran). Under `contextMetadataFilter`, `docCount` counts only the
|
|
1654
|
+
* matching contexts.
|
|
1617
1655
|
*/
|
|
1618
1656
|
topics?: Array<KnowledgeBaseGraphTopic>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Size of the pool the subgraph was cut from — the entities in scope, the topic's members, the entity's
|
|
1659
|
+
* neighbors or the search matches. Compare with `nodes.length` to offer more. Absent when not counted.
|
|
1660
|
+
*/
|
|
1661
|
+
totalCount?: number;
|
|
1662
|
+
/** How a `search` matched: by entity name, or by meaning when no name matched. */
|
|
1663
|
+
searchMatch?: 'name' | 'similar';
|
|
1664
|
+
/**
|
|
1665
|
+
* True when `contextMetadataFilter` matched more contexts than one request reads; the subgraph then
|
|
1666
|
+
* covers only the first of them.
|
|
1667
|
+
*/
|
|
1668
|
+
scopeTruncated?: boolean;
|
|
1619
1669
|
}
|
|
1620
1670
|
/**
|
|
1621
1671
|
* A topic (theme) node of the graph's concept layer, as referenced by
|
|
@@ -1656,12 +1706,14 @@ export interface KnowledgeBaseGraphTopicEdge {
|
|
|
1656
1706
|
* round trip with a complete answer — no per-level walking.
|
|
1657
1707
|
* @category AI
|
|
1658
1708
|
*/
|
|
1659
|
-
export type KnowledgeBaseGraphQueryOp = 'overview' | 'resolve' | 'describe' | 'subtree' | 'docsUnder' | 'conceptsOf' | 'neighborhood' | 'pathBetween' | 'globalSummary';
|
|
1709
|
+
export type KnowledgeBaseGraphQueryOp = 'overview' | 'resolve' | 'describe' | 'subtree' | 'docsUnder' | 'conceptsOf' | 'neighborhood' | 'pathBetween' | 'globalSummary' | 'relationship';
|
|
1660
1710
|
/**
|
|
1661
1711
|
* Request structure for querying a knowledge base's graph (documents, entities, topics, facets) through
|
|
1662
1712
|
* the closed op set. `ref` accepts a facet nodeId (`facet_…` — exact; the only persistable concept
|
|
1663
|
-
* handles)
|
|
1664
|
-
*
|
|
1713
|
+
* handles), a topic id from {@link KnowledgeBaseGraphTopic.id} or an entity id from
|
|
1714
|
+
* {@link KnowledgeBaseGraphNode.id} (both exact, both churn on rebuild) or a name, resolved server-side
|
|
1715
|
+
* (exact → alias → similarity). An unresolvable ref fails with `CONCEPT_NOT_FOUND` plus the nearest
|
|
1716
|
+
* matching names.
|
|
1665
1717
|
* @category AI
|
|
1666
1718
|
*/
|
|
1667
1719
|
export interface QueryKnowledgeBaseGraphRequest {
|
|
@@ -1669,9 +1721,12 @@ export interface QueryKnowledgeBaseGraphRequest {
|
|
|
1669
1721
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
1670
1722
|
/** The operation to run. */
|
|
1671
1723
|
op: KnowledgeBaseGraphQueryOp;
|
|
1672
|
-
/**
|
|
1724
|
+
/**
|
|
1725
|
+
* Node ref (name, facet nodeId, topic id or entity id). Required by resolve/describe/subtree/docsUnder/
|
|
1726
|
+
* neighborhood/pathBetween/relationship.
|
|
1727
|
+
*/
|
|
1673
1728
|
ref?: string;
|
|
1674
|
-
/** Second node ref for `pathBetween`. */
|
|
1729
|
+
/** Second node ref for `pathBetween`, and the target entity for `relationship`. */
|
|
1675
1730
|
refB?: string;
|
|
1676
1731
|
/** The document's contextId for `conceptsOf`. */
|
|
1677
1732
|
contextId?: string;
|
|
@@ -1683,8 +1738,16 @@ export interface QueryKnowledgeBaseGraphRequest {
|
|
|
1683
1738
|
hops?: number;
|
|
1684
1739
|
/** `docsUnder`: when true (default), include documents under the whole subtree, not just the node itself. */
|
|
1685
1740
|
recursive?: boolean;
|
|
1686
|
-
/**
|
|
1741
|
+
/**
|
|
1742
|
+
* `docsUnder` and `relationship`: maximum documents returned. Default 25, max 100 (`totalDocs` always
|
|
1743
|
+
* reports the full count).
|
|
1744
|
+
*/
|
|
1687
1745
|
limit?: number;
|
|
1746
|
+
/**
|
|
1747
|
+
* `docsUnder` and `relationship`: keeps only the documents whose context matches the filter. Filters on
|
|
1748
|
+
* context-record metadata only, not on per-chunk keys.
|
|
1749
|
+
*/
|
|
1750
|
+
contextMetadataFilter?: AiContextMetadataFilter;
|
|
1688
1751
|
}
|
|
1689
1752
|
/** One node matched by a graph query (`resolve`, and the anchors of other ops). @category AI */
|
|
1690
1753
|
export interface KnowledgeBaseGraphQueryMatch {
|
|
@@ -1767,6 +1830,27 @@ export interface KnowledgeBaseGraphQueryPath {
|
|
|
1767
1830
|
/** Thematic tier: names of concepts both refs sit under. */
|
|
1768
1831
|
sharedConcepts?: Array<string>;
|
|
1769
1832
|
}
|
|
1833
|
+
/**
|
|
1834
|
+
* A `relationship` answer: the direct relationship between two entities, in its asserted direction, and
|
|
1835
|
+
* the documents asserting it.
|
|
1836
|
+
* @category AI
|
|
1837
|
+
*/
|
|
1838
|
+
export interface KnowledgeBaseGraphQueryRelationship {
|
|
1839
|
+
/** Source entity name. */
|
|
1840
|
+
source: string;
|
|
1841
|
+
/** Target entity name. */
|
|
1842
|
+
target: string;
|
|
1843
|
+
/** Relationship label. */
|
|
1844
|
+
type: string;
|
|
1845
|
+
/** Relationship description, when the extraction produced one. */
|
|
1846
|
+
description?: string;
|
|
1847
|
+
/** How many times the relationship was asserted. */
|
|
1848
|
+
weight: number;
|
|
1849
|
+
/** Documents asserting the relationship (capped by `limit`). */
|
|
1850
|
+
documents: Array<KnowledgeBaseGraphQueryDoc>;
|
|
1851
|
+
/** Number of documents asserting it (compare with `documents.length` for truncation). */
|
|
1852
|
+
totalDocs: number;
|
|
1853
|
+
}
|
|
1770
1854
|
/**
|
|
1771
1855
|
* Response structure for a graph query. `op` echoes the request; exactly the fields that op produces
|
|
1772
1856
|
* are set (e.g. `matches` for `resolve`, `tree` for `subtree`).
|
|
@@ -1803,6 +1887,13 @@ export interface QueryKnowledgeBaseGraphResponse {
|
|
|
1803
1887
|
pathBetween?: KnowledgeBaseGraphQueryPath;
|
|
1804
1888
|
/** `globalSummary`: the KB's topic summaries ranked against the query, most relevant first. */
|
|
1805
1889
|
summaries?: Array<KnowledgeBaseGraphQueryGlobalSummary>;
|
|
1890
|
+
/** `relationship`: the relationship between `ref` and `refB` and the documents asserting it. */
|
|
1891
|
+
relationship?: KnowledgeBaseGraphQueryRelationship;
|
|
1892
|
+
/**
|
|
1893
|
+
* True when `contextMetadataFilter` matched more contexts than one request reads; the documents then come
|
|
1894
|
+
* from only the first of them.
|
|
1895
|
+
*/
|
|
1896
|
+
scopeTruncated?: boolean;
|
|
1806
1897
|
}
|
|
1807
1898
|
/**
|
|
1808
1899
|
* One context to stage through bulk ingestion. Unlike the sync request, `imageExtractionModel` is not
|
|
@@ -1977,7 +2068,8 @@ export interface BulkIngestionJobStatusCounts {
|
|
|
1977
2068
|
* cross it under load. So do `'SOURCE_UNREACHABLE'` (the provider could not fetch the source, which a
|
|
1978
2069
|
* fresh link can fix) and `'PROVIDER_ACCESS_DENIED'` (the provider refused the credential or its quota is
|
|
1979
2070
|
* spent, a fault of the environment). `'JOB_FULL'`: the job's request ceiling had no room left for this
|
|
1980
|
-
* file
|
|
2071
|
+
* file when it was admitted — before any paid stage ran — so re-submit it in a fresh job; a file that
|
|
2072
|
+
* alone exceeds the ceiling fails this way in every job.
|
|
1981
2073
|
* @category AI
|
|
1982
2074
|
*/
|
|
1983
2075
|
export type BulkIngestionFileErrorCode = 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'IMAGE_OVER_PROVIDER_LIMIT' | 'JOB_FULL' | 'NO_EMBEDDABLE_CONTENT' | 'PROVIDER_ACCESS_DENIED' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'SOURCE_UNREACHABLE' | 'UNREADABLE_DOCUMENT' | 'UNREADABLE_WORKBOOK' | 'UNSUPPORTED_FILE_TYPE';
|
|
@@ -9,6 +9,11 @@ export interface InvokeLangGraphOptions {
|
|
|
9
9
|
input?: Record<string, unknown>;
|
|
10
10
|
/** How long the run may take, in ms, before it stops and fails. At most, and by default, one hour. */
|
|
11
11
|
timeoutMs?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Context of the run, which every node reads as LangGraph's `runtime.context`. It is not stored, so a resume
|
|
14
|
+
* passes its own.
|
|
15
|
+
*/
|
|
16
|
+
context?: Record<string, unknown>;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Options for resuming an interrupted LangGraph thread.
|
|
@@ -17,6 +22,8 @@ export interface InvokeLangGraphOptions {
|
|
|
17
22
|
export interface ResumeLangGraphOptions {
|
|
18
23
|
/** How long the resumed run may take, in ms, before it stops and fails. At most, and by default, one hour. */
|
|
19
24
|
timeoutMs?: number;
|
|
25
|
+
/** Context of the resumed run, which every node reads as LangGraph's `runtime.context`. */
|
|
26
|
+
context?: Record<string, unknown>;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Successful result of a LangGraph invocation.
|
|
@@ -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,161 @@
|
|
|
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
|
+
/**
|
|
13
|
+
* Base fields shared by all document mutations.
|
|
14
|
+
* @category Database
|
|
15
|
+
*/
|
|
16
|
+
export interface BaseMutation {
|
|
17
|
+
/** The type of the mutation. */
|
|
18
|
+
type: MutationType;
|
|
19
|
+
/** The identity of the mutated document. */
|
|
20
|
+
squidDocIdObj: SquidDocIdObj;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A mutation on a document.
|
|
24
|
+
* @category Database
|
|
25
|
+
*/
|
|
26
|
+
export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
|
|
27
|
+
/**
|
|
28
|
+
* Represents a delete mutation on a document.
|
|
29
|
+
* @category Database
|
|
30
|
+
*/
|
|
31
|
+
export interface DeleteMutation extends BaseMutation {
|
|
32
|
+
/** Specifies that the mutation is a deletion. */
|
|
33
|
+
type: 'delete';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents an update mutation on a document.
|
|
37
|
+
* @category Database
|
|
38
|
+
*/
|
|
39
|
+
export interface UpdateMutation<T = any> extends BaseMutation {
|
|
40
|
+
/** Specifies that the mutation is an update. */
|
|
41
|
+
type: 'update';
|
|
42
|
+
/** The updated properties */
|
|
43
|
+
properties: {
|
|
44
|
+
[key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents an insert mutation on a document.
|
|
49
|
+
* @category Database
|
|
50
|
+
*/
|
|
51
|
+
export interface InsertMutation<T = any> extends BaseMutation {
|
|
52
|
+
/** Specifies that the mutation is an insertion. */
|
|
53
|
+
type: 'insert';
|
|
54
|
+
/** The inserted document */
|
|
55
|
+
properties: T;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A representation of a single property update.
|
|
59
|
+
* @category Database
|
|
60
|
+
*/
|
|
61
|
+
export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
|
|
62
|
+
/**
|
|
63
|
+
* A value update property mutation.
|
|
64
|
+
* @category Database
|
|
65
|
+
*/
|
|
66
|
+
export interface ValueUpdatePropertyMutation<Value = any> {
|
|
67
|
+
/** Specifies that the mutation updates a value. */
|
|
68
|
+
type: 'update';
|
|
69
|
+
/** New value to be set. */
|
|
70
|
+
value: Value;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Applying a numeric function to a property.
|
|
74
|
+
* @category Database
|
|
75
|
+
*/
|
|
76
|
+
export interface ApplyNumericFnPropertyMutation {
|
|
77
|
+
/** Specifies that the mutation applies a numeric function. */
|
|
78
|
+
type: 'applyNumericFn';
|
|
79
|
+
/** Numeric function to apply. */
|
|
80
|
+
fn: 'increment';
|
|
81
|
+
/** Value to use in the numeric function. */
|
|
82
|
+
value: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A property update that removes a property from a document.
|
|
86
|
+
* @category Database
|
|
87
|
+
*/
|
|
88
|
+
export interface RemovePropertyMutation {
|
|
89
|
+
/** Specifies that the mutation removes a property. */
|
|
90
|
+
type: 'removeProperty';
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A property mutation that appends a value to the existing string.
|
|
94
|
+
* @category Database
|
|
95
|
+
*/
|
|
96
|
+
export interface ApplyExtendString {
|
|
97
|
+
/** Specifies that the mutation applies a string function. */
|
|
98
|
+
type: 'applyStringFn';
|
|
99
|
+
/** String function to extend the existing string. */
|
|
100
|
+
fn: 'extendString';
|
|
101
|
+
/** String value to append. */
|
|
102
|
+
value: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A property mutation that trims the existing string.
|
|
106
|
+
* @category Database
|
|
107
|
+
*/
|
|
108
|
+
export interface ApplyTrimString {
|
|
109
|
+
/** Specifies that the mutation applies a string function. */
|
|
110
|
+
type: 'applyStringFn';
|
|
111
|
+
/** String function to trim the existing string. */
|
|
112
|
+
fn: 'trim';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A property mutation that modifies a string.
|
|
116
|
+
* @category Database
|
|
117
|
+
*/
|
|
118
|
+
export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
|
|
119
|
+
/**
|
|
120
|
+
* The before and after documents of a document change.
|
|
121
|
+
* @category Database
|
|
122
|
+
*/
|
|
123
|
+
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
124
|
+
/** Document state before the mutation. */
|
|
125
|
+
before: T | undefined;
|
|
126
|
+
/** Document state after the mutation. */
|
|
127
|
+
after: T | undefined;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The mutation context that will be provided to the security function.
|
|
131
|
+
* @category Database
|
|
132
|
+
*/
|
|
133
|
+
export declare class MutationContext<T = any> {
|
|
134
|
+
readonly mutation: Mutation<T>;
|
|
135
|
+
readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
|
|
136
|
+
readonly serverTimeStamp: Date;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the state of the document before the mutation was applied.
|
|
139
|
+
*/
|
|
140
|
+
get before(): T | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Returns the state of the document after the mutation was applied.
|
|
143
|
+
*/
|
|
144
|
+
get after(): T | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Returns the type of the mutation (insert, update, or delete).
|
|
147
|
+
*/
|
|
148
|
+
getMutationType(): MutationType;
|
|
149
|
+
/** Returns true if the mutation affects the provided path. */
|
|
150
|
+
affectsPath(path: Paths<T>): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Find all affected paths starting from a root path.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* doc before - { a: { b: 1, c: 2 }, d: 3 }
|
|
156
|
+
* doc after - { a: { b: 1, c: 3 }, d: 4 }
|
|
157
|
+
* doc.affectedPaths('a') // ['a.c']
|
|
158
|
+
*/
|
|
159
|
+
affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
|
|
160
|
+
private checkPath;
|
|
161
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Base fields shared by all native query contexts.
|
|
9
|
+
* @category Database
|
|
10
|
+
*/
|
|
11
|
+
export interface BaseNativeQueryContext {
|
|
12
|
+
/** Type of the native query request. */
|
|
13
|
+
type: NativeQueryRequestType;
|
|
14
|
+
/** Identifier for the integration. */
|
|
15
|
+
integrationId: IntegrationId;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Context for executing a relational database query.
|
|
19
|
+
* @category Database
|
|
20
|
+
*/
|
|
21
|
+
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
22
|
+
/** Specifies that the query is for a relational database. */
|
|
23
|
+
type: 'relational';
|
|
24
|
+
/** SQL query string to be executed. */
|
|
25
|
+
query: string;
|
|
26
|
+
/** Parameters to be used in the query. */
|
|
27
|
+
params: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Context for executing a MongoDB query.
|
|
31
|
+
* @category Database
|
|
32
|
+
*/
|
|
33
|
+
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
34
|
+
/** Specifies that the query is for a Mongo database. */
|
|
35
|
+
type: 'mongo';
|
|
36
|
+
/** Name of the MongoDB collection to query. */
|
|
37
|
+
collectionName: string;
|
|
38
|
+
/** Array of aggregation pipeline stages. */
|
|
39
|
+
aggregationPipeline: Array<any | undefined>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Context for executing an Elasticsearch query.
|
|
43
|
+
* @category Database
|
|
44
|
+
*/
|
|
45
|
+
export interface ElasticsearchNativeQueryContext {
|
|
46
|
+
/** Specifies that the query is for an Elasticsearch database. */
|
|
47
|
+
type: 'elasticsearch';
|
|
48
|
+
/** Elasticsearch index to query. */
|
|
49
|
+
index: string;
|
|
50
|
+
/** Elasticsearch query string. */
|
|
51
|
+
endpoint?: string;
|
|
52
|
+
/** HTTP method to use for the request. */
|
|
53
|
+
method?: 'GET' | 'POST';
|
|
54
|
+
/** Body of the request. */
|
|
55
|
+
body: Record<string, any>;
|
|
56
|
+
/** Headers to include in the request. */
|
|
57
|
+
integrationId: IntegrationId;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Context for executing a pure database query.
|
|
61
|
+
* @category Database
|
|
62
|
+
*/
|
|
63
|
+
export interface PureNativeQueryContext extends BaseNativeQueryContext {
|
|
64
|
+
/** Specifies that the query is for a relational database. */
|
|
65
|
+
type: 'pure';
|
|
66
|
+
/** SQL query string to be executed. */
|
|
67
|
+
query: string;
|
|
68
|
+
/** Parameters to be used in the query. */
|
|
69
|
+
params: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Union type representing either a relational or MongoDB native query context.
|
|
73
|
+
* @category Database
|
|
74
|
+
*/
|
|
75
|
+
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext;
|