@squidcloud/client 1.0.340 → 1.0.342
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/metric-name.d.ts +9 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +5 -2
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +21 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +120 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +155 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +115 -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 +53 -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/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/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 +1 -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 +5 -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/agent/ai-agent-client-reference.d.ts +1 -1
- package/dist/typescript-client/src/version.d.ts +5 -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_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_";
|
|
@@ -338,6 +338,7 @@ export interface BaseAiAgentChatOptions {
|
|
|
338
338
|
temperature?: number;
|
|
339
339
|
/** Preset instruction options that can be toggled on */
|
|
340
340
|
guardrails?: GuardrailsOptions;
|
|
341
|
+
/** The LLM model to use. */
|
|
341
342
|
model?: AiChatModelName;
|
|
342
343
|
}
|
|
343
344
|
/**
|
|
@@ -569,8 +570,10 @@ export type GuardrailKeysType = 'disableProfanity' | 'offTopicAnswers' | 'profes
|
|
|
569
570
|
* @category AI
|
|
570
571
|
*/
|
|
571
572
|
export type GuardrailsOptions = {
|
|
572
|
-
|
|
573
|
-
|
|
573
|
+
disableProfanity?: boolean;
|
|
574
|
+
offTopicAnswers?: boolean;
|
|
575
|
+
professionalTone?: boolean;
|
|
576
|
+
disablePii?: boolean;
|
|
574
577
|
custom?: string;
|
|
575
578
|
};
|
|
576
579
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApiEndpointId, HttpMethod } from '../public-types/integrations/api.public-types';
|
|
2
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
3
|
+
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
4
|
+
/** The headers of an API call. */
|
|
5
|
+
export type ApiHeaders = Record<string, string | number | boolean>;
|
|
6
|
+
/** The context of an API call. */
|
|
7
|
+
export declare class ApiCallContext {
|
|
8
|
+
readonly integrationId: IntegrationId;
|
|
9
|
+
readonly endpointId: ApiEndpointId;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly method: HttpMethod;
|
|
12
|
+
readonly body: unknown;
|
|
13
|
+
readonly options: ApiOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface CallApiRequest<BodyType = any> {
|
|
16
|
+
integrationId: IntegrationId;
|
|
17
|
+
endpointId: ApiEndpointId;
|
|
18
|
+
body?: BodyType;
|
|
19
|
+
overrideMethod?: HttpMethod;
|
|
20
|
+
options: ApiOptions;
|
|
21
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
* @category Database
|
|
23
|
+
*/
|
|
24
|
+
export interface DeleteMutation extends BaseMutation {
|
|
25
|
+
type: 'delete';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @category Database
|
|
29
|
+
*/
|
|
30
|
+
export interface UpdateMutation<T = any> extends BaseMutation {
|
|
31
|
+
type: 'update';
|
|
32
|
+
/** The updated properties */
|
|
33
|
+
properties: {
|
|
34
|
+
[key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @category Database
|
|
39
|
+
*/
|
|
40
|
+
export interface InsertMutation<T = any> extends BaseMutation {
|
|
41
|
+
type: 'insert';
|
|
42
|
+
/** The inserted document */
|
|
43
|
+
properties: T;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A representation of a single property update.
|
|
47
|
+
* @category Database
|
|
48
|
+
*/
|
|
49
|
+
export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
|
|
50
|
+
/**
|
|
51
|
+
* A value update property mutation.
|
|
52
|
+
* @category Database
|
|
53
|
+
*/
|
|
54
|
+
export interface ValueUpdatePropertyMutation<Value = any> {
|
|
55
|
+
type: 'update';
|
|
56
|
+
value: Value;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Applying a numeric function to a property.
|
|
60
|
+
* @category Database
|
|
61
|
+
*/
|
|
62
|
+
export interface ApplyNumericFnPropertyMutation {
|
|
63
|
+
type: 'applyNumericFn';
|
|
64
|
+
fn: 'increment';
|
|
65
|
+
value: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A property update that removes a property from a document.
|
|
69
|
+
* @category Database
|
|
70
|
+
*/
|
|
71
|
+
export interface RemovePropertyMutation {
|
|
72
|
+
type: 'removeProperty';
|
|
73
|
+
}
|
|
74
|
+
interface ApplyExtendString {
|
|
75
|
+
type: 'applyStringFn';
|
|
76
|
+
fn: 'extendString';
|
|
77
|
+
value: string;
|
|
78
|
+
}
|
|
79
|
+
interface ApplyTrimString {
|
|
80
|
+
type: 'applyStringFn';
|
|
81
|
+
fn: 'trim';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A property mutation that modifies a string.
|
|
85
|
+
* @category Database
|
|
86
|
+
*/
|
|
87
|
+
export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
|
|
88
|
+
/**
|
|
89
|
+
* The before and after documents of a document change.
|
|
90
|
+
* @category Database
|
|
91
|
+
*/
|
|
92
|
+
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
93
|
+
before: T | undefined;
|
|
94
|
+
after: T | undefined;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The mutation context that will be provided to the security function.
|
|
98
|
+
* @category Database
|
|
99
|
+
*/
|
|
100
|
+
export declare class MutationContext<T = any> {
|
|
101
|
+
readonly mutation: Mutation<T>;
|
|
102
|
+
readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
|
|
103
|
+
readonly serverTimeStamp: Date;
|
|
104
|
+
getMutationType(): MutationType;
|
|
105
|
+
get before(): T | undefined;
|
|
106
|
+
get after(): T | undefined;
|
|
107
|
+
/** Returns true if the mutation affects the provided path. */
|
|
108
|
+
affectsPath(path: Paths<T>): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Find all affected paths starting from a root path.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* doc before - { a: { b: 1, c: 2 }, d: 3 }
|
|
114
|
+
* doc after - { a: { b: 1, c: 3 }, d: 4 }
|
|
115
|
+
* doc.affectedPaths('a') // ['a.c']
|
|
116
|
+
*/
|
|
117
|
+
affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
|
|
118
|
+
private checkPath;
|
|
119
|
+
}
|
|
120
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* @category Database
|
|
4
|
+
*/
|
|
5
|
+
export type NativeQueryRequestType = 'relational' | 'mongo';
|
|
6
|
+
interface BaseNativeQueryContext {
|
|
7
|
+
type: NativeQueryRequestType;
|
|
8
|
+
integrationId: IntegrationId;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @category Database
|
|
12
|
+
*/
|
|
13
|
+
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
14
|
+
type: 'relational';
|
|
15
|
+
query: string;
|
|
16
|
+
params: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @category Database
|
|
20
|
+
*/
|
|
21
|
+
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
22
|
+
type: 'mongo';
|
|
23
|
+
collectionName: string;
|
|
24
|
+
aggregationPipeline: Array<any | undefined>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @category Database
|
|
28
|
+
*/
|
|
29
|
+
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
* @category Database
|
|
113
|
+
*/
|
|
114
|
+
export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
|
|
115
|
+
operator: 'in';
|
|
116
|
+
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @category Database
|
|
120
|
+
*/
|
|
121
|
+
export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
|
|
122
|
+
operator: 'not in';
|
|
123
|
+
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @category Database
|
|
127
|
+
*/
|
|
128
|
+
export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
|
|
129
|
+
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
130
|
+
value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A condition that includes the 'in' and 'not in' operators.
|
|
134
|
+
* @category Database
|
|
135
|
+
*/
|
|
136
|
+
export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
|
|
137
|
+
operator: AllOperators;
|
|
138
|
+
value: any;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A list of general conditions.
|
|
142
|
+
* @category Database
|
|
143
|
+
*/
|
|
144
|
+
export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
|
|
145
|
+
/**
|
|
146
|
+
* @category Database
|
|
147
|
+
*/
|
|
148
|
+
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
149
|
+
type AllOperators = Operator | 'in' | 'not in';
|
|
150
|
+
/**
|
|
151
|
+
* A generic value that can exist in a query.
|
|
152
|
+
* @category Database
|
|
153
|
+
*/
|
|
154
|
+
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;
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AgentContextRequest, AiAgent, AiAgentChatOptions, AiAgentContext, AiAudioCreateSpeechOptions, AiChatModelName, AiContextMetadata, AiContextMetadataFilter, AiGenerateImageOptions, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions } from '../public-types/ai-agent.public-types';
|
|
2
|
+
import { AiAgentId, AppId, ClientRequestId } from '../public-types/communication.public-types';
|
|
3
|
+
type ModelDataType = {
|
|
4
|
+
maxTokens: number;
|
|
5
|
+
defaultTokens: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const AiModelData: Record<AiChatModelName, ModelDataType>;
|
|
8
|
+
export interface AiChatRequest {
|
|
9
|
+
agentId: AiAgentId;
|
|
10
|
+
clientRequestId: ClientRequestId;
|
|
11
|
+
prompt?: string;
|
|
12
|
+
options?: AllAiAgentChatOptions;
|
|
13
|
+
}
|
|
14
|
+
export interface AiAskRequest {
|
|
15
|
+
agentId: AiAgentId;
|
|
16
|
+
prompt?: string;
|
|
17
|
+
options?: AllAiAgentChatOptions;
|
|
18
|
+
}
|
|
19
|
+
export interface AiGenerateImageRequest {
|
|
20
|
+
prompt: string;
|
|
21
|
+
options: AiGenerateImageOptions;
|
|
22
|
+
}
|
|
23
|
+
export interface AiAskQuestionInternalRequest {
|
|
24
|
+
appId: AppId;
|
|
25
|
+
prompt: string;
|
|
26
|
+
options: AiAgentChatOptions;
|
|
27
|
+
}
|
|
28
|
+
export interface AiAskQuestionInternalResponse {
|
|
29
|
+
answer: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AiContextSizeRequest {
|
|
32
|
+
appId: AppId;
|
|
33
|
+
agentId: AiAgentId;
|
|
34
|
+
}
|
|
35
|
+
export interface AiContextSizeResponse {
|
|
36
|
+
sizeBytes: number;
|
|
37
|
+
}
|
|
38
|
+
export interface AiAskResponse {
|
|
39
|
+
responseString: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AiAskWithVoiceResponse {
|
|
42
|
+
responseString: string;
|
|
43
|
+
voiceResponse: AiAudioCreateSpeechResponse;
|
|
44
|
+
}
|
|
45
|
+
export interface AiTranscribeAndAskWithVoiceResponse {
|
|
46
|
+
transcribedPrompt: string;
|
|
47
|
+
responseString: string;
|
|
48
|
+
voiceResponse: AiAudioCreateSpeechResponse;
|
|
49
|
+
}
|
|
50
|
+
export interface AiTranscribeAndChatResponse {
|
|
51
|
+
transcribedPrompt: string;
|
|
52
|
+
}
|
|
53
|
+
export interface AiSearchRequest {
|
|
54
|
+
options: AiSearchOptions;
|
|
55
|
+
agentId: AiAgentId;
|
|
56
|
+
}
|
|
57
|
+
export interface AiSearchResponse {
|
|
58
|
+
chunks: Array<AiSearchResultChunk>;
|
|
59
|
+
}
|
|
60
|
+
export interface AiAudioCreateSpeechResponse {
|
|
61
|
+
mimeType: string;
|
|
62
|
+
extension: string;
|
|
63
|
+
base64File: string;
|
|
64
|
+
}
|
|
65
|
+
export interface AiAudioCreateSpeechRequest {
|
|
66
|
+
input: string;
|
|
67
|
+
options: AiAudioCreateSpeechOptions;
|
|
68
|
+
}
|
|
69
|
+
export interface GetAgentRequest {
|
|
70
|
+
agentId: AiAgentId;
|
|
71
|
+
}
|
|
72
|
+
export interface GetAgentResponse {
|
|
73
|
+
agent: AiAgent | undefined;
|
|
74
|
+
}
|
|
75
|
+
export interface GetAgentContextRequest {
|
|
76
|
+
agentId: AiAgentId;
|
|
77
|
+
contextId: string;
|
|
78
|
+
}
|
|
79
|
+
export interface DeleteAgentRequest {
|
|
80
|
+
agentId: AiAgentId;
|
|
81
|
+
}
|
|
82
|
+
export interface ListAgentContextsRequest {
|
|
83
|
+
agentId: AiAgentId;
|
|
84
|
+
}
|
|
85
|
+
export interface ListAgentContextsResponse {
|
|
86
|
+
contexts: Array<AiAgentContext>;
|
|
87
|
+
}
|
|
88
|
+
export interface DeleteAgentContextsRequest {
|
|
89
|
+
agentId: AiAgentId;
|
|
90
|
+
contextIds: Array<string>;
|
|
91
|
+
}
|
|
92
|
+
export interface UpsertAgentContextsRequest {
|
|
93
|
+
agentId: AiAgentId;
|
|
94
|
+
contextRequests: Array<AgentContextRequest>;
|
|
95
|
+
}
|
|
96
|
+
export interface UpsertAgentCustomGuardrailsRequest {
|
|
97
|
+
agentId: AiAgentId;
|
|
98
|
+
customGuardrail: string;
|
|
99
|
+
}
|
|
100
|
+
export interface DeleteAgentCustomGuardrailsRequest {
|
|
101
|
+
agentId: AiAgentId;
|
|
102
|
+
}
|
|
103
|
+
export interface ProvideAgentFeedbackRequest {
|
|
104
|
+
agentId: AiAgentId;
|
|
105
|
+
feedback: string;
|
|
106
|
+
}
|
|
107
|
+
export interface ResetAgentFeedbackRequest {
|
|
108
|
+
agentId: AiAgentId;
|
|
109
|
+
}
|
|
110
|
+
export interface ListAgentsResponse {
|
|
111
|
+
agents: Array<AiAgent>;
|
|
112
|
+
}
|
|
113
|
+
export declare function validateAiContextMetadata(metadata: AiContextMetadata): void;
|
|
114
|
+
export declare function validateAiContextMetadataFilter(filter: AiContextMetadataFilter): void;
|
|
115
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MmEntity, MmEntityMatch, MmFindMatchesOptions, MmListEntitiesOptions, MmMatchMaker } from '../public-types/ai-matchmaking.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 MmListEntitiesRequest {
|
|
43
|
+
matchMakerId: string;
|
|
44
|
+
categoryId: string;
|
|
45
|
+
options: MmListEntitiesOptions;
|
|
46
|
+
}
|
|
47
|
+
export interface MmGetEntityRequest {
|
|
48
|
+
matchMakerId: string;
|
|
49
|
+
entityId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface MmGetEntityResponse {
|
|
52
|
+
entity: MmEntity | undefined;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ChatId = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MetricName } from '../metric-name';
|
|
2
|
+
import { AppId } from '../public-types/communication.public-types';
|
|
3
|
+
export interface ObservableNameMetrics {
|
|
4
|
+
count: MetricName;
|
|
5
|
+
time: MetricName;
|
|
6
|
+
}
|
|
7
|
+
export declare const ObservableNames: {
|
|
8
|
+
readonly functionExecution: ObservableNameMetrics;
|
|
9
|
+
readonly codeInitialization: ObservableNameMetrics;
|
|
10
|
+
readonly getAiChatbotProfiles: ObservableNameMetrics;
|
|
11
|
+
readonly aiImageGeneration: ObservableNameMetrics;
|
|
12
|
+
readonly aiRemoveBackground: ObservableNameMetrics;
|
|
13
|
+
readonly aiAudioTranscribe: ObservableNameMetrics;
|
|
14
|
+
readonly aiAudioCreateSpeech: ObservableNameMetrics;
|
|
15
|
+
readonly discoverGraphQLConnectionSchema: ObservableNameMetrics;
|
|
16
|
+
readonly discoverOpenApiSchema: ObservableNameMetrics;
|
|
17
|
+
readonly discoverOpenApiSchemaFromFile: ObservableNameMetrics;
|
|
18
|
+
readonly graphqlQuery: ObservableNameMetrics;
|
|
19
|
+
readonly testGraphQLConnection: ObservableNameMetrics;
|
|
20
|
+
readonly graphql: ObservableNameMetrics;
|
|
21
|
+
};
|
|
22
|
+
export type ObservableName = keyof typeof ObservableNames;
|
|
23
|
+
export interface MetricEvent {
|
|
24
|
+
appId: AppId;
|
|
25
|
+
name: MetricName;
|
|
26
|
+
tags: Record<string, string>;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
value: number;
|
|
29
|
+
isExposedToUser: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface LogEvent {
|
|
32
|
+
message: string;
|
|
33
|
+
level: string;
|
|
34
|
+
tags: Record<string, string>;
|
|
35
|
+
timestamp: Date;
|
|
36
|
+
isExposedToUser: boolean;
|
|
37
|
+
host: string;
|
|
38
|
+
source?: string;
|
|
39
|
+
service?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const AUDIT_LOG_EVENT_NAMES: readonly ["ai_agent"];
|
|
42
|
+
export type AuditLogEventName = (typeof AUDIT_LOG_EVENT_NAMES)[number];
|
|
43
|
+
export interface AuditLogEvent {
|
|
44
|
+
appId: AppId;
|
|
45
|
+
name: AuditLogEventName;
|
|
46
|
+
timestamp: Date;
|
|
47
|
+
context: {
|
|
48
|
+
clientId?: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
};
|
|
51
|
+
tags: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
/** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
|
|
54
|
+
export declare const O11Y_TAG_IS_ERROR = "isError";
|
|
55
|
+
/** Tag for log events. Metrics have an explicit appId field. */
|
|
56
|
+
export declare const O11Y_TAG_APP_ID = "appId";
|
|
57
|
+
/** Tag for metric and log events. */
|
|
58
|
+
export declare const O11Y_TAG_INTEGRATION_ID = "integrationId";
|
|
59
|
+
/** Tag for AI events. */
|
|
60
|
+
export declare const O11Y_TAG_AI_MODEL = "aiModel";
|
|
61
|
+
export declare const O11Y_TAG_AI_PROFILE = "aiProfile";
|
|
62
|
+
export declare const O11Y_TAG_API_KEY_SOURCE = "apiKeySource";
|
|
63
|
+
/** Tag for metric and log events. Value: '0' - not a tenant originated, '1' - is a tenant originated. */
|
|
64
|
+
export declare const O11Y_TAG_IS_TENANT_ORIGINATED = "isTenantOriginated";
|
|
65
|
+
/** Contains a full (with a service name) function name for backend functions. */
|
|
66
|
+
export declare const O11Y_TAG_FUNCTION_NAME = "functionName";
|
|
67
|
+
/** Contains a type of the function name for backend functions (See ExecuteFunctionAnnotationType.). */
|
|
68
|
+
export declare const O11Y_TAG_FUNCTION_TYPE = "functionType";
|
|
69
|
+
export declare function getBooleanMetricTagValue(value: boolean): string;
|
|
70
|
+
export declare const COUNT_METRIC_SUFFIXES: string[];
|
|
71
|
+
export declare const GAUGE_METRIC_SUFFIXES: string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Condition, SimpleCondition } from '../public-types/query.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates the regex pattern, handling special characters as follows:
|
|
4
|
+
* - `_` is replaced with a `.`
|
|
5
|
+
* - `%` is replaced with `[\s\S]*`.
|
|
6
|
+
* - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`.
|
|
7
|
+
* - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \
|
|
8
|
+
*
|
|
9
|
+
* Exported for testing purposes.
|
|
10
|
+
* */
|
|
11
|
+
export declare function replaceSpecialCharacters(input: string): string;
|
|
12
|
+
/** Returns true if the condition is a 'SimpleCondition' or false otherwise. */
|
|
13
|
+
export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SOCKET_RECONNECT_TIMEOUT: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTimestampEnabled(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
|