@squidcloud/client 1.0.446 → 1.0.448
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-common.public-types.d.ts +2 -2
- package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +10 -1
- package/dist/internal-common/src/public-types/query.public-types.d.ts +2 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +29 -1
- package/dist/typescript-client/src/document-reference.d.ts +1 -0
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +8 -0
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +15 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
- 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 -177
- package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -209
- 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 -107
- 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 -1
- 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
|
@@ -39,12 +39,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4", "grok-4-1-fast-r
|
|
|
39
39
|
* Public Anthropic chat model names (active models only).
|
|
40
40
|
* @category AI
|
|
41
41
|
*/
|
|
42
|
-
export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-4-6", "claude-
|
|
42
|
+
export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-4-6", "claude-sonnet-4-6"];
|
|
43
43
|
/**
|
|
44
44
|
* The supported AI model names.
|
|
45
45
|
* @category AI
|
|
46
46
|
*/
|
|
47
|
-
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5-mini", "gpt-5-nano", "gpt-5.2", "gpt-5.2-pro", "claude-haiku-4-5-20251001", "claude-opus-4-6", "claude-
|
|
47
|
+
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5-mini", "gpt-5-nano", "gpt-5.2", "gpt-5.2-pro", "claude-haiku-4-5-20251001", "claude-opus-4-6", "claude-sonnet-4-6", "gemini-3-pro", "gemini-3-flash", "grok-4", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
48
48
|
/** Checks if the given model name is a global AI chat model name. */
|
|
49
49
|
export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
|
|
50
50
|
/**
|
|
@@ -2,6 +2,15 @@ import { AiAgentMemoryOptions, AiChatOptions, AiFileUrl, AiSessionContext } from
|
|
|
2
2
|
import { ApiOptions } from './api-client.public-types';
|
|
3
3
|
import { AiAgentId, IntegrationId } from './communication.public-types';
|
|
4
4
|
import { PartialBy } from './typescript.public-types';
|
|
5
|
+
/** A single output column descriptor in a raw query result file. */
|
|
6
|
+
export interface AiQueryResultFieldSchema {
|
|
7
|
+
/** Column name as it appears in the query result. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Data type of the column (e.g. "varchar", "int", "decimal"). */
|
|
10
|
+
type: string;
|
|
11
|
+
/** Human-readable description of what the column represents. */
|
|
12
|
+
desc: string;
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* Options for configuring AI query execution.
|
|
7
16
|
* @category AI
|
|
@@ -102,7 +111,7 @@ export interface AiQueryAnalyzeResultsOptions {
|
|
|
102
111
|
agentId?: AiAgentId;
|
|
103
112
|
}
|
|
104
113
|
/**
|
|
105
|
-
* Information about an executed query
|
|
114
|
+
* Information about an executed query.
|
|
106
115
|
* @category AI
|
|
107
116
|
*/
|
|
108
117
|
export interface ExecutedQueryInfo {
|
|
@@ -97,6 +97,8 @@ export interface Query<Doc extends DocumentData = any> {
|
|
|
97
97
|
limit: number;
|
|
98
98
|
/** Optional configuration to limit results by specific fields with custom sorting. */
|
|
99
99
|
limitBy?: LimitBy<Doc>;
|
|
100
|
+
/** Optional list of fields to return. If null/undefined, all fields are returned. If empty array, only metadata/IDs are returned. */
|
|
101
|
+
projectFields?: Array<FieldName<Doc>>;
|
|
100
102
|
}
|
|
101
103
|
/**
|
|
102
104
|
* A configuration object used to apply additional field-based limits to a query.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { AiAgent, AiChatMessage, AiChatModelSelection, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiStatusMessage, AiTranscribeAndAskResponse, AllAiAgentChatOptions, GuardrailsOptions, ListAgentRevisionsResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
2
|
+
import { AiAgent, AiChatMessage, AiChatModelSelection, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiConnectedKnowledgeBaseMetadata, AiStatusMessage, AiTranscribeAndAskResponse, AllAiAgentChatOptions, GuardrailsOptions, ListAgentRevisionsResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
3
3
|
import { JobId } from '../../../internal-common/src/public-types/job.public-types';
|
|
4
4
|
import { Paths } from '../../../internal-common/src/public-types/typescript.public-types';
|
|
5
5
|
import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskResponse, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
|
|
@@ -179,6 +179,34 @@ export declare class AiAgentReference {
|
|
|
179
179
|
* Atomically adds a connected integration to the agent.
|
|
180
180
|
*/
|
|
181
181
|
addConnectedIntegration(integration: AiConnectedIntegrationMetadata): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Atomically adds a connected agent to the agent.
|
|
184
|
+
*/
|
|
185
|
+
addConnectedAgent(connectedAgent: AiConnectedAgentMetadata): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Atomically adds a connected knowledge base to the agent.
|
|
188
|
+
*/
|
|
189
|
+
addConnectedKnowledgeBase(knowledgeBase: AiConnectedKnowledgeBaseMetadata): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Atomically adds a function to the agent.
|
|
192
|
+
*/
|
|
193
|
+
addFunction(functionId: string): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Atomically removes a connected agent from the agent.
|
|
196
|
+
*/
|
|
197
|
+
removeConnectedAgent(connectedAgentId: string): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Atomically removes a connected integration from the agent.
|
|
200
|
+
*/
|
|
201
|
+
removeConnectedIntegration(integrationId: string): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Atomically removes a connected knowledge base from the agent.
|
|
204
|
+
*/
|
|
205
|
+
removeConnectedKnowledgeBase(knowledgeBaseId: string): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Atomically removes a function from the agent.
|
|
208
|
+
*/
|
|
209
|
+
removeFunction(functionId: string): Promise<void>;
|
|
182
210
|
/**
|
|
183
211
|
* Sets the agent's description.
|
|
184
212
|
*/
|
|
@@ -17,6 +17,7 @@ export declare class DocumentReference<T extends DocumentData = any> {
|
|
|
17
17
|
private _squidDocId;
|
|
18
18
|
private readonly dataManager;
|
|
19
19
|
private readonly queryBuilderFactory;
|
|
20
|
+
private readonly projectFields?;
|
|
20
21
|
/** A string that uniquely identifies this document reference. */
|
|
21
22
|
refId: string;
|
|
22
23
|
/**
|
|
@@ -4,6 +4,11 @@ import { Alias, DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType
|
|
|
4
4
|
import { Pagination, PaginationOptions } from './pagination';
|
|
5
5
|
import { BaseQueryBuilder, HasDereference, QueryBuilder } from './query-builder.factory';
|
|
6
6
|
import { SnapshotEmitter } from './snapshot-emitter';
|
|
7
|
+
/** Result type after projection: only the selected fields.
|
|
8
|
+
* Note: __docId__ and PKs are still returned at runtime, but not included in the type.
|
|
9
|
+
* Users must explicitly project fields they want in the type.
|
|
10
|
+
*/
|
|
11
|
+
type ProjectedResult<T, K extends keyof T> = Pick<T, K>;
|
|
7
12
|
/**
|
|
8
13
|
* Represents the result of a join query where each property is a document reference,
|
|
9
14
|
* grouped by alias instead of containing DocumentData.
|
|
@@ -110,6 +115,8 @@ export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, Re
|
|
|
110
115
|
* @returns The query builder
|
|
111
116
|
*/
|
|
112
117
|
sortBy(fieldName: (keyof ReturnType[RootAlias] & FieldName) | string, asc?: boolean): this;
|
|
118
|
+
/** @inheritDoc */
|
|
119
|
+
projectFields<K extends keyof ReturnType & FieldName>(_fields: K[]): JoinQueryBuilder<Aliases, ProjectedResult<ReturnType, K>, LatestAlias, RootAlias>;
|
|
113
120
|
/**
|
|
114
121
|
* Joins this query with another collection using a specified alias from the left side of the join,
|
|
115
122
|
* allowing you to build complex multi-level joins. The join is defined by specifying which fields
|
|
@@ -314,3 +321,4 @@ export declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnT
|
|
|
314
321
|
paginate(options?: Partial<PaginationOptions>): Pagination<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
|
|
315
322
|
private groupData;
|
|
316
323
|
}
|
|
324
|
+
export {};
|
|
@@ -3,6 +3,11 @@ import { DocumentReference } from '../document-reference';
|
|
|
3
3
|
import { DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, SerializedSimpleQuery, SimpleCondition } from '../public-types';
|
|
4
4
|
import { Pagination, PaginationOptions } from './pagination';
|
|
5
5
|
import { SnapshotEmitter } from './snapshot-emitter';
|
|
6
|
+
/** Result type after projection: only the selected fields.
|
|
7
|
+
* Note: __docId__ and PKs are still returned at runtime, but not included in the type.
|
|
8
|
+
* Users must explicitly project fields they want in the type.
|
|
9
|
+
*/
|
|
10
|
+
type ProjectedResult<T, K extends keyof T> = Pick<T, K>;
|
|
6
11
|
/**
|
|
7
12
|
* Interface used solely for inheritDoc
|
|
8
13
|
* @category Database
|
|
@@ -150,6 +155,13 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
150
155
|
* Returns the query object built by this query builder.
|
|
151
156
|
*/
|
|
152
157
|
abstract build(): Query;
|
|
158
|
+
/**
|
|
159
|
+
* Specifies which fields to return from the query. If not called, all fields are returned.
|
|
160
|
+
* Use to improve query performance by reducing the amount of data transferred.
|
|
161
|
+
* @param fields The fields to include in the query results.
|
|
162
|
+
* @returns A query builder with the narrowed return type containing only the projected fields
|
|
163
|
+
*/
|
|
164
|
+
abstract projectFields<K extends keyof MyDocType & FieldName>(fields: K[]): BaseQueryBuilder<ProjectedResult<MyDocType, K>>;
|
|
153
165
|
private throwIfInvalidLikePattern;
|
|
154
166
|
}
|
|
155
167
|
/**
|
|
@@ -181,6 +193,8 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
|
|
|
181
193
|
/** @inheritDoc */
|
|
182
194
|
sortBy(fieldName: (keyof DocumentType & FieldName) | string, asc?: boolean): this;
|
|
183
195
|
/** @inheritDoc */
|
|
196
|
+
projectFields<K extends keyof DocumentType & FieldName>(fields: K[]): QueryBuilder<ProjectedResult<DocumentType, K>>;
|
|
197
|
+
/** @inheritDoc */
|
|
184
198
|
build(): Query;
|
|
185
199
|
getSortOrder(): FieldSort<DocumentType>[];
|
|
186
200
|
/**
|
|
@@ -226,3 +240,4 @@ export declare class Changes<DocumentType extends DocumentData> {
|
|
|
226
240
|
/** The actual document data that was deleted from the query result */
|
|
227
241
|
readonly deletes: Array<DocumentType>;
|
|
228
242
|
}
|
|
243
|
+
export {};
|
package/package.json
CHANGED
|
@@ -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_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_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"];
|
|
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 {};
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { AiQueryOptions } from '../public-types/ai-query.public-types';
|
|
2
|
-
import { IntegrationId } from '../public-types/communication.public-types';
|
|
3
|
-
import { CollectionName, DocumentData } from '../public-types/document.public-types';
|
|
4
|
-
import { FieldSort, Operator, Query, SimpleCondition } from '../public-types/query.public-types';
|
|
5
|
-
import { DeepRecord, FieldOf, PartialBy, Paths } from '../public-types/typescript.public-types';
|
|
6
|
-
/**
|
|
7
|
-
* The information provided to the secureAiQuery function about the AI query being executed.
|
|
8
|
-
* @category AI
|
|
9
|
-
*/
|
|
10
|
-
export interface AiQueryContext {
|
|
11
|
-
/** The prompt provided for the AI query. */
|
|
12
|
-
prompt: string;
|
|
13
|
-
/** The options used for executing the AI query. */
|
|
14
|
-
options: AiQueryOptions;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Represents the Squid query context.
|
|
18
|
-
* Passed to methods that require query details, such as those annotated with the `@secureCollection` annotation.
|
|
19
|
-
* @category Database
|
|
20
|
-
*/
|
|
21
|
-
export declare class QueryContext<T extends DocumentData = any> {
|
|
22
|
-
readonly query: Query<T>;
|
|
23
|
-
/**
|
|
24
|
-
* The ID of the integration being queried.
|
|
25
|
-
*/
|
|
26
|
-
get integrationId(): IntegrationId;
|
|
27
|
-
/**
|
|
28
|
-
* The name of the collection being queried.
|
|
29
|
-
*/
|
|
30
|
-
get collectionName(): CollectionName;
|
|
31
|
-
/**
|
|
32
|
-
* The query limit if one exists, -1 otherwise.
|
|
33
|
-
*/
|
|
34
|
-
get limit(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
|
|
37
|
-
* parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
|
|
38
|
-
* additional fields in its sort order, but only after the specified sorts.
|
|
39
|
-
*
|
|
40
|
-
* @param sorts An array of field sorts.
|
|
41
|
-
* @returns Whether the query's sorts matches the provided field sorts.
|
|
42
|
-
*/
|
|
43
|
-
sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
|
|
46
|
-
* `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
|
|
47
|
-
* in the query.
|
|
48
|
-
*
|
|
49
|
-
* @param sorts An array of field sorts.
|
|
50
|
-
* @returns Whether the query's sorts exactly match the provided field sorts.
|
|
51
|
-
*/
|
|
52
|
-
sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): 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 fieldName The name of the field for the condition.
|
|
59
|
-
* @param operator The operator of the condition.
|
|
60
|
-
* @param value The value of the condition.
|
|
61
|
-
* @returns Whether the query is a subquery of the parent condition.
|
|
62
|
-
*/
|
|
63
|
-
isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
|
|
66
|
-
* to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
|
|
67
|
-
* additional conditions, as these only narrow the result set.
|
|
68
|
-
*
|
|
69
|
-
* @param condition The condition to validate.
|
|
70
|
-
* @returns Whether the query is a subquery of the parent condition.
|
|
71
|
-
*/
|
|
72
|
-
isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
|
|
75
|
-
* to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
|
|
76
|
-
* additional conditions, as these only narrow the result set.
|
|
77
|
-
*
|
|
78
|
-
* @param conditions The conditions to validate.
|
|
79
|
-
* @returns Whether the query includes subquery of the parent conditions.
|
|
80
|
-
*/
|
|
81
|
-
isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
|
|
84
|
-
* to a subset of the results that obtained for the parent query, including sorts and limits.
|
|
85
|
-
*
|
|
86
|
-
* @param query The query to validate.
|
|
87
|
-
* @returns Whether the query is a subquery of the parent query.
|
|
88
|
-
*/
|
|
89
|
-
isSubqueryOfQuery(query: Query<T>): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Returns all conditions that apply to any of the specified field names. This method
|
|
92
|
-
* provides a convenient way to retrieve all conditions that involve a specific set of fields.
|
|
93
|
-
*
|
|
94
|
-
* @param fieldNames The field names for which to retrieve conditions.
|
|
95
|
-
* @returns An array of conditions that involve any of the specified field names.
|
|
96
|
-
*/
|
|
97
|
-
getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
|
|
98
|
-
/**
|
|
99
|
-
* Returns all conditions that apply to the specified field name. This method provides
|
|
100
|
-
* a convenient way to retrieve all conditions that involve a specific field.
|
|
101
|
-
*
|
|
102
|
-
* @param fieldName The field name for which to retrieve conditions.
|
|
103
|
-
* @returns An array of conditions that involve the specified field name.
|
|
104
|
-
*/
|
|
105
|
-
getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
|
|
106
|
-
/**
|
|
107
|
-
* Returns true if the given document can be a result of the query.
|
|
108
|
-
* The method does not account for limit and sort order.
|
|
109
|
-
*/
|
|
110
|
-
documentMatchesQuery(doc: DocumentData): boolean;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* A list of context conditions.
|
|
114
|
-
* @category Database
|
|
115
|
-
*/
|
|
116
|
-
export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
|
|
117
|
-
/**
|
|
118
|
-
* A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'.
|
|
119
|
-
* @category Database
|
|
120
|
-
*/
|
|
121
|
-
export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
122
|
-
/**
|
|
123
|
-
* A condition using the 'in' operator to match values within a set.
|
|
124
|
-
* @category Database
|
|
125
|
-
*/
|
|
126
|
-
export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
|
|
127
|
-
/** Specifies the 'in' operator to check if a value exists within an array. */
|
|
128
|
-
operator: 'in';
|
|
129
|
-
/** An array of values to match against the field. */
|
|
130
|
-
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* A condition using the 'not in' operator to exclude values within a set.
|
|
134
|
-
* @category Database
|
|
135
|
-
*/
|
|
136
|
-
export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
|
|
137
|
-
/** Specifies the 'not in' operator to check if a value does not exist within an array. */
|
|
138
|
-
operator: 'not in';
|
|
139
|
-
/** An array of values to exclude from the field. */
|
|
140
|
-
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* A condition using operators other than 'in' or 'not in' for field comparisons.
|
|
144
|
-
* @category Database
|
|
145
|
-
*/
|
|
146
|
-
export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
|
|
147
|
-
/** The operator to use for the comparison, excluding 'in' and 'not in'. */
|
|
148
|
-
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
149
|
-
/** The value to compare against the field. */
|
|
150
|
-
value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* A condition that includes all operators, including 'in' and 'not in', for general use.
|
|
154
|
-
* @category Database
|
|
155
|
-
*/
|
|
156
|
-
export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
|
|
157
|
-
/** The operator to apply to the condition, including all possible operators. */
|
|
158
|
-
operator: AllOperators;
|
|
159
|
-
/** The value to use in the condition comparison. */
|
|
160
|
-
value: any;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* A list of general conditions.
|
|
164
|
-
* @category Database
|
|
165
|
-
*/
|
|
166
|
-
export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
|
|
167
|
-
/**
|
|
168
|
-
* @category Database
|
|
169
|
-
*/
|
|
170
|
-
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
171
|
-
type AllOperators = Operator | 'in' | 'not in';
|
|
172
|
-
/**
|
|
173
|
-
* A generic value that can exist in a query.
|
|
174
|
-
* @category Database
|
|
175
|
-
*/
|
|
176
|
-
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;
|
|
177
|
-
export {};
|