@squidcloud/client 1.0.357 → 1.0.358
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/metric-name.d.ts +9 -0
- package/dist/internal-common/src/public-types/web.public-types.d.ts +2 -2
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +148 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +60 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +166 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +166 -0
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +1 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +59 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/observability.types.d.ts +71 -0
- package/dist/internal-common/src/types/query.types.d.ts +13 -0
- package/dist/internal-common/src/types/secret.types.d.ts +2 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/time-units.d.ts +1 -0
- package/dist/internal-common/src/types/url-shortener.types.d.ts +41 -0
- package/dist/internal-common/src/utils/array.d.ts +1 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http.d.ts +2 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +49 -0
- package/dist/internal-common/src/utils/serialization.d.ts +10 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +19 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/dist/typescript-client/src/web-client.d.ts +2 -2
- 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_aiContextUpsert_count", "squid_aiContextDelete_count", "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_";
|
|
@@ -43,7 +43,7 @@ export interface WebGetUrlContentResponse {
|
|
|
43
43
|
export interface WebShortUrlRequest {
|
|
44
44
|
/** The URL to shorten. It must be a valid URL and should include the protocol (start with http:// or https://). */
|
|
45
45
|
url: string;
|
|
46
|
-
/** Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to
|
|
46
|
+
/** Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to 1 day. */
|
|
47
47
|
secondsToLive?: number;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
@@ -52,7 +52,7 @@ export interface WebShortUrlRequest {
|
|
|
52
52
|
export interface WebShortUrlBulkRequest {
|
|
53
53
|
/** The URLs to shorten. They must be valid URLs and should include the protocol (start with http:// or https://). */
|
|
54
54
|
urls: string[];
|
|
55
|
-
/** Seconds to live for all shortened URLs. If set to 0, the URLs will never expire. Defaults to
|
|
55
|
+
/** Seconds to live for all shortened URLs. If set to 0, the URLs will never expire. Defaults to 1 day. */
|
|
56
56
|
secondsToLive?: number;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiEndpointId, HttpMethod } from '../public-types/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
|
+
/**
|
|
16
|
+
* Represents a request to call an API through a specified integration and endpoint.
|
|
17
|
+
* Includes optional method override and additional request options.
|
|
18
|
+
*/
|
|
19
|
+
export interface CallApiRequest<BodyType = any> {
|
|
20
|
+
/** The identifier of the integration through which the API is called. */
|
|
21
|
+
integrationId: IntegrationId;
|
|
22
|
+
/** Target API endpoint to invoke. */
|
|
23
|
+
endpointId: ApiEndpointId;
|
|
24
|
+
/** Optional request payload. */
|
|
25
|
+
body?: BodyType;
|
|
26
|
+
/** Optional HTTP method override. Default is POST. */
|
|
27
|
+
overrideMethod?: HttpMethod;
|
|
28
|
+
/** Additional request options. */
|
|
29
|
+
options: ApiOptions;
|
|
30
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Paths } from '../public-types/typescript.public-types';
|
|
2
|
+
import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
|
|
3
|
+
/**
|
|
4
|
+
* The mutation type.
|
|
5
|
+
* @category Database
|
|
6
|
+
*/
|
|
7
|
+
export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
|
|
8
|
+
/**
|
|
9
|
+
* @category Database
|
|
10
|
+
*/
|
|
11
|
+
export type MutationType = (typeof MUTATION_TYPES)[number];
|
|
12
|
+
interface BaseMutation {
|
|
13
|
+
type: MutationType;
|
|
14
|
+
squidDocIdObj: SquidDocIdObj;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A mutation on a document.
|
|
18
|
+
* @category Database
|
|
19
|
+
*/
|
|
20
|
+
export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
|
|
21
|
+
/**
|
|
22
|
+
* Represents a delete mutation on a document.
|
|
23
|
+
* @category Database
|
|
24
|
+
*/
|
|
25
|
+
export interface DeleteMutation extends BaseMutation {
|
|
26
|
+
/** Specifies that the mutation is a deletion. */
|
|
27
|
+
type: 'delete';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents an update mutation on a document.
|
|
31
|
+
* @category Database
|
|
32
|
+
*/
|
|
33
|
+
export interface UpdateMutation<T = any> extends BaseMutation {
|
|
34
|
+
/** Specifies that the mutation is an update. */
|
|
35
|
+
type: 'update';
|
|
36
|
+
/** The updated properties */
|
|
37
|
+
properties: {
|
|
38
|
+
[key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents an insert mutation on a document.
|
|
43
|
+
* @category Database
|
|
44
|
+
*/
|
|
45
|
+
export interface InsertMutation<T = any> extends BaseMutation {
|
|
46
|
+
/** Specifies that the mutation is an insertion. */
|
|
47
|
+
type: 'insert';
|
|
48
|
+
/** The inserted document */
|
|
49
|
+
properties: T;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A representation of a single property update.
|
|
53
|
+
* @category Database
|
|
54
|
+
*/
|
|
55
|
+
export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
|
|
56
|
+
/**
|
|
57
|
+
* A value update property mutation.
|
|
58
|
+
* @category Database
|
|
59
|
+
*/
|
|
60
|
+
export interface ValueUpdatePropertyMutation<Value = any> {
|
|
61
|
+
/** Specifies that the mutation updates a value. */
|
|
62
|
+
type: 'update';
|
|
63
|
+
/** New value to be set. */
|
|
64
|
+
value: Value;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Applying a numeric function to a property.
|
|
68
|
+
* @category Database
|
|
69
|
+
*/
|
|
70
|
+
export interface ApplyNumericFnPropertyMutation {
|
|
71
|
+
/** Specifies that the mutation applies a numeric function. */
|
|
72
|
+
type: 'applyNumericFn';
|
|
73
|
+
/** Numeric function to apply. */
|
|
74
|
+
fn: 'increment';
|
|
75
|
+
/** Value to use in the numeric function. */
|
|
76
|
+
value: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A property update that removes a property from a document.
|
|
80
|
+
* @category Database
|
|
81
|
+
*/
|
|
82
|
+
export interface RemovePropertyMutation {
|
|
83
|
+
/** Specifies that the mutation removes a property. */
|
|
84
|
+
type: 'removeProperty';
|
|
85
|
+
}
|
|
86
|
+
interface ApplyExtendString {
|
|
87
|
+
/** Specifies that the mutation applies a string function. */
|
|
88
|
+
type: 'applyStringFn';
|
|
89
|
+
/** String function to extend the existing string. */
|
|
90
|
+
fn: 'extendString';
|
|
91
|
+
/** String value to append. */
|
|
92
|
+
value: string;
|
|
93
|
+
}
|
|
94
|
+
interface ApplyTrimString {
|
|
95
|
+
/** Specifies that the mutation applies a string function. */
|
|
96
|
+
type: 'applyStringFn';
|
|
97
|
+
/** String function to trim the existing string. */
|
|
98
|
+
fn: 'trim';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A property mutation that modifies a string.
|
|
102
|
+
* @category Database
|
|
103
|
+
*/
|
|
104
|
+
export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
|
|
105
|
+
/**
|
|
106
|
+
* The before and after documents of a document change.
|
|
107
|
+
* @category Database
|
|
108
|
+
*/
|
|
109
|
+
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
110
|
+
/** Document state before the mutation. */
|
|
111
|
+
before: T | undefined;
|
|
112
|
+
/** Document state after the mutation. */
|
|
113
|
+
after: T | undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The mutation context that will be provided to the security function.
|
|
117
|
+
* @category Database
|
|
118
|
+
*/
|
|
119
|
+
export declare class MutationContext<T = any> {
|
|
120
|
+
readonly mutation: Mutation<T>;
|
|
121
|
+
readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
|
|
122
|
+
readonly serverTimeStamp: Date;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the type of the mutation (insert, update, or delete).
|
|
125
|
+
*/
|
|
126
|
+
getMutationType(): MutationType;
|
|
127
|
+
/**
|
|
128
|
+
* Returns the state of the document before the mutation was applied.
|
|
129
|
+
*/
|
|
130
|
+
get before(): T | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the state of the document after the mutation was applied.
|
|
133
|
+
*/
|
|
134
|
+
get after(): T | undefined;
|
|
135
|
+
/** Returns true if the mutation affects the provided path. */
|
|
136
|
+
affectsPath(path: Paths<T>): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Find all affected paths starting from a root path.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* doc before - { a: { b: 1, c: 2 }, d: 3 }
|
|
142
|
+
* doc after - { a: { b: 1, c: 3 }, d: 4 }
|
|
143
|
+
* doc.affectedPaths('a') // ['a.c']
|
|
144
|
+
*/
|
|
145
|
+
affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
|
|
146
|
+
private checkPath;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the type of native query request, either relational or MongoDB.
|
|
4
|
+
* @category Database
|
|
5
|
+
*/
|
|
6
|
+
export type NativeQueryRequestType = 'relational' | 'mongo';
|
|
7
|
+
interface BaseNativeQueryContext {
|
|
8
|
+
/** Type of the native query request. */
|
|
9
|
+
type: NativeQueryRequestType;
|
|
10
|
+
/** Identifier for the integration. */
|
|
11
|
+
integrationId: IntegrationId;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Context for executing a relational database query.
|
|
15
|
+
* @category Database
|
|
16
|
+
*/
|
|
17
|
+
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
18
|
+
/** Specifies that the query is for a relational database. */
|
|
19
|
+
type: 'relational';
|
|
20
|
+
/** SQL query string to be executed. */
|
|
21
|
+
query: string;
|
|
22
|
+
/** Parameters to be used in the query. */
|
|
23
|
+
params: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Context for executing a MongoDB query.
|
|
27
|
+
* @category Database
|
|
28
|
+
*/
|
|
29
|
+
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
30
|
+
/** Specifies that the query is for a Mongo database. */
|
|
31
|
+
type: 'mongo';
|
|
32
|
+
/** Name of the MongoDB collection to query. */
|
|
33
|
+
collectionName: string;
|
|
34
|
+
/** Array of aggregation pipeline stages. */
|
|
35
|
+
aggregationPipeline: Array<any | undefined>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Context for executing an Elasticsearch query.
|
|
39
|
+
* @category Database
|
|
40
|
+
*/
|
|
41
|
+
export interface ElasticsearchNativeQueryContext {
|
|
42
|
+
/** Specifies that the query is for an Elasticsearch database. */
|
|
43
|
+
type: 'elasticsearch';
|
|
44
|
+
/** Elasticsearch index to query. */
|
|
45
|
+
index: string;
|
|
46
|
+
/** Elasticsearch query string. */
|
|
47
|
+
endpoint?: string;
|
|
48
|
+
/** HTTP method to use for the request. */
|
|
49
|
+
method?: 'GET' | 'POST';
|
|
50
|
+
/** Body of the request. */
|
|
51
|
+
body: Record<string, any>;
|
|
52
|
+
/** Headers to include in the request. */
|
|
53
|
+
integrationId: IntegrationId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Union type representing either a relational or MongoDB native query context.
|
|
57
|
+
* @category Database
|
|
58
|
+
*/
|
|
59
|
+
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
* @category Database
|
|
9
|
+
*/
|
|
10
|
+
export declare class QueryContext<T extends DocumentData = any> {
|
|
11
|
+
readonly query: Query<T>;
|
|
12
|
+
/**
|
|
13
|
+
* The ID of the integration being queried.
|
|
14
|
+
*/
|
|
15
|
+
get integrationId(): IntegrationId;
|
|
16
|
+
/**
|
|
17
|
+
* The name of the collection being queried.
|
|
18
|
+
*/
|
|
19
|
+
get collectionName(): CollectionName;
|
|
20
|
+
/**
|
|
21
|
+
* The query limit if one exists, -1 otherwise.
|
|
22
|
+
*/
|
|
23
|
+
get limit(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
|
|
26
|
+
* parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
|
|
27
|
+
* additional fields in its sort order, but only after the specified sorts.
|
|
28
|
+
*
|
|
29
|
+
* @param sorts An array of field sorts.
|
|
30
|
+
* @returns Whether the query's sorts matches the provided field sorts.
|
|
31
|
+
*/
|
|
32
|
+
sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
|
|
35
|
+
* `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
|
|
36
|
+
* in the query.
|
|
37
|
+
*
|
|
38
|
+
* @param sorts An array of field sorts.
|
|
39
|
+
* @returns Whether the query's sorts exactly match the provided field sorts.
|
|
40
|
+
*/
|
|
41
|
+
sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
|
|
44
|
+
* to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
|
|
45
|
+
* additional conditions, as these only narrow the result set.
|
|
46
|
+
*
|
|
47
|
+
* @param fieldName The name of the field for the condition.
|
|
48
|
+
* @param operator The operator of the condition.
|
|
49
|
+
* @param value The value of the condition.
|
|
50
|
+
* @returns Whether the query is a subquery of the parent condition.
|
|
51
|
+
*/
|
|
52
|
+
isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
|
|
55
|
+
* to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
|
|
56
|
+
* additional conditions, as these only narrow the result set.
|
|
57
|
+
*
|
|
58
|
+
* @param condition The condition to validate.
|
|
59
|
+
* @returns Whether the query is a subquery of the parent condition.
|
|
60
|
+
*/
|
|
61
|
+
isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
|
|
64
|
+
* to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
|
|
65
|
+
* additional conditions, as these only narrow the result set.
|
|
66
|
+
*
|
|
67
|
+
* @param conditions The conditions to validate.
|
|
68
|
+
* @returns Whether the query includes subquery of the parent conditions.
|
|
69
|
+
*/
|
|
70
|
+
isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
|
|
73
|
+
* to a subset of the results that obtained for the parent query, including sorts and limits.
|
|
74
|
+
*
|
|
75
|
+
* @param query The query to validate.
|
|
76
|
+
* @returns Whether the query is a subquery of the parent query.
|
|
77
|
+
*/
|
|
78
|
+
isSubqueryOfQuery(query: Query<T>): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Returns all conditions that apply to any of the specified field names. This method
|
|
81
|
+
* provides a convenient way to retrieve all conditions that involve a specific set of fields.
|
|
82
|
+
*
|
|
83
|
+
* @param fieldNames The field names for which to retrieve conditions.
|
|
84
|
+
* @returns An array of conditions that involve any of the specified field names.
|
|
85
|
+
*/
|
|
86
|
+
getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns all conditions that apply to the specified field name. This method provides
|
|
89
|
+
* a convenient way to retrieve all conditions that involve a specific field.
|
|
90
|
+
*
|
|
91
|
+
* @param fieldName The field name for which to retrieve conditions.
|
|
92
|
+
* @returns An array of conditions that involve the specified field name.
|
|
93
|
+
*/
|
|
94
|
+
getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns true if the given document can be a result of the query.
|
|
97
|
+
* The method does not account for limit and sort order.
|
|
98
|
+
*/
|
|
99
|
+
documentMatchesQuery(doc: DocumentData): boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A list of context conditions.
|
|
103
|
+
* @category Database
|
|
104
|
+
*/
|
|
105
|
+
export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
|
|
106
|
+
/**
|
|
107
|
+
* A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'.
|
|
108
|
+
* @category Database
|
|
109
|
+
*/
|
|
110
|
+
export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
111
|
+
/**
|
|
112
|
+
* A condition using the 'in' operator to match values within a set.
|
|
113
|
+
* @category Database
|
|
114
|
+
*/
|
|
115
|
+
export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
|
|
116
|
+
/** Specifies the 'in' operator to check if a value exists within an array. */
|
|
117
|
+
operator: 'in';
|
|
118
|
+
/** An array of values to match against the field. */
|
|
119
|
+
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A condition using the 'not in' operator to exclude values within a set.
|
|
123
|
+
* @category Database
|
|
124
|
+
*/
|
|
125
|
+
export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
|
|
126
|
+
/** Specifies the 'not in' operator to check if a value does not exist within an array. */
|
|
127
|
+
operator: 'not in';
|
|
128
|
+
/** An array of values to exclude from the field. */
|
|
129
|
+
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A condition using operators other than 'in' or 'not in' for field comparisons.
|
|
133
|
+
* @category Database
|
|
134
|
+
*/
|
|
135
|
+
export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
|
|
136
|
+
/** The operator to use for the comparison, excluding 'in' and 'not in'. */
|
|
137
|
+
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
138
|
+
/** The value to compare against the field. */
|
|
139
|
+
value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A condition that includes all operators, including 'in' and 'not in', for general use.
|
|
143
|
+
* @category Database
|
|
144
|
+
*/
|
|
145
|
+
export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
|
|
146
|
+
/** The operator to apply to the condition, including all possible operators. */
|
|
147
|
+
operator: AllOperators;
|
|
148
|
+
/** The value to use in the condition comparison. */
|
|
149
|
+
value: any;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A list of general conditions.
|
|
153
|
+
* @category Database
|
|
154
|
+
*/
|
|
155
|
+
export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
|
|
156
|
+
/**
|
|
157
|
+
* @category Database
|
|
158
|
+
*/
|
|
159
|
+
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
160
|
+
type AllOperators = Operator | 'in' | 'not in';
|
|
161
|
+
/**
|
|
162
|
+
* A generic value that can exist in a query.
|
|
163
|
+
* @category Database
|
|
164
|
+
*/
|
|
165
|
+
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;
|
|
166
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { AgentContextRequest, AiAgent, AiAgentChatOptions, AiAgentContext, AiAudioCreateSpeechOptions, AiChatModelName, AiConnectedIntegrationMetadata, AiContextMetadata, AiContextMetadataFilter, AiEmbeddingsModelName, AiGenerateImageOptions, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions } from '../public-types/ai-agent.public-types';
|
|
2
|
+
import { AiAgentId, AppId, ClientRequestId, IntegrationId } from '../public-types/communication.public-types';
|
|
3
|
+
import { AiFunctionId } from '../public-types/backend.public-types';
|
|
4
|
+
import { IntegrationType } from '../public-types/integration.public-types';
|
|
5
|
+
type ModelDataType = {
|
|
6
|
+
maxTokens: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const AiModelData: Record<AiChatModelName, ModelDataType>;
|
|
9
|
+
export declare const AiEmbeddingModelData: Record<AiEmbeddingsModelName, ModelDataType>;
|
|
10
|
+
export interface AiChatRequest {
|
|
11
|
+
agentId: AiAgentId;
|
|
12
|
+
clientRequestId: ClientRequestId;
|
|
13
|
+
prompt?: string;
|
|
14
|
+
options?: AllAiAgentChatOptions;
|
|
15
|
+
}
|
|
16
|
+
export interface AiAskRequest {
|
|
17
|
+
agentId: AiAgentId;
|
|
18
|
+
prompt?: string;
|
|
19
|
+
options?: AllAiAgentChatOptions;
|
|
20
|
+
}
|
|
21
|
+
export interface AiGenerateImageRequest {
|
|
22
|
+
prompt: string;
|
|
23
|
+
options: AiGenerateImageOptions;
|
|
24
|
+
}
|
|
25
|
+
export interface AiAskQuestionInternalRequest {
|
|
26
|
+
appId: AppId;
|
|
27
|
+
prompt: string;
|
|
28
|
+
options: AiAgentChatOptions;
|
|
29
|
+
}
|
|
30
|
+
export interface AiAskQuestionInternalResponse {
|
|
31
|
+
answer: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AiContextSizeRequest {
|
|
34
|
+
appId: AppId;
|
|
35
|
+
agentId: AiAgentId;
|
|
36
|
+
}
|
|
37
|
+
export interface AiContextSizeResponse {
|
|
38
|
+
sizeBytes: number;
|
|
39
|
+
}
|
|
40
|
+
export interface AiAskResponse {
|
|
41
|
+
responseString: string;
|
|
42
|
+
}
|
|
43
|
+
export interface AiAskWithVoiceResponse {
|
|
44
|
+
responseString: string;
|
|
45
|
+
voiceResponse: AiAudioCreateSpeechResponse;
|
|
46
|
+
}
|
|
47
|
+
export interface AiTranscribeAndAskWithVoiceResponse {
|
|
48
|
+
transcribedPrompt: string;
|
|
49
|
+
responseString: string;
|
|
50
|
+
voiceResponse: AiAudioCreateSpeechResponse;
|
|
51
|
+
}
|
|
52
|
+
export interface AiTranscribeAndChatResponse {
|
|
53
|
+
transcribedPrompt: string;
|
|
54
|
+
}
|
|
55
|
+
export interface AiSearchRequest {
|
|
56
|
+
options: AiSearchOptions;
|
|
57
|
+
agentId: AiAgentId;
|
|
58
|
+
}
|
|
59
|
+
export interface AiSearchResponse {
|
|
60
|
+
chunks: Array<AiSearchResultChunk>;
|
|
61
|
+
}
|
|
62
|
+
export interface AiAudioCreateSpeechResponse {
|
|
63
|
+
mimeType: string;
|
|
64
|
+
extension: string;
|
|
65
|
+
base64File: string;
|
|
66
|
+
}
|
|
67
|
+
export interface AiAudioCreateSpeechRequest {
|
|
68
|
+
input: string;
|
|
69
|
+
options: AiAudioCreateSpeechOptions;
|
|
70
|
+
}
|
|
71
|
+
export interface GetAgentRequest {
|
|
72
|
+
agentId: AiAgentId;
|
|
73
|
+
}
|
|
74
|
+
export interface GetAgentResponse {
|
|
75
|
+
agent: AiAgent | undefined;
|
|
76
|
+
}
|
|
77
|
+
export interface GetAgentContextRequest {
|
|
78
|
+
agentId: AiAgentId;
|
|
79
|
+
contextId: string;
|
|
80
|
+
}
|
|
81
|
+
export interface DeleteAgentRequest {
|
|
82
|
+
agentId: AiAgentId;
|
|
83
|
+
}
|
|
84
|
+
export interface ListAgentContextsRequest {
|
|
85
|
+
agentId: AiAgentId;
|
|
86
|
+
}
|
|
87
|
+
export interface ListAgentContextsResponse {
|
|
88
|
+
contexts: Array<AiAgentContext>;
|
|
89
|
+
}
|
|
90
|
+
export interface DeleteAgentContextsRequest {
|
|
91
|
+
agentId: AiAgentId;
|
|
92
|
+
contextIds: Array<string>;
|
|
93
|
+
}
|
|
94
|
+
export interface UpsertAgentContextsRequest {
|
|
95
|
+
agentId: AiAgentId;
|
|
96
|
+
contextRequests: Array<AgentContextRequest>;
|
|
97
|
+
}
|
|
98
|
+
export interface UpsertAgentCustomGuardrailsRequest {
|
|
99
|
+
agentId: AiAgentId;
|
|
100
|
+
customGuardrail: string;
|
|
101
|
+
}
|
|
102
|
+
export interface DeleteAgentCustomGuardrailsRequest {
|
|
103
|
+
agentId: AiAgentId;
|
|
104
|
+
}
|
|
105
|
+
export interface ProvideAgentFeedbackRequest {
|
|
106
|
+
agentId: AiAgentId;
|
|
107
|
+
feedback: string;
|
|
108
|
+
}
|
|
109
|
+
export interface ResetAgentFeedbackRequest {
|
|
110
|
+
agentId: AiAgentId;
|
|
111
|
+
}
|
|
112
|
+
export interface ListAgentsResponse {
|
|
113
|
+
agents: Array<AiAgent>;
|
|
114
|
+
}
|
|
115
|
+
export declare function validateAiContextMetadata(metadata: AiContextMetadata): void;
|
|
116
|
+
export declare function validateAiContextMetadataFilter(filter: AiContextMetadataFilter): void;
|
|
117
|
+
export declare const METADATA_SERVICE_FUNCTION_NAME = "default:metadata";
|
|
118
|
+
/** A service function name that is used to call tenant or local backend to fetch AI function overrides. */
|
|
119
|
+
export declare const GET_AI_FUNCTION_OVERRIDES_SERVICE_FUNCTION_NAME = "default:getAiFunctionOverrides";
|
|
120
|
+
/** A real TypeScript function name that can be added to any service by user to override AI functions. */
|
|
121
|
+
export declare const GET_AI_FUNCTION_OVERRIDES_USER_FUNCTION_NAME = "getAiFunctionOverrides";
|
|
122
|
+
/** Input (the only parameter) of the `getAiFunctionOverrides` function in client bundle */
|
|
123
|
+
export interface GetAiFunctionOverridesInput {
|
|
124
|
+
integrationId: IntegrationId;
|
|
125
|
+
integrationType: IntegrationType;
|
|
126
|
+
/** Current connected integration metadata with custom options. */
|
|
127
|
+
metadata: AiConnectedIntegrationMetadata;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Result of the `getAiFunctionOverrides` execution:
|
|
131
|
+
* details how to override the set of AI functions available in the bundle for the provided input.
|
|
132
|
+
*/
|
|
133
|
+
export interface GetAiFunctionOverridesResult {
|
|
134
|
+
/**
|
|
135
|
+
* Map of overridden functions.
|
|
136
|
+
* If a function is not mentioned in the map - there is no override.
|
|
137
|
+
*/
|
|
138
|
+
functionOverrides: Record<AiFunctionId, AiFunctionOverrideDetails>;
|
|
139
|
+
}
|
|
140
|
+
export interface AiFunctionOverrideDetails {
|
|
141
|
+
id: AiFunctionId;
|
|
142
|
+
/** If set to true, the function won't be available for the connector agent. */
|
|
143
|
+
isExcluded?: boolean;
|
|
144
|
+
/** Set of parameters to fill with a predefined values. */
|
|
145
|
+
predefinedParameters: Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The literal marker that must appear at the start of a response of the 'dictionary' model
|
|
149
|
+
* to indicate an AI function call invocation.
|
|
150
|
+
*
|
|
151
|
+
* When parsing a raw assistant response, dictionary model code look for a line beginning with this exact string,
|
|
152
|
+
* followed by the target function’s identifier, then a JSON payload of arguments on subsequent lines.
|
|
153
|
+
*
|
|
154
|
+
* Example valid response payload:
|
|
155
|
+
* ```
|
|
156
|
+
* <~
|
|
157
|
+
* @call doSomething
|
|
158
|
+
* {
|
|
159
|
+
* "foo": 42,
|
|
160
|
+
* "bar": "baz"
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export declare const DICTIONARY_AI_FUNCTION_CALL_COMMAND = "@fn";
|
|
165
|
+
export declare const DICTIONARY_AI_AGENT_CALL_COMMAND = "@agent";
|
|
166
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { MmEntity, MmEntityMatch, MmFindMatchesOptions, MmListEntitiesOptions, MmMatchMaker } from '../public-types/ai-matchmaking.public-types';
|
|
2
|
+
export interface MmCreateMatchMakerRequest {
|
|
3
|
+
matchMaker: MmMatchMaker;
|
|
4
|
+
}
|
|
5
|
+
export interface MmDeleteMatchMakerRequest {
|
|
6
|
+
matchMakerId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MmGetMatchMakerRequest {
|
|
9
|
+
matchMakerId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MmGetMatchMakerResponse {
|
|
12
|
+
matchMaker: MmMatchMaker | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface MmDeleteEntityRequest {
|
|
15
|
+
matchMakerId: string;
|
|
16
|
+
entityId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MmInsertEntityRequest {
|
|
19
|
+
matchMakerId: string;
|
|
20
|
+
entity: MmEntity;
|
|
21
|
+
}
|
|
22
|
+
export interface MmInsertEntitiesRequest {
|
|
23
|
+
matchMakerId: string;
|
|
24
|
+
entities: Array<MmEntity>;
|
|
25
|
+
}
|
|
26
|
+
export interface MmFindMatchesRequest {
|
|
27
|
+
matchMakerId: string;
|
|
28
|
+
entityId: string;
|
|
29
|
+
options: MmFindMatchesOptions;
|
|
30
|
+
}
|
|
31
|
+
export interface MmFindMatchesResponse {
|
|
32
|
+
matches: Array<MmEntityMatch>;
|
|
33
|
+
}
|
|
34
|
+
export interface MmFindMatchesForEntityRequest {
|
|
35
|
+
matchMakerId: string;
|
|
36
|
+
entity: Omit<MmEntity, 'metadata' | 'id'>;
|
|
37
|
+
options: MmFindMatchesOptions;
|
|
38
|
+
}
|
|
39
|
+
export interface MmFindMatchesForEntityResponse {
|
|
40
|
+
matches: Array<MmEntityMatch>;
|
|
41
|
+
}
|
|
42
|
+
export interface MmListMatchMakersResponse {
|
|
43
|
+
matchMakers: Array<MmMatchMaker>;
|
|
44
|
+
}
|
|
45
|
+
export interface MmListEntitiesRequest {
|
|
46
|
+
matchMakerId: string;
|
|
47
|
+
categoryId: string;
|
|
48
|
+
options: MmListEntitiesOptions;
|
|
49
|
+
}
|
|
50
|
+
export interface MmListEntitiesResponse {
|
|
51
|
+
entities: Array<MmEntity>;
|
|
52
|
+
}
|
|
53
|
+
export interface MmGetEntityRequest {
|
|
54
|
+
matchMakerId: string;
|
|
55
|
+
entityId: string;
|
|
56
|
+
}
|
|
57
|
+
export interface MmGetEntityResponse {
|
|
58
|
+
entity: MmEntity | undefined;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ChatId = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|