@squidcloud/client 1.0.286 → 1.0.288
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/internal-common/src/public-types/ai-assistant.public-types.d.ts +5 -0
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +22 -16
- package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +5 -0
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +6 -0
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.public-types.d.ts +2 -1
- package/dist/typescript-client/src/ai-agent-client.d.ts +2 -1
- package/dist/typescript-client/src/ai.types.d.ts +22 -1
- package/dist/typescript-client/src/index.d.ts +1 -0
- package/dist/typescript-client/src/integration-client.d.ts +6 -0
- package/dist/typescript-client/src/squid.d.ts +5 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +5 -2
- package/dist/internal-common/src/metric-name.d.ts +0 -9
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -21
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -18
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -123
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +0 -1
- package/dist/internal-common/src/types/ai-chatbot.types.d.ts +0 -13
- 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/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/observability.types.d.ts +0 -59
- package/dist/internal-common/src/types/query.types.d.ts +0 -10
- package/dist/internal-common/src/types/secret.types.d.ts +0 -2
- package/dist/internal-common/src/types/socket.types.d.ts +0 -1
- package/dist/internal-common/src/types/time-units.d.ts +0 -1
- package/dist/internal-common/src/utils/array.d.ts +0 -1
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
- package/dist/internal-common/src/utils/http.d.ts +0 -2
- package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
- package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
- package/dist/internal-common/src/utils/object.d.ts +0 -49
- package/dist/internal-common/src/utils/serialization.d.ts +0 -5
- package/dist/internal-common/src/utils/validation.d.ts +0 -20
- package/dist/internal-common/src/websocket.impl.d.ts +0 -26
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { OpenAiResponseFormat } from './ai-chatbot.public-types';
|
|
2
|
+
import { FunctionName } from './bundle-data.public-types';
|
|
2
3
|
export type AssistantToolType = 'code_interpreter' | 'file_search';
|
|
3
4
|
/** The options for the AI assistant. */
|
|
4
5
|
export interface QueryAssistantOptions {
|
|
6
|
+
/** Extra context passed to all AI functions. */
|
|
7
|
+
agentContext?: Record<string, unknown>;
|
|
8
|
+
/** Extra context per AI function.*/
|
|
9
|
+
functionContexts?: Record<FunctionName, Record<string, unknown>>;
|
|
5
10
|
/** The format of the response from the AI model. Defaults to 'text' */
|
|
6
11
|
responseFormat?: OpenAiResponseFormat;
|
|
7
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionName } from './bundle-data.public-types';
|
|
1
|
+
import { FunctionName, FunctionNameWithContext } from './bundle-data.public-types';
|
|
2
2
|
import { IntegrationId } from './communication.public-types';
|
|
3
3
|
/** The supported OpenAI models */
|
|
4
4
|
export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "gpt-4-turbo-preview", "gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "o1-preview", "o1-mini", "gpt-4-turbo"];
|
|
@@ -106,33 +106,39 @@ export interface AiFileUrl {
|
|
|
106
106
|
}
|
|
107
107
|
/** The options for the AI chatbot chat method. */
|
|
108
108
|
export interface AiChatbotChatOptions {
|
|
109
|
-
/** The maximum number of tokens to use when making the request to the AI model. Default to the max tokens the model can accept */
|
|
109
|
+
/** The maximum number of tokens to use when making the request to the AI model. Default to the max tokens the model can accept. */
|
|
110
110
|
maxTokens?: number;
|
|
111
|
-
/** A unique chat ID, if the same chat ID is used again and history is not disabled, it will continue the conversation */
|
|
111
|
+
/** A unique chat ID, if the same chat ID is used again and history is not disabled, it will continue the conversation. */
|
|
112
112
|
chatId?: string;
|
|
113
|
-
/** Whether to disable history for the chat. Default to false */
|
|
113
|
+
/** Whether to disable history for the chat. Default to false. */
|
|
114
114
|
disableHistory?: boolean;
|
|
115
|
-
/** Whether to include references from the source context in the response. Default to false */
|
|
115
|
+
/** Whether to include references from the source context in the response. Default to false. */
|
|
116
116
|
includeReference?: boolean;
|
|
117
|
-
/** The format of the response from the AI model. Note that not all models support JSON format. Default to 'text' */
|
|
117
|
+
/** The format of the response from the AI model. Note that not all models support JSON format. Default to 'text'. */
|
|
118
118
|
responseFormat?: OpenAiResponseFormat;
|
|
119
|
-
/** Whether to response in a "smooth typing" way, beneficial when the chat result is displayed in a UI. Default to true */
|
|
119
|
+
/** Whether to response in a "smooth typing" way, beneficial when the chat result is displayed in a UI. Default to true. */
|
|
120
120
|
smoothTyping?: boolean;
|
|
121
|
-
/** The temperature to use when sampling from the model. Default to 0.5 */
|
|
121
|
+
/** The temperature to use when sampling from the model. Default to 0.5. */
|
|
122
122
|
temperature?: number;
|
|
123
|
-
/** The top P value to use when sampling from the model. Default to 1 */
|
|
123
|
+
/** The top P value to use when sampling from the model. Default to 1. */
|
|
124
124
|
topP?: number;
|
|
125
|
-
/** The model to use for this chat. If not provided, the profile model will be used */
|
|
125
|
+
/** The model to use for this chat. If not provided, the profile model will be used. */
|
|
126
126
|
overrideModel?: AiChatModelName;
|
|
127
|
-
/** File URLs (only images supported at the moment) */
|
|
127
|
+
/** File URLs (only images supported at the moment). */
|
|
128
128
|
fileUrls?: Array<AiFileUrl>;
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
/**
|
|
129
|
+
/** Global context passed to the agent and all AI functions of the agent. */
|
|
130
|
+
agentContext?: Record<string, unknown>;
|
|
131
|
+
/**
|
|
132
|
+
* Functions to expose to the AI.
|
|
133
|
+
* Either a function name or a name with an extra function context passed only to this function.
|
|
134
|
+
* The parameter values must be valid serializable JSON values.
|
|
135
|
+
*/
|
|
136
|
+
functions?: Array<FunctionName | FunctionNameWithContext>;
|
|
137
|
+
/** A list of instructions to include with the prompt. */
|
|
132
138
|
instructions?: Array<string>;
|
|
133
|
-
/** A set of filters that will limit the context the AI can access */
|
|
139
|
+
/** A set of filters that will limit the context the AI can access. */
|
|
134
140
|
contextMetadataFilter?: AiContextMetadataFilter;
|
|
135
|
-
/** The options to use for the response in voice */
|
|
141
|
+
/** The options to use for the response in voice. */
|
|
136
142
|
voiceOptions?: AiAudioCreateSpeechOptions;
|
|
137
143
|
}
|
|
138
144
|
export interface AiAskResponse {
|
|
@@ -17,5 +17,10 @@ export interface AiFunctionParam {
|
|
|
17
17
|
}
|
|
18
18
|
export type TopicName = string;
|
|
19
19
|
export type FunctionName = string;
|
|
20
|
+
/** Function name with the contextual data. The data must be a serializable JSON. */
|
|
21
|
+
export interface FunctionNameWithContext {
|
|
22
|
+
name: FunctionName;
|
|
23
|
+
context: Record<string, unknown>;
|
|
24
|
+
}
|
|
20
25
|
export type ServiceName = string;
|
|
21
26
|
export type ServiceFunctionName = `${ServiceName}:${FunctionName}`;
|
|
@@ -71,3 +71,9 @@ export declare enum IntegrationSchemaType {
|
|
|
71
71
|
'graphql' = "graphql"
|
|
72
72
|
}
|
|
73
73
|
export declare const AI_AGENTS_INTEGRATION_ID: IntegrationId;
|
|
74
|
+
export interface IntegrationInfo {
|
|
75
|
+
id: IntegrationId;
|
|
76
|
+
type: IntegrationType;
|
|
77
|
+
creationDate?: Date;
|
|
78
|
+
updateDate?: Date;
|
|
79
|
+
}
|
|
@@ -6,7 +6,7 @@ export type AiChatbotConfiguration = {
|
|
|
6
6
|
export type AiChatbotProfileMetadata = {
|
|
7
7
|
modelName: AiChatModelName;
|
|
8
8
|
isPublic: boolean;
|
|
9
|
-
strictContext
|
|
9
|
+
strictContext?: boolean;
|
|
10
10
|
instructions: Record<string, string>;
|
|
11
11
|
/** 'text-embedding-ada-002' if undefined. */
|
|
12
12
|
embeddingModelName?: AiEmbeddingsModelName;
|
|
@@ -14,6 +14,7 @@ export type AiChatbotProfileMetadata = {
|
|
|
14
14
|
vectorDbType?: VectorDbType;
|
|
15
15
|
/** List of AI functions attached to the profile by default. */
|
|
16
16
|
functions?: Array<FunctionName>;
|
|
17
|
+
auditLog?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export type AiChatbotContextMetadata = {
|
|
19
20
|
title: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AiProfileId, AiChatbotChatOptions, AiChatbotContext, AiChatModelName, AiSearchOptions, AiSearchResponse, AiTranscribeAndAskResponse, AiTranscribeAndChatResponse } from './public-types';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { BlobAndFilename } from './types';
|
|
3
4
|
export interface TranscribeAndChatResponse {
|
|
4
5
|
transcribedPrompt: string;
|
|
5
6
|
responseStream: Observable<string>;
|
|
@@ -161,7 +162,7 @@ export declare class AiAgentContextReference {
|
|
|
161
162
|
* @param file - The file to insert.
|
|
162
163
|
* @returns A promise that resolves when the context is successfully created.
|
|
163
164
|
*/
|
|
164
|
-
insert(data: AiChatBotContextData, file?: File): Promise<void>;
|
|
165
|
+
insert(data: AiChatBotContextData, file?: File | BlobAndFilename): Promise<void>;
|
|
165
166
|
/**
|
|
166
167
|
* Appends data to an existing context entry on the chatbot profile. This will result in an error if an entry has not
|
|
167
168
|
* @param data An object containing options for appending the entry.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AiAgentReference, AiChatbotClient } from './ai-agent-client';
|
|
2
2
|
import { AiAssistantClient } from './ai-assistant-client';
|
|
3
|
-
import { IntegrationId } from './public-types';
|
|
3
|
+
import { ApiOptions, IntegrationId } from './public-types';
|
|
4
4
|
import { AiImageClient } from './ai-image-client';
|
|
5
5
|
import { AiAudioClient } from './ai-audio-client';
|
|
6
6
|
export interface ExecuteAiQueryRequest {
|
|
@@ -11,6 +11,12 @@ export interface ExecuteAiQueryMultiRequest {
|
|
|
11
11
|
integrationIds: Array<IntegrationId>;
|
|
12
12
|
prompt: string;
|
|
13
13
|
}
|
|
14
|
+
export interface ExecuteAiApiRequest {
|
|
15
|
+
integrationId: IntegrationId;
|
|
16
|
+
prompt: string;
|
|
17
|
+
allowedEndpoints?: string[];
|
|
18
|
+
provideExplanation?: boolean;
|
|
19
|
+
}
|
|
14
20
|
export interface ExecuteAiQueryResponse {
|
|
15
21
|
answer: string;
|
|
16
22
|
explanation?: string;
|
|
@@ -28,6 +34,20 @@ export interface ExecuteAiQueryMultiResponse {
|
|
|
28
34
|
executedQueries: Array<ExecutedQuery>;
|
|
29
35
|
success: boolean;
|
|
30
36
|
}
|
|
37
|
+
interface ApiResult {
|
|
38
|
+
endpointId: string;
|
|
39
|
+
responseBody: string;
|
|
40
|
+
responseStatusCode: number;
|
|
41
|
+
requestBody: any;
|
|
42
|
+
requestOptions: ApiOptions;
|
|
43
|
+
}
|
|
44
|
+
export interface ExecuteAiApiResponse {
|
|
45
|
+
answer: string;
|
|
46
|
+
explanation?: string;
|
|
47
|
+
executedApis?: Array<ApiResult>;
|
|
48
|
+
queryMarkdownType?: string;
|
|
49
|
+
success: boolean;
|
|
50
|
+
}
|
|
31
51
|
/**
|
|
32
52
|
* AiClient class serves as a facade for interacting with different AI services.
|
|
33
53
|
* It provides simplified access to AI chatbot and assistant functionalities
|
|
@@ -83,5 +103,6 @@ export declare class AiClient {
|
|
|
83
103
|
*/
|
|
84
104
|
executeAiQuery(integrationId: IntegrationId, prompt: string): Promise<ExecuteAiQueryResponse>;
|
|
85
105
|
executeAiQueryMulti(integrationIds: Array<IntegrationId>, prompt: string): Promise<ExecuteAiQueryMultiResponse>;
|
|
106
|
+
executeAiApiCall(integrationId: IntegrationId, prompt: string, allowedEndpoints?: string[], provideExplanation?: boolean): Promise<ExecuteAiApiResponse>;
|
|
86
107
|
}
|
|
87
108
|
export {};
|
|
@@ -37,6 +37,7 @@ export * from './rpc.manager';
|
|
|
37
37
|
export * from './observability-client';
|
|
38
38
|
export * from './secret.client';
|
|
39
39
|
export * from './scheduler-client';
|
|
40
|
+
export * from './integration-client';
|
|
40
41
|
export * from './socket.manager';
|
|
41
42
|
export * from './squid-http-client';
|
|
42
43
|
export * from './squid';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IntegrationId, IntegrationInfo, IntegrationType } from './public-types';
|
|
2
|
+
export declare class IntegrationClient {
|
|
3
|
+
private readonly rpcManager;
|
|
4
|
+
list(type?: IntegrationType): Promise<IntegrationInfo[]>;
|
|
5
|
+
get(id: IntegrationId): Promise<IntegrationInfo | undefined>;
|
|
6
|
+
}
|
|
@@ -12,6 +12,7 @@ import { ObservabilityClient } from './observability-client';
|
|
|
12
12
|
import { ExtractionClient } from './extraction-client';
|
|
13
13
|
import { PersonalStorageClient } from './personal-storage-client';
|
|
14
14
|
import { SchedulerClient } from './scheduler-client';
|
|
15
|
+
import { IntegrationClient } from './integration-client';
|
|
15
16
|
/** The different options that can be used to initialize a Squid instance. */
|
|
16
17
|
export interface SquidOptions {
|
|
17
18
|
/**
|
|
@@ -105,6 +106,8 @@ export declare class Squid {
|
|
|
105
106
|
private readonly observabilityClient;
|
|
106
107
|
private readonly queueManagerFactory;
|
|
107
108
|
private readonly schedulerClient;
|
|
109
|
+
private readonly integrationClient;
|
|
110
|
+
private readonly _appId;
|
|
108
111
|
/**
|
|
109
112
|
* Creates a new instance of Squid with the given options.
|
|
110
113
|
*
|
|
@@ -210,6 +213,8 @@ export declare class Squid {
|
|
|
210
213
|
get secrets(): SecretClient;
|
|
211
214
|
get observability(): ObservabilityClient;
|
|
212
215
|
get schedulers(): SchedulerClient;
|
|
216
|
+
get integrations(): IntegrationClient;
|
|
217
|
+
get appId(): AppId;
|
|
213
218
|
/**
|
|
214
219
|
* Returns a distributed lock for the given mutex. The lock can be used to synchronize access to a shared resource.
|
|
215
220
|
* The lock will be released when the release method on the returned object is invoked or whenever the connection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.
|
|
1
|
+
export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.288";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.288",
|
|
4
4
|
"description": "A typescript implementation of the Squid client",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/typescript-client/src/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
44
|
"bufferutil": "^4.0.8",
|
|
45
|
-
"utf-8-validate":
|
|
45
|
+
"utf-8-validate": "^6.0.4"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"rxjs": ">=7.5.7 <8.0.0"
|
|
@@ -58,5 +58,8 @@
|
|
|
58
58
|
"tscpaths": "^0.0.9",
|
|
59
59
|
"webpack": "^5.95.0",
|
|
60
60
|
"webpack-cli": "^5.1.4"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=20.0.0"
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Names of the Squid metrics.
|
|
3
|
-
* Should be in sync with MetricName.kt.
|
|
4
|
-
* See MetricName.kt for documentation on each value.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_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_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_webhook_count", "squid_webhook_time"];
|
|
7
|
-
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
8
|
-
/** Common prefix for all Squid metrics. */
|
|
9
|
-
export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,123 +0,0 @@
|
|
|
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
|
-
export declare class QueryContext<T extends DocumentData = any> {
|
|
6
|
-
readonly query: Query<T>;
|
|
7
|
-
/**
|
|
8
|
-
* The ID of the integration being queried.
|
|
9
|
-
*/
|
|
10
|
-
get integrationId(): IntegrationId;
|
|
11
|
-
/**
|
|
12
|
-
* The name of the collection being queried.
|
|
13
|
-
*/
|
|
14
|
-
get collectionName(): CollectionName;
|
|
15
|
-
/**
|
|
16
|
-
* The query limit if one exists, -1 otherwise.
|
|
17
|
-
*/
|
|
18
|
-
get limit(): number;
|
|
19
|
-
/**
|
|
20
|
-
* Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
|
|
21
|
-
* parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
|
|
22
|
-
* additional fields in its sort order, but only after the specified sorts.
|
|
23
|
-
*
|
|
24
|
-
* @param sorts An array of field sorts.
|
|
25
|
-
* @returns Whether the query's sorts matches the provided field sorts.
|
|
26
|
-
*/
|
|
27
|
-
sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
|
|
30
|
-
* `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
|
|
31
|
-
* in the query.
|
|
32
|
-
*
|
|
33
|
-
* @param sorts An array of field sorts.
|
|
34
|
-
* @returns Whether the query's sorts exactly match the provided field sorts.
|
|
35
|
-
*/
|
|
36
|
-
sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
|
|
39
|
-
* to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
|
|
40
|
-
* additional conditions, as these only narrow the result set.
|
|
41
|
-
*
|
|
42
|
-
* @param fieldName The name of the field for the condition.
|
|
43
|
-
* @param operator The operator of the condition.
|
|
44
|
-
* @param value The value of the condition.
|
|
45
|
-
* @returns Whether the query is a subquery of the parent condition.
|
|
46
|
-
*/
|
|
47
|
-
isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
|
|
50
|
-
* to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
|
|
51
|
-
* additional conditions, as these only narrow the result set.
|
|
52
|
-
*
|
|
53
|
-
* @param condition The condition to validate.
|
|
54
|
-
* @returns Whether the query is a subquery of the parent condition.
|
|
55
|
-
*/
|
|
56
|
-
isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
|
|
59
|
-
* to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
|
|
60
|
-
* additional conditions, as these only narrow the result set.
|
|
61
|
-
*
|
|
62
|
-
* @param conditions The conditions to validate.
|
|
63
|
-
* @returns Whether the query includes subquery of the parent conditions.
|
|
64
|
-
*/
|
|
65
|
-
isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
|
|
68
|
-
* to a subset of the results that obtained for the parent query, including sorts and limits.
|
|
69
|
-
*
|
|
70
|
-
* @param query The query to validate.
|
|
71
|
-
* @returns Whether the query is a subquery of the parent query.
|
|
72
|
-
*/
|
|
73
|
-
isSubqueryOfQuery(query: Query<T>): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Returns all conditions that apply to any of the specified field names. This method
|
|
76
|
-
* provides a convenient way to retrieve all conditions that involve a specific set of fields.
|
|
77
|
-
*
|
|
78
|
-
* @param fieldNames The field names for which to retrieve conditions.
|
|
79
|
-
* @returns An array of conditions that involve any of the specified field names.
|
|
80
|
-
*/
|
|
81
|
-
getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
|
|
82
|
-
/**
|
|
83
|
-
* Returns all conditions that apply to the specified field name. This method provides
|
|
84
|
-
* a convenient way to retrieve all conditions that involve a specific field.
|
|
85
|
-
*
|
|
86
|
-
* @param fieldName The field name for which to retrieve conditions.
|
|
87
|
-
* @returns An array of conditions that involve the specified field name.
|
|
88
|
-
*/
|
|
89
|
-
getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
|
|
90
|
-
/**
|
|
91
|
-
* Returns true if the given document can be a result of the query.
|
|
92
|
-
* The method does not account for limit and sort order.
|
|
93
|
-
*/
|
|
94
|
-
documentMatchesQuery(doc: DocumentData): boolean;
|
|
95
|
-
}
|
|
96
|
-
/** A list of context conditions */
|
|
97
|
-
export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
|
|
98
|
-
/** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
|
|
99
|
-
export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
100
|
-
export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
|
|
101
|
-
operator: 'in';
|
|
102
|
-
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
103
|
-
}
|
|
104
|
-
export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
|
|
105
|
-
operator: 'not in';
|
|
106
|
-
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
107
|
-
}
|
|
108
|
-
export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
|
|
109
|
-
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
110
|
-
value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
|
|
111
|
-
}
|
|
112
|
-
/** A condition that includes the 'in' and 'not in' operators. */
|
|
113
|
-
export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
|
|
114
|
-
operator: AllOperators;
|
|
115
|
-
value: any;
|
|
116
|
-
}
|
|
117
|
-
/** A list of general conditions. */
|
|
118
|
-
export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
|
|
119
|
-
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
120
|
-
type AllOperators = Operator | 'in' | 'not in';
|
|
121
|
-
/** A generic value that can exist in a query. */
|
|
122
|
-
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;
|
|
123
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AiFileUrl } from '../public-types/ai-chatbot.public-types';
|
|
2
|
-
import { FunctionName } from '../public-types/bundle-data.public-types';
|
|
3
|
-
export type AiChatResponseFormat = 'text' | 'json_object';
|
|
4
|
-
export interface AiChatOptions {
|
|
5
|
-
maxTokens: number;
|
|
6
|
-
responseFormat: AiChatResponseFormat;
|
|
7
|
-
temperature: number;
|
|
8
|
-
topP: number;
|
|
9
|
-
instructions: Array<string>;
|
|
10
|
-
clientId: string;
|
|
11
|
-
fileUrls: Array<AiFileUrl>;
|
|
12
|
-
functions?: Array<FunctionName>;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ChatId = string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
/** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
|
|
42
|
-
export declare const O11Y_TAG_IS_ERROR = "isError";
|
|
43
|
-
/** Tag for log events. Metrics have an explicit appId field. */
|
|
44
|
-
export declare const O11Y_TAG_APP_ID = "appId";
|
|
45
|
-
/** Tag for metric and log events. */
|
|
46
|
-
export declare const O11Y_TAG_INTEGRATION_ID = "integrationId";
|
|
47
|
-
/** Tag for AI events. */
|
|
48
|
-
export declare const O11Y_TAG_AI_MODEL = "aiModel";
|
|
49
|
-
export declare const O11Y_TAG_AI_PROFILE = "aiProfile";
|
|
50
|
-
export declare const O11Y_TAG_API_KEY_SOURCE = "apiKeySource";
|
|
51
|
-
/** Tag for metric and log events. Value: '0' - not a tenant originated, '1' - is a tenant originated. */
|
|
52
|
-
export declare const O11Y_TAG_IS_TENANT_ORIGINATED = "isTenantOriginated";
|
|
53
|
-
/** Contains a full (with a service name) function name for backend functions. */
|
|
54
|
-
export declare const O11Y_TAG_FUNCTION_NAME = "functionName";
|
|
55
|
-
/** Contains a type of the function name for backend functions (See ExecuteFunctionAnnotationType.). */
|
|
56
|
-
export declare const O11Y_TAG_FUNCTION_TYPE = "functionType";
|
|
57
|
-
export declare function getBooleanMetricTagValue(value: boolean): string;
|
|
58
|
-
export declare const COUNT_METRIC_SUFFIXES: string[];
|
|
59
|
-
export declare const GAUGE_METRIC_SUFFIXES: string[];
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isTimestampEnabled(): boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,4 +0,0 @@
|
|
|
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;
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|