@squidcloud/client 1.0.147 → 1.0.149
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 +8793 -8803
- package/dist/common/src/ai-assistant.types.d.ts +25 -25
- package/dist/common/src/ai-chatbot.context.d.ts +12 -12
- package/dist/common/src/ai-chatbot.schemas.d.ts +1 -1
- package/dist/common/src/ai-chatbot.types.d.ts +27 -27
- package/dist/common/src/api-call.context.d.ts +13 -13
- package/dist/common/src/api.types.d.ts +4 -4
- package/dist/common/src/application.schemas.d.ts +66 -66
- package/dist/common/src/application.types.d.ts +141 -143
- package/dist/common/src/backend-function.schemas.d.ts +1 -1
- package/dist/common/src/backend-function.types.d.ts +1 -1
- package/dist/common/src/backend-run.types.d.ts +2 -2
- package/dist/common/src/bundle-api.types.d.ts +41 -43
- package/dist/common/src/bundle-data.types.d.ts +5 -5
- package/dist/common/src/communication.types.d.ts +10 -8
- package/dist/common/src/context.types.d.ts +40 -40
- package/dist/common/src/distributed-lock.context.d.ts +4 -4
- package/dist/common/src/document.types.d.ts +22 -22
- package/dist/common/src/graphql.context.d.ts +7 -7
- package/dist/common/src/graphql.types.d.ts +9 -9
- package/dist/common/src/heartbeat.types.d.ts +1 -1
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/index.d.ts +54 -57
- package/dist/common/src/integrations/ai_chatbot.types.d.ts +31 -31
- package/dist/common/src/integrations/api.types.d.ts +80 -80
- package/dist/common/src/integrations/auth.types.d.ts +47 -47
- package/dist/common/src/integrations/database.types.d.ts +274 -274
- package/dist/common/src/integrations/index.d.ts +134 -134
- package/dist/common/src/integrations/observability.types.d.ts +23 -23
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/metrics.types.d.ts +1 -1
- package/dist/common/src/mutation.context.d.ts +14 -14
- package/dist/common/src/mutation.schemas.d.ts +1 -1
- package/dist/common/src/mutation.types.d.ts +53 -53
- package/dist/common/src/native-query.context.d.ts +7 -7
- package/dist/common/src/native-query.types.d.ts +16 -16
- package/dist/common/src/query/base-query-builder.d.ts +147 -147
- package/dist/common/src/query/index.d.ts +4 -4
- package/dist/common/src/query/pagination.d.ts +62 -62
- package/dist/common/src/query/query-context.d.ts +137 -137
- package/dist/common/src/query/serialized-query.types.d.ts +24 -24
- package/dist/common/src/query.types.d.ts +64 -64
- package/dist/common/src/regions.d.ts +1 -1
- package/dist/common/src/schema/schema.types.d.ts +54 -54
- package/dist/common/src/secret.schemas.d.ts +1 -1
- package/dist/common/src/secret.types.d.ts +22 -22
- package/dist/common/src/security.types.d.ts +1 -1
- package/dist/common/src/socket.schemas.d.ts +1 -1
- package/dist/common/src/socket.types.d.ts +5 -5
- package/dist/common/src/time-units.d.ts +1 -1
- package/dist/common/src/trigger.types.d.ts +1 -1
- package/dist/common/src/types.d.ts +14 -14
- package/dist/common/src/utils/array.d.ts +1 -1
- package/dist/common/src/utils/assert.d.ts +1 -1
- package/dist/common/src/utils/error.d.ts +4 -4
- package/dist/common/src/utils/global.utils.d.ts +1 -1
- package/dist/common/src/utils/http.d.ts +2 -2
- package/dist/common/src/utils/id.d.ts +2 -2
- package/dist/common/src/utils/lock.manager.d.ts +14 -14
- package/dist/common/src/utils/object.d.ts +5 -5
- package/dist/common/src/utils/serialization.d.ts +5 -6
- package/dist/common/src/utils/transforms.d.ts +18 -18
- package/dist/common/src/utils/url.d.ts +1 -1
- package/dist/common/src/utils/validation.d.ts +25 -25
- package/dist/common/src/webhook-response.d.ts +1 -1
- package/dist/common/src/websocket.impl.d.ts +21 -21
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/ai-assistant-client.d.ts +73 -73
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +174 -174
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +8 -8
- package/dist/typescript-client/src/ai.types.d.ts +61 -61
- package/dist/typescript-client/src/api.manager.d.ts +11 -11
- package/dist/typescript-client/src/auth.manager.d.ts +26 -26
- package/dist/typescript-client/src/backend-function.manager.d.ts +9 -9
- package/dist/typescript-client/src/client-id.service.d.ts +27 -27
- package/dist/typescript-client/src/collection-reference.d.ts +80 -80
- package/dist/typescript-client/src/collection-reference.factory.d.ts +13 -13
- package/dist/typescript-client/src/connection-details.d.ts +23 -23
- package/dist/typescript-client/src/data.manager.d.ts +174 -173
- package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +16 -16
- package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
- package/dist/typescript-client/src/document-reference.d.ts +140 -140
- package/dist/typescript-client/src/document-reference.factory.d.ts +13 -13
- package/dist/typescript-client/src/document-store.d.ts +14 -14
- package/dist/typescript-client/src/graphql-client.d.ts +14 -14
- package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -11
- package/dist/typescript-client/src/index.d.ts +9 -9
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +10 -10
- package/dist/typescript-client/src/native-query-manager.d.ts +7 -7
- package/dist/typescript-client/src/query/deserializer.d.ts +3 -3
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -161
- package/dist/typescript-client/src/query/local-query-manager.d.ts +9 -9
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -77
- package/dist/typescript-client/src/query/query-sender.d.ts +33 -33
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +131 -130
- package/dist/typescript-client/src/query/query.types.d.ts +49 -49
- package/dist/typescript-client/src/rate-limiter.d.ts +32 -32
- package/dist/typescript-client/src/rpc.manager.d.ts +30 -30
- package/dist/typescript-client/src/secret.client.d.ts +22 -22
- package/dist/typescript-client/src/socket.manager.d.ts +43 -43
- package/dist/typescript-client/src/squid.d.ts +238 -269
- package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
- package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
- package/dist/typescript-client/src/types.d.ts +2 -2
- package/package.json +3 -2
- package/dist/common/src/named-query.context.d.ts +0 -4
- package/dist/common/src/named-query.schemas.d.ts +0 -1
- package/dist/common/src/named-query.types.d.ts +0 -1
- package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
|
|
3
|
-
import { Operator } from '../query.types';
|
|
4
|
-
import { SerializedQuery } from './serialized-query.types';
|
|
5
|
-
import { PaginationOptions, Pagination } from './pagination';
|
|
6
|
-
export interface SnapshotEmitter<ReturnType> {
|
|
7
|
-
/**
|
|
8
|
-
* Returns a promise that resolves to the query results.
|
|
9
|
-
*
|
|
10
|
-
* @returns A promise that resolves to the query results.
|
|
11
|
-
*/
|
|
12
|
-
snapshot(): Promise<Array<ReturnType>>;
|
|
13
|
-
/**
|
|
14
|
-
* Returns an observable that emits the query results and updates whenever the query results change unless
|
|
15
|
-
* `subscribe=false` is provided.
|
|
16
|
-
*
|
|
17
|
-
* Important: Make sure to unsubscribe from the observable when you are done with it.
|
|
18
|
-
*
|
|
19
|
-
* @param subscribe Whether to subscribe to changes to the query results. Defaults to `true`.
|
|
20
|
-
* @returns An observable for the query results.
|
|
21
|
-
*/
|
|
22
|
-
snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the results of the query based on the data that is currently available on the client. This method is useful
|
|
25
|
-
* for synchronously accessing data that has already been fetched by another query. The method will return an empty
|
|
26
|
-
* array if data has not yet been populated.
|
|
27
|
-
*
|
|
28
|
-
* @returns An array of query results.
|
|
29
|
-
*/
|
|
30
|
-
peek(): Array<ReturnType>;
|
|
31
|
-
limit(limit: number): SnapshotEmitter<ReturnType>;
|
|
32
|
-
/**
|
|
33
|
-
* Returns a pagination wrapper for this query.
|
|
34
|
-
* @param options The pagination options. Defaults to `{ subscribe: true, pageSize: 100 }`.
|
|
35
|
-
*/
|
|
36
|
-
paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
|
|
37
|
-
serialize(): SerializedQuery;
|
|
38
|
-
}
|
|
39
|
-
/** Query builder base class. */
|
|
40
|
-
export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
41
|
-
/**
|
|
42
|
-
* Adds a condition to the query.
|
|
43
|
-
* @param fieldName The name of the field to query.
|
|
44
|
-
* @param operator The operator to use.
|
|
45
|
-
* @param value The value to compare against.
|
|
46
|
-
* @returns The query builder.
|
|
47
|
-
*/
|
|
48
|
-
abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
49
|
-
/**
|
|
50
|
-
* A shortcut for where(fieldName, '==', value)
|
|
51
|
-
*
|
|
52
|
-
* @param fieldName The name of the field to query.
|
|
53
|
-
* @param value The value to compare against.
|
|
54
|
-
* @returns The query builder.
|
|
55
|
-
*/
|
|
56
|
-
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
57
|
-
/**
|
|
58
|
-
* A shortcut for where(fieldName, '!=', value)
|
|
59
|
-
* @param fieldName The name of the field to query.
|
|
60
|
-
* @param value The value to compare against.
|
|
61
|
-
* @returns The query builder.
|
|
62
|
-
*/
|
|
63
|
-
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
64
|
-
/**
|
|
65
|
-
* A shortcut for where(fieldName, 'in', value)
|
|
66
|
-
* @param fieldName The name of the field to query.
|
|
67
|
-
* @param value An array of values to compare against.
|
|
68
|
-
* @returns The query builder.
|
|
69
|
-
*/
|
|
70
|
-
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
71
|
-
/**
|
|
72
|
-
* A shortcut for where(fieldName, 'not in', value)
|
|
73
|
-
* @param fieldName The name of the field to query.
|
|
74
|
-
* @param value An array of values to compare against.
|
|
75
|
-
* @returns The query builder.
|
|
76
|
-
*/
|
|
77
|
-
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
78
|
-
/**
|
|
79
|
-
* A shortcut for where(fieldName, '>', value)
|
|
80
|
-
* @param fieldName The name of the field to query.
|
|
81
|
-
* @param value The value to compare against.
|
|
82
|
-
* @returns The query builder.
|
|
83
|
-
*/
|
|
84
|
-
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
85
|
-
/**
|
|
86
|
-
* A shortcut for where(fieldName, '>=', value)
|
|
87
|
-
* @param fieldName The name of the field to query.
|
|
88
|
-
* @param value The value to compare against.
|
|
89
|
-
* @returns The query builder.
|
|
90
|
-
*/
|
|
91
|
-
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
92
|
-
/**
|
|
93
|
-
* A shortcut for where(fieldName, '<', value)
|
|
94
|
-
* @param fieldName The name of the field to query.
|
|
95
|
-
* @param value The value to compare against.
|
|
96
|
-
* @returns The query builder.
|
|
97
|
-
*/
|
|
98
|
-
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
99
|
-
/**
|
|
100
|
-
* A shortcut for where(fieldName, '<=', value)
|
|
101
|
-
* @param fieldName The name of the field to query.
|
|
102
|
-
* @param value The value to compare against.
|
|
103
|
-
* @returns The query builder.
|
|
104
|
-
*/
|
|
105
|
-
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
106
|
-
/**
|
|
107
|
-
* A shortcut for where(fieldName, 'like', pattern).
|
|
108
|
-
*
|
|
109
|
-
* @param fieldName The name of the field to query.
|
|
110
|
-
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
111
|
-
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
112
|
-
* @returns The query builder.
|
|
113
|
-
*/
|
|
114
|
-
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
115
|
-
/**
|
|
116
|
-
* A shortcut for where(fieldName, 'not like', pattern).
|
|
117
|
-
*
|
|
118
|
-
* @param fieldName The name of the field to query.
|
|
119
|
-
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
120
|
-
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
121
|
-
* @returns The query builder.
|
|
122
|
-
*/
|
|
123
|
-
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
124
|
-
/**
|
|
125
|
-
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
126
|
-
* if none is provided.
|
|
127
|
-
* @param limit The limit to set.
|
|
128
|
-
* @returns The query builder.
|
|
129
|
-
*/
|
|
130
|
-
abstract limit(limit: number): this;
|
|
131
|
-
/**
|
|
132
|
-
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
133
|
-
* determines the order in which they are applied.
|
|
134
|
-
* @param fieldName The name of the field to sort by.
|
|
135
|
-
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
136
|
-
* @returns The query builder.
|
|
137
|
-
*/
|
|
138
|
-
abstract sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
139
|
-
}
|
|
140
|
-
export interface HasDereference {
|
|
141
|
-
/**
|
|
142
|
-
* Dereferences the document references in the result of this query. For example, collection.query().snapshot()
|
|
143
|
-
* returns an array of DocumentReference objects, but collection.query().dereference().snapshot() returns an array of
|
|
144
|
-
* the actual document data.
|
|
145
|
-
*/
|
|
146
|
-
dereference(): any;
|
|
147
|
-
}
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
|
|
3
|
+
import { Operator } from '../query.types';
|
|
4
|
+
import { SerializedQuery } from './serialized-query.types';
|
|
5
|
+
import { PaginationOptions, Pagination } from './pagination';
|
|
6
|
+
export interface SnapshotEmitter<ReturnType> {
|
|
7
|
+
/**
|
|
8
|
+
* Returns a promise that resolves to the query results.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise that resolves to the query results.
|
|
11
|
+
*/
|
|
12
|
+
snapshot(): Promise<Array<ReturnType>>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns an observable that emits the query results and updates whenever the query results change unless
|
|
15
|
+
* `subscribe=false` is provided.
|
|
16
|
+
*
|
|
17
|
+
* Important: Make sure to unsubscribe from the observable when you are done with it.
|
|
18
|
+
*
|
|
19
|
+
* @param subscribe Whether to subscribe to changes to the query results. Defaults to `true`.
|
|
20
|
+
* @returns An observable for the query results.
|
|
21
|
+
*/
|
|
22
|
+
snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the results of the query based on the data that is currently available on the client. This method is useful
|
|
25
|
+
* for synchronously accessing data that has already been fetched by another query. The method will return an empty
|
|
26
|
+
* array if data has not yet been populated.
|
|
27
|
+
*
|
|
28
|
+
* @returns An array of query results.
|
|
29
|
+
*/
|
|
30
|
+
peek(): Array<ReturnType>;
|
|
31
|
+
limit(limit: number): SnapshotEmitter<ReturnType>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a pagination wrapper for this query.
|
|
34
|
+
* @param options The pagination options. Defaults to `{ subscribe: true, pageSize: 100 }`.
|
|
35
|
+
*/
|
|
36
|
+
paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
|
|
37
|
+
serialize(): SerializedQuery;
|
|
38
|
+
}
|
|
39
|
+
/** Query builder base class. */
|
|
40
|
+
export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
41
|
+
/**
|
|
42
|
+
* Adds a condition to the query.
|
|
43
|
+
* @param fieldName The name of the field to query.
|
|
44
|
+
* @param operator The operator to use.
|
|
45
|
+
* @param value The value to compare against.
|
|
46
|
+
* @returns The query builder.
|
|
47
|
+
*/
|
|
48
|
+
abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
49
|
+
/**
|
|
50
|
+
* A shortcut for where(fieldName, '==', value)
|
|
51
|
+
*
|
|
52
|
+
* @param fieldName The name of the field to query.
|
|
53
|
+
* @param value The value to compare against.
|
|
54
|
+
* @returns The query builder.
|
|
55
|
+
*/
|
|
56
|
+
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
57
|
+
/**
|
|
58
|
+
* A shortcut for where(fieldName, '!=', value)
|
|
59
|
+
* @param fieldName The name of the field to query.
|
|
60
|
+
* @param value The value to compare against.
|
|
61
|
+
* @returns The query builder.
|
|
62
|
+
*/
|
|
63
|
+
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
64
|
+
/**
|
|
65
|
+
* A shortcut for where(fieldName, 'in', value)
|
|
66
|
+
* @param fieldName The name of the field to query.
|
|
67
|
+
* @param value An array of values to compare against.
|
|
68
|
+
* @returns The query builder.
|
|
69
|
+
*/
|
|
70
|
+
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
71
|
+
/**
|
|
72
|
+
* A shortcut for where(fieldName, 'not in', value)
|
|
73
|
+
* @param fieldName The name of the field to query.
|
|
74
|
+
* @param value An array of values to compare against.
|
|
75
|
+
* @returns The query builder.
|
|
76
|
+
*/
|
|
77
|
+
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
78
|
+
/**
|
|
79
|
+
* A shortcut for where(fieldName, '>', value)
|
|
80
|
+
* @param fieldName The name of the field to query.
|
|
81
|
+
* @param value The value to compare against.
|
|
82
|
+
* @returns The query builder.
|
|
83
|
+
*/
|
|
84
|
+
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
85
|
+
/**
|
|
86
|
+
* A shortcut for where(fieldName, '>=', value)
|
|
87
|
+
* @param fieldName The name of the field to query.
|
|
88
|
+
* @param value The value to compare against.
|
|
89
|
+
* @returns The query builder.
|
|
90
|
+
*/
|
|
91
|
+
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
92
|
+
/**
|
|
93
|
+
* A shortcut for where(fieldName, '<', value)
|
|
94
|
+
* @param fieldName The name of the field to query.
|
|
95
|
+
* @param value The value to compare against.
|
|
96
|
+
* @returns The query builder.
|
|
97
|
+
*/
|
|
98
|
+
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
99
|
+
/**
|
|
100
|
+
* A shortcut for where(fieldName, '<=', value)
|
|
101
|
+
* @param fieldName The name of the field to query.
|
|
102
|
+
* @param value The value to compare against.
|
|
103
|
+
* @returns The query builder.
|
|
104
|
+
*/
|
|
105
|
+
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
106
|
+
/**
|
|
107
|
+
* A shortcut for where(fieldName, 'like', pattern).
|
|
108
|
+
*
|
|
109
|
+
* @param fieldName The name of the field to query.
|
|
110
|
+
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
111
|
+
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
112
|
+
* @returns The query builder.
|
|
113
|
+
*/
|
|
114
|
+
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
115
|
+
/**
|
|
116
|
+
* A shortcut for where(fieldName, 'not like', pattern).
|
|
117
|
+
*
|
|
118
|
+
* @param fieldName The name of the field to query.
|
|
119
|
+
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
120
|
+
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
121
|
+
* @returns The query builder.
|
|
122
|
+
*/
|
|
123
|
+
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
124
|
+
/**
|
|
125
|
+
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
126
|
+
* if none is provided.
|
|
127
|
+
* @param limit The limit to set.
|
|
128
|
+
* @returns The query builder.
|
|
129
|
+
*/
|
|
130
|
+
abstract limit(limit: number): this;
|
|
131
|
+
/**
|
|
132
|
+
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
133
|
+
* determines the order in which they are applied.
|
|
134
|
+
* @param fieldName The name of the field to sort by.
|
|
135
|
+
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
136
|
+
* @returns The query builder.
|
|
137
|
+
*/
|
|
138
|
+
abstract sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
139
|
+
}
|
|
140
|
+
export interface HasDereference {
|
|
141
|
+
/**
|
|
142
|
+
* Dereferences the document references in the result of this query. For example, collection.query().snapshot()
|
|
143
|
+
* returns an array of DocumentReference objects, but collection.query().dereference().snapshot() returns an array of
|
|
144
|
+
* the actual document data.
|
|
145
|
+
*/
|
|
146
|
+
dereference(): any;
|
|
147
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './query-context';
|
|
2
|
-
export * from './base-query-builder';
|
|
3
|
-
export * from './serialized-query.types';
|
|
4
|
-
export * from './pagination';
|
|
1
|
+
export * from './query-context';
|
|
2
|
+
export * from './base-query-builder';
|
|
3
|
+
export * from './serialized-query.types';
|
|
4
|
+
export * from './pagination';
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
/** The state of a pagination. */
|
|
3
|
-
export interface PaginationState<ReturnType> {
|
|
4
|
-
/** The page data. */
|
|
5
|
-
data: Array<ReturnType>;
|
|
6
|
-
/** Whether there is a next page. */
|
|
7
|
-
hasNext: boolean;
|
|
8
|
-
/** Whether there is a previous page. */
|
|
9
|
-
hasPrev: boolean;
|
|
10
|
-
}
|
|
11
|
-
/** Pagination options */
|
|
12
|
-
export interface PaginationOptions {
|
|
13
|
-
/** Whether to show real-time updates. Defaults to true. */
|
|
14
|
-
subscribe: boolean;
|
|
15
|
-
/** The number of items in a page. Defaults to 100. */
|
|
16
|
-
pageSize: number;
|
|
17
|
-
}
|
|
18
|
-
interface InternalState<ReturnType> {
|
|
19
|
-
data: ReturnType[];
|
|
20
|
-
extractedData: any[];
|
|
21
|
-
numBefore: number;
|
|
22
|
-
numAfter: number;
|
|
23
|
-
}
|
|
24
|
-
export declare class Pagination<ReturnType> {
|
|
25
|
-
private readonly options;
|
|
26
|
-
private internalStateObserver;
|
|
27
|
-
private firstElement;
|
|
28
|
-
private readonly isDestroyed;
|
|
29
|
-
private templateSnapshotEmitter;
|
|
30
|
-
private snapshotSubject;
|
|
31
|
-
private onFirstPage;
|
|
32
|
-
private navigatingToLastPage;
|
|
33
|
-
private lastElement;
|
|
34
|
-
private goToFirstPage;
|
|
35
|
-
private static compareValues;
|
|
36
|
-
private compare;
|
|
37
|
-
private dataReceived;
|
|
38
|
-
private doNewQuery;
|
|
39
|
-
private waitForInternalState;
|
|
40
|
-
private internalStateToState;
|
|
41
|
-
/** Unsubscribes from the pagination. */
|
|
42
|
-
unsubscribe(): void;
|
|
43
|
-
prevInternal(internalState: InternalState<ReturnType>): void;
|
|
44
|
-
/** Returns a promise that resolves when the previous page of data is available. */
|
|
45
|
-
prev(): Promise<PaginationState<ReturnType>>;
|
|
46
|
-
/** Returns a promise that resolves when the next page of data is available. */
|
|
47
|
-
next(): Promise<PaginationState<ReturnType>>;
|
|
48
|
-
/** Returns a promise that resolves when the page data is available. */
|
|
49
|
-
waitForData(): Promise<PaginationState<ReturnType>>;
|
|
50
|
-
/** Returns an observable that emits the current state of the pagination. */
|
|
51
|
-
observeState(): Observable<PaginationState<ReturnType>>;
|
|
52
|
-
/** Jumps to the first page of the pagination. */
|
|
53
|
-
first(): Promise<PaginationState<ReturnType>>;
|
|
54
|
-
/** Refreshes the current page of the pagination. */
|
|
55
|
-
refreshPage(): Promise<PaginationState<ReturnType>>;
|
|
56
|
-
/**
|
|
57
|
-
* Jumps to the last page of the pagination. This page will always have the last <pageSize> elements of the
|
|
58
|
-
* underlying query, regardless of whether the total document count is evenly divisible by the page size.
|
|
59
|
-
*/
|
|
60
|
-
last(): Promise<PaginationState<ReturnType>>;
|
|
61
|
-
}
|
|
62
|
-
export {};
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/** The state of a pagination. */
|
|
3
|
+
export interface PaginationState<ReturnType> {
|
|
4
|
+
/** The page data. */
|
|
5
|
+
data: Array<ReturnType>;
|
|
6
|
+
/** Whether there is a next page. */
|
|
7
|
+
hasNext: boolean;
|
|
8
|
+
/** Whether there is a previous page. */
|
|
9
|
+
hasPrev: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Pagination options */
|
|
12
|
+
export interface PaginationOptions {
|
|
13
|
+
/** Whether to show real-time updates. Defaults to true. */
|
|
14
|
+
subscribe: boolean;
|
|
15
|
+
/** The number of items in a page. Defaults to 100. */
|
|
16
|
+
pageSize: number;
|
|
17
|
+
}
|
|
18
|
+
interface InternalState<ReturnType> {
|
|
19
|
+
data: ReturnType[];
|
|
20
|
+
extractedData: any[];
|
|
21
|
+
numBefore: number;
|
|
22
|
+
numAfter: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class Pagination<ReturnType> {
|
|
25
|
+
private readonly options;
|
|
26
|
+
private internalStateObserver;
|
|
27
|
+
private firstElement;
|
|
28
|
+
private readonly isDestroyed;
|
|
29
|
+
private templateSnapshotEmitter;
|
|
30
|
+
private snapshotSubject;
|
|
31
|
+
private onFirstPage;
|
|
32
|
+
private navigatingToLastPage;
|
|
33
|
+
private lastElement;
|
|
34
|
+
private goToFirstPage;
|
|
35
|
+
private static compareValues;
|
|
36
|
+
private compare;
|
|
37
|
+
private dataReceived;
|
|
38
|
+
private doNewQuery;
|
|
39
|
+
private waitForInternalState;
|
|
40
|
+
private internalStateToState;
|
|
41
|
+
/** Unsubscribes from the pagination. */
|
|
42
|
+
unsubscribe(): void;
|
|
43
|
+
prevInternal(internalState: InternalState<ReturnType>): void;
|
|
44
|
+
/** Returns a promise that resolves when the previous page of data is available. */
|
|
45
|
+
prev(): Promise<PaginationState<ReturnType>>;
|
|
46
|
+
/** Returns a promise that resolves when the next page of data is available. */
|
|
47
|
+
next(): Promise<PaginationState<ReturnType>>;
|
|
48
|
+
/** Returns a promise that resolves when the page data is available. */
|
|
49
|
+
waitForData(): Promise<PaginationState<ReturnType>>;
|
|
50
|
+
/** Returns an observable that emits the current state of the pagination. */
|
|
51
|
+
observeState(): Observable<PaginationState<ReturnType>>;
|
|
52
|
+
/** Jumps to the first page of the pagination. */
|
|
53
|
+
first(): Promise<PaginationState<ReturnType>>;
|
|
54
|
+
/** Refreshes the current page of the pagination. */
|
|
55
|
+
refreshPage(): Promise<PaginationState<ReturnType>>;
|
|
56
|
+
/**
|
|
57
|
+
* Jumps to the last page of the pagination. This page will always have the last <pageSize> elements of the
|
|
58
|
+
* underlying query, regardless of whether the total document count is evenly divisible by the page size.
|
|
59
|
+
*/
|
|
60
|
+
last(): Promise<PaginationState<ReturnType>>;
|
|
61
|
+
}
|
|
62
|
+
export {};
|