@squidcloud/client 1.0.462 → 1.0.464
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/public-types/ai-agent.public-types.d.ts +21 -16
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +2 -2
- package/dist/internal-common/src/public-types/query.public-types.d.ts +32 -1
- package/dist/internal-common/src/public-types/secret.public-types.d.ts +31 -0
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +5 -1
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +36 -1
- package/dist/typescript-client/src/query-utils.d.ts +24 -1
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +4 -4
- package/dist/internal-common/src/metric-name.d.ts +0 -9
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -148
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -72
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -190
- package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -240
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -202
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -59
- package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
- package/dist/internal-common/src/types/communication.types.d.ts +0 -1
- package/dist/internal-common/src/types/document.types.d.ts +0 -1
- package/dist/internal-common/src/types/file.types.d.ts +0 -6
- package/dist/internal-common/src/types/headers.types.d.ts +0 -17
- package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
- package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/notification.types.d.ts +0 -5
- package/dist/internal-common/src/types/observability.types.d.ts +0 -131
- package/dist/internal-common/src/types/query.types.d.ts +0 -13
- package/dist/internal-common/src/types/secret.types.d.ts +0 -7
- package/dist/internal-common/src/types/socket.types.d.ts +0 -1
- package/dist/internal-common/src/types/stage.d.ts +0 -9
- package/dist/internal-common/src/types/time-units.d.ts +0 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
- package/dist/internal-common/src/utils/array.d.ts +0 -7
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
- package/dist/internal-common/src/utils/http.d.ts +0 -5
- package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
- package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
- package/dist/internal-common/src/utils/object.d.ts +0 -86
- package/dist/internal-common/src/utils/serialization.d.ts +0 -18
- package/dist/internal-common/src/utils/squid.constants.d.ts +0 -6
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
- package/dist/internal-common/src/utils/validation.d.ts +0 -19
- package/dist/internal-common/src/websocket.impl.d.ts +0 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
-
import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, GeminiChatModelName, GrokChatModelName, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat } from './ai-common.public-types';
|
|
2
|
+
import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, GeminiChatModelName, GrokChatModelName, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat, OpenAiImageModelName } from './ai-common.public-types';
|
|
3
3
|
import { AiContextMetadata, AiContextMetadataFilter, AiKnowledgeBaseContextType, AiRagType } from './ai-knowledge-base.public-types';
|
|
4
4
|
import { AiFunctionId, AiFunctionIdWithContext, UserAiChatModelName } from './backend.public-types';
|
|
5
5
|
import { AiAgentId, AiContextId, AiKnowledgeBaseId, AppId, IntegrationId } from './communication.public-types';
|
|
@@ -10,7 +10,7 @@ import { SecretKey } from './secret.public-types';
|
|
|
10
10
|
/**
|
|
11
11
|
* @category AI
|
|
12
12
|
*/
|
|
13
|
-
export type AiGenerateImageOptions =
|
|
13
|
+
export type AiGenerateImageOptions = GptImageOptions | StableDiffusionCoreOptions | FluxOptions;
|
|
14
14
|
/**
|
|
15
15
|
* @category AI
|
|
16
16
|
*/
|
|
@@ -48,18 +48,18 @@ export interface BaseAiAudioCreateSpeechOptions {
|
|
|
48
48
|
modelName: AiAudioCreateSpeechModelName;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Options for generating images using
|
|
51
|
+
* Options for generating images using OpenAI's gpt-image-* family of models.
|
|
52
52
|
* @category AI
|
|
53
53
|
*/
|
|
54
|
-
export interface
|
|
55
|
-
/** Specifies the
|
|
56
|
-
modelName:
|
|
57
|
-
/** The quality of the generated image; defaults to '
|
|
58
|
-
quality?: '
|
|
54
|
+
export interface GptImageOptions extends BaseAiGenerateImageOptions {
|
|
55
|
+
/** Specifies the OpenAI image model to use. */
|
|
56
|
+
modelName: OpenAiImageModelName;
|
|
57
|
+
/** The quality of the generated image; defaults to 'auto'. */
|
|
58
|
+
quality?: 'auto' | 'high' | 'medium' | 'low';
|
|
59
59
|
/** The size of the generated image; defaults to '1024x1024'. */
|
|
60
|
-
size?: '1024x1024' | '
|
|
61
|
-
/** The number of images to generate; defaults to 1
|
|
62
|
-
numberOfImagesToGenerate?:
|
|
60
|
+
size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
|
|
61
|
+
/** The number of images to generate; defaults to 1. */
|
|
62
|
+
numberOfImagesToGenerate?: number;
|
|
63
63
|
}
|
|
64
64
|
interface BaseOpenAiAudioTranscribeOptions extends BaseAiAudioTranscribeOptions {
|
|
65
65
|
/** Specifies the model for audio transcription. */
|
|
@@ -337,18 +337,23 @@ export interface AiAgentExecutionPlanOptions {
|
|
|
337
337
|
*/
|
|
338
338
|
allowClarificationQuestions?: boolean;
|
|
339
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* The memory mode for an AI agent:
|
|
342
|
+
* - 'none': No memory is used, the agent does not remember past interactions.
|
|
343
|
+
* - 'read-only': The agent can read from memory but cannot write to it.
|
|
344
|
+
* - 'read-write': The agent can both read from and write to memory.
|
|
345
|
+
* @category AI
|
|
346
|
+
*/
|
|
347
|
+
export type AiAgentMemoryMode = 'none' | 'read-only' | 'read-write';
|
|
340
348
|
/**
|
|
341
349
|
* Options for AI agent memory management.
|
|
342
350
|
* @category AI
|
|
343
351
|
*/
|
|
344
352
|
export interface AiAgentMemoryOptions {
|
|
345
353
|
/**
|
|
346
|
-
* The memory mode
|
|
347
|
-
* - 'none': No memory is used, the agent does not remember past interactions.
|
|
348
|
-
* - 'read-only': The agent can read from memory but cannot write to it.
|
|
349
|
-
* - 'read-write': The agent can both read from and write to memory.
|
|
354
|
+
* The memory mode for an AI agent
|
|
350
355
|
*/
|
|
351
|
-
memoryMode:
|
|
356
|
+
memoryMode: AiAgentMemoryMode;
|
|
352
357
|
/**
|
|
353
358
|
* A unique ID to store the chat memory.
|
|
354
359
|
*
|
|
@@ -97,7 +97,7 @@ export type AiEmbeddingsModelSelection = AiEmbeddingsModelName | IntegrationEmbe
|
|
|
97
97
|
* The supported AI image generation model names.
|
|
98
98
|
* @category AI
|
|
99
99
|
*/
|
|
100
|
-
export declare const OPENAI_IMAGE_MODEL_NAMES: readonly ["
|
|
100
|
+
export declare const OPENAI_IMAGE_MODEL_NAMES: readonly ["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-2", "gpt-image-2-2026-04-21", "chatgpt-image-latest"];
|
|
101
101
|
/**
|
|
102
102
|
* @category AI
|
|
103
103
|
*/
|
|
@@ -121,7 +121,7 @@ export declare const FLUX_MODEL_NAMES: readonly ["flux-pro-1.1", "flux-kontext-p
|
|
|
121
121
|
/**
|
|
122
122
|
* @category AI
|
|
123
123
|
*/
|
|
124
|
-
export declare const AI_IMAGE_MODEL_NAMES: readonly ["
|
|
124
|
+
export declare const AI_IMAGE_MODEL_NAMES: readonly ["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-2", "gpt-image-2-2026-04-21", "chatgpt-image-latest", "stable-diffusion-core", "flux-pro-1.1", "flux-kontext-pro"];
|
|
125
125
|
/**
|
|
126
126
|
* @category AI
|
|
127
127
|
*/
|
|
@@ -20,11 +20,17 @@ export interface JoinCondition {
|
|
|
20
20
|
/** Indicates whether the join is an inner join (true) or outer join (false). */
|
|
21
21
|
isInner: boolean;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Field name for filtering by document ID through the standard query API, without needing to
|
|
25
|
+
* know the underlying primary key column names.
|
|
26
|
+
* @category Database
|
|
27
|
+
*/
|
|
28
|
+
export declare const DOC_ID_FIELD = "__docId__";
|
|
23
29
|
/**
|
|
24
30
|
* A list of query conditions.
|
|
25
31
|
* @category Database
|
|
26
32
|
*/
|
|
27
|
-
export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
|
|
33
|
+
export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc> | DocIdCondition<Doc>;
|
|
28
34
|
/**
|
|
29
35
|
* A list of query conditions.
|
|
30
36
|
* @category Database
|
|
@@ -55,6 +61,23 @@ export interface CompositeCondition<Doc extends DocumentData = any> {
|
|
|
55
61
|
fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
|
|
56
62
|
}
|
|
57
63
|
type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
|
|
64
|
+
/**
|
|
65
|
+
* Set of operators supported by `DocIdCondition`.
|
|
66
|
+
* @category Database
|
|
67
|
+
*/
|
|
68
|
+
export type DocIdOperator = '==' | '!=' | 'in' | 'not in';
|
|
69
|
+
/**
|
|
70
|
+
* A condition that filters documents by their identity for collections with composite primary keys.
|
|
71
|
+
* Each entry in `docIds` maps primary-key field names to values and represents one AND grouping.
|
|
72
|
+
* The list of entries is ORed together.
|
|
73
|
+
* @category Database
|
|
74
|
+
*/
|
|
75
|
+
export interface DocIdCondition<Doc extends DocumentData = any> {
|
|
76
|
+
/** The operator applied to the set of doc-id values. Limited to the equality family. */
|
|
77
|
+
operator: DocIdOperator;
|
|
78
|
+
/** The list of composite-key value groups */
|
|
79
|
+
docIds: Array<Record<FieldName<Doc>, any>>;
|
|
80
|
+
}
|
|
58
81
|
/**
|
|
59
82
|
* The list of operators related to arrays.
|
|
60
83
|
* @category Database
|
|
@@ -100,6 +123,14 @@ export interface Query<Doc extends DocumentData = any> {
|
|
|
100
123
|
/** Optional list of fields to return. If null/undefined, all fields are returned. If empty array, only metadata/IDs are returned. */
|
|
101
124
|
projectFields?: Array<FieldName<Doc>>;
|
|
102
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Result returned from deleting documents matched by a query.
|
|
128
|
+
* @category Database
|
|
129
|
+
*/
|
|
130
|
+
export interface QueryDeleteResult {
|
|
131
|
+
/** Number of documents selected for deletion. */
|
|
132
|
+
deletedCount: number;
|
|
133
|
+
}
|
|
103
134
|
/**
|
|
104
135
|
* A configuration object used to apply additional field-based limits to a query.
|
|
105
136
|
* @category Database
|
|
@@ -49,3 +49,34 @@ export interface SetSecretRequestEntry {
|
|
|
49
49
|
/** The value to assign to the secret. */
|
|
50
50
|
value: SecretValue;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Public representation of a management API key. Never includes the plaintext value or hash.
|
|
54
|
+
* @category Secret
|
|
55
|
+
*/
|
|
56
|
+
export interface ManagementApiKey {
|
|
57
|
+
/** Stable key identifier. */
|
|
58
|
+
id: string;
|
|
59
|
+
/** User that owns the key. */
|
|
60
|
+
userId: string;
|
|
61
|
+
/** Optional human-readable description. */
|
|
62
|
+
description: string | null;
|
|
63
|
+
/** Lower-case 'active' | 'suspended' | 'deleted'. */
|
|
64
|
+
status: string;
|
|
65
|
+
/** ISO-8601 timestamp of creation. */
|
|
66
|
+
createdAt: string;
|
|
67
|
+
/** ISO-8601 timestamp of the last status / metadata change. */
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
/** ISO-8601 timestamp of the last successful validation, or null if never used. */
|
|
70
|
+
lastUsedAt: string | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Response returned when a management API key is created. The plaintext keyValue is only
|
|
74
|
+
* returned at creation time — it is not retrievable afterwards.
|
|
75
|
+
* @category Secret
|
|
76
|
+
*/
|
|
77
|
+
export interface CreateManagementApiKeyResponse {
|
|
78
|
+
/** Public metadata of the new key. */
|
|
79
|
+
key: ManagementApiKey;
|
|
80
|
+
/** Plaintext key value — only returned here, never persisted in clear, never returned again. */
|
|
81
|
+
keyValue: string;
|
|
82
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { DocumentReference } from '../document-reference';
|
|
3
|
-
import { Alias, DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, SerializedJoinQuery, SimpleCondition } from '../public-types';
|
|
3
|
+
import { Alias, DOC_ID_FIELD, DocIdOrDocIdObj, DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, SerializedJoinQuery, SimpleCondition } from '../public-types';
|
|
4
4
|
import { Pagination, PaginationOptions } from './pagination';
|
|
5
5
|
import { BaseQueryBuilder, HasDereference, QueryBuilder } from './query-builder.factory';
|
|
6
6
|
import { SnapshotEmitter } from './snapshot-emitter';
|
|
@@ -98,6 +98,10 @@ export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, Re
|
|
|
98
98
|
* @param value The value to compare against
|
|
99
99
|
* @returns The query builder
|
|
100
100
|
*/
|
|
101
|
+
where(fieldName: typeof DOC_ID_FIELD, operator: '==' | '!=', value: DocIdOrDocIdObj): this;
|
|
102
|
+
/** @inheritDoc */
|
|
103
|
+
where(fieldName: typeof DOC_ID_FIELD, operator: 'in' | 'not in', value: Array<DocIdOrDocIdObj>): this;
|
|
104
|
+
/** @inheritDoc */
|
|
101
105
|
where(fieldName: (keyof ReturnType[LatestAlias] & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
102
106
|
/**
|
|
103
107
|
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { DocumentReference } from '../document-reference';
|
|
3
|
-
import { DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, SerializedSimpleQuery, SimpleCondition } from '../public-types';
|
|
3
|
+
import { DOC_ID_FIELD, DocIdOrDocIdObj, DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, QueryDeleteResult, SerializedSimpleQuery, SimpleCondition } from '../public-types';
|
|
4
4
|
import { Pagination, PaginationOptions } from './pagination';
|
|
5
5
|
import { SnapshotEmitter } from './snapshot-emitter';
|
|
6
6
|
/** Result type after projection: only the selected fields.
|
|
@@ -32,6 +32,7 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
32
32
|
* @param value The value to compare against.
|
|
33
33
|
* @returns The query builder.
|
|
34
34
|
*/
|
|
35
|
+
eq(fieldName: typeof DOC_ID_FIELD, value: DocIdOrDocIdObj): this;
|
|
35
36
|
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
36
37
|
/**
|
|
37
38
|
* A shortcut for `where(fieldName, '!=', value)`
|
|
@@ -39,6 +40,7 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
39
40
|
* @param value The value to compare against.
|
|
40
41
|
* @returns The query builder.
|
|
41
42
|
*/
|
|
43
|
+
neq(fieldName: typeof DOC_ID_FIELD, value: DocIdOrDocIdObj): this;
|
|
42
44
|
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
43
45
|
/**
|
|
44
46
|
* A shortcut for `where(fieldName, 'in', value)`
|
|
@@ -46,6 +48,7 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
46
48
|
* @param value An array of values to compare against.
|
|
47
49
|
* @returns The query builder.
|
|
48
50
|
*/
|
|
51
|
+
in(fieldName: typeof DOC_ID_FIELD, value: Array<DocIdOrDocIdObj>): this;
|
|
49
52
|
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
50
53
|
/**
|
|
51
54
|
* A shortcut for `where(fieldName, 'not in', value)`
|
|
@@ -53,7 +56,26 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
53
56
|
* @param value An array of values to compare against.
|
|
54
57
|
* @returns The query builder.
|
|
55
58
|
*/
|
|
59
|
+
nin(fieldName: typeof DOC_ID_FIELD, value: Array<DocIdOrDocIdObj>): this;
|
|
56
60
|
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
61
|
+
/**
|
|
62
|
+
* A shortcut for `eq(DOC_ID_FIELD, id)`. Filters the query to the single document with the given id.
|
|
63
|
+
* For composite primary keys, pass an object with all PK fields, e.g. `{pk1: 'a', pk2: 1}`.
|
|
64
|
+
* For single primary keys, the raw scalar value (`'Amy'`, `42`) also works.
|
|
65
|
+
*
|
|
66
|
+
* @param id The document id to filter by.
|
|
67
|
+
* @returns The query builder.
|
|
68
|
+
*/
|
|
69
|
+
docId(id: DocIdOrDocIdObj | PrimitiveFieldType): this;
|
|
70
|
+
/**
|
|
71
|
+
* A shortcut for `in(DOC_ID_FIELD, ids)`. Filters the query to documents whose id is in the given list.
|
|
72
|
+
* For composite primary keys, pass objects with all PK fields, e.g. `[{pk1: 'a', pk2: 1}, ...]`.
|
|
73
|
+
* For single primary keys, raw scalar values also work.
|
|
74
|
+
*
|
|
75
|
+
* @param ids The list of document ids to filter by.
|
|
76
|
+
* @returns The query builder.
|
|
77
|
+
*/
|
|
78
|
+
docIds(ids: Array<DocIdOrDocIdObj | PrimitiveFieldType>): this;
|
|
57
79
|
/**
|
|
58
80
|
* A shortcut for `where(fieldName, '>', value)`
|
|
59
81
|
* @param fieldName The name of the field to query.
|
|
@@ -135,6 +157,8 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
135
157
|
* @param value The value to compare against.
|
|
136
158
|
* @returns The query builder.
|
|
137
159
|
*/
|
|
160
|
+
abstract where(fieldName: typeof DOC_ID_FIELD, operator: '==' | '!=', value: DocIdOrDocIdObj): this;
|
|
161
|
+
abstract where(fieldName: typeof DOC_ID_FIELD, operator: 'in' | 'not in', value: Array<DocIdOrDocIdObj>): this;
|
|
138
162
|
abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
139
163
|
/**
|
|
140
164
|
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
@@ -176,6 +200,7 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
|
|
|
176
200
|
private readonly documentReferenceFactory;
|
|
177
201
|
private readonly queryBuilderFactory;
|
|
178
202
|
private readonly documentIdentityService;
|
|
203
|
+
private readonly mutationSender?;
|
|
179
204
|
private forceFetchFromServer;
|
|
180
205
|
/**
|
|
181
206
|
* A unique hash for the query. Identical queries should return the same hash
|
|
@@ -184,6 +209,9 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
|
|
|
184
209
|
* @returns The query's hash string.
|
|
185
210
|
*/
|
|
186
211
|
get hash(): string;
|
|
212
|
+
where(fieldName: typeof DOC_ID_FIELD, operator: '==' | '!=', value: DocIdOrDocIdObj): this;
|
|
213
|
+
/** @inheritDoc */
|
|
214
|
+
where(fieldName: typeof DOC_ID_FIELD, operator: 'in' | 'not in', value: Array<DocIdOrDocIdObj>): this;
|
|
187
215
|
/** @inheritDoc */
|
|
188
216
|
where(fieldName: (keyof DocumentType & FieldName) | string, operator: Operator, value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
189
217
|
/** @inheritDoc */
|
|
@@ -218,6 +246,12 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
|
|
|
218
246
|
* @inheritDoc
|
|
219
247
|
*/
|
|
220
248
|
changes(): Observable<Changes<DocumentType>>;
|
|
249
|
+
/**
|
|
250
|
+
* Deletes documents matching this query.
|
|
251
|
+
*
|
|
252
|
+
* @returns The number of documents selected for deletion.
|
|
253
|
+
*/
|
|
254
|
+
delete(): Promise<QueryDeleteResult>;
|
|
221
255
|
/** @inheritDoc */
|
|
222
256
|
dereference(): SnapshotEmitter<DocumentType>;
|
|
223
257
|
getSortOrders(): Array<FieldSort<any>>;
|
|
@@ -226,6 +260,7 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
|
|
|
226
260
|
flipSortOrder(): QueryBuilder<DocumentType>;
|
|
227
261
|
serialize(): SerializedSimpleQuery;
|
|
228
262
|
paginate(options?: Partial<PaginationOptions>): Pagination<DocumentReference<DocumentType>>;
|
|
263
|
+
private validateQueryDeleteModifiers;
|
|
229
264
|
private mergeConditions;
|
|
230
265
|
}
|
|
231
266
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentData } from '../../internal-common/src/public-types/document.public-types';
|
|
1
|
+
import { DocIdOrDocIdObj, DocumentData } from '../../internal-common/src/public-types/document.public-types';
|
|
2
2
|
import { QueryBuilder } from './query/query-builder.factory';
|
|
3
3
|
/**
|
|
4
4
|
* Result of the `visitQueryResults` function.
|
|
@@ -16,3 +16,26 @@ export interface VisitQueryResultsStats {
|
|
|
16
16
|
* @category Database
|
|
17
17
|
*/
|
|
18
18
|
export declare function visitQueryResults<T extends DocumentData>(query: QueryBuilder<T>, callback: (t: T) => Promise<unknown>, pageSize?: number): Promise<VisitQueryResultsStats>;
|
|
19
|
+
/**
|
|
20
|
+
* Paginates through the query and returns the docIds of all matching documents in a form
|
|
21
|
+
* that can be passed back to `collection.doc(id)` to retrieve the same documents. Does
|
|
22
|
+
* NOT read `ref.data` — only the index identifiers — so it is safe to call when document
|
|
23
|
+
* data is being mutated concurrently, and uses O(N) of small ids rather than O(N) of
|
|
24
|
+
* full document payloads.
|
|
25
|
+
*
|
|
26
|
+
* Use this instead of `visitQueryResults` when the per-row processing may mutate the same
|
|
27
|
+
* collection in a way that affects which documents match the query. Live pagination breaks
|
|
28
|
+
* in that case: a write that takes a row out of the result set evicts refs in the same
|
|
29
|
+
* page (DataManager reacts globally to mutations), and subsequent `ref.data` reads throw
|
|
30
|
+
* "No data found". The recommended pattern is:
|
|
31
|
+
*
|
|
32
|
+
* const ids = await loadQueryResultDocIds(query);
|
|
33
|
+
* for (const id of ids) {
|
|
34
|
+
* const doc = await collection.doc(id).snapshot();
|
|
35
|
+
* if (!doc) continue;
|
|
36
|
+
* // ...mutate doc...
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* @category Database
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadQueryResultDocIds<T extends DocumentData>(query: QueryBuilder<T>, pageSize?: number): Promise<Array<DocIdOrDocIdObj>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.464",
|
|
4
4
|
"description": "A typescript implementation of the Squid client",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"license": "ISC",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"json-schema-typed": "^8.0.1",
|
|
42
|
-
"ws": "^8.
|
|
42
|
+
"ws": "^8.20.0"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
45
|
"bufferutil": "^4.0.8",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"typedoc-plugin-markdown": "^4.8.1",
|
|
54
54
|
"@supercharge/promise-pool": "^3.2.0",
|
|
55
55
|
"@webpack-cli/generators": "^3.0.7",
|
|
56
|
-
"copy-webpack-plugin": "^
|
|
56
|
+
"copy-webpack-plugin": "^14.0.0",
|
|
57
57
|
"cpx": "^1.5.0",
|
|
58
58
|
"generate-package-json-webpack-plugin": "^2.6.0",
|
|
59
59
|
"otrie": "^1.2.2",
|
|
60
60
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
61
61
|
"tscpaths": "^0.0.9",
|
|
62
|
-
"webpack": "^5.
|
|
62
|
+
"webpack": "^5.106.2",
|
|
63
63
|
"webpack-cli": "^5.1.4"
|
|
64
64
|
},
|
|
65
65
|
"browser": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Names of the Squid metrics.
|
|
3
|
-
* Should be in sync with MetricName.kt.
|
|
4
|
-
* See MetricName.kt for documentation on each value.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_aiIntegrationApi_count", "squid_aiIntegrationApi_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_aiContextUpsert_count", "squid_aiContextDelete_count", "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_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_testAgentProtocolConnection_count", "squid_testAgentProtocolConnection_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", "squid_acquireLock_count", "squid_acquireLock_time", "squid_releaseLock_count", "squid_releaseLock_time"];
|
|
7
|
-
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
8
|
-
/** Common prefix for all Squid metrics. */
|
|
9
|
-
export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
2
|
-
import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
|
|
3
|
-
import { IntegrationId } from '../public-types/communication.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
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
|
|
2
|
-
import { Paths } from '../public-types/typescript.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 state of the document before the mutation was applied.
|
|
125
|
-
*/
|
|
126
|
-
get before(): T | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* Returns the state of the document after the mutation was applied.
|
|
129
|
-
*/
|
|
130
|
-
get after(): T | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Returns the type of the mutation (insert, update, or delete).
|
|
133
|
-
*/
|
|
134
|
-
getMutationType(): MutationType;
|
|
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 {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { IntegrationId } from '../public-types/communication.public-types';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the type of native query request, either relational, elastic or MongoDB.
|
|
4
|
-
* @category Database
|
|
5
|
-
*/
|
|
6
|
-
export type NativeQueryRequestType = 'relational' | 'mongo' | 'elasticsearch' | 'pure';
|
|
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
|
-
* Context for executing a pure database query.
|
|
57
|
-
* @category Database
|
|
58
|
-
*/
|
|
59
|
-
export interface PureNativeQueryContext extends BaseNativeQueryContext {
|
|
60
|
-
/** Specifies that the query is for a relational database. */
|
|
61
|
-
type: 'pure';
|
|
62
|
-
/** SQL query string to be executed. */
|
|
63
|
-
query: string;
|
|
64
|
-
/** Parameters to be used in the query. */
|
|
65
|
-
params: Record<string, any>;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Union type representing either a relational or MongoDB native query context.
|
|
69
|
-
* @category Database
|
|
70
|
-
*/
|
|
71
|
-
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext;
|
|
72
|
-
export {};
|