@squidcloud/client 1.0.463 → 1.0.465
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 +24 -11
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +5 -5
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +31 -0
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +5 -0
- package/dist/internal-common/src/public-types/integration.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/schema.public-types.d.ts +22 -0
- 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 +5 -4
|
@@ -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. */
|
|
@@ -613,6 +613,19 @@ export interface AiAgent<T extends AiChatModelSelection | undefined = undefined>
|
|
|
613
613
|
export type UpsertAgentRequest = Omit<AiAgent, 'createdAt' | 'updatedAt' | 'options'> & {
|
|
614
614
|
options?: AiChatOptions;
|
|
615
615
|
};
|
|
616
|
+
/**
|
|
617
|
+
* Status update title broadcast when the agent finishes producing a response,
|
|
618
|
+
* either successfully or with an error. Emitted exactly once per `ask` job and
|
|
619
|
+
* is the last status event for that job.
|
|
620
|
+
* @category AI
|
|
621
|
+
*/
|
|
622
|
+
export declare const AGENT_STATUS_TITLE_AGENT_RESPONSE = "Agent Response";
|
|
623
|
+
/**
|
|
624
|
+
* Status update title broadcast when the agent invokes a knowledge-base
|
|
625
|
+
* callable. A matching invocation produces a single event with this title.
|
|
626
|
+
* @category AI
|
|
627
|
+
*/
|
|
628
|
+
export declare const AGENT_STATUS_TITLE_ACCESSING_KB = "Accessing Knowledge Base";
|
|
616
629
|
/**
|
|
617
630
|
* A status message from an AI agent operation.
|
|
618
631
|
* @category AI
|
|
@@ -8,7 +8,7 @@ export declare const RERANK_PROVIDERS: readonly ["cohere", "none"];
|
|
|
8
8
|
*/
|
|
9
9
|
export type AiRerankProvider = (typeof RERANK_PROVIDERS)[number];
|
|
10
10
|
/** List of available AI provider types. See AiProviderType. */
|
|
11
|
-
export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "cohere", "flux", "gemini", "openai", "grok", "stability", "voyage", "mistral", "textract", "external"];
|
|
11
|
+
export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "cohere", "flux", "gemini", "openai", "grok", "stability", "voyage", "mistral", "textract", "vertex", "external"];
|
|
12
12
|
/**
|
|
13
13
|
* Type of the AI provider.
|
|
14
14
|
* References a single AI service, regardless of the model or other AI function it provides (like
|
|
@@ -29,7 +29,7 @@ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.4", "gpt-5.4-mini
|
|
|
29
29
|
* Public Gemini chat model names (active models only).
|
|
30
30
|
* @category AI
|
|
31
31
|
*/
|
|
32
|
-
export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3-pro", "gemini-3-flash"];
|
|
32
|
+
export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.5-flash"];
|
|
33
33
|
/**
|
|
34
34
|
* Public Grok chat model names (active models only).
|
|
35
35
|
* @category AI
|
|
@@ -44,7 +44,7 @@ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-202
|
|
|
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.4", "gpt-5.4-mini", "gpt-5.4-nano", "claude-haiku-4-5-20251001", "claude-opus-4-7", "claude-sonnet-4-6", "gemini-3-pro", "gemini-3-flash", "grok-4", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
47
|
+
export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "claude-haiku-4-5-20251001", "claude-opus-4-7", "claude-sonnet-4-6", "gemini-3.1-pro", "gemini-3.5-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
|
/**
|
|
@@ -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
|
*/
|
|
@@ -186,6 +186,17 @@ export interface AiKnowledgeBaseContextTextOptions extends BaseAiKnowledgeBaseCo
|
|
|
186
186
|
*/
|
|
187
187
|
export interface AiKnowledgeBaseContextFileOptions extends BaseAiKnowledgeBaseContextOptions {
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Hint about the format of a text context payload.
|
|
191
|
+
*
|
|
192
|
+
* - `auto`: detect the format from the content (default).
|
|
193
|
+
* - `markdown`: treat the text as Markdown — image references will be extracted if `extractImages` is true.
|
|
194
|
+
* - `html`: treat the text as HTML — `<img>` tags will be extracted if `extractImages` is true.
|
|
195
|
+
* - `plain`: treat the text as plain text — no image extraction is performed even if `extractImages` is true.
|
|
196
|
+
*
|
|
197
|
+
* @category AI
|
|
198
|
+
*/
|
|
199
|
+
export type AiKnowledgeBaseTextFormat = 'auto' | 'markdown' | 'html' | 'plain';
|
|
189
200
|
/**
|
|
190
201
|
* Request structure for adding text-based context to an AI agent.
|
|
191
202
|
* @category AI
|
|
@@ -199,6 +210,26 @@ export interface AiKnowledgeBaseTextContextRequest extends BaseAiKnowledgeBaseCo
|
|
|
199
210
|
title: string;
|
|
200
211
|
/** The text content to add to the context. */
|
|
201
212
|
text: string;
|
|
213
|
+
/**
|
|
214
|
+
* Hint about the format of the text. If omitted (or `'auto'`), the format is sniffed from the content.
|
|
215
|
+
* Only `'markdown'` and `'html'` (or `'auto'` with content that looks like markdown/HTML) participate in
|
|
216
|
+
* image extraction when `extractImages` is true.
|
|
217
|
+
*/
|
|
218
|
+
format?: AiKnowledgeBaseTextFormat;
|
|
219
|
+
/**
|
|
220
|
+
* Whether to extract images embedded in markdown/HTML text. Defaults to false.
|
|
221
|
+
*
|
|
222
|
+
* When true and the text is detected as (or declared to be) markdown/HTML, image references inside the
|
|
223
|
+
* text (`` or `<img src="...">`) are fetched, stored, and have descriptions generated
|
|
224
|
+
* just like images extracted from a PDF.
|
|
225
|
+
*
|
|
226
|
+
* Has no effect for plain text.
|
|
227
|
+
*/
|
|
228
|
+
extractImages?: boolean;
|
|
229
|
+
/** Minimum width/height (in pixels) for an image to be kept. Smaller images are skipped. */
|
|
230
|
+
imageMinSizePixels?: number;
|
|
231
|
+
/** The AI model to use for generating image descriptions, if specified. */
|
|
232
|
+
imageExtractionModel?: AiChatModelSelection;
|
|
202
233
|
/** General options for how to process the text. */
|
|
203
234
|
options?: AiKnowledgeBaseContextTextOptions;
|
|
204
235
|
}
|
|
@@ -30,6 +30,11 @@ export interface ExtractDataFromDocumentOptions {
|
|
|
30
30
|
* Defaults to false.
|
|
31
31
|
*/
|
|
32
32
|
discardOriginalFile?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Format hint for text-based extraction (markdown / HTML). When omitted, the format is detected from
|
|
35
|
+
* the content. Only consulted by extractors that handle text input.
|
|
36
|
+
*/
|
|
37
|
+
textFormat?: 'auto' | 'markdown' | 'html' | 'plain';
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* Request payload for extracting data from a document via URL.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IntegrationId } from './communication.public-types';
|
|
2
2
|
/** List of all integration types supported by Squid. */
|
|
3
|
-
export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_azure_blob", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint"];
|
|
3
|
+
export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_azure_blob", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "azure-entra-external-id", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint", "vertex"];
|
|
4
4
|
/**
|
|
5
5
|
* @category Database
|
|
6
6
|
*/
|
|
@@ -8,7 +8,7 @@ export declare const DATA_INTEGRATION_TYPES: readonly ["bigquery", "built_in_db"
|
|
|
8
8
|
/**
|
|
9
9
|
* @category Auth
|
|
10
10
|
*/
|
|
11
|
-
export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "keycloak", "descope", "firebase_auth"];
|
|
11
|
+
export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "keycloak", "descope", "firebase_auth", "azure-entra-external-id"];
|
|
12
12
|
/** Supported integration types for GraphQL-based services. */
|
|
13
13
|
export declare const GRAPHQL_INTEGRATION_TYPES: readonly ["graphql"];
|
|
14
14
|
/** Supported integration types for HTTP-based services. */
|
|
@@ -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
|
|
@@ -51,4 +51,26 @@ export type TopLevelPropertySchema = PropertySchema & {
|
|
|
51
51
|
export type CollectionSchema = Omit<ConvertDeep<JSONSchema>, 'properties'> & {
|
|
52
52
|
properties?: Record<string, TopLevelPropertySchema>;
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* API-boundary view of {@link CollectionSchema} for use in OpenAPI-exposed
|
|
56
|
+
* controllers. Decouples the public REST surface from `json-schema-typed`'s
|
|
57
|
+
* recursive generic, which tsoa's type resolver cannot walk.
|
|
58
|
+
*
|
|
59
|
+
* The on-the-wire payload is the same as {@link CollectionSchema} — this type
|
|
60
|
+
* just describes it as an opaque JSON object for the generated OpenAPI spec
|
|
61
|
+
* (which is also what tsoa 5.x emitted for {@link CollectionSchema}: a bare
|
|
62
|
+
* `object` with no properties).
|
|
63
|
+
*/
|
|
64
|
+
export interface CollectionSchemaApi {
|
|
65
|
+
/** JSON Schema `type` keyword (e.g. "object"). */
|
|
66
|
+
type?: string;
|
|
67
|
+
/** Map of property names to their schemas. */
|
|
68
|
+
properties?: Record<string, unknown>;
|
|
69
|
+
/** Names of required properties. */
|
|
70
|
+
required?: string[];
|
|
71
|
+
/** Human-readable description of the collection. */
|
|
72
|
+
description?: string;
|
|
73
|
+
/** Additional JSON Schema / Squid-specific fields are preserved as-is. */
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
54
76
|
export {};
|
|
@@ -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.465",
|
|
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,8 @@
|
|
|
39
39
|
"license": "ISC",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"json-schema-typed": "^8.0.1",
|
|
42
|
-
"
|
|
42
|
+
"lz4js": "^0.2.0",
|
|
43
|
+
"ws": "^8.21.0"
|
|
43
44
|
},
|
|
44
45
|
"optionalDependencies": {
|
|
45
46
|
"bufferutil": "^4.0.8",
|
|
@@ -49,8 +50,6 @@
|
|
|
49
50
|
"rxjs": ">=7.5.7 <8.0.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"typedoc": "^0.28.10",
|
|
53
|
-
"typedoc-plugin-markdown": "^4.8.1",
|
|
54
53
|
"@supercharge/promise-pool": "^3.2.0",
|
|
55
54
|
"@webpack-cli/generators": "^3.0.7",
|
|
56
55
|
"copy-webpack-plugin": "^14.0.0",
|
|
@@ -59,6 +58,8 @@
|
|
|
59
58
|
"otrie": "^1.2.2",
|
|
60
59
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
61
60
|
"tscpaths": "^0.0.9",
|
|
61
|
+
"typedoc": "^0.28.10",
|
|
62
|
+
"typedoc-plugin-markdown": "^4.8.1",
|
|
62
63
|
"webpack": "^5.106.2",
|
|
63
64
|
"webpack-cli": "^5.1.4"
|
|
64
65
|
},
|