@squidcloud/client 1.0.447 → 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-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/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
|
@@ -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.
|
|
@@ -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 {};
|