@squidcloud/client 1.0.166 → 1.0.168
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 +35 -16
- package/package.json +1 -1
- package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +0 -25
- package/dist/internal-common/src/public-types/ai-chatbot.public-context.d.ts +0 -12
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +0 -31
- package/dist/internal-common/src/public-types/api-call.public-context.d.ts +0 -14
- package/dist/internal-common/src/public-types/application.public-types.d.ts +0 -149
- package/dist/internal-common/src/public-types/base-query-builder.public-types.d.ts +0 -147
- package/dist/internal-common/src/public-types/bundle-api.public-types.d.ts +0 -57
- package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +0 -8
- package/dist/internal-common/src/public-types/communication.public-types.d.ts +0 -12
- package/dist/internal-common/src/public-types/context.public-types.d.ts +0 -40
- package/dist/internal-common/src/public-types/distributed-lock.public-context.d.ts +0 -4
- package/dist/internal-common/src/public-types/document.public-types.d.ts +0 -32
- package/dist/internal-common/src/public-types/graphql.public-context.d.ts +0 -7
- package/dist/internal-common/src/public-types/graphql.public-types.d.ts +0 -9
- package/dist/internal-common/src/public-types/http-status.enum.d.ts +0 -50
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +0 -61
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.d.ts +0 -32
- package/dist/internal-common/src/public-types/integrations/api.types.d.ts +0 -81
- package/dist/internal-common/src/public-types/integrations/auth.types.d.ts +0 -54
- package/dist/internal-common/src/public-types/integrations/database.types.d.ts +0 -206
- package/dist/internal-common/src/public-types/integrations/observability.types.d.ts +0 -24
- package/dist/internal-common/src/public-types/integrations/queue-types.d.ts +0 -40
- package/dist/internal-common/src/public-types/integrations/schemas.d.ts +0 -70
- package/dist/internal-common/src/public-types/mutation.public-context.d.ts +0 -14
- package/dist/internal-common/src/public-types/mutation.public-types.d.ts +0 -53
- package/dist/internal-common/src/public-types/native-query.public-context.d.ts +0 -7
- package/dist/internal-common/src/public-types/native-query.public-types.d.ts +0 -16
- package/dist/internal-common/src/public-types/pagination.public-types.d.ts +0 -62
- package/dist/internal-common/src/public-types/query.public-context.d.ts +0 -137
- package/dist/internal-common/src/public-types/query.public-types.d.ts +0 -64
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +0 -5
- package/dist/internal-common/src/public-types/schema.public-types.d.ts +0 -46
- package/dist/internal-common/src/public-types/secret.public-types.d.ts +0 -16
- package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +0 -24
- package/dist/internal-common/src/public-types/socket.public-types.d.ts +0 -5
- package/dist/internal-common/src/public-types/topic.public-context.d.ts +0 -10
- package/dist/internal-common/src/public-types/typescript.public-types.d.ts +0 -15
- package/dist/internal-common/src/public-utils/id-utils.d.ts +0 -6
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +0 -1
- package/dist/internal-common/src/types/ai-chatbot.types.d.ts +0 -1
- package/dist/internal-common/src/types/api.types.d.ts +0 -2
- package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
- package/dist/internal-common/src/types/backend-run.types.d.ts +0 -2
- package/dist/internal-common/src/types/bundle-data.types.d.ts +0 -4
- package/dist/internal-common/src/types/communication.types.d.ts +0 -1
- package/dist/internal-common/src/types/document.types.d.ts +0 -1
- package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/openapi.types.d.ts +0 -1
- package/dist/internal-common/src/types/query.types.d.ts +0 -1
- package/dist/internal-common/src/types/secret.types.d.ts +0 -11
- package/dist/internal-common/src/types/socket.types.d.ts +0 -7
- package/dist/internal-common/src/utils/array.d.ts +0 -1
- package/dist/internal-common/src/utils/assert.d.ts +0 -1
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
- package/dist/internal-common/src/utils/http.d.ts +0 -2
- package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
- package/dist/internal-common/src/utils/object.d.ts +0 -5
- package/dist/internal-common/src/utils/serialization.d.ts +0 -5
- package/dist/internal-common/src/utils/validation.d.ts +0 -27
- package/dist/internal-common/src/websocket.impl.d.ts +0 -21
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +0 -1239
- package/dist/typescript-client/src/ai-assistant-client.d.ts +0 -73
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +0 -174
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +0 -8
- package/dist/typescript-client/src/ai.types.d.ts +0 -63
- package/dist/typescript-client/src/api.manager.d.ts +0 -11
- package/dist/typescript-client/src/auth.manager.d.ts +0 -27
- package/dist/typescript-client/src/backend-function.manager.d.ts +0 -9
- package/dist/typescript-client/src/backend-transforms.d.ts +0 -0
- package/dist/typescript-client/src/client-id.service.d.ts +0 -27
- package/dist/typescript-client/src/collection-reference.d.ts +0 -80
- package/dist/typescript-client/src/collection-reference.factory.d.ts +0 -13
- package/dist/typescript-client/src/connection-details.d.ts +0 -23
- package/dist/typescript-client/src/data.manager.d.ts +0 -175
- package/dist/typescript-client/src/destruct.manager.d.ts +0 -13
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +0 -16
- package/dist/typescript-client/src/document-identity.service.d.ts +0 -12
- package/dist/typescript-client/src/document-reference.d.ts +0 -149
- package/dist/typescript-client/src/document-reference.factory.d.ts +0 -13
- package/dist/typescript-client/src/document-store.d.ts +0 -14
- package/dist/typescript-client/src/graphql-client.d.ts +0 -14
- package/dist/typescript-client/src/graphql-client.factory.d.ts +0 -11
- package/dist/typescript-client/src/index.d.ts +0 -11
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +0 -12
- package/dist/typescript-client/src/native-query-manager.d.ts +0 -7
- package/dist/typescript-client/src/public-types.d.ts +0 -37
- package/dist/typescript-client/src/public-utils.d.ts +0 -1
- package/dist/typescript-client/src/query/deserializer.d.ts +0 -3
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +0 -161
- package/dist/typescript-client/src/query/local-query-manager.d.ts +0 -9
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +0 -77
- package/dist/typescript-client/src/query/query-sender.d.ts +0 -34
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +0 -133
- package/dist/typescript-client/src/query/query.types.d.ts +0 -49
- package/dist/typescript-client/src/queue.manager.d.ts +0 -7
- package/dist/typescript-client/src/rate-limiter.d.ts +0 -32
- package/dist/typescript-client/src/rpc.manager.d.ts +0 -30
- package/dist/typescript-client/src/secret.client.d.ts +0 -23
- package/dist/typescript-client/src/socket.manager.d.ts +0 -44
- package/dist/typescript-client/src/squid.d.ts +0 -245
- package/dist/typescript-client/src/state/state.service.spec.d.ts +0 -1
- package/dist/typescript-client/src/testing/setup-tests.d.ts +0 -1
- package/dist/typescript-client/src/types.d.ts +0 -2
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { DocTimestamp, Mutation, SquidDocId, SquidDocument } from './public-types';
|
|
2
|
-
import { DestructManager } from './destruct.manager';
|
|
3
|
-
import DocumentIdentityService from './document-identity.service';
|
|
4
|
-
import { DocumentStore } from './document-store';
|
|
5
|
-
import { MutationSender } from './mutation/mutation-sender';
|
|
6
|
-
import { QueryBuilderFactory } from './query/query-builder.factory';
|
|
7
|
-
import { QuerySender } from './query/query-sender';
|
|
8
|
-
import { QuerySubscriptionManager } from './query/query-subscription.manager';
|
|
9
|
-
import { SocketManager } from './socket.manager';
|
|
10
|
-
import { TransactionId } from './types';
|
|
11
|
-
import { LockManager } from '../../internal-common/src/utils/lock.manager';
|
|
12
|
-
export interface DocTimestampMetadata {
|
|
13
|
-
timestamp: DocTimestamp;
|
|
14
|
-
expireTimestamp?: number;
|
|
15
|
-
}
|
|
16
|
-
export declare class DataManager {
|
|
17
|
-
private readonly documentStore;
|
|
18
|
-
private readonly mutationSender;
|
|
19
|
-
private readonly socketManager;
|
|
20
|
-
private readonly querySubscriptionManager;
|
|
21
|
-
private readonly queryBuilderFactory;
|
|
22
|
-
private readonly lockManager;
|
|
23
|
-
private readonly destructManager;
|
|
24
|
-
private readonly documentIdentityService;
|
|
25
|
-
private readonly querySender;
|
|
26
|
-
private readonly docIdToLocalTimestamp;
|
|
27
|
-
private currentTransactionId;
|
|
28
|
-
/**
|
|
29
|
-
* During a batch, any update to a document that may trigger an update to a query is collected here and once the batch
|
|
30
|
-
* ends, the relevant subscribes to these queries will be updated.
|
|
31
|
-
*/
|
|
32
|
-
private readonly batchClientRequestIds;
|
|
33
|
-
/**
|
|
34
|
-
* In this map we save timestamps for documents that are available locally or recently deleted but need to remain
|
|
35
|
-
* here so if a mutation comes from the server we know whether to apply it or not based on the timestamp. For
|
|
36
|
-
* example, if a document is removed locally and immediately after, an update is received from the server - In that
|
|
37
|
-
* case, it may be the update pre-dates the data that was available locally a second ago. For that reason, the
|
|
38
|
-
* timestamp needs to be kept and even for removed documents it will be kept for ~20 seconds more.
|
|
39
|
-
*
|
|
40
|
-
* Eventually, this map is used as a gatekeeper for preventing old versions of a document (based on timestamp) to
|
|
41
|
-
* appear on the client.
|
|
42
|
-
*/
|
|
43
|
-
private readonly docIdToServerTimestamp;
|
|
44
|
-
/**
|
|
45
|
-
* In the case of a local change (outgoing change) without a server timestamp, an incoming server update cannot be
|
|
46
|
-
* applied and needs to be queued until the local state allows it. In this case the incoming update will be queued in
|
|
47
|
-
* this map. Any future incoming server update to the same document will override the previous update in case it has
|
|
48
|
-
* a later timestamp.
|
|
49
|
-
*/
|
|
50
|
-
private readonly pendingIncomingUpdates;
|
|
51
|
-
/**
|
|
52
|
-
* A mutation sent to the server will be stored in this map until it receives a timestamp from the server. These
|
|
53
|
-
* mutations were already applied locally and were sent to the server or about to be sent if sentToServer=false
|
|
54
|
-
* (or are queued in the MutationSender due to a lock). The existence of these pending mutations indicates the data
|
|
55
|
-
* manager to:
|
|
56
|
-
* 1 - Not apply any incoming server mutation while there are outgoing mutations without a timestamp
|
|
57
|
-
* 2 - Not delete the local document even if there are no queries related to this document - there is a chance
|
|
58
|
-
* that there will be a future query that will need this document and the query needs to return the local version
|
|
59
|
-
* of the document.
|
|
60
|
-
* 3 - Even when all outgoing mutations have a timestamp, it may be that there is a pending query in flight that will
|
|
61
|
-
* need to return the document. In this case, the local document may be different from the server. Hence, it
|
|
62
|
-
* cannot accept the server change and will wait for another update from the server. For this purpose, timestamp
|
|
63
|
-
* will be stored in docsToTimestamp for ~20 more seconds.
|
|
64
|
-
*
|
|
65
|
-
* Note: Only one entry per squidDocId can be with sentToServer=false. This is true since all updates to the same doc
|
|
66
|
-
* in the same batch are appended (and reduced) to the same outgoing mutation object.
|
|
67
|
-
*/
|
|
68
|
-
private readonly pendingOutgoingMutations;
|
|
69
|
-
private readonly pendingOutgoingMutationsChanged;
|
|
70
|
-
/**
|
|
71
|
-
* A subject for whether there are outgoing mutations. If there are outgoing mutations, any incoming update from the
|
|
72
|
-
* server will be delayed until all the outgoing mutations will be acknowledged by the server.
|
|
73
|
-
* This mechanism is needed to avoid this case:
|
|
74
|
-
*
|
|
75
|
-
* collection.docRef('a').delete();
|
|
76
|
-
* collection.snapshots().subscribe((res) => {
|
|
77
|
-
* // The result here may include doc with id='a' since the delete mutation was not acknowledged.
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* If we wait for the acknowledgment message, we will have a server timestamp and will be able to ignore the incoming
|
|
81
|
-
* result for document with id='a'.
|
|
82
|
-
*/
|
|
83
|
-
private readonly outgoingMutationsEmpty;
|
|
84
|
-
/**
|
|
85
|
-
* When applying an outgoing mutation, there may be a short time that the mutation is not yet inserted into the
|
|
86
|
-
* pending outgoing mutations map. In this case, we mark the document id as known to be dirty and remove it from the
|
|
87
|
-
* set once the pending outgoing mutations map is updated.
|
|
88
|
-
*/
|
|
89
|
-
private readonly knownDirtyDocs;
|
|
90
|
-
private readonly failedDocsToResync;
|
|
91
|
-
private readonly refreshDocIdToTimestamp;
|
|
92
|
-
private deleteExpiredTimestampsInterval;
|
|
93
|
-
private handleIncomingMessagesForTests;
|
|
94
|
-
constructor(documentStore: DocumentStore, mutationSender: MutationSender, socketManager: SocketManager, querySubscriptionManager: QuerySubscriptionManager, queryBuilderFactory: QueryBuilderFactory, lockManager: LockManager, destructManager: DestructManager, documentIdentityService: DocumentIdentityService, querySender: QuerySender);
|
|
95
|
-
getProperties(squidDocId: SquidDocId): SquidDocument | undefined;
|
|
96
|
-
/** Whether a document has changes that are out of sync with the server. */
|
|
97
|
-
isDirty(squidDocId: SquidDocId): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Runs the provided function without sending mutations to the server while collecting the updates to the different
|
|
100
|
-
* queries. Local updates will still be applied. Once the batch finishes, all the updates will be sent to the server
|
|
101
|
-
* and the different queries will be notified. runInTransaction may be invoked inside another runInTransaction, only
|
|
102
|
-
* the top level batch will trigger updates to the server.
|
|
103
|
-
*/
|
|
104
|
-
runInTransaction<T = any>(fn: (transactionId: TransactionId) => Promise<T>, transactionId?: TransactionId): Promise<T>;
|
|
105
|
-
/** Applies a mutation done from the client (from DocumentReference) and sends it to the server. */
|
|
106
|
-
applyOutgoingMutation(mutation: Mutation, transactionId: TransactionId | undefined): Promise<void>;
|
|
107
|
-
/** Same as runInTransaction with the exception that the passed function runs synchronously. */
|
|
108
|
-
private runInTransactionSync;
|
|
109
|
-
/** Remove properties from the document record that should not be sent to the server. */
|
|
110
|
-
private removeInternalProperties;
|
|
111
|
-
/** Listens and handles mutations and snapshots notifications from the socketManager. */
|
|
112
|
-
private handleNotifications;
|
|
113
|
-
private handleIncomingMutations;
|
|
114
|
-
private handleIncomingQuerySnapshots;
|
|
115
|
-
/**
|
|
116
|
-
* Returns a boolean for whether some updates were ignored because the client knows of a later timestamp for those
|
|
117
|
-
* documents.
|
|
118
|
-
*/
|
|
119
|
-
private applyIncomingUpdates;
|
|
120
|
-
private maybeApplyIncomingUpdate;
|
|
121
|
-
private refreshQueryMapping;
|
|
122
|
-
private destruct;
|
|
123
|
-
private stopDeleteExpiredTimestampsJob;
|
|
124
|
-
/**
|
|
125
|
-
* Removes entries from the docToTimestamp map for all the documents that are no longer relevant for this client.
|
|
126
|
-
* If a document is currently tracked, we forget it.
|
|
127
|
-
* Cases a document is considered not relevant anymore:
|
|
128
|
-
* 1 - There are no outgoing or incoming updates for this document AND:
|
|
129
|
-
* a - The document was deleted on the server and this client already received a notification about it OR
|
|
130
|
-
* b - The document no longer has a query that will keep it up-to-date
|
|
131
|
-
*/
|
|
132
|
-
private startDeleteExpiredTimestampsJob;
|
|
133
|
-
/**
|
|
134
|
-
* Whether the document is tracked by any pending mutations or ongoing queries.
|
|
135
|
-
*/
|
|
136
|
-
isTracked(squidDocId: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Whether a document exists locally, but is no longer tracked by any mutations or queries. This is often the case
|
|
139
|
-
* for in-memory DocumentReferences that are not part of any query.
|
|
140
|
-
*/
|
|
141
|
-
isForgotten(squidDocId: SquidDocId): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Whether a document only exists locally. This means that the document has never by sent to or received from the
|
|
144
|
-
* server.
|
|
145
|
-
*/
|
|
146
|
-
isLocalOnly(squidDocId: SquidDocId): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Whether the document has even been acknowledged by the server. Acknowledgements occur when an incoming query or
|
|
149
|
-
* mutation is received, and when an outgoing mutation is acknowledged.
|
|
150
|
-
*/
|
|
151
|
-
hasBeenAcknowledged(squidDocId: SquidDocId): boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Updates the document with the new properties, returns true if an update was done or false in case the doc did not
|
|
154
|
-
* change.
|
|
155
|
-
*/
|
|
156
|
-
private updateDocumentFromSnapshot;
|
|
157
|
-
private finishTransaction;
|
|
158
|
-
private sendAllUnsentOutgoingMutations;
|
|
159
|
-
private sendMutationsForIntegration;
|
|
160
|
-
private removeOutgoingMutation;
|
|
161
|
-
private resyncFailedUpdates;
|
|
162
|
-
private refreshUpdatedDocuments;
|
|
163
|
-
private groupOutgoingMutationsByIntegrationId;
|
|
164
|
-
/**
|
|
165
|
-
* Handles the case that due to some change (an incoming or outgoing change to a document), a document becomes orphan.
|
|
166
|
-
* That is, there are no ongoing queries that will keep it up-to-date.
|
|
167
|
-
* An orphan document should not stay locally since it may be stale after some time.
|
|
168
|
-
*/
|
|
169
|
-
private handleOrphanDocs;
|
|
170
|
-
private acknowledgeDocument;
|
|
171
|
-
private setExpiration;
|
|
172
|
-
private forgetDocument;
|
|
173
|
-
private migrateDocIds;
|
|
174
|
-
private hasPendingSentMutations;
|
|
175
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
export type DestructorFn = () => Promise<void> | void;
|
|
3
|
-
export declare class DestructManager {
|
|
4
|
-
private readonly preDestructors;
|
|
5
|
-
private readonly destructors;
|
|
6
|
-
private readonly isDestructedSubject;
|
|
7
|
-
get isDestructing(): boolean;
|
|
8
|
-
observeIsDestructing(): Observable<void>;
|
|
9
|
-
onPreDestruct(fn: DestructorFn): void;
|
|
10
|
-
onDestruct(fn: DestructorFn): void;
|
|
11
|
-
destruct(): Promise<void>;
|
|
12
|
-
reportDestructed(): void;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
/** A handler for a distributed lock that can be released. */
|
|
3
|
-
export interface DistributedLock {
|
|
4
|
-
/** Releases the lock. */
|
|
5
|
-
release(): void;
|
|
6
|
-
/**
|
|
7
|
-
* Whether the lock has been released.
|
|
8
|
-
* @returns True if the lock has been released.
|
|
9
|
-
*/
|
|
10
|
-
isReleased(): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Observes when the lock is released (It may be released due to a connection issue)
|
|
13
|
-
* @returns An observable that emits when the lock is released.
|
|
14
|
-
*/
|
|
15
|
-
observeRelease(): Observable<void>;
|
|
16
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { DestructManager } from './destruct.manager';
|
|
3
|
-
import { DocumentStore } from './document-store';
|
|
4
|
-
import { IdResolutionMap } from '../../internal-common/src/types/mutation.types';
|
|
5
|
-
export default class DocumentIdentityService {
|
|
6
|
-
private readonly documentStore;
|
|
7
|
-
private readonly destructManager;
|
|
8
|
-
private readonly changeNotifier;
|
|
9
|
-
constructor(documentStore: DocumentStore, destructManager: DestructManager);
|
|
10
|
-
migrate(idResolutionMap: IdResolutionMap): void;
|
|
11
|
-
observeChanges(): Observable<IdResolutionMap>;
|
|
12
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { DocumentData } from './public-types';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { TransactionId } from './types';
|
|
4
|
-
import { DeepRecord, Paths } from '../../internal-common/src/public-types/typescript.public-types';
|
|
5
|
-
/**
|
|
6
|
-
* Holds a reference to a document. A document reference is a reference to a specific record in a collection. You can
|
|
7
|
-
* use it to read or write data to the document. A document can refer to a row in a table in a relational database or a
|
|
8
|
-
* document in a NoSQL database. Additionally, a document reference can refer to a non-existent document, which you can
|
|
9
|
-
* use to create a new document.
|
|
10
|
-
*
|
|
11
|
-
* Read more about document references in the
|
|
12
|
-
* {@link https://docs.squid.cloud/docs/development-tools/client-sdk/document-reference documentation}.
|
|
13
|
-
* @typeParam T The type of the document data.
|
|
14
|
-
*/
|
|
15
|
-
export declare class DocumentReference<T extends DocumentData = any> {
|
|
16
|
-
private _squidDocId;
|
|
17
|
-
private readonly dataManager;
|
|
18
|
-
private readonly queryBuilderFactory;
|
|
19
|
-
/** A string that uniquely identifies this document reference. */
|
|
20
|
-
refId: string;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the document data. Throws an error if the document does not exist.
|
|
23
|
-
*
|
|
24
|
-
* @returns The document data.
|
|
25
|
-
* @throws Error if the document does not exist.
|
|
26
|
-
*/
|
|
27
|
-
get data(): T;
|
|
28
|
-
/**
|
|
29
|
-
* Returns a read-only internal copy of the document data. This works similar to `this.data`, except it does not
|
|
30
|
-
* perform a defensive copy. The caller may not modify this object, on penalty of unexpected behavior.
|
|
31
|
-
*
|
|
32
|
-
* @returns The document data.
|
|
33
|
-
* @throws Error if the document does not exist.
|
|
34
|
-
*/
|
|
35
|
-
get dataRef(): T;
|
|
36
|
-
/**
|
|
37
|
-
* Returns whether data has been populated for this document reference. Data
|
|
38
|
-
* will not present if a document has not been queried, does not exist, or
|
|
39
|
-
* has been deleted.
|
|
40
|
-
*
|
|
41
|
-
* @returns Whether the document has data.
|
|
42
|
-
*/
|
|
43
|
-
get hasData(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* A promise that resolves with the latest data from the server or undefined if the document does not exist on the
|
|
46
|
-
* server.
|
|
47
|
-
*
|
|
48
|
-
* @returns A promise that resolves with latest data from the server or undefined if the document does not exist on
|
|
49
|
-
* the server.
|
|
50
|
-
*/
|
|
51
|
-
snapshot(): Promise<T | undefined>;
|
|
52
|
-
/**
|
|
53
|
-
* Returns an observable that emits the latest data from the server or undefined if the document is deleted or does
|
|
54
|
-
* not exist on the server.
|
|
55
|
-
*
|
|
56
|
-
* @returns An observable that emits the latest data from the server or undefined if the document is deleted or does
|
|
57
|
-
* not exist on the server.
|
|
58
|
-
*/
|
|
59
|
-
snapshots(): Observable<T | undefined>;
|
|
60
|
-
/**
|
|
61
|
-
* Returns the data that is currently available on the client or undefined if data has not yet been populated.
|
|
62
|
-
*
|
|
63
|
-
* @returns The data that is currently available on the client or undefined if data has not yet been populated.
|
|
64
|
-
*/
|
|
65
|
-
peek(): T | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Returns whether the locally available version of the document may not be the latest version on the server.
|
|
68
|
-
*
|
|
69
|
-
* @returns Whether the locally available version of the document may not be the latest version on the server.
|
|
70
|
-
*/
|
|
71
|
-
isDirty(): boolean;
|
|
72
|
-
private isTracked;
|
|
73
|
-
/**
|
|
74
|
-
* Updates the document with the given data.
|
|
75
|
-
* The `update` will be reflected optimistically locally and will be applied to the server later.
|
|
76
|
-
* If a transactionId is provided, the `update` will be applied to the server as an atomic operation together with
|
|
77
|
-
* the rest of the operations in the transaction and the `update` will not reflect locally until the transaction is
|
|
78
|
-
* completed locally.
|
|
79
|
-
*
|
|
80
|
-
* The returned promise will resolve once the `update` has been applied to the server or immediately if the `update`
|
|
81
|
-
* is part of a transaction.
|
|
82
|
-
*
|
|
83
|
-
* @param data The data to update - can be partial.
|
|
84
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
85
|
-
* immediately.
|
|
86
|
-
*/
|
|
87
|
-
update(data: Partial<DeepRecord<T>>, transactionId?: TransactionId): Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Similar to {@link update}, but only updates the given path.
|
|
90
|
-
* @param path The path to update.
|
|
91
|
-
* @param value The value to set at the given path.
|
|
92
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
93
|
-
* immediately.
|
|
94
|
-
*/
|
|
95
|
-
setInPath<K extends Paths<T>>(path: K, value: DeepRecord<T>[K], transactionId?: TransactionId): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Similar to `update`, but only deletes the given path.
|
|
98
|
-
* @param path The path to delete.
|
|
99
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
100
|
-
* immediately.
|
|
101
|
-
*/
|
|
102
|
-
deleteInPath(path: Paths<T>, transactionId?: TransactionId): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Increments the value at the given path by the given value. The value may be both positive and negative.
|
|
105
|
-
* @param path The path to the value to increment.
|
|
106
|
-
* @param value The value to increment by.
|
|
107
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
108
|
-
* immediately.
|
|
109
|
-
*/
|
|
110
|
-
incrementInPath(path: Paths<T>, value: number, transactionId?: TransactionId): Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* Decrements the value at the given path by the given value. The value may be both positive and negative.
|
|
113
|
-
* @param path The path to the value to decrement.
|
|
114
|
-
* @param value The value to decrement by.
|
|
115
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
116
|
-
* immediately.
|
|
117
|
-
*/
|
|
118
|
-
decrementInPath(path: Paths<T>, value: number, transactionId?: TransactionId): Promise<void>;
|
|
119
|
-
/**
|
|
120
|
-
* Inserts the document with the given data. If the document already exists, the operation will be treated as
|
|
121
|
-
* `upsert`. The `insert` will be reflected optimistically locally and will be applied to the server later. If a
|
|
122
|
-
* transactionId is provided, the `insert` will be applied to the server as an atomic operation together with the
|
|
123
|
-
* rest
|
|
124
|
-
* of the operations in the transaction and the `insert` will not reflect locally until the transaction is completed
|
|
125
|
-
* locally.
|
|
126
|
-
*
|
|
127
|
-
* The returned promise will resolve once the `insert` has been applied to the server or immediately if the `insert`
|
|
128
|
-
* is part of a transaction.
|
|
129
|
-
*
|
|
130
|
-
* @param data The data to insert.
|
|
131
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
132
|
-
* immediately.
|
|
133
|
-
*/
|
|
134
|
-
insert(data: T, transactionId?: TransactionId): Promise<void>;
|
|
135
|
-
/**
|
|
136
|
-
* Deletes the document.
|
|
137
|
-
* The `delete` will be reflected optimistically locally and will be applied to the server later.
|
|
138
|
-
* If a transactionId is provided, the `delete` will be applied to the server as an atomic operation together with
|
|
139
|
-
* the rest of the operations in the transaction and the `delete` will not reflect locally until the transaction is
|
|
140
|
-
* completed locally.
|
|
141
|
-
*
|
|
142
|
-
* The returned promise will resolve once the `delete` has been applied to the server or immediately if the `delete`
|
|
143
|
-
* is part of a transaction.
|
|
144
|
-
*
|
|
145
|
-
* @param transactionId The transaction to use for this operation. If not provided, the operation will be applied
|
|
146
|
-
* immediately.
|
|
147
|
-
*/
|
|
148
|
-
delete(transactionId?: TransactionId): Promise<void>;
|
|
149
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SquidDocId } from './public-types';
|
|
2
|
-
import { DataManager } from './data.manager';
|
|
3
|
-
import DocumentIdentityService from './document-identity.service';
|
|
4
|
-
import { DocumentReference } from './document-reference';
|
|
5
|
-
import { QueryBuilderFactory } from './query/query-builder.factory';
|
|
6
|
-
export declare class DocumentReferenceFactory {
|
|
7
|
-
private readonly documentIdentityService;
|
|
8
|
-
private dataManager;
|
|
9
|
-
constructor(documentIdentityService: DocumentIdentityService);
|
|
10
|
-
create(squidDocId: SquidDocId, queryBuilderFactory: QueryBuilderFactory): DocumentReference;
|
|
11
|
-
setDataManager(dataManager: DataManager): void;
|
|
12
|
-
private getCollectionKey;
|
|
13
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FieldType, Query, SquidDocId, SquidDocument } from './public-types';
|
|
2
|
-
export declare class DocumentStore {
|
|
3
|
-
private readonly squidDocIdToDoc;
|
|
4
|
-
saveDocument(squidDocId: SquidDocId, properties: SquidDocument | undefined): SquidDocument | undefined;
|
|
5
|
-
hasData(squidDocId: SquidDocId): boolean;
|
|
6
|
-
getDocument(squidDocId: SquidDocId): SquidDocument;
|
|
7
|
-
getDocumentOrUndefined(squidDocId: SquidDocId): SquidDocument | undefined;
|
|
8
|
-
compareValues(a: FieldType | undefined, b: FieldType | undefined): number;
|
|
9
|
-
compareSquidDocs(a: SquidDocument, b: SquidDocument, sortFieldNames: string[], sortOrders: ('asc' | 'desc')[]): number;
|
|
10
|
-
group(sortedDocs: SquidDocument[], sortFieldNames: string[]): SquidDocument[][];
|
|
11
|
-
sortAndLimitDocs(docIdSet: Set<SquidDocId>, query: Query): Array<SquidDocument>;
|
|
12
|
-
private removeInternalProperties;
|
|
13
|
-
migrateDocId(squidDocId: SquidDocId, newSquidDocId: SquidDocId): void;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { RpcManager } from './rpc.manager';
|
|
2
|
-
import { GraphQLRequest, IntegrationId, SupportedSquidRegion } from './public-types';
|
|
3
|
-
/** A GraphQL client that can be used to query and mutate data. */
|
|
4
|
-
export declare class GraphQLClient {
|
|
5
|
-
private readonly rpcManager;
|
|
6
|
-
private readonly region;
|
|
7
|
-
private readonly appId;
|
|
8
|
-
private readonly client;
|
|
9
|
-
constructor(rpcManager: RpcManager, integrationId: IntegrationId, region: SupportedSquidRegion, appId: string);
|
|
10
|
-
/** Executes a GraphQL query and returns a promise with the result. */
|
|
11
|
-
query<T = any>(request: GraphQLRequest): Promise<T>;
|
|
12
|
-
/** Executes a GraphQL mutation and returns a promise with the result. */
|
|
13
|
-
mutate<T = Record<string, any>>(request: GraphQLRequest): Promise<T | null | undefined>;
|
|
14
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GraphQLClient } from './graphql-client';
|
|
2
|
-
import { RpcManager } from './rpc.manager';
|
|
3
|
-
import { IntegrationId, SupportedSquidRegion } from './public-types';
|
|
4
|
-
export declare class GraphQLClientFactory {
|
|
5
|
-
private readonly rpcManager;
|
|
6
|
-
private readonly region;
|
|
7
|
-
private readonly appId;
|
|
8
|
-
private readonly clientsMap;
|
|
9
|
-
constructor(rpcManager: RpcManager, region: SupportedSquidRegion, appId: string);
|
|
10
|
-
get(integrationId: IntegrationId): GraphQLClient;
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './public-types';
|
|
2
|
-
export * from './public-utils';
|
|
3
|
-
export { AiChatbotProfileReference } from './ai-chatbot-client';
|
|
4
|
-
export { Changes, QueryBuilder } from './query/query-builder.factory';
|
|
5
|
-
export { CollectionReference } from './collection-reference';
|
|
6
|
-
export { DocumentReference } from './document-reference';
|
|
7
|
-
export { GraphQLClient } from './graphql-client';
|
|
8
|
-
export { JoinQueryBuilder } from './query/join-query-builder.factory';
|
|
9
|
-
export { Squid, SquidOptions } from './squid';
|
|
10
|
-
export { TransactionId } from './types';
|
|
11
|
-
export { deserializeQuery } from './query/deserializer';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RpcManager } from '../rpc.manager';
|
|
2
|
-
import { QuerySender } from '../query/query-sender';
|
|
3
|
-
import { LockManager } from '../../../internal-common/src/utils/lock.manager';
|
|
4
|
-
import { IntegrationId, Mutation } from '../public-types';
|
|
5
|
-
import { MutateResponse } from '../../../internal-common/src/types/mutation.types';
|
|
6
|
-
export declare class MutationSender {
|
|
7
|
-
private readonly rpcManager;
|
|
8
|
-
private readonly lockManager;
|
|
9
|
-
private readonly querySender;
|
|
10
|
-
constructor(rpcManager: RpcManager, lockManager: LockManager, querySender: QuerySender);
|
|
11
|
-
sendMutations(mutations: Array<Mutation>, integrationId: IntegrationId): Promise<MutateResponse>;
|
|
12
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { RpcManager } from './rpc.manager';
|
|
2
|
-
import { IntegrationId, NativeQueryRequest } from './public-types';
|
|
3
|
-
export declare class NativeQueryManager {
|
|
4
|
-
private readonly rpcManager;
|
|
5
|
-
constructor(rpcManager: RpcManager);
|
|
6
|
-
executeNativeQuery<T>(integrationId: IntegrationId, request: NativeQueryRequest): Promise<T>;
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export * from '../../internal-common/src/public-types/ai-assistant.public-types';
|
|
2
|
-
export * from '../../internal-common/src/public-types/ai-chatbot.public-context';
|
|
3
|
-
export * from '../../internal-common/src/public-types/ai-chatbot.public-types';
|
|
4
|
-
export * from '../../internal-common/src/public-types/api-call.public-context';
|
|
5
|
-
export * from '../../internal-common/src/public-types/application.public-types';
|
|
6
|
-
export * from '../../internal-common/src/public-types/base-query-builder.public-types';
|
|
7
|
-
export * from '../../internal-common/src/public-types/bundle-api.public-types';
|
|
8
|
-
export * from '../../internal-common/src/public-types/bundle-data.public-types';
|
|
9
|
-
export * from '../../internal-common/src/public-types/communication.public-types';
|
|
10
|
-
export * from '../../internal-common/src/public-types/context.public-types';
|
|
11
|
-
export * from '../../internal-common/src/public-types/distributed-lock.public-context';
|
|
12
|
-
export * from '../../internal-common/src/public-types/document.public-types';
|
|
13
|
-
export * from '../../internal-common/src/public-types/graphql.public-context';
|
|
14
|
-
export * from '../../internal-common/src/public-types/graphql.public-types';
|
|
15
|
-
export * from '../../internal-common/src/public-types/http-status.enum';
|
|
16
|
-
export * from '../../internal-common/src/public-types/integration.public-types';
|
|
17
|
-
export * from '../../internal-common/src/public-types/integrations/ai_chatbot.types';
|
|
18
|
-
export * from '../../internal-common/src/public-types/integrations/api.types';
|
|
19
|
-
export * from '../../internal-common/src/public-types/integrations/auth.types';
|
|
20
|
-
export * from '../../internal-common/src/public-types/integrations/database.types';
|
|
21
|
-
export * from '../../internal-common/src/public-types/integrations/observability.types';
|
|
22
|
-
export * from '../../internal-common/src/public-types/integrations/queue-types';
|
|
23
|
-
export * from '../../internal-common/src/public-types/integrations/schemas';
|
|
24
|
-
export * from '../../internal-common/src/public-types/mutation.public-context';
|
|
25
|
-
export * from '../../internal-common/src/public-types/mutation.public-types';
|
|
26
|
-
export * from '../../internal-common/src/public-types/native-query.public-context';
|
|
27
|
-
export * from '../../internal-common/src/public-types/native-query.public-types';
|
|
28
|
-
export * from '../../internal-common/src/public-types/pagination.public-types';
|
|
29
|
-
export * from '../../internal-common/src/public-types/query.public-context';
|
|
30
|
-
export * from '../../internal-common/src/public-types/query.public-types';
|
|
31
|
-
export * from '../../internal-common/src/public-types/regions.public-types';
|
|
32
|
-
export * from '../../internal-common/src/public-types/schema.public-types';
|
|
33
|
-
export * from '../../internal-common/src/public-types/secret.public-types';
|
|
34
|
-
export * from '../../internal-common/src/public-types/serialized-query.public-types';
|
|
35
|
-
export * from '../../internal-common/src/public-types/socket.public-types';
|
|
36
|
-
export * from '../../internal-common/src/public-types/topic.public-context';
|
|
37
|
-
export * from '../../internal-common/src/public-types/typescript.public-types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../internal-common/src/public-utils/id-utils';
|