@squidcloud/client 1.0.285 → 1.0.287
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/bundle-data.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/communication.public-types.d.ts +4 -2
- package/dist/internal-common/src/public-types/context.public-types.d.ts +1 -0
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.public-types.d.ts +7 -1
- package/dist/internal-common/src/public-types/integrations/api.public-types.d.ts +2 -0
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +0 -4
- package/dist/typescript-client/src/ai-agent-client.d.ts +3 -3
- package/dist/typescript-client/src/ai.types.d.ts +22 -1
- package/dist/typescript-client/src/collection-reference.d.ts +1 -1
- package/dist/typescript-client/src/document-reference.d.ts +1 -1
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +1 -1
- package/dist/typescript-client/src/secret.client.d.ts +20 -2
- package/dist/typescript-client/src/squid.d.ts +5 -5
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +5 -2
- 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/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/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
|
@@ -9,7 +9,6 @@ export type MetricActionType = 'write' | 'all';
|
|
|
9
9
|
/** The different types of actions that can be performed on an AI chatbot. */
|
|
10
10
|
export type AiChatbotActionType = 'chat' | 'mutate' | 'all';
|
|
11
11
|
export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
|
|
12
|
-
export type FunctionName = string;
|
|
13
12
|
export interface AiFunctionParam {
|
|
14
13
|
name: string;
|
|
15
14
|
description: string;
|
|
@@ -17,5 +16,6 @@ export interface AiFunctionParam {
|
|
|
17
16
|
required: boolean;
|
|
18
17
|
}
|
|
19
18
|
export type TopicName = string;
|
|
19
|
+
export type FunctionName = string;
|
|
20
20
|
export type ServiceName = string;
|
|
21
21
|
export type ServiceFunctionName = `${ServiceName}:${FunctionName}`;
|
|
@@ -3,10 +3,12 @@ export type AppId = string;
|
|
|
3
3
|
export declare const ENVIRONMENT_IDS: readonly ["dev", "prod"];
|
|
4
4
|
export type EnvironmentId = (typeof ENVIRONMENT_IDS)[number];
|
|
5
5
|
export type SquidDeveloperId = string;
|
|
6
|
-
/** @deprecated. Use ENVIRONMENT_IDS. */
|
|
7
|
-
export declare const allEnvironmentIds: Array<EnvironmentId>;
|
|
8
6
|
/** A type alias for an integration id. */
|
|
9
7
|
export type IntegrationId = string;
|
|
10
8
|
export type ClientId = string;
|
|
11
9
|
export type SquidDocId = string;
|
|
12
10
|
export type ClientRequestId = string;
|
|
11
|
+
/** ID of AI agent. Also known as AI profile id. */
|
|
12
|
+
export type AiAgentId = string;
|
|
13
|
+
export type AiProfileId = AiAgentId;
|
|
14
|
+
export type AiContextId = string;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { AiChatModelName, AiEmbeddingsModelName, VectorDbType } from '../ai-chatbot.public-types';
|
|
2
|
+
import { FunctionName } from '../bundle-data.public-types';
|
|
2
3
|
export type AiChatbotConfiguration = {
|
|
3
4
|
apiKey?: string;
|
|
4
5
|
};
|
|
5
6
|
export type AiChatbotProfileMetadata = {
|
|
6
7
|
modelName: AiChatModelName;
|
|
7
8
|
isPublic: boolean;
|
|
8
|
-
strictContext
|
|
9
|
+
strictContext?: boolean;
|
|
9
10
|
instructions: Record<string, string>;
|
|
11
|
+
/** 'text-embedding-ada-002' if undefined. */
|
|
10
12
|
embeddingModelName?: AiEmbeddingsModelName;
|
|
13
|
+
/** 'pinecone' if undefined. */
|
|
11
14
|
vectorDbType?: VectorDbType;
|
|
15
|
+
/** List of AI functions attached to the profile by default. */
|
|
16
|
+
functions?: Array<FunctionName>;
|
|
17
|
+
auditLog?: boolean;
|
|
12
18
|
};
|
|
13
19
|
export type AiChatbotContextMetadata = {
|
|
14
20
|
title: string;
|
|
@@ -11,6 +11,7 @@ export type IntegrationApiEndpoints = Record<ApiEndpointId, ApiEndpoint>;
|
|
|
11
11
|
export interface ApiRequestField {
|
|
12
12
|
location: ApiParameterLocation;
|
|
13
13
|
description?: string;
|
|
14
|
+
required?: boolean;
|
|
14
15
|
}
|
|
15
16
|
/** The options for calling an API. */
|
|
16
17
|
export interface CallApiOptions {
|
|
@@ -55,6 +56,7 @@ export interface ApiEndpoint {
|
|
|
55
56
|
responseSchema?: Record<FieldPath, ApiResponseField>;
|
|
56
57
|
injectionSchema?: ApiInjectionSchema;
|
|
57
58
|
tags?: Array<string>;
|
|
59
|
+
description?: string;
|
|
58
60
|
}
|
|
59
61
|
export interface DiscoverOpenApiSchemaRequest {
|
|
60
62
|
integrationId: IntegrationId;
|
|
@@ -2,7 +2,3 @@
|
|
|
2
2
|
export declare const SQUID_REGIONS: readonly ["us-east-1.aws", "ap-south-1.aws", "us-central1.gcp"];
|
|
3
3
|
/** Region type used by Squid. */
|
|
4
4
|
export type SquidRegion = (typeof SQUID_REGIONS)[number];
|
|
5
|
-
/** @deprecated: Use 'SQUID_REGIONS'. */
|
|
6
|
-
export declare const SUPPORTED_SQUID_REGIONS: readonly ["us-east-1.aws", "ap-south-1.aws", "us-central1.gcp"];
|
|
7
|
-
/** @deprecated: Use 'SquidRegion'. */
|
|
8
|
-
export type SupportedSquidRegion = SquidRegion;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiChatbotChatOptions, AiChatbotContext, AiChatModelName, AiSearchOptions, AiSearchResponse, AiTranscribeAndAskResponse, AiTranscribeAndChatResponse } from './public-types';
|
|
1
|
+
import { AiProfileId, AiChatbotChatOptions, AiChatbotContext, AiChatModelName, AiSearchOptions, AiSearchResponse, AiTranscribeAndAskResponse, AiTranscribeAndChatResponse } from './public-types';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
export interface TranscribeAndChatResponse {
|
|
4
4
|
transcribedPrompt: string;
|
|
@@ -49,12 +49,12 @@ export declare class AiAgentClient {
|
|
|
49
49
|
/**
|
|
50
50
|
* Sends a prompt to the specified profile id and returns the response as a Promise of string.
|
|
51
51
|
*
|
|
52
|
-
* @param
|
|
52
|
+
* @param agentId - The agent id (profile id).
|
|
53
53
|
* @param prompt - The prompt.
|
|
54
54
|
* @param options - The options to send to the chat model.
|
|
55
55
|
* @returns A promise that resolves when the chat is complete. The resolved value is the entire response.
|
|
56
56
|
*/
|
|
57
|
-
ask(
|
|
57
|
+
ask(agentId: AiProfileId, prompt: string, options?: AskOptionsWithoutVoice): Promise<string>;
|
|
58
58
|
transcribeAndAsk(profileId: string, fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
|
|
59
59
|
transcribeAndAskWithVoiceResponse(profileId: string, fileToTranscribe: File, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
|
|
60
60
|
askWithVoiceResponse(profileId: string, prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
|
|
@@ -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 {};
|
|
@@ -20,7 +20,7 @@ export interface DocIdAndData<T extends DocumentData> {
|
|
|
20
20
|
* collection in a NoSQL database.
|
|
21
21
|
*
|
|
22
22
|
* Read more about collection references in the
|
|
23
|
-
* {@link https://docs.
|
|
23
|
+
* {@link https://docs.getsquid.ai/docs/database/collection-reference documentation}.
|
|
24
24
|
* @typeParam T The type of the document data.
|
|
25
25
|
*/
|
|
26
26
|
export declare class CollectionReference<T extends DocumentData> {
|
|
@@ -9,7 +9,7 @@ import { DeepRecord, Paths } from '../../internal-common/src/public-types/typesc
|
|
|
9
9
|
* use to create a new document.
|
|
10
10
|
*
|
|
11
11
|
* Read more about document references in the
|
|
12
|
-
* {@link https://docs.
|
|
12
|
+
* {@link https://docs.getsquid.ai/docs/database/document-reference documentation}.
|
|
13
13
|
* @typeParam T The type of the document data.
|
|
14
14
|
*/
|
|
15
15
|
export declare class DocumentReference<T extends DocumentData = any> {
|
|
@@ -40,7 +40,7 @@ interface HasGrouped {
|
|
|
40
40
|
/**
|
|
41
41
|
* A query builder that can participate in a join.
|
|
42
42
|
* To learn more about join queries, see the
|
|
43
|
-
* {@link https://docs.
|
|
43
|
+
* {@link https://docs.getsquid.ai/docs/database/queries#joining-data-across-collections-and-integrations documentation}.
|
|
44
44
|
*/
|
|
45
45
|
export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, LatestAlias extends Alias, RootAlias extends Alias> extends BaseQueryBuilder<ReturnType> implements SnapshotEmitter<WithDocumentReferences<ReturnType>>, HasGrouped, HasDereference {
|
|
46
46
|
private readonly collectionName;
|
|
@@ -5,8 +5,26 @@ export declare class SecretClient {
|
|
|
5
5
|
getAll(): Promise<Record<SecretKey, SecretEntry>>;
|
|
6
6
|
upsert(key: SecretKey, value: SecretValue): Promise<SecretEntry>;
|
|
7
7
|
upsertMany(entries: Array<SetSecretRequestEntry>): Promise<Array<SecretEntry>>;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Deletes a specified secret key.
|
|
10
|
+
* If the secret is missing, it will be ignored, and the operation will proceed without failure.
|
|
11
|
+
*
|
|
12
|
+
* @param key - The secret key to delete.
|
|
13
|
+
* @param force - If set to true, forces deletion regardless of the secret's usage status across any enabled
|
|
14
|
+
* integrations. Default is false.
|
|
15
|
+
* @returns A promise that resolves when the deletion request is complete.
|
|
16
|
+
*/
|
|
17
|
+
delete(key: SecretKey, force?: boolean): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Deletes a list of specified secret keys.
|
|
20
|
+
* If any secret in the list is missing, it will be ignored, and the operation will proceed without failure.
|
|
21
|
+
*
|
|
22
|
+
* @param keys - An array of secret keys to delete.
|
|
23
|
+
* @param force - If set to true, forces deletion regardless of the secret's usage status across any enabled
|
|
24
|
+
* integrations. Default is false.
|
|
25
|
+
* @returns A promise that resolves when the deletion request is complete.
|
|
26
|
+
*/
|
|
27
|
+
deleteMany(keys: Array<SecretKey>, force?: boolean): Promise<void>;
|
|
10
28
|
get apiKeys(): ApiKeysSecretClient;
|
|
11
29
|
}
|
|
12
30
|
export declare class ApiKeysSecretClient {
|
|
@@ -142,7 +142,7 @@ export declare class Squid {
|
|
|
142
142
|
* If the integrationId is not provided, the `built_in_db` integration id will be used.
|
|
143
143
|
*
|
|
144
144
|
* For more information on the CollectionReference object, please refer to the
|
|
145
|
-
* {@link https://docs.
|
|
145
|
+
* {@link https://docs.getsquid.ai/docs/database/collection-reference documentation}.
|
|
146
146
|
*
|
|
147
147
|
* @param collectionName The name of the collection.
|
|
148
148
|
* @param integrationId The id of the integration, default to `built_in_db`.
|
|
@@ -155,7 +155,7 @@ export declare class Squid {
|
|
|
155
155
|
* will be atomic. Note that mutations for different integrations will not be atomic.
|
|
156
156
|
*
|
|
157
157
|
* For more information about transactions in Squid, please refer to the
|
|
158
|
-
* {@link https://docs.
|
|
158
|
+
* {@link https://docs.getsquid.ai/docs/database/transactions documentation}.
|
|
159
159
|
*
|
|
160
160
|
* @param fn The callback to run as an atomic change. The function receives a transactionId that should be used for
|
|
161
161
|
* all the mutations that should be atomic. The function should return a promise.
|
|
@@ -167,7 +167,7 @@ export declare class Squid {
|
|
|
167
167
|
* Executes the given backend function with the given parameters and returns a promise with the result.
|
|
168
168
|
*
|
|
169
169
|
* For more information about backend functions in Squid, please refer to the
|
|
170
|
-
* {@link https://docs.
|
|
170
|
+
* {@link https://docs.getsquid.ai/docs/backend/executables/ documentation}.
|
|
171
171
|
*
|
|
172
172
|
* @param functionName The name of the function to execute on the server.
|
|
173
173
|
* @param params The parameters to pass to the function.
|
|
@@ -177,7 +177,7 @@ export declare class Squid {
|
|
|
177
177
|
executeFunction<T = any>(functionName: string, ...params: any[]): Promise<T>;
|
|
178
178
|
/**
|
|
179
179
|
* Executes a native relational query with the given parameters and returns a promise with the result.
|
|
180
|
-
* See https://docs.
|
|
180
|
+
* See https://docs.getsquid.ai/docs/database/native-queries.
|
|
181
181
|
*
|
|
182
182
|
* @param integrationId The id of the integration that the query is associated with.
|
|
183
183
|
* @param query The raw SQL or other database-specific query to execute.
|
|
@@ -188,7 +188,7 @@ export declare class Squid {
|
|
|
188
188
|
executeNativeRelationalQuery<T = any>(integrationId: IntegrationId, query: string, params?: Record<string, any>): Promise<Array<T>>;
|
|
189
189
|
/**
|
|
190
190
|
* Executes a native Mongo/built-in-db query with the given pipeline and returns a promise with the result.
|
|
191
|
-
* See https://docs.
|
|
191
|
+
* See https://docs.getsquid.ai/docs/database/native-queries#native-mongodb-queries.
|
|
192
192
|
*
|
|
193
193
|
* @param integrationId The id of the integration that the query is associated with.
|
|
194
194
|
* @param collectionName The collection to query.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.
|
|
1
|
+
export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.287";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.287",
|
|
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,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,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,49 +0,0 @@
|
|
|
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[];
|
|
@@ -1,5 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|