@squidcloud/client 1.0.99 → 1.0.101
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 +4 -4
- package/dist/esm/index.js +4 -4
- package/dist/typescript-client/src/collection-reference.d.ts +1 -1
- package/dist/typescript-client/src/document-reference.d.ts +1 -1
- package/dist/typescript-client/src/document-store.d.ts +1 -1
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +1 -1
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +16 -0
- package/dist/typescript-client/src/squid.d.ts +5 -5
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import { QueryBuilder } from './query/query-builder.factory';
|
|
|
9
9
|
* collection in a NoSQL database.
|
|
10
10
|
*
|
|
11
11
|
* Read more about collection references in the
|
|
12
|
-
* [documentation]{@link https://docs.squid.cloud/docs/client-sdk/collection-reference}.
|
|
12
|
+
* [documentation]{@link https://docs.squid.cloud/docs/development-tools/client-sdk/collection-reference}.
|
|
13
13
|
* @typeParam T The type of the document data.
|
|
14
14
|
*/
|
|
15
15
|
export declare class CollectionReference<T extends DocumentData> {
|
|
@@ -8,7 +8,7 @@ import { TransactionId } from './types';
|
|
|
8
8
|
* use to create a new document.
|
|
9
9
|
*
|
|
10
10
|
* Read more about document references in the
|
|
11
|
-
* [documentation]{@link https://docs.squid.cloud/docs/client-sdk/document-reference}.
|
|
11
|
+
* [documentation]{@link https://docs.squid.cloud/docs/development-tools/client-sdk/document-reference}.
|
|
12
12
|
* @typeParam T The type of the document data.
|
|
13
13
|
*/
|
|
14
14
|
export declare class DocumentReference<T extends DocumentData = any> {
|
|
@@ -5,7 +5,7 @@ export declare class DocumentStore {
|
|
|
5
5
|
hasData(squidDocId: SquidDocId): boolean;
|
|
6
6
|
getDocument(squidDocId: SquidDocId): SquidDocument;
|
|
7
7
|
getDocumentOrUndefined(squidDocId: SquidDocId): SquidDocument | undefined;
|
|
8
|
-
sortAndLimitDocs(docIdSet: Set<SquidDocId
|
|
8
|
+
sortAndLimitDocs(docIdSet: Set<SquidDocId>, query: Query): Array<SquidDocument>;
|
|
9
9
|
private removeInternalProperties;
|
|
10
10
|
migrateDocId(squidDocId: SquidDocId, newSquidDocId: SquidDocId): void;
|
|
11
11
|
}
|
|
@@ -30,7 +30,7 @@ interface HasGrouped {
|
|
|
30
30
|
/**
|
|
31
31
|
* A query builder that can participate in a join.
|
|
32
32
|
* To learn more about join queries, see
|
|
33
|
-
* {@link https://docs.squid.cloud/docs/client-sdk/queries#joining-data-across-collections-and-integrations}.
|
|
33
|
+
* {@link https://docs.squid.cloud/docs/development-tools/client-sdk/queries#joining-data-across-collections-and-integrations}.
|
|
34
34
|
*/
|
|
35
35
|
export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, LatestAlias extends Alias, RootAlias extends Alias> extends BaseQueryBuilder<ReturnType> implements SnapshotEmitter<WithDocumentReferences<ReturnType>>, HasGrouped, HasDereference {
|
|
36
36
|
private readonly collectionName;
|
|
@@ -5,6 +5,8 @@ import DocumentIdentityService from '../document-identity.service';
|
|
|
5
5
|
import { DocumentStore } from '../document-store';
|
|
6
6
|
import { RpcManager } from '../rpc.manager';
|
|
7
7
|
import { ClientIdService } from '../client-id.service';
|
|
8
|
+
export declare const FETCH_BEYOND_LIMIT = 100;
|
|
9
|
+
export declare const LIMIT_UNDERFLOW_TRIGGER = 20;
|
|
8
10
|
interface OngoingQuery {
|
|
9
11
|
clientRequestId: ClientRequestId;
|
|
10
12
|
query: Query;
|
|
@@ -33,6 +35,20 @@ interface OngoingQuery {
|
|
|
33
35
|
done: boolean;
|
|
34
36
|
isInFlight: boolean;
|
|
35
37
|
forceFetchFromServer: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* If there's a limit, we request `limit + FETCH_BEYOND_LIMIT` documents from the server.
|
|
40
|
+
* If we got that many documents, that means there may be even more. In that case, if our result set goes below
|
|
41
|
+
* `limit + LIMIT_UNDERFLOW_TRIGGER` documents (due to local or remote deletions), we need to resend the query to the
|
|
42
|
+
* server to potentially get more documents.
|
|
43
|
+
* If the number of documents is less than `limit + FETCH_BEYOND_LIMIT`, that means there are not that many documents
|
|
44
|
+
* on the server, so we don't need to resend the query regardless of how small our result size is or becomes.
|
|
45
|
+
*/
|
|
46
|
+
limitUnderflowState: LimitUnderflowState;
|
|
47
|
+
}
|
|
48
|
+
declare enum LimitUnderflowState {
|
|
49
|
+
UNKNOWN = 0,
|
|
50
|
+
DISABLED = 1,
|
|
51
|
+
ENABLED = 2
|
|
36
52
|
}
|
|
37
53
|
interface DocsAndAlias {
|
|
38
54
|
docs: Array<SquidDocument>;
|
|
@@ -108,7 +108,7 @@ export declare class Squid {
|
|
|
108
108
|
* If the integrationId is not provided, the `built_in_db` integration id will be used.
|
|
109
109
|
*
|
|
110
110
|
* For more information on the CollectionReference object, please refer to the
|
|
111
|
-
* documentation at {@link https://docs.squid.cloud/docs/client-sdk/collection-reference}.
|
|
111
|
+
* documentation at {@link https://docs.squid.cloud/docs/development-tools/client-sdk/collection-reference}.
|
|
112
112
|
*
|
|
113
113
|
* @param collectionName The name of the collection.
|
|
114
114
|
* @param integrationId The id of the integration, default to `built_in_db`.
|
|
@@ -121,7 +121,7 @@ export declare class Squid {
|
|
|
121
121
|
* will be atomic. Note that mutations for different integrations will not be atomic.
|
|
122
122
|
*
|
|
123
123
|
* For more information about transactions in Squid, please refer to the
|
|
124
|
-
* documentation at {@link https://docs.squid.cloud/docs/client-sdk/transactions}.
|
|
124
|
+
* documentation at {@link https://docs.squid.cloud/docs/development-tools/client-sdk/transactions}.
|
|
125
125
|
*
|
|
126
126
|
* @param fn The callback to run as an atomic change. The function receives a transactionId that should be used for
|
|
127
127
|
* all the mutations that should be atomic. The function should return a promise.
|
|
@@ -133,7 +133,7 @@ export declare class Squid {
|
|
|
133
133
|
* Executes the given backend function with the given parameters and returns a promise with the result.
|
|
134
134
|
*
|
|
135
135
|
* For more information about backend functions in Squid, please refer to the
|
|
136
|
-
* documentation at {@link https://docs.squid.cloud/docs/backend/executables}.
|
|
136
|
+
* documentation at {@link https://docs.squid.cloud/docs/development-tools/backend/executables}.
|
|
137
137
|
*
|
|
138
138
|
* @param functionName The name of the function to execute on the server.
|
|
139
139
|
* @param params The parameters to pass to the function.
|
|
@@ -145,7 +145,7 @@ export declare class Squid {
|
|
|
145
145
|
* Executes the given named query with the given parameters and returns a promise with the result.
|
|
146
146
|
*
|
|
147
147
|
* For more information about named queries in Squid, please refer to the
|
|
148
|
-
* documentation at {@link https://docs.squid.cloud/docs/backend/named-queries}.
|
|
148
|
+
* documentation at {@link https://docs.squid.cloud/docs/development-tools/backend/named-queries}.
|
|
149
149
|
*
|
|
150
150
|
* @param integrationId The id of the integration that the named query is defined with.
|
|
151
151
|
* @param queryName The name of the named query.
|
|
@@ -188,7 +188,7 @@ export declare class Squid {
|
|
|
188
188
|
/**
|
|
189
189
|
* Returns an AI Assistant client for the given integration. The AI Assistant client can be used to build and chat
|
|
190
190
|
* with custom AI profiles. For more information about the AI Assistant in Squid, please refer to the documentation
|
|
191
|
-
* at {@link https://docs.squid.cloud/docs/
|
|
191
|
+
* at {@link https://docs.squid.cloud/docs/ai/ai-assistant}.
|
|
192
192
|
*
|
|
193
193
|
* @param integrationId The id of the AI Assistant integration.
|
|
194
194
|
* @returns An AI Assistant client.
|