@squidcloud/client 1.0.463 → 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.
@@ -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 = DallEOptions | StableDiffusionCoreOptions | FluxOptions;
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 the DALL-E model.
51
+ * Options for generating images using OpenAI's gpt-image-* family of models.
52
52
  * @category AI
53
53
  */
54
- export interface DallEOptions extends BaseAiGenerateImageOptions {
55
- /** Specifies the DALL-E 3 model for image generation. */
56
- modelName: 'dall-e-3';
57
- /** The quality of the generated image; defaults to 'standard'. */
58
- quality?: 'hd' | 'standard';
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' | '1792x1024' | '1024x1792';
61
- /** The number of images to generate; defaults to 1 and limited to 1. */
62
- numberOfImagesToGenerate?: 1;
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. */
@@ -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 ["dall-e-3"];
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 ["dall-e-3", "stable-diffusion-core", "flux-pro-1.1", "flux-kontext-pro"];
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>>;
@@ -2,4 +2,4 @@
2
2
  * The current version of the SquidCloud client package.
3
3
  * @category Platform
4
4
  */
5
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.463";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.464";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.463",
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",