@squidcloud/client 1.0.471 → 1.0.473
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 +58 -2
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +12 -1
- package/dist/internal-common/src/public-types/connector.public-types.d.ts +12 -0
- package/dist/internal-common/src/public-types/event.public-types.d.ts +18 -0
- package/dist/typescript-client/src/admin-client.d.ts +7 -1
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +6 -0
- package/dist/typescript-client/src/agent/ai-agent-client.d.ts +1 -0
- package/dist/typescript-client/src/ai-client.d.ts +1 -0
- package/dist/typescript-client/src/connector-client.d.ts +32 -0
- package/dist/typescript-client/src/events-client.d.ts +21 -0
- package/dist/typescript-client/src/index.d.ts +2 -0
- package/dist/typescript-client/src/public-types.d.ts +2 -0
- package/dist/typescript-client/src/squid.d.ts +15 -0
- 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 -14
- 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 -72
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -190
- package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -240
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -202
- 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/headers.types.d.ts +0 -17
- package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
- package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/notification.types.d.ts +0 -5
- package/dist/internal-common/src/types/observability.types.d.ts +0 -142
- package/dist/internal-common/src/types/query.types.d.ts +0 -15
- package/dist/internal-common/src/types/secret.types.d.ts +0 -7
- package/dist/internal-common/src/types/socket.types.d.ts +0 -1
- package/dist/internal-common/src/types/stage.d.ts +0 -9
- package/dist/internal-common/src/types/time-units.d.ts +0 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
- package/dist/internal-common/src/utils/array.d.ts +0 -7
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/file-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 -11
- 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 -86
- package/dist/internal-common/src/utils/serialization.d.ts +0 -18
- package/dist/internal-common/src/utils/squid.constants.d.ts +0 -6
- package/dist/internal-common/src/utils/trace-id-generator.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
|
@@ -318,6 +318,13 @@ export interface AiChatPromptQuotas {
|
|
|
318
318
|
* Default: 5.
|
|
319
319
|
*/
|
|
320
320
|
maxAiCallStackSize: number;
|
|
321
|
+
/**
|
|
322
|
+
* Maximum wall-clock runtime, in seconds, of a single prompt for CLI-agent models
|
|
323
|
+
* (Claude Code, Codex). Optional override of the per-call self-kill deadline — mainly to
|
|
324
|
+
* tighten it for stricter runaway protection — clamped to [30, 1800]. Ignored for
|
|
325
|
+
* non-CLI-agent models. Default: the platform maximum (30 minutes).
|
|
326
|
+
*/
|
|
327
|
+
maxRuntimeSeconds?: number;
|
|
321
328
|
}
|
|
322
329
|
/**
|
|
323
330
|
* Options for AI agent execution plan, allowing the agent to plan what functionality to use (connected agents,
|
|
@@ -473,6 +480,15 @@ export interface BaseAiChatOptions {
|
|
|
473
480
|
executionPlanOptions?: AiAgentExecutionPlanOptions;
|
|
474
481
|
/** An array of file URLs to include in the chat context. */
|
|
475
482
|
fileUrls?: Array<AiFileUrl>;
|
|
483
|
+
/**
|
|
484
|
+
* Arbitrary client-defined annotations attached to this AI call for usage tracking.
|
|
485
|
+
* Reported as `annotation.<key>` tags on Squid AI usage metrics, so token usage can later be
|
|
486
|
+
* filtered and grouped by these values (e.g. `{ feature: 'support-bot', requestSource: 'mobile' }`).
|
|
487
|
+
* Inherited by nested calls to connected agents made while serving this call.
|
|
488
|
+
* Limits: at most 10 entries, keys up to 64 characters, values up to 256 characters;
|
|
489
|
+
* entries beyond the limits are dropped or truncated.
|
|
490
|
+
*/
|
|
491
|
+
metricAnnotations?: Record<string, string>;
|
|
476
492
|
/**
|
|
477
493
|
* The level of reasoning effort to apply; defaults to model-specific value.
|
|
478
494
|
* Effective only for models with reasoning.
|
|
@@ -533,10 +549,44 @@ export interface OpenAiChatOptions extends BaseAiChatOptions {
|
|
|
533
549
|
model?: OpenAiChatModelName;
|
|
534
550
|
}
|
|
535
551
|
/**
|
|
536
|
-
*
|
|
552
|
+
* Canonical reasoning-effort levels, ordered from least to most effort. These are the values that
|
|
553
|
+
* have a defined position on the effort axis and therefore participate in clamping when a model does
|
|
554
|
+
* not support the exact requested level.
|
|
537
555
|
* @category AI
|
|
538
556
|
*/
|
|
539
|
-
export type
|
|
557
|
+
export type CanonicalReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
558
|
+
/**
|
|
559
|
+
* AI reasoning effort. Pass one of the canonical levels for portable, autocomplete-friendly usage, or
|
|
560
|
+
* a raw provider-native string when a model exposes a level outside the canonical set.
|
|
561
|
+
*
|
|
562
|
+
* Resolution against the selected model (see {@link ReasoningCapability}):
|
|
563
|
+
* - exact match with the model's capability -> used as-is (1:1);
|
|
564
|
+
* - canonical level the model lacks -> clamped to the nearest supported level (ties resolve downward);
|
|
565
|
+
* - unknown string the model cannot place on the axis -> dropped, so the model's own default applies,
|
|
566
|
+
* with a warning;
|
|
567
|
+
* - model without a reasoning knob -> ignored, with a warning.
|
|
568
|
+
* @category AI
|
|
569
|
+
*/
|
|
570
|
+
export type AiReasoningEffort = CanonicalReasoningEffort | (string & {});
|
|
571
|
+
/**
|
|
572
|
+
* Declares how a model exposes reasoning effort. Used as the single source of truth for resolving a
|
|
573
|
+
* requested {@link AiReasoningEffort} onto what the model natively accepts. When a request cannot be
|
|
574
|
+
* matched or clamped, no reasoning parameter is emitted and the model applies its own native default.
|
|
575
|
+
*
|
|
576
|
+
* - `none`: the model has no reasoning knob (e.g. it always reasons).
|
|
577
|
+
* - `levels`: the model accepts a fixed set of named levels (emitted as a string).
|
|
578
|
+
* - `budget`: the model accepts a token budget; each canonical level maps to a concrete integer.
|
|
579
|
+
* @category AI
|
|
580
|
+
*/
|
|
581
|
+
export type ReasoningCapability = {
|
|
582
|
+
kind: 'none';
|
|
583
|
+
} | {
|
|
584
|
+
kind: 'levels';
|
|
585
|
+
supported: AiReasoningEffort[];
|
|
586
|
+
} | {
|
|
587
|
+
kind: 'budget';
|
|
588
|
+
perLevel: Partial<Record<CanonicalReasoningEffort, number>>;
|
|
589
|
+
};
|
|
540
590
|
/**
|
|
541
591
|
* Controls response length and detail level.
|
|
542
592
|
* Use `low` for brief responses,`medium` for balanced detail, or `high` for comprehensive explanations.
|
|
@@ -891,6 +941,12 @@ export interface UserAiAskResponse {
|
|
|
891
941
|
inputTokens?: number;
|
|
892
942
|
/** The number of output tokens generated by the AI agent. */
|
|
893
943
|
outputTokens?: number;
|
|
944
|
+
/** Cached input tokens read from the prompt cache. Only set by providers that report it (e.g. claude-code). */
|
|
945
|
+
cacheReadInputTokens?: number;
|
|
946
|
+
/** Input tokens written to the prompt cache. Only set by providers that report it (e.g. claude-code). */
|
|
947
|
+
cacheWriteInputTokens?: number;
|
|
948
|
+
/** Total request cost in USD as reported by the provider. Only set by providers that compute it (e.g. claude-code). */
|
|
949
|
+
totalCostUsd?: number;
|
|
894
950
|
}
|
|
895
951
|
/** Represents an annotation in the AI response. */
|
|
896
952
|
export type AiAnnotation = AiFileAnnotation;
|
|
@@ -40,7 +40,11 @@ export interface AiKnowledgeBase {
|
|
|
40
40
|
export interface AiKnowledgeBaseMetadataField {
|
|
41
41
|
/** The name of field.*/
|
|
42
42
|
name: string;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The field data type - used for validation and filtering. `date` values are normalized to integer
|
|
45
|
+
* epoch milliseconds at write time so range filters (`$gt`/`$lt`) work across vector store backends.
|
|
46
|
+
* `array` is not yet supported and is rejected at knowledge-base upsert time.
|
|
47
|
+
*/
|
|
44
48
|
dataType: 'string' | 'number' | 'boolean' | 'date' | 'array';
|
|
45
49
|
/** Indicates if the field is required for knowledge base entries.*/
|
|
46
50
|
required: boolean;
|
|
@@ -168,6 +172,13 @@ export interface AiKnowledgeBaseContext {
|
|
|
168
172
|
sizeBytes: number;
|
|
169
173
|
/** Metadata associated with the context. */
|
|
170
174
|
metadata: AiContextMetadata;
|
|
175
|
+
/**
|
|
176
|
+
* Names of metadata fields whose stored values were machine-extracted from the content
|
|
177
|
+
* (driven by the knowledge base's `metadataFields` schema) rather than user-supplied.
|
|
178
|
+
* On re-upsert/replay, extracted values count as not-supplied (re-extracted fresh) while
|
|
179
|
+
* user-supplied values are preserved; consumers can also use this to caveat extracted values.
|
|
180
|
+
*/
|
|
181
|
+
autoExtractedMetadataFields?: string[];
|
|
171
182
|
/** Original request configuration for how the context content was processed. */
|
|
172
183
|
requestConfig?: AgentContextRequest;
|
|
173
184
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of all connector package names.
|
|
3
|
+
* To prevent automatic discovery && latest version sync in 'prod' add your connector package name to
|
|
4
|
+
* 'CONNECTOR_PACKAGES_TO_EXCLUDE_FROM_AUTO_SYNC' in ConnectorsService (console-backend).
|
|
5
|
+
* @category Platform
|
|
6
|
+
*/
|
|
7
|
+
export declare const CONNECTOR_IDS: readonly ["confluence", "cotomi", "essentials", "freshdesk", "github", "google_calendar", "google_drive", "hubspot", "sharepoint", "jira", "jira_jsm", "linear", "mail", "onedrive", "salesforce", "servicenow_csm", "slack", "teams", "ticketmind_companion", "zendesk"];
|
|
8
|
+
/**
|
|
9
|
+
* Unique connector package name.
|
|
10
|
+
* @category Platform
|
|
11
|
+
*/
|
|
12
|
+
export type ConnectorId = (typeof CONNECTOR_IDS)[number];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A generic event that can be emitted with `squid.events().emit` and handled by one or more
|
|
3
|
+
* subscribers declared with the backend `@eventHandler` decorator. Events are delivered over core's
|
|
4
|
+
* internal event stream (not the public queue API), at-least-once and with no ordering guarantee.
|
|
5
|
+
*/
|
|
6
|
+
export interface TriggerEvent<T = unknown> {
|
|
7
|
+
/** Unique event id (e.g. `generateUUID()`). */
|
|
8
|
+
id: string;
|
|
9
|
+
/** The event type. Determines which `@eventHandler` subscribers receive the event. */
|
|
10
|
+
type: string;
|
|
11
|
+
/** Arbitrary, JSON-serializable event payload. */
|
|
12
|
+
payload: T;
|
|
13
|
+
}
|
|
14
|
+
/** Request body for the `events/emit` core endpoint that publishes a `TriggerEvent`. */
|
|
15
|
+
export interface EmitEventRequest<T = unknown> {
|
|
16
|
+
/** The event to emit. */
|
|
17
|
+
event: TriggerEvent<T>;
|
|
18
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { ConnectorClient } from './connector-client';
|
|
1
2
|
import { IntegrationClient } from './integration-client';
|
|
2
3
|
import { SecretClient } from './secret.client';
|
|
3
4
|
/**
|
|
4
5
|
* AdminClient provides access to application administrative operations,
|
|
5
|
-
* including integrations and secrets management.
|
|
6
|
+
* including integrations, connectors, and secrets management.
|
|
6
7
|
* @category Platform
|
|
7
8
|
*/
|
|
8
9
|
export declare class AdminClient {
|
|
@@ -11,11 +12,16 @@ export declare class AdminClient {
|
|
|
11
12
|
private readonly appId;
|
|
12
13
|
private readonly consoleRegion;
|
|
13
14
|
private readonly integrationClient;
|
|
15
|
+
private readonly connectorClient;
|
|
14
16
|
private readonly secretClient;
|
|
15
17
|
/**
|
|
16
18
|
* Returns the IntegrationClient for managing integrations.
|
|
17
19
|
*/
|
|
18
20
|
integrations(): IntegrationClient;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the ConnectorClient for managing app-level (integration-less) connectors.
|
|
23
|
+
*/
|
|
24
|
+
connectors(): ConnectorClient;
|
|
19
25
|
/**
|
|
20
26
|
* Returns the SecretClient for managing secrets.
|
|
21
27
|
*/
|
|
@@ -23,6 +23,7 @@ export declare class AiAgentReference {
|
|
|
23
23
|
private readonly socketManager;
|
|
24
24
|
private readonly jobClient;
|
|
25
25
|
private readonly backendFunctionManager;
|
|
26
|
+
private readonly getMetricAnnotations;
|
|
26
27
|
/**
|
|
27
28
|
* Retrieves metadata and configuration of the AI agent.
|
|
28
29
|
*/
|
|
@@ -238,6 +239,11 @@ export declare class AiAgentReference {
|
|
|
238
239
|
private replaceFileTags;
|
|
239
240
|
private askInternal;
|
|
240
241
|
private chatInternal;
|
|
242
|
+
/**
|
|
243
|
+
* Merges the Squid-instance-level metric annotations under the per-call ones.
|
|
244
|
+
* Returns the options unchanged when no annotations are set anywhere.
|
|
245
|
+
*/
|
|
246
|
+
private withMetricAnnotations;
|
|
241
247
|
/**
|
|
242
248
|
* Calls rpcManager post but with the agent api key if one was given during construction
|
|
243
249
|
*/
|
|
@@ -22,6 +22,7 @@ export declare class AiAgentClient {
|
|
|
22
22
|
private readonly socketManager;
|
|
23
23
|
private readonly jobClient;
|
|
24
24
|
private readonly backendFunctionManager;
|
|
25
|
+
private readonly getMetricAnnotations;
|
|
25
26
|
private readonly ongoingChatSequences;
|
|
26
27
|
/**
|
|
27
28
|
* Retrieves an instance of AiAgentReference for a specific agent ID.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ConnectorId } from './public-types';
|
|
2
|
+
/**
|
|
3
|
+
* ConnectorClient manages app-level (integration-less) connectors attached to an application.
|
|
4
|
+
*
|
|
5
|
+
* Unlike integrations, these connectors carry no per-connector configuration record — attaching one
|
|
6
|
+
* simply adds it to the application's `appConnectors` list and (re)deploys its bundle. Any configuration
|
|
7
|
+
* the connector needs is provided out of band (e.g. via application secrets).
|
|
8
|
+
* @category Platform
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConnectorClient {
|
|
11
|
+
private readonly rpcManager;
|
|
12
|
+
private readonly iacBaseUrl;
|
|
13
|
+
/**
|
|
14
|
+
* Lists the connectors explicitly attached to the application.
|
|
15
|
+
*
|
|
16
|
+
* @returns A promise that resolves with the list of attached connector ids.
|
|
17
|
+
*/
|
|
18
|
+
list(): Promise<Array<ConnectorId>>;
|
|
19
|
+
/**
|
|
20
|
+
* Attaches a connector to the application. Idempotent — attaching an already-attached connector is a
|
|
21
|
+
* no-op on the platform side.
|
|
22
|
+
*
|
|
23
|
+
* @param connectorId - The id of the connector to attach.
|
|
24
|
+
*/
|
|
25
|
+
connect(connectorId: ConnectorId): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Detaches a connector from the application.
|
|
28
|
+
*
|
|
29
|
+
* @param connectorId - The id of the connector to detach.
|
|
30
|
+
*/
|
|
31
|
+
disconnect(connectorId: ConnectorId): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TriggerEvent } from '../../internal-common/src/public-types/event.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* EventsClient provides methods for emitting generic events that are handled by backend functions
|
|
4
|
+
* declared with the `@eventHandler` decorator.
|
|
5
|
+
* @category Platform
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventsClient {
|
|
8
|
+
private readonly rpcManager;
|
|
9
|
+
/**
|
|
10
|
+
* Emits a generic event delivered to every subscriber declared with `@eventHandler` for the same
|
|
11
|
+
* event type. Events are delivered durably/at-least-once with no ordering guarantee, so handlers
|
|
12
|
+
* should be idempotent and order-independent. Resolves once the event is enqueued, not once
|
|
13
|
+
* subscribers have handled it.
|
|
14
|
+
*
|
|
15
|
+
* Requires API key authentication — events are emitted only by trusted server-side code, so calls
|
|
16
|
+
* authenticated with a user token are rejected.
|
|
17
|
+
*
|
|
18
|
+
* @param event The event to emit, with a unique `id`, a `type`, and a `payload`.
|
|
19
|
+
*/
|
|
20
|
+
emit<T>(event: TriggerEvent<T>): Promise<void>;
|
|
21
|
+
}
|
|
@@ -17,6 +17,7 @@ export * from './client-id.service';
|
|
|
17
17
|
export * from './collection-reference';
|
|
18
18
|
export * from './collection-reference.factory';
|
|
19
19
|
export * from './connection-details';
|
|
20
|
+
export * from './connector-client';
|
|
20
21
|
export * from './console-utils';
|
|
21
22
|
export * from './data.manager';
|
|
22
23
|
export * from './destruct.manager';
|
|
@@ -25,6 +26,7 @@ export * from './document-identity.service';
|
|
|
25
26
|
export * from './document-reference';
|
|
26
27
|
export * from './document-reference.factory';
|
|
27
28
|
export * from './document-store';
|
|
29
|
+
export * from './events-client';
|
|
28
30
|
export * from './execute-function-options';
|
|
29
31
|
export * from './external-auth-client';
|
|
30
32
|
export * from './extraction-client';
|
|
@@ -11,8 +11,10 @@ export * from '../../internal-common/src/public-types/api.public-types';
|
|
|
11
11
|
export * from '../../internal-common/src/public-types/backend.public-types';
|
|
12
12
|
export * from '../../internal-common/src/public-types/code-executor.public-types';
|
|
13
13
|
export * from '../../internal-common/src/public-types/communication.public-types';
|
|
14
|
+
export * from '../../internal-common/src/public-types/connector.public-types';
|
|
14
15
|
export * from '../../internal-common/src/public-types/context.public-types';
|
|
15
16
|
export * from '../../internal-common/src/public-types/document.public-types';
|
|
17
|
+
export * from '../../internal-common/src/public-types/event.public-types';
|
|
16
18
|
export * from '../../internal-common/src/public-types/external-auth/external-auth.public-types';
|
|
17
19
|
export * from '../../internal-common/src/public-types/extraction.public-types';
|
|
18
20
|
export * from '../../internal-common/src/public-types/http-status.public-types';
|
|
@@ -4,6 +4,7 @@ import { ApiClient } from './api-client';
|
|
|
4
4
|
import { CollectionReference } from './collection-reference';
|
|
5
5
|
import { ConnectionDetails } from './connection-details';
|
|
6
6
|
import { DistributedLock, DistributedLockOptions } from './distributed-lock.manager';
|
|
7
|
+
import { EventsClient } from './events-client';
|
|
7
8
|
import { ExecuteFunctionOptions } from './execute-function-options';
|
|
8
9
|
import { ExternalAuthClient } from './external-auth-client';
|
|
9
10
|
import { ExtractionClient } from './extraction-client';
|
|
@@ -129,8 +130,10 @@ export declare class Squid {
|
|
|
129
130
|
private readonly queueManagerFactory;
|
|
130
131
|
private readonly schedulerClient;
|
|
131
132
|
private readonly notificationClient;
|
|
133
|
+
private readonly eventsClient;
|
|
132
134
|
private readonly _appId;
|
|
133
135
|
private readonly runtimeOptions;
|
|
136
|
+
private metricAnnotations?;
|
|
134
137
|
/**
|
|
135
138
|
* Creates a new instance of Squid with the given options.
|
|
136
139
|
*
|
|
@@ -314,6 +317,14 @@ export declare class Squid {
|
|
|
314
317
|
* Returns a set of AI specific clients.
|
|
315
318
|
*/
|
|
316
319
|
ai(): AiClient;
|
|
320
|
+
/**
|
|
321
|
+
* Sets default metric annotations attached to every AI call made through this Squid instance.
|
|
322
|
+
* Annotations are reported as `annotation.<key>` tags on Squid AI usage metrics, so token usage
|
|
323
|
+
* can later be filtered and grouped by them (e.g. `{ feature: 'support-bot' }`).
|
|
324
|
+
* Per-call `metricAnnotations` in chat options are merged on top of these defaults.
|
|
325
|
+
* Pass `undefined` to clear. See `BaseAiChatOptions.metricAnnotations` for limits.
|
|
326
|
+
*/
|
|
327
|
+
setMetricAnnotations(annotations: Record<string, string> | undefined): void;
|
|
317
328
|
/**
|
|
318
329
|
* Returns a set of functionality for interacting with jobs.
|
|
319
330
|
*/
|
|
@@ -350,6 +361,10 @@ export declare class Squid {
|
|
|
350
361
|
* Returns a client for working with structured data extraction tools.
|
|
351
362
|
*/
|
|
352
363
|
extraction(): ExtractionClient;
|
|
364
|
+
/**
|
|
365
|
+
* Returns a client for emitting events handled by `@eventHandler` backend functions.
|
|
366
|
+
*/
|
|
367
|
+
events(): EventsClient;
|
|
353
368
|
/**
|
|
354
369
|
* Returns a distributed lock for the given mutex. The lock can be used to synchronize access to a shared resource.
|
|
355
370
|
* The lock will be released when the release method on the returned object is invoked or whenever the connection
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
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_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_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_";
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,72 +0,0 @@
|
|
|
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 {};
|