@squidcloud/client 1.0.51 → 1.0.53
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/common/src/application.types.d.ts +1 -0
- package/dist/common/src/socket.types.d.ts +2 -0
- package/dist/index.js +6 -6
- package/dist/typescript-client/src/auth.manager.d.ts +17 -0
- package/dist/typescript-client/src/data.manager.d.ts +2 -2
- package/dist/typescript-client/src/rpc.manager.d.ts +5 -9
- package/dist/typescript-client/src/socket.manager.d.ts +4 -7
- package/dist/typescript-client/src/squid.d.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DestructManager } from './destruct.manager';
|
|
3
|
+
import { ApiKey, AuthToken } from '@squidcloud/common';
|
|
4
|
+
export declare class AuthManager {
|
|
5
|
+
private readonly destructManager;
|
|
6
|
+
private readonly apiKey;
|
|
7
|
+
private readonly authIdTokenSet;
|
|
8
|
+
private readonly authIdTokenObservableSubject;
|
|
9
|
+
private shouldWaitForAuth;
|
|
10
|
+
private idToken;
|
|
11
|
+
constructor(destructManager: DestructManager, apiKey: ApiKey | undefined);
|
|
12
|
+
setAuthIdToken(idToken: string | undefined | Promise<string | undefined> | Observable<string | undefined>): void;
|
|
13
|
+
observeAuthIdToken(): Observable<string | undefined>;
|
|
14
|
+
waitForReadyState(): Promise<void>;
|
|
15
|
+
getApiKey(): ApiKey | undefined;
|
|
16
|
+
getAuthToken(): AuthToken | undefined;
|
|
17
|
+
}
|
|
@@ -5,8 +5,8 @@ import { DocumentStore } from './document-store';
|
|
|
5
5
|
import { MutationSender } from './mutation/mutation-sender';
|
|
6
6
|
import { QueryBuilderFactory } from './query/query-builder.factory';
|
|
7
7
|
import { QuerySubscriptionManager } from './query/query-subscription.manager';
|
|
8
|
-
import { SocketManagerInterface } from './socket.manager';
|
|
9
8
|
import { TransactionId } from './types';
|
|
9
|
+
import { SocketManager } from './socket.manager';
|
|
10
10
|
export interface DocTimestampMetadata {
|
|
11
11
|
timestamp: DocTimestamp;
|
|
12
12
|
expireTimestamp?: number;
|
|
@@ -82,7 +82,7 @@ export declare class DataManager {
|
|
|
82
82
|
private readonly refreshDocIdToTimestamp;
|
|
83
83
|
private deleteExpiredTimestampsInterval;
|
|
84
84
|
private handleIncomingMessagesForTests;
|
|
85
|
-
constructor(documentStore: DocumentStore, mutationSender: MutationSender, socketManager:
|
|
85
|
+
constructor(documentStore: DocumentStore, mutationSender: MutationSender, socketManager: SocketManager, querySubscriptionManager: QuerySubscriptionManager, queryBuilderFactory: QueryBuilderFactory, lockManager: LockManager, destructManager: DestructManager, documentIdentityService: DocumentIdentityService);
|
|
86
86
|
getProperties(squidDocId: SquidDocId): SquidDocument | undefined;
|
|
87
87
|
/** Whether a document has changes that are out of sync with the server. */
|
|
88
88
|
isDirty(squidDocId: SquidDocId): boolean;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { ApiKey } from '@squidcloud/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
1
|
import { DestructManager } from './destruct.manager';
|
|
4
|
-
import {
|
|
2
|
+
import { SocketManager } from './socket.manager';
|
|
3
|
+
import { AuthManager } from './auth.manager';
|
|
5
4
|
export declare class RpcManager {
|
|
6
5
|
private readonly rpcEndpoint;
|
|
7
6
|
private readonly socketManager;
|
|
8
7
|
private readonly destructManager;
|
|
9
8
|
private readonly headers;
|
|
9
|
+
private readonly authManager;
|
|
10
10
|
private readonly staticHeaders;
|
|
11
|
-
private readonly
|
|
12
|
-
|
|
13
|
-
private readonly authIdTokenObservableSubject;
|
|
14
|
-
private shouldWaitForAuth;
|
|
15
|
-
constructor(rpcEndpoint: string, socketManager: SocketManagerInterface, destructManager: DestructManager, headers?: Record<string, string>, apiKey?: ApiKey);
|
|
11
|
+
private readonly onGoingRpcCounter;
|
|
12
|
+
constructor(rpcEndpoint: string, socketManager: SocketManager, destructManager: DestructManager, headers: Record<string, string>, authManager: AuthManager);
|
|
16
13
|
awaitAllSettled(): Promise<void>;
|
|
17
|
-
setAuthIdToken(idToken: string | undefined | Promise<string | undefined> | Observable<string | undefined>): void;
|
|
18
14
|
setStaticHeader(key: string, value: string): void;
|
|
19
15
|
deleteStaticHeader(key: string): void;
|
|
20
16
|
getEndpoint(): string;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { ClientId, MessageFromClient, MessageToClient } from '@squidcloud/common';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { DestructManager } from './destruct.manager';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
observeConnectionReady(): Observable<boolean>;
|
|
7
|
-
sendMessage(message: MessageFromClient): void;
|
|
8
|
-
}
|
|
9
|
-
export declare class SocketManager implements SocketManagerInterface {
|
|
4
|
+
import { AuthManager } from './auth.manager';
|
|
5
|
+
export declare class SocketManager {
|
|
10
6
|
private readonly clientId;
|
|
11
7
|
private readonly socketIoEndpoint;
|
|
12
8
|
private readonly messageNotificationWrapper;
|
|
13
9
|
private readonly destructManager;
|
|
10
|
+
private readonly authManager;
|
|
14
11
|
private readonly webSocketObserver;
|
|
15
12
|
private readonly allMessagesObserver;
|
|
16
13
|
private readonly connectionReady;
|
|
17
14
|
private readonly seenMessageIds;
|
|
18
15
|
private socket;
|
|
19
16
|
private firstConnection;
|
|
20
|
-
constructor(clientId: ClientId, socketIoEndpoint: string, messageNotificationWrapper: (fn: () => any) => any, destructManager: DestructManager, extraHeaders
|
|
17
|
+
constructor(clientId: ClientId, socketIoEndpoint: string, messageNotificationWrapper: (fn: () => any) => any, destructManager: DestructManager, extraHeaders: Record<string, string> | undefined, authManager: AuthManager);
|
|
21
18
|
observeNotifications<T extends MessageToClient>(): Observable<T>;
|
|
22
19
|
observeConnectionReady(): Observable<boolean>;
|
|
23
20
|
sendMessage(message: MessageFromClient): void;
|
|
@@ -58,6 +58,7 @@ export declare class Squid {
|
|
|
58
58
|
private readonly destructManager;
|
|
59
59
|
private readonly documentIdentityService;
|
|
60
60
|
private readonly distributedLockManager;
|
|
61
|
+
private readonly authManager;
|
|
61
62
|
private static readonly squidInstancesMap;
|
|
62
63
|
/**
|
|
63
64
|
* Creates a new instance of Squid with the given options.
|
|
@@ -112,7 +113,7 @@ export declare class Squid {
|
|
|
112
113
|
* @param fn The callback to run as an atomic change. The function receives a transactionId that should be used for
|
|
113
114
|
* all the mutations that should be atomic. The function should return a promise.
|
|
114
115
|
*
|
|
115
|
-
* @returns A promise that resolves when the transactions
|
|
116
|
+
* @returns A promise that resolves when the transactions are committed on the server.
|
|
116
117
|
*/
|
|
117
118
|
runInTransaction: (fn: (transactionId: TransactionId) => Promise<void>) => Promise<void>;
|
|
118
119
|
/**
|
|
@@ -173,7 +174,7 @@ export declare class Squid {
|
|
|
173
174
|
* the lock.
|
|
174
175
|
* @returns A promise that resolves with the lock object. The promise will reject if failed to acquire the lock.
|
|
175
176
|
*/
|
|
176
|
-
|
|
177
|
+
acquireLock: (mutex: string, exclusive?: boolean) => Promise<DistributedLock>;
|
|
177
178
|
/**
|
|
178
179
|
* Destructs the Squid Client. Unsubscribes from all ongoing queries or requests, and clears the local data.
|
|
179
180
|
* After invoking this method, the Squid client will not be usable.
|