@squidcloud/client 1.0.317 → 1.0.319

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.
Files changed (38) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/internal-common/src/metric-name.d.ts +9 -0
  3. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +12 -8
  4. package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +2 -2
  5. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +21 -0
  6. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +18 -0
  7. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +127 -0
  8. package/dist/internal-common/src/types/ai-agent.types.d.ts +29 -0
  9. package/dist/internal-common/src/types/ai-assistant.types.d.ts +1 -0
  10. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +40 -0
  11. package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
  12. package/dist/internal-common/src/types/communication.types.d.ts +1 -0
  13. package/dist/internal-common/src/types/document.types.d.ts +1 -0
  14. package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
  15. package/dist/internal-common/src/types/observability.types.d.ts +71 -0
  16. package/dist/internal-common/src/types/query.types.d.ts +10 -0
  17. package/dist/internal-common/src/types/secret.types.d.ts +2 -0
  18. package/dist/internal-common/src/types/socket.types.d.ts +1 -0
  19. package/dist/internal-common/src/types/time-units.d.ts +1 -0
  20. package/dist/internal-common/src/utils/array.d.ts +1 -0
  21. package/dist/internal-common/src/utils/assert.d.ts +1 -0
  22. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
  23. package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
  24. package/dist/internal-common/src/utils/http.d.ts +1 -0
  25. package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
  26. package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
  27. package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
  28. package/dist/internal-common/src/utils/object.d.ts +49 -0
  29. package/dist/internal-common/src/utils/serialization.d.ts +5 -0
  30. package/dist/internal-common/src/utils/squid.constants.d.ts +1 -0
  31. package/dist/internal-common/src/utils/validation.d.ts +20 -0
  32. package/dist/internal-common/src/websocket.impl.d.ts +26 -0
  33. package/dist/typescript-client/src/ai-agent-client.d.ts +5 -13
  34. package/dist/typescript-client/src/ai-matchmaking-client.d.ts +5 -0
  35. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +5 -2
  36. package/dist/typescript-client/src/query/query-builder.factory.d.ts +7 -1
  37. package/dist/typescript-client/src/version.d.ts +1 -1
  38. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Names of the Squid metrics.
3
+ * Should be in sync with MetricName.kt.
4
+ * See MetricName.kt for documentation on each value.
5
+ */
6
+ export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_aiIntegrationApi_count", "squid_aiIntegrationApi_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_built_in_db_size", "squid_codeInitialization_count", "squid_codeInitialization_time", "squid_deleteApiKey_count", "squid_deleteApiKey_time", "squid_deleteSecret_count", "squid_deleteSecret_time", "squid_discoverGraphQLConnectionSchema_count", "squid_discoverGraphQLConnectionSchema_time", "squid_discoverOpenApiSchema_count", "squid_discoverOpenApiSchema_time", "squid_discoverOpenApiSchemaFromFile_count", "squid_discoverOpenApiSchemaFromFile_time", "squid_executeBackendFunction_count", "squid_executeBackendFunction_time", "squid_getAiChatbotProfiles_count", "squid_getAiChatbotProfiles_time", "squid_getAllApiKeys_count", "squid_getAllApiKeys_time", "squid_getAllSecrets_count", "squid_getAllSecrets_time", "squid_getAppApiKey_count", "squid_getAppApiKey_time", "squid_getSecret_count", "squid_getSecret_time", "squid_graphql_count", "squid_graphql_time", "squid_graphqlQuery_count", "squid_graphqlQuery_time", "squid_integrationCount_value", "squid_acquireLock_count", "squid_releaseLock_count", "squid_mutate_count", "squid_mutate_time", "squid_metricQuery_count", "squid_metricQuery_time", "squid_metricReport_count", "squid_metricReport_time", "squid_nativeQuery_count", "squid_nativeQuery_time", "squid_openapi_count", "squid_openapi_time", "squid_produceTopicMessage_count", "squid_produceTopicMessage_time", "squid_query_count", "squid_query_time", "squid_registerQuery_count", "squid_registerQuery_time", "squid_rerankChunks_count", "squid_rerankChunks_time", "squid_schedulerJob_count", "squid_schedulerJob_time", "squid_schema_size", "squid_secrets_entries", "squid_storageDeleteFiles_count", "squid_storageDeleteFiles_time", "squid_storageGetDownloadUrl_count", "squid_storageGetDownloadUrl_time", "squid_storageGetFileMetadata_count", "squid_storageGetFileMetadata_time", "squid_storageListDirectoryContents_count", "squid_storageListDirectoryContents_time", "squid_storageUploadFile_count", "squid_storageUploadFile_time", "squid_subscribeToTopic_count", "squid_subscribeToTopic_time", "squid_testGraphQLConnection_count", "squid_testGraphQLConnection_time", "squid_trigger_count", "squid_trigger_time", "squid_upsertApiKey_count", "squid_upsertApiKey_time", "squid_upsertSecret_count", "squid_upsertSecret_time", "squid_vectorChunks_count", "squid_vectorChunks_time", "squid_webhook_count", "squid_webhook_time"];
7
+ export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
8
+ /** Common prefix for all Squid metrics. */
9
+ export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
@@ -234,9 +234,9 @@ export interface AiSearchRequest {
234
234
  }
235
235
  export type AiMutationType = 'insert' | 'update' | 'delete' | 'append' | 'feedback';
236
236
  export type AiResourceType = 'instruction' | 'profile' | 'context' | 'contexts';
237
- export type AiAgentContextType = 'text' | 'url' | 'file';
238
- export interface AiAgentContextBase {
239
- type: AiAgentContextType;
237
+ export type AiContextType = 'text' | 'url' | 'file';
238
+ export interface AiContextBase {
239
+ type: AiContextType;
240
240
  data: string;
241
241
  metadata?: AiContextMetadata;
242
242
  password?: string;
@@ -249,16 +249,16 @@ export interface AiSearchResultChunk {
249
249
  metadata?: AiContextMetadata;
250
250
  score: number;
251
251
  }
252
- export interface AiAgentTextContext extends AiAgentContextBase {
252
+ export interface AiTextContext extends AiContextBase {
253
253
  type: 'text';
254
254
  }
255
- export interface AiAgentUrlContext extends AiAgentContextBase {
255
+ export interface AiUrlContext extends AiContextBase {
256
256
  type: 'url';
257
257
  extractImages?: boolean;
258
258
  minImageWidth?: number;
259
259
  minImageHeight?: number;
260
260
  }
261
- export interface AiAgentFileContext extends AiAgentContextBase {
261
+ export interface AiFileContext extends AiContextBase {
262
262
  type: 'file';
263
263
  extractImages?: boolean;
264
264
  minImageWidth?: number;
@@ -266,11 +266,15 @@ export interface AiAgentFileContext extends AiAgentContextBase {
266
266
  fullPageAsImage?: boolean;
267
267
  extractionModel?: AiChatModelName;
268
268
  }
269
- export declare class AiAgentChatContext {
269
+ /**
270
+ * Provides context to the security rules of an AI Agent for each new user prompt.
271
+ * Refer to the `@secureAiChatbotChat` annotation for more details.
272
+ */
273
+ export declare class AiChatContext {
270
274
  readonly prompt?: string;
271
275
  readonly profileId: AiAgentId;
272
276
  }
273
- export type AiAgentContext = AiAgentTextContext | AiAgentUrlContext | AiAgentFileContext;
277
+ export type AiContext = AiTextContext | AiUrlContext | AiFileContext;
274
278
  export type AiContextMetadataValue = number | string | boolean | undefined;
275
279
  export type AiContextMetadataValueArray = AiContextMetadataValue[];
276
280
  export interface AiContextMetadataEqFilter {
@@ -7,8 +7,8 @@ export type StorageActionType = 'read' | 'write' | 'update' | 'insert' | 'delete
7
7
  export type TopicActionType = 'read' | 'write' | 'all';
8
8
  /** The different type of actions for metrics. */
9
9
  export type MetricActionType = 'write' | 'all';
10
- /** The different types of actions that can be performed on an AI chatbot. */
11
- export type AiChatbotActionType = 'chat' | 'mutate' | 'all';
10
+ /** Types of actions that can be performed on an AI chatbot. */
11
+ export type AiActionType = 'chat' | 'mutate' | 'all';
12
12
  export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
13
13
  export interface AiFunctionParam {
14
14
  name: string;
@@ -0,0 +1,21 @@
1
+ import { ApiEndpointId, HttpMethod } from '../public-types/integrations/api.public-types';
2
+ import { IntegrationId } from '../public-types/communication.public-types';
3
+ import { ApiOptions } from '../public-types/api-client.public-types';
4
+ /** The headers of an API call. */
5
+ export type ApiHeaders = Record<string, string | number | boolean>;
6
+ /** The context of an API call. */
7
+ export declare class ApiCallContext {
8
+ readonly integrationId: IntegrationId;
9
+ readonly endpointId: ApiEndpointId;
10
+ readonly url: string;
11
+ readonly method: HttpMethod;
12
+ readonly body: unknown;
13
+ readonly options: ApiOptions;
14
+ }
15
+ export interface CallApiRequest<BodyType = any> {
16
+ integrationId: IntegrationId;
17
+ endpointId: ApiEndpointId;
18
+ body?: BodyType;
19
+ overrideMethod?: HttpMethod;
20
+ options: ApiOptions;
21
+ }
@@ -0,0 +1,18 @@
1
+ import { IntegrationId } from '../public-types/communication.public-types';
2
+ export type NativeQueryRequestType = 'relational' | 'mongo';
3
+ interface BaseNativeQueryContext {
4
+ type: NativeQueryRequestType;
5
+ integrationId: IntegrationId;
6
+ }
7
+ export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
8
+ type: 'relational';
9
+ query: string;
10
+ params: Record<string, any>;
11
+ }
12
+ export interface MongoNativeQueryContext extends BaseNativeQueryContext {
13
+ type: 'mongo';
14
+ collectionName: string;
15
+ aggregationPipeline: Array<any | undefined>;
16
+ }
17
+ export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext;
18
+ export {};
@@ -0,0 +1,127 @@
1
+ import { FieldSort, Operator, Query, SimpleCondition } from '../public-types/query.public-types';
2
+ import { DeepRecord, FieldOf, PartialBy, Paths } from '../public-types/typescript.public-types';
3
+ import { CollectionName, DocumentData } from '../public-types/document.public-types';
4
+ import { IntegrationId } from '../public-types/communication.public-types';
5
+ /**
6
+ * Represents the Squid query context.
7
+ * Passed to methods that require query details, such as those annotated with the `@secureCollection` annotation.
8
+ */
9
+ export declare class QueryContext<T extends DocumentData = any> {
10
+ readonly query: Query<T>;
11
+ /**
12
+ * The ID of the integration being queried.
13
+ */
14
+ get integrationId(): IntegrationId;
15
+ /**
16
+ * The name of the collection being queried.
17
+ */
18
+ get collectionName(): CollectionName;
19
+ /**
20
+ * The query limit if one exists, -1 otherwise.
21
+ */
22
+ get limit(): number;
23
+ /**
24
+ * Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
25
+ * parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
26
+ * additional fields in its sort order, but only after the specified sorts.
27
+ *
28
+ * @param sorts An array of field sorts.
29
+ * @returns Whether the query's sorts matches the provided field sorts.
30
+ */
31
+ sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
32
+ /**
33
+ * Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
34
+ * `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
35
+ * in the query.
36
+ *
37
+ * @param sorts An array of field sorts.
38
+ * @returns Whether the query's sorts exactly match the provided field sorts.
39
+ */
40
+ sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
41
+ /**
42
+ * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
43
+ * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
44
+ * additional conditions, as these only narrow the result set.
45
+ *
46
+ * @param fieldName The name of the field for the condition.
47
+ * @param operator The operator of the condition.
48
+ * @param value The value of the condition.
49
+ * @returns Whether the query is a subquery of the parent condition.
50
+ */
51
+ isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
52
+ /**
53
+ * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
54
+ * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
55
+ * additional conditions, as these only narrow the result set.
56
+ *
57
+ * @param condition The condition to validate.
58
+ * @returns Whether the query is a subquery of the parent condition.
59
+ */
60
+ isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
61
+ /**
62
+ * Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
63
+ * to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
64
+ * additional conditions, as these only narrow the result set.
65
+ *
66
+ * @param conditions The conditions to validate.
67
+ * @returns Whether the query includes subquery of the parent conditions.
68
+ */
69
+ isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
70
+ /**
71
+ * Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
72
+ * to a subset of the results that obtained for the parent query, including sorts and limits.
73
+ *
74
+ * @param query The query to validate.
75
+ * @returns Whether the query is a subquery of the parent query.
76
+ */
77
+ isSubqueryOfQuery(query: Query<T>): boolean;
78
+ /**
79
+ * Returns all conditions that apply to any of the specified field names. This method
80
+ * provides a convenient way to retrieve all conditions that involve a specific set of fields.
81
+ *
82
+ * @param fieldNames The field names for which to retrieve conditions.
83
+ * @returns An array of conditions that involve any of the specified field names.
84
+ */
85
+ getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
86
+ /**
87
+ * Returns all conditions that apply to the specified field name. This method provides
88
+ * a convenient way to retrieve all conditions that involve a specific field.
89
+ *
90
+ * @param fieldName The field name for which to retrieve conditions.
91
+ * @returns An array of conditions that involve the specified field name.
92
+ */
93
+ getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
94
+ /**
95
+ * Returns true if the given document can be a result of the query.
96
+ * The method does not account for limit and sort order.
97
+ */
98
+ documentMatchesQuery(doc: DocumentData): boolean;
99
+ }
100
+ /** A list of context conditions */
101
+ export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
102
+ /** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
103
+ export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
104
+ export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
105
+ operator: 'in';
106
+ value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
107
+ }
108
+ export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
109
+ operator: 'not in';
110
+ value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
111
+ }
112
+ export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
113
+ operator: Exclude<ContextOperator, 'in' | 'not in'>;
114
+ value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
115
+ }
116
+ /** A condition that includes the 'in' and 'not in' operators. */
117
+ export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
118
+ operator: AllOperators;
119
+ value: any;
120
+ }
121
+ /** A list of general conditions. */
122
+ export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
123
+ export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
124
+ type AllOperators = Operator | 'in' | 'not in';
125
+ /** A generic value that can exist in a query. */
126
+ export type GenericValue<Doc = any, F extends Paths<Doc> = Paths<Doc>, O extends AllOperators = any> = O extends 'in' ? Array<DeepRecord<Doc>[F]> | null : O extends 'not in' ? Array<DeepRecord<Doc>[F]> | null : DeepRecord<Doc>[F] | null;
127
+ export {};
@@ -0,0 +1,29 @@
1
+ import { AiChatPromptQuotas, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiFileUrl } from '../public-types/ai-agent.public-types';
2
+ import { AiAgentId } from '../public-types/communication.public-types';
3
+ import { FunctionName, FunctionNameWithContext } from '../public-types/bundle-data.public-types';
4
+ export type AiChatResponseFormat = 'text' | 'json_object';
5
+ export interface AiChatOptions {
6
+ maxTokens: number;
7
+ responseFormat: AiChatResponseFormat;
8
+ temperature: number;
9
+ topP: number;
10
+ instructions: Array<string>;
11
+ clientId: string;
12
+ fileUrls: Array<AiFileUrl>;
13
+ /** Constrains effort on reasoning for reasoning models. o1 models only. */
14
+ reasoningEffort?: 'low' | 'medium' | 'high';
15
+ /** Current AI profile ID (AI agent ID). */
16
+ agentId?: AiAgentId;
17
+ /** A unique chat ID for the conversation. */
18
+ chatId?: string;
19
+ /** Global per-agent context passed to all AI functions. Must be a serializable JSON. */
20
+ agentContext?: Record<string, unknown>;
21
+ /** List of AI functions available for the agent. Overrides the stored list.*/
22
+ functions?: Array<FunctionName | FunctionNameWithContext>;
23
+ /** List of connected AI agents can be called by the current agent. Overrides the stored list.*/
24
+ connectedAgents?: Array<AiConnectedAgentMetadata>;
25
+ /** List of connected integrations. Overrides the stored list. */
26
+ connectedIntegrations?: Array<AiConnectedIntegrationMetadata>;
27
+ /** Current budget for nested or recursive AI chat calls per single prompt. */
28
+ quotas?: AiChatPromptQuotas;
29
+ }
@@ -0,0 +1,40 @@
1
+ import { MmEntity, MmEntityMatch, MmFindMatchesOptions, MmListEntitiesOptions, MmMatchMaker } from '../public-types/ai-matchmaking.types';
2
+ export interface MmCreateMatchMakerRequest {
3
+ matchMaker: MmMatchMaker;
4
+ }
5
+ export interface MmDeleteEntityRequest {
6
+ matchMakerId: string;
7
+ entityId: string;
8
+ }
9
+ export interface MmInsertEntityRequest {
10
+ matchMakerId: string;
11
+ entity: MmEntity;
12
+ }
13
+ export interface MmInsertEntitiesRequest {
14
+ matchMakerId: string;
15
+ entities: Array<MmEntity>;
16
+ }
17
+ export interface MmFindMatchesRequest {
18
+ matchMakerId: string;
19
+ entityId: string;
20
+ options: MmFindMatchesOptions;
21
+ }
22
+ export interface MmFindMatchesResponse {
23
+ matches: Array<MmEntityMatch>;
24
+ }
25
+ export interface MmFindMatchesForEntityRequest {
26
+ matchMakerId: string;
27
+ entity: Omit<MmEntity, 'metadata' | 'id'>;
28
+ options: MmFindMatchesOptions;
29
+ }
30
+ export interface MmFindMatchesForEntityResponse {
31
+ matches: Array<MmEntityMatch>;
32
+ }
33
+ export interface MmListEntitiesRequest {
34
+ matchMakerId: string;
35
+ categoryId: string;
36
+ options: MmListEntitiesOptions;
37
+ }
38
+ export interface MmDeleteMatchMakerRequest {
39
+ matchMakerId: string;
40
+ }
@@ -0,0 +1 @@
1
+ export type ChatId = string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ import { MetricName } from '../metric-name';
2
+ import { AppId } from '../public-types/communication.public-types';
3
+ export interface ObservableNameMetrics {
4
+ count: MetricName;
5
+ time: MetricName;
6
+ }
7
+ export declare const ObservableNames: {
8
+ readonly functionExecution: ObservableNameMetrics;
9
+ readonly codeInitialization: ObservableNameMetrics;
10
+ readonly getAiChatbotProfiles: ObservableNameMetrics;
11
+ readonly aiImageGeneration: ObservableNameMetrics;
12
+ readonly aiRemoveBackground: ObservableNameMetrics;
13
+ readonly aiAudioTranscribe: ObservableNameMetrics;
14
+ readonly aiAudioCreateSpeech: ObservableNameMetrics;
15
+ readonly discoverGraphQLConnectionSchema: ObservableNameMetrics;
16
+ readonly discoverOpenApiSchema: ObservableNameMetrics;
17
+ readonly discoverOpenApiSchemaFromFile: ObservableNameMetrics;
18
+ readonly graphqlQuery: ObservableNameMetrics;
19
+ readonly testGraphQLConnection: ObservableNameMetrics;
20
+ readonly graphql: ObservableNameMetrics;
21
+ };
22
+ export type ObservableName = keyof typeof ObservableNames;
23
+ export interface MetricEvent {
24
+ appId: AppId;
25
+ name: MetricName;
26
+ tags: Record<string, string>;
27
+ timestamp: Date;
28
+ value: number;
29
+ isExposedToUser: boolean;
30
+ }
31
+ export interface LogEvent {
32
+ message: string;
33
+ level: string;
34
+ tags: Record<string, string>;
35
+ timestamp: Date;
36
+ isExposedToUser: boolean;
37
+ host: string;
38
+ source?: string;
39
+ service?: string;
40
+ }
41
+ export declare const AUDIT_LOG_EVENT_NAMES: readonly ["ai_agent_prompt"];
42
+ export type AuditLogEventName = (typeof AUDIT_LOG_EVENT_NAMES)[number];
43
+ export interface AuditLogEvent {
44
+ appId: AppId;
45
+ name: AuditLogEventName;
46
+ timestamp: Date;
47
+ context: {
48
+ clientId?: string;
49
+ userId: string;
50
+ };
51
+ tags: Record<string, string>;
52
+ }
53
+ /** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
54
+ export declare const O11Y_TAG_IS_ERROR = "isError";
55
+ /** Tag for log events. Metrics have an explicit appId field. */
56
+ export declare const O11Y_TAG_APP_ID = "appId";
57
+ /** Tag for metric and log events. */
58
+ export declare const O11Y_TAG_INTEGRATION_ID = "integrationId";
59
+ /** Tag for AI events. */
60
+ export declare const O11Y_TAG_AI_MODEL = "aiModel";
61
+ export declare const O11Y_TAG_AI_PROFILE = "aiProfile";
62
+ export declare const O11Y_TAG_API_KEY_SOURCE = "apiKeySource";
63
+ /** Tag for metric and log events. Value: '0' - not a tenant originated, '1' - is a tenant originated. */
64
+ export declare const O11Y_TAG_IS_TENANT_ORIGINATED = "isTenantOriginated";
65
+ /** Contains a full (with a service name) function name for backend functions. */
66
+ export declare const O11Y_TAG_FUNCTION_NAME = "functionName";
67
+ /** Contains a type of the function name for backend functions (See ExecuteFunctionAnnotationType.). */
68
+ export declare const O11Y_TAG_FUNCTION_TYPE = "functionType";
69
+ export declare function getBooleanMetricTagValue(value: boolean): string;
70
+ export declare const COUNT_METRIC_SUFFIXES: string[];
71
+ export declare const GAUGE_METRIC_SUFFIXES: string[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generates the regex pattern, handling special characters as follows:
3
+ * - `_` is replaced with a `.`
4
+ * - `%` is replaced with `[\s\S]*`.
5
+ * - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`.
6
+ * - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \
7
+ *
8
+ * Exported for testing purposes.
9
+ * */
10
+ export declare function replaceSpecialCharacters(input: string): string;
@@ -0,0 +1,2 @@
1
+ export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
2
+ export declare const APP_API_KEY = "APP_API_KEY";
@@ -0,0 +1 @@
1
+ export declare const SOCKET_RECONNECT_TIMEOUT: number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ /** Returns true if the application is run by a Playwright test. */
2
+ export declare function isPlaywrightTestMode(): boolean | undefined;
@@ -0,0 +1 @@
1
+ export declare function isTimestampEnabled(): boolean;
@@ -0,0 +1 @@
1
+ export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
@@ -0,0 +1,14 @@
1
+ type LockMutex = string;
2
+ /**
3
+ * A simple lock manager that locks a list of mutexes.
4
+ * When locking a list of mutexes, the lock will start only when all the mutexes are available - preventing partial lock
5
+ * and potential deadlocks.
6
+ */
7
+ export declare class LockManager {
8
+ private readonly locks;
9
+ lock(...mutexes: LockMutex[]): Promise<void>;
10
+ release(...mutexes: LockMutex[]): void;
11
+ canGetLock(...mutexes: LockMutex[]): boolean;
12
+ lockSync(...mutexes: LockMutex[]): void;
13
+ }
14
+ export {};
@@ -0,0 +1,4 @@
1
+ import { QueryMetricsRequestCommon, QueryMetricsResultGroup } from '../public-types/metric.public-types';
2
+ export type QueryMetricsRequestIntervals = Required<Pick<QueryMetricsRequestCommon, 'fillValue' | 'fn' | 'groupByTags' | 'periodEndSeconds' | 'periodStartSeconds' | 'pointIntervalAlignment' | 'pointIntervalSeconds' | 'tagDomains' | 'noDataBehavior'>>;
3
+ /** Adds missed known tag domain groups and fills all missed points with a request.fillValue. */
4
+ export declare function fillMissedPoints(request: QueryMetricsRequestIntervals, resultGroups: Array<QueryMetricsResultGroup>): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Type suffixes defines the type of the metric and can be used for
3
+ * metric value validation for incoming metrics.
4
+ */
5
+ export declare const SQUID_METRIC_TYPE_SUFFIXES: readonly ["_count", "_time", "_size", "_entries", "_value"];
6
+ /** Returns true if the given metric has a valid metric type. */
7
+ export declare function hasValidMetricTypeSuffix(metricName: string): boolean;
@@ -0,0 +1,49 @@
1
+ /** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
2
+ export declare function getInPath(obj: unknown, path: string): any;
3
+ export declare function isDateObject(value: unknown): value is Date;
4
+ /** Sets a value by path . Does not support array indexes. */
5
+ export declare function setInPath(obj: object, path: string, value: unknown, delimiter?: string): void;
6
+ export declare function deleteInPath(obj: object, path: string, delimiter?: string): void;
7
+ export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
8
+ export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
9
+ export declare function isNil(obj: unknown): obj is null | undefined;
10
+ export declare function isEqual(a: unknown, b: unknown): boolean;
11
+ export declare function isEmpty(a: unknown): boolean;
12
+ export declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...fieldsToRemove: K): Pick<T, Exclude<keyof T, K[number]>>;
13
+ export type CloneCustomizer = (value: unknown) => unknown | undefined;
14
+ /**
15
+ * Creates a deep copy of the specified object, including all nested objects and specifically handling Date, Map, and
16
+ * Set fields.
17
+ *
18
+ * The customizer function can modify the cloning process for the object and its fields. If the customizer
19
+ * returns 'undefined' for any input, the function falls back to the standard cloning logic.
20
+ *
21
+ * The cloning process is recursive, ensuring deep cloning of all objects.
22
+ *
23
+ * Note: This function does not support cloning objects with circular dependencies and will throw a system stack
24
+ * overflow error if encountered.
25
+ */
26
+ export declare function cloneDeep<R = unknown>(value: R, customizer?: CloneCustomizer): R;
27
+ /** Creates a shallow clone of the object. */
28
+ export declare function cloneShallow<T>(value: T): T;
29
+ export declare function deepMerge<T extends object, U extends object>(target: T, source: U): T & U;
30
+ /** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
31
+ export declare function compareValues(v1: unknown, v2: unknown): number;
32
+ /** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */
33
+ export declare function mapValues<ResultType extends object = Record<string, unknown>, InputType extends Record<string, unknown> = Record<string, unknown>>(obj: InputType, valueMapperFn: (value: any, key: keyof InputType, obj: InputType) => unknown): ResultType;
34
+ /** Groups elements of the array by key. See _.groupBy for details. */
35
+ export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (item: T) => K): Record<K, T[]>;
36
+ /**
37
+ * Picks selected fields from the object and returns a new object with the fields selected.
38
+ * The selected fields are assigned by reference (there is no cloning).
39
+ */
40
+ export declare function pick<T extends object, K extends keyof T>(obj: T, keys: ReadonlyArray<K>): Pick<T, K>;
41
+ /** Inverts the record: swaps keys and values. */
42
+ export declare function invert<K extends string | number, V extends string | number>(record: Record<K, V>): Record<V, K>;
43
+ /**
44
+ * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
45
+ * If end is less than start a zero-length range is created unless a negative step is specified.
46
+ *
47
+ * Same as lodash range but with an additional parameter: `maximumNumberOfItems`.
48
+ */
49
+ export declare function range(start: number, end: number, step: number, maximumNumberOfItems?: number): number[];
@@ -0,0 +1,5 @@
1
+ export declare function normalizeJsonAsString(json: unknown): string;
2
+ export declare function serializeObj(obj: unknown): string;
3
+ export declare function deserializeObj<T = any>(str: string): T;
4
+ export declare function encodeValueForMapping(value: unknown): string;
5
+ export declare function decodeValueForMapping(encodedString: string): any;
@@ -0,0 +1 @@
1
+ export declare const SQUID_SUPPORT_EMAIL = "support@getsquid.ai";
@@ -0,0 +1,20 @@
1
+ import { HttpStatus } from '../public-types/http-status.enum';
2
+ export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT | HttpStatus.INTERNAL_SERVER_ERROR;
3
+ export declare class ValidationError extends Error {
4
+ readonly statusCode: StatusCode;
5
+ readonly details?: any;
6
+ constructor(error: string, statusCode: StatusCode, details?: Record<string, any>);
7
+ }
8
+ export declare function isValidId(id: unknown, maxLength?: number): boolean;
9
+ export declare function validateFieldSort(fieldSort: unknown): void;
10
+ export declare function validateQueryLimit(limit: unknown): void;
11
+ /**
12
+ * All type names returned by 'typeof' supported by JavaScript:
13
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}.
14
+ * and a few other supported types.
15
+ */
16
+ export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function';
17
+ /** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */
18
+ export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean;
19
+ /** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */
20
+ export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;
@@ -0,0 +1,26 @@
1
+ interface Options {
2
+ maxAttempts?: number;
3
+ protocols?: string[];
4
+ onmessage?: (event: any) => void;
5
+ onopen?: (event: any) => void;
6
+ onclose?: (event: any) => void;
7
+ onerror?: (event: any) => void;
8
+ onreconnect?: (event: any) => void;
9
+ onmaximum?: (event: any) => void;
10
+ timeoutMillis?: number;
11
+ }
12
+ export interface WebSocketWrapper {
13
+ open: () => void;
14
+ reconnect: (e: any) => void;
15
+ json: (x: any) => void;
16
+ send: (x: string) => void;
17
+ close: (x?: number, y?: string) => void;
18
+ connected: boolean;
19
+ /**
20
+ * Websocket is explicitly closed by calling socket.close().
21
+ * Used to ignore errors after socket.closed() is called.
22
+ */
23
+ closeCalled: boolean;
24
+ }
25
+ export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper;
26
+ export {};
@@ -1,4 +1,4 @@
1
- import { AiAgentChatOptions, AiAgentContext, AiAgentId, AiAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResponse, AiStatusMessage, AiTranscribeAndAskResponse, AiTranscribeAndChatResponse, MUTABLE_AI_AGENT_METADATA_FIELDS } from './public-types';
1
+ import { AiAgentChatOptions, AiContext, AiAgentId, AiAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResponse, AiStatusMessage, AiTranscribeAndAskResponse, AiTranscribeAndChatResponse, MUTABLE_AI_AGENT_METADATA_FIELDS } from './public-types';
2
2
  import { Observable } from 'rxjs';
3
3
  import { BlobAndFilename } from './types';
4
4
  export interface TranscribeAndChatResponse {
@@ -67,13 +67,13 @@ export declare class AiAgentClient {
67
67
  }
68
68
  export interface AiChatBotContextData {
69
69
  title: string;
70
- context: AiAgentContext;
70
+ context: AiContext;
71
71
  }
72
72
  export interface AiChatBotContextDataWithId extends AiChatBotContextData {
73
73
  id?: string;
74
74
  }
75
75
  export type AiAgentData = Pick<AiAgentMetadata, (typeof MUTABLE_AI_AGENT_METADATA_FIELDS)[number]>;
76
- export interface InstructionData {
76
+ export interface AiInstructionData {
77
77
  instruction: string;
78
78
  }
79
79
  export declare class AiAgentReference {
@@ -208,7 +208,7 @@ export declare class AiAgentInstructionReference {
208
208
  * @param data.instruction - The instruction data.
209
209
  * @returns A promise that resolves when the instruction entry is successfully created.
210
210
  */
211
- insert(data: InstructionData): Promise<void>;
211
+ insert(data: AiInstructionData): Promise<void>;
212
212
  /**
213
213
  * Updates an existing instruction entry for the agent.
214
214
  * Throws an error if an entry with the specified instruction ID does not exist.
@@ -217,7 +217,7 @@ export declare class AiAgentInstructionReference {
217
217
  * @param data.instruction - The instruction data.
218
218
  * @returns A promise that resolves when the instruction entry is successfully updated.
219
219
  */
220
- update(data: InstructionData): Promise<void>;
220
+ update(data: AiInstructionData): Promise<void>;
221
221
  /**
222
222
  * Deletes an existing instruction entry for the agent.
223
223
  * Throws an error if an entry with the specified instruction ID does not exist.
@@ -226,11 +226,3 @@ export declare class AiAgentInstructionReference {
226
226
  */
227
227
  delete(): Promise<void>;
228
228
  }
229
- export declare class AiChatbotProfileReference extends AiAgentReference {
230
- }
231
- export declare class AiChatbotClient extends AiAgentClient {
232
- }
233
- export declare class AiChatbotContextReference extends AiAgentContextReference {
234
- }
235
- export declare class AiChatbotInstructionReference extends AiAgentInstructionReference {
236
- }