@squidcloud/client 1.0.281 → 1.0.283
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +12 -2
- package/dist/internal-common/src/public-types/context.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +21 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +18 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +123 -0
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +1 -0
- package/dist/internal-common/src/types/ai-chatbot.types.d.ts +13 -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/query.types.d.ts +10 -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 +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/object.d.ts +49 -0
- package/dist/internal-common/src/utils/serialization.d.ts +5 -0
- package/dist/internal-common/src/utils/validation.d.ts +20 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/collection-reference.d.ts +1 -1
- package/dist/typescript-client/src/observability-client.d.ts +39 -1
- package/dist/typescript-client/src/squid.d.ts +4 -2
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,8 @@ export declare const OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES: readonly ["whisper-
|
|
|
14
14
|
export declare const OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES: readonly ["tts-1", "tts-1-hd"];
|
|
15
15
|
export declare const OPENAI_AUDIO_MODEL_NAMES: readonly ["whisper-1", "tts-1", "tts-1-hd"];
|
|
16
16
|
export declare const STABLE_DIFFUSION_MODEL_NAMES: readonly ["stable-diffusion-core"];
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const FLUX_MODEL_NAMES: readonly ["flux-pro-1.1"];
|
|
18
|
+
export declare const AI_IMAGE_MODEL_NAMES: readonly ["dall-e-3", "stable-diffusion-core", "flux-pro-1.1"];
|
|
18
19
|
export declare const AI_AUDIO_TRANSCRIPTION_MODEL_NAMES: readonly ["whisper-1"];
|
|
19
20
|
export declare const AI_AUDIO_CREATE_SPEECH_MODEL_NAMES: readonly ["tts-1", "tts-1-hd"];
|
|
20
21
|
export declare const OPEN_AI_CREATE_SPEECH_FORMATS: readonly ["mp3", "opus", "aac", "flac", "wav", "pcm"];
|
|
@@ -32,7 +33,8 @@ export type OpenAiAudioTranscriptionModelName = (typeof OPENAI_AUDIO_TRANSCRIPTI
|
|
|
32
33
|
export type OpenAiAudioCreateSpeechModelName = (typeof OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES)[number];
|
|
33
34
|
export type OpenAiCreateSpeechFormat = (typeof OPEN_AI_CREATE_SPEECH_FORMATS)[number];
|
|
34
35
|
export type StableDiffusionModelName = (typeof STABLE_DIFFUSION_MODEL_NAMES)[number];
|
|
35
|
-
export type
|
|
36
|
+
export type FluxModelName = (typeof FLUX_MODEL_NAMES)[number];
|
|
37
|
+
export type AiGenerateImageOptions = DallEOptions | StableDiffusionCoreOptions | FluxOptions;
|
|
36
38
|
export type AiAudioTranscribeOptions = WhisperOptions;
|
|
37
39
|
export type AiAudioCreateSpeechOptions = OpenAiCreateSpeechOptions;
|
|
38
40
|
export type VectorDbType = 'pinecone' | 'postgres';
|
|
@@ -72,6 +74,14 @@ export interface OpenAiCreateSpeechOptions extends BaseAiAudioCreateSpeechOption
|
|
|
72
74
|
responseFormat?: OpenAiCreateSpeechFormat;
|
|
73
75
|
speed?: number;
|
|
74
76
|
}
|
|
77
|
+
export interface FluxOptions extends BaseAiGenerateImageOptions {
|
|
78
|
+
modelName: 'flux-pro-1.1';
|
|
79
|
+
width?: number;
|
|
80
|
+
height?: number;
|
|
81
|
+
prompt_upsampling?: boolean;
|
|
82
|
+
seed?: number;
|
|
83
|
+
safety_tolerance?: number;
|
|
84
|
+
}
|
|
75
85
|
export interface StableDiffusionCoreOptions extends BaseAiGenerateImageOptions {
|
|
76
86
|
modelName: 'stable-diffusion-core';
|
|
77
87
|
aspectRatio?: '16:9' | '1:1' | '21:9' | '2:3' | '3:2' | '4:5' | '5:4' | '9:16' | '9:21';
|
|
@@ -35,6 +35,6 @@ export interface RunContext {
|
|
|
35
35
|
clientId?: ClientId;
|
|
36
36
|
/** The IP address of the client that initiated this request. */
|
|
37
37
|
sourceIp?: string;
|
|
38
|
-
/** The headers of the request. */
|
|
38
|
+
/** The headers of the request. Headers are in lower-case. */
|
|
39
39
|
headers?: Record<string, any>;
|
|
40
40
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApiEndpointId, HttpMethod } from '../public-types/integrations/api.public-types';
|
|
2
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
3
|
+
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
4
|
+
/** The headers of an API call. */
|
|
5
|
+
export type ApiHeaders = Record<string, string | number | boolean>;
|
|
6
|
+
/** The context of an API call. */
|
|
7
|
+
export declare class ApiCallContext {
|
|
8
|
+
readonly integrationId: IntegrationId;
|
|
9
|
+
readonly endpointId: ApiEndpointId;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly method: HttpMethod;
|
|
12
|
+
readonly body: unknown;
|
|
13
|
+
readonly options: ApiOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface CallApiRequest<BodyType = any> {
|
|
16
|
+
integrationId: IntegrationId;
|
|
17
|
+
endpointId: ApiEndpointId;
|
|
18
|
+
body?: BodyType;
|
|
19
|
+
overrideMethod?: HttpMethod;
|
|
20
|
+
options: ApiOptions;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
2
|
+
export type NativeQueryRequestType = 'relational' | 'mongo';
|
|
3
|
+
interface BaseNativeQueryContext {
|
|
4
|
+
type: NativeQueryRequestType;
|
|
5
|
+
integrationId: IntegrationId;
|
|
6
|
+
}
|
|
7
|
+
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
8
|
+
type: 'relational';
|
|
9
|
+
query: string;
|
|
10
|
+
params: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
13
|
+
type: 'mongo';
|
|
14
|
+
collectionName: string;
|
|
15
|
+
aggregationPipeline: Array<any | undefined>;
|
|
16
|
+
}
|
|
17
|
+
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates the regex pattern, handling special characters as follows:
|
|
3
|
+
* - `_` is replaced with a `.`
|
|
4
|
+
* - `%` is replaced with `[\s\S]*`.
|
|
5
|
+
* - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`.
|
|
6
|
+
* - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \
|
|
7
|
+
*
|
|
8
|
+
* Exported for testing purposes.
|
|
9
|
+
* */
|
|
10
|
+
export declare function replaceSpecialCharacters(input: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTimestampEnabled(): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type LockMutex = string;
|
|
2
|
+
/**
|
|
3
|
+
* A simple lock manager that locks a list of mutexes.
|
|
4
|
+
* When locking a list of mutexes, the lock will start only when all the mutexes are available - preventing partial lock
|
|
5
|
+
* and potential deadlocks.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LockManager {
|
|
8
|
+
private readonly locks;
|
|
9
|
+
lock(...mutexes: LockMutex[]): Promise<void>;
|
|
10
|
+
release(...mutexes: LockMutex[]): void;
|
|
11
|
+
canGetLock(...mutexes: LockMutex[]): boolean;
|
|
12
|
+
lockSync(...mutexes: LockMutex[]): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QueryMetricsRequestCommon, QueryMetricsResultGroup } from '../public-types/metric.public-types';
|
|
2
|
+
export type QueryMetricsRequestIntervals = Required<Pick<QueryMetricsRequestCommon, 'fillValue' | 'fn' | 'groupByTags' | 'periodEndSeconds' | 'periodStartSeconds' | 'pointIntervalAlignment' | 'pointIntervalSeconds' | 'tagDomains' | 'noDataBehavior'>>;
|
|
3
|
+
/** Adds missed known tag domain groups and fills all missed points with a request.fillValue. */
|
|
4
|
+
export declare function fillMissedPoints(request: QueryMetricsRequestIntervals, resultGroups: Array<QueryMetricsResultGroup>): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
|
|
2
|
+
export declare function getInPath(obj: unknown, path: string): any;
|
|
3
|
+
export declare function isDateObject(value: unknown): value is Date;
|
|
4
|
+
/** Sets a value by path . Does not support array indexes. */
|
|
5
|
+
export declare function setInPath(obj: object, path: string, value: unknown, delimiter?: string): void;
|
|
6
|
+
export declare function deleteInPath(obj: object, path: string, delimiter?: string): void;
|
|
7
|
+
export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
|
|
8
|
+
export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
|
|
9
|
+
export declare function isNil(obj: unknown): obj is null | undefined;
|
|
10
|
+
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
11
|
+
export declare function isEmpty(a: unknown): boolean;
|
|
12
|
+
export declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...fieldsToRemove: K): Pick<T, Exclude<keyof T, K[number]>>;
|
|
13
|
+
export type CloneCustomizer = (value: unknown) => unknown | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a deep copy of the specified object, including all nested objects and specifically handling Date, Map, and
|
|
16
|
+
* Set fields.
|
|
17
|
+
*
|
|
18
|
+
* The customizer function can modify the cloning process for the object and its fields. If the customizer
|
|
19
|
+
* returns 'undefined' for any input, the function falls back to the standard cloning logic.
|
|
20
|
+
*
|
|
21
|
+
* The cloning process is recursive, ensuring deep cloning of all objects.
|
|
22
|
+
*
|
|
23
|
+
* Note: This function does not support cloning objects with circular dependencies and will throw a system stack
|
|
24
|
+
* overflow error if encountered.
|
|
25
|
+
*/
|
|
26
|
+
export declare function cloneDeep<R = unknown>(value: R, customizer?: CloneCustomizer): R;
|
|
27
|
+
/** Creates a shallow clone of the object. */
|
|
28
|
+
export declare function cloneShallow<T>(value: T): T;
|
|
29
|
+
export declare function deepMerge<T extends object, U extends object>(target: T, source: U): T & U;
|
|
30
|
+
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
31
|
+
export declare function compareValues(v1: unknown, v2: unknown): number;
|
|
32
|
+
/** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */
|
|
33
|
+
export declare function mapValues<ResultType extends object = Record<string, unknown>, InputType extends Record<string, unknown> = Record<string, unknown>>(obj: InputType, valueMapperFn: (value: any, key: keyof InputType, obj: InputType) => unknown): ResultType;
|
|
34
|
+
/** Groups elements of the array by key. See _.groupBy for details. */
|
|
35
|
+
export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (item: T) => K): Record<K, T[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Picks selected fields from the object and returns a new object with the fields selected.
|
|
38
|
+
* The selected fields are assigned by reference (there is no cloning).
|
|
39
|
+
*/
|
|
40
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: ReadonlyArray<K>): Pick<T, K>;
|
|
41
|
+
/** Inverts the record: swaps keys and values. */
|
|
42
|
+
export declare function invert<K extends string | number, V extends string | number>(record: Record<K, V>): Record<V, K>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
|
|
45
|
+
* If end is less than start a zero-length range is created unless a negative step is specified.
|
|
46
|
+
*
|
|
47
|
+
* Same as lodash range but with an additional parameter: `maximumNumberOfItems`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function range(start: number, end: number, step: number, maximumNumberOfItems?: number): number[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function normalizeJsonAsString(json: unknown): string;
|
|
2
|
+
export declare function serializeObj(obj: unknown): string;
|
|
3
|
+
export declare function deserializeObj<T = any>(str: string): T;
|
|
4
|
+
export declare function encodeValueForMapping(value: unknown): string;
|
|
5
|
+
export declare function decodeValueForMapping(encodedString: string): any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpStatus } from '../public-types/http-status.enum';
|
|
2
|
+
export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT | HttpStatus.INTERNAL_SERVER_ERROR;
|
|
3
|
+
export declare class ValidationError extends Error {
|
|
4
|
+
readonly statusCode: StatusCode;
|
|
5
|
+
readonly details?: any;
|
|
6
|
+
constructor(error: string, statusCode: StatusCode, details?: Record<string, any>);
|
|
7
|
+
}
|
|
8
|
+
export declare function isValidId(id: unknown, maxLength?: number): boolean;
|
|
9
|
+
export declare function validateFieldSort(fieldSort: unknown): void;
|
|
10
|
+
export declare function validateQueryLimit(limit: unknown): void;
|
|
11
|
+
/**
|
|
12
|
+
* All type names returned by 'typeof' supported by JavaScript:
|
|
13
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}.
|
|
14
|
+
* and a few other supported types.
|
|
15
|
+
*/
|
|
16
|
+
export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function';
|
|
17
|
+
/** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */
|
|
18
|
+
export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean;
|
|
19
|
+
/** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */
|
|
20
|
+
export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
maxAttempts?: number;
|
|
3
|
+
protocols?: string[];
|
|
4
|
+
onmessage?: (event: any) => void;
|
|
5
|
+
onopen?: (event: any) => void;
|
|
6
|
+
onclose?: (event: any) => void;
|
|
7
|
+
onerror?: (event: any) => void;
|
|
8
|
+
onreconnect?: (event: any) => void;
|
|
9
|
+
onmaximum?: (event: any) => void;
|
|
10
|
+
timeoutMillis?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface WebSocketWrapper {
|
|
13
|
+
open: () => void;
|
|
14
|
+
reconnect: (e: any) => void;
|
|
15
|
+
json: (x: any) => void;
|
|
16
|
+
send: (x: string) => void;
|
|
17
|
+
close: (x?: number, y?: string) => void;
|
|
18
|
+
connected: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Websocket is explicitly closed by calling socket.close().
|
|
21
|
+
* Used to ignore errors after socket.closed() is called.
|
|
22
|
+
*/
|
|
23
|
+
closeCalled: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper;
|
|
26
|
+
export {};
|
|
@@ -34,7 +34,7 @@ export declare class CollectionReference<T extends DocumentData> {
|
|
|
34
34
|
refId: string;
|
|
35
35
|
/**
|
|
36
36
|
* Returns a document reference for the given document id.
|
|
37
|
-
* The document id is an object that maps the primary keys of the collection (as defined in the Squid
|
|
37
|
+
* The document id is an object that maps the primary keys of the collection (as defined in the Squid Console)
|
|
38
38
|
* to their values. There are a few exceptions:
|
|
39
39
|
* 1 - String document id is only supported for the `built_in_db` when a schema was not defined.
|
|
40
40
|
* 2 - Not all the fields in the document id are required. If a field is not provided, it will be generated on the
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { QueryMetricsRequest, QueryMetricsResponse } from '../../internal-common/src/public-types/metric.public-types';
|
|
2
|
+
/** A client for reporting user metrics and querying both application-related Squid and user metrics. */
|
|
3
|
+
export declare class ObservabilityClient {
|
|
4
|
+
private readonly rpcManager;
|
|
5
|
+
private pendingPromises;
|
|
6
|
+
private isReporting;
|
|
7
|
+
/**
|
|
8
|
+
* Reports metrics to the metric submission queue.
|
|
9
|
+
* The metric can be sent immediately or with some (several seconds) delay
|
|
10
|
+
* due to optimizations applied by Squid client.
|
|
11
|
+
* If no tags are provided tags are set to an empty record ({}).
|
|
12
|
+
* If no timestamp is provided the timestamp is set to now().
|
|
13
|
+
*/
|
|
14
|
+
reportMetric<MetricNameType = string>(metric: MetricReport<MetricNameType>): void;
|
|
15
|
+
/**
|
|
16
|
+
* Flushes all pending (unsent) metrics.
|
|
17
|
+
* Note: Even after flushing, it may take some time for these metrics to become visible via 'queryMetrics' due to the
|
|
18
|
+
* eventual consistency of the metrics storage.
|
|
19
|
+
*/
|
|
20
|
+
flush(): Promise<void>;
|
|
21
|
+
/** Queries a batch of metric values. */
|
|
22
|
+
queryMetrics<MetricName extends string = string>(metricRequest: QueryMetricsRequest<MetricName>): Promise<QueryMetricsResponse<MetricName>>;
|
|
23
|
+
}
|
|
24
|
+
/** A single metric event. */
|
|
25
|
+
export interface Metric<MetricNameType = string> {
|
|
26
|
+
/** Name of the metric. */
|
|
27
|
+
name: MetricNameType;
|
|
28
|
+
/** Value of the metric. */
|
|
29
|
+
value: number;
|
|
30
|
+
/** Time associated with the metric. Milliseconds since UNIX epoch. */
|
|
31
|
+
timestamp: number;
|
|
32
|
+
/** Set of tags for the metric. */
|
|
33
|
+
tags: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* MetricReport represents a single metric event with some optional fields.
|
|
37
|
+
* These optional fields are automatically populated by Squid with default values.
|
|
38
|
+
*/
|
|
39
|
+
export type MetricReport<MetricNameType = string> = Omit<Metric<MetricNameType>, 'tags' | 'timestamp'> & Partial<Pick<Metric, 'tags' | 'timestamp'>>;
|
|
@@ -8,6 +8,7 @@ import { QueueManager } from './queue.manager';
|
|
|
8
8
|
import { SecretClient } from './secret.client';
|
|
9
9
|
import { StorageClient } from './storage-client';
|
|
10
10
|
import { TransactionId } from './types';
|
|
11
|
+
import { ObservabilityClient } from './observability-client';
|
|
11
12
|
import { ExtractionClient } from './extraction-client';
|
|
12
13
|
import { PersonalStorageClient } from './personal-storage-client';
|
|
13
14
|
import { SchedulerClient } from './scheduler-client';
|
|
@@ -26,7 +27,7 @@ export interface SquidOptions {
|
|
|
26
27
|
appId: AppId;
|
|
27
28
|
/**
|
|
28
29
|
* The application API key, using the API key can be used to bypass security rules and other restrictions.
|
|
29
|
-
* The API key can be found in the Squid
|
|
30
|
+
* The API key can be found in the Squid Console.
|
|
30
31
|
*/
|
|
31
32
|
apiKey?: ApiKey;
|
|
32
33
|
/**
|
|
@@ -41,7 +42,7 @@ export interface SquidOptions {
|
|
|
41
42
|
*/
|
|
42
43
|
authProvider?: SquidAuthProvider;
|
|
43
44
|
/**
|
|
44
|
-
* The region that the application is running in. This is used to determine the URL of the Squid
|
|
45
|
+
* The region that the application is running in. This is used to determine the URL of the Squid API.
|
|
45
46
|
*/
|
|
46
47
|
region: SquidRegion;
|
|
47
48
|
/**
|
|
@@ -207,6 +208,7 @@ export declare class Squid {
|
|
|
207
208
|
personalStorage(integrationId: IntegrationId): PersonalStorageClient;
|
|
208
209
|
extraction(): ExtractionClient;
|
|
209
210
|
get secrets(): SecretClient;
|
|
211
|
+
get observability(): ObservabilityClient;
|
|
210
212
|
get schedulers(): SchedulerClient;
|
|
211
213
|
/**
|
|
212
214
|
* Returns a distributed lock for the given mutex. The lock can be used to synchronize access to a shared resource.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.
|
|
1
|
+
export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.283";
|