@squidcloud/client 1.0.62 → 1.0.64

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.
Files changed (99) hide show
  1. package/dist/common/src/ai-assistant.context.d.ts +11 -11
  2. package/dist/common/src/ai-assistant.schemas.d.ts +210 -210
  3. package/dist/common/src/ai-assistant.types.d.ts +81 -81
  4. package/dist/common/src/api-call.context.d.ts +12 -12
  5. package/dist/common/src/api.types.d.ts +24 -24
  6. package/dist/common/src/application.schemas.d.ts +1060 -1060
  7. package/dist/common/src/application.types.d.ts +224 -224
  8. package/dist/common/src/auth.types.d.ts +4 -4
  9. package/dist/common/src/backend-function.schemas.d.ts +3 -3
  10. package/dist/common/src/backend-function.types.d.ts +7 -7
  11. package/dist/common/src/backend-run.types.d.ts +53 -53
  12. package/dist/common/src/bundle-api.types.d.ts +68 -68
  13. package/dist/common/src/bundle-data.types.d.ts +59 -59
  14. package/dist/common/src/communication.types.d.ts +4 -4
  15. package/dist/common/src/context.types.d.ts +32 -32
  16. package/dist/common/src/distributed-lock.context.d.ts +5 -5
  17. package/dist/common/src/document.types.d.ts +37 -37
  18. package/dist/common/src/graphql.context.d.ts +6 -6
  19. package/dist/common/src/graphql.types.d.ts +11 -11
  20. package/dist/common/src/http-status.enum.d.ts +50 -50
  21. package/dist/common/src/index.d.ts +54 -54
  22. package/dist/common/src/integrations/ai_assistant.types.d.ts +30 -30
  23. package/dist/common/src/integrations/api.types.d.ts +80 -80
  24. package/dist/common/src/integrations/auth.types.d.ts +22 -22
  25. package/dist/common/src/integrations/database.types.d.ts +236 -236
  26. package/dist/common/src/integrations/index.d.ts +97 -97
  27. package/dist/common/src/integrations/observability.types.d.ts +22 -22
  28. package/dist/common/src/logger.types.d.ts +21 -21
  29. package/dist/common/src/metrics.types.d.ts +58 -58
  30. package/dist/common/src/mutation.context.d.ts +10 -10
  31. package/dist/common/src/mutation.schemas.d.ts +5 -5
  32. package/dist/common/src/mutation.types.d.ts +72 -72
  33. package/dist/common/src/named-query.context.d.ts +4 -4
  34. package/dist/common/src/named-query.schemas.d.ts +3 -3
  35. package/dist/common/src/named-query.types.d.ts +9 -9
  36. package/dist/common/src/query/index.d.ts +2 -2
  37. package/dist/common/src/query/query-context.d.ts +37 -37
  38. package/dist/common/src/query/simple-query-builder.d.ts +137 -137
  39. package/dist/common/src/query.schemas.d.ts +5 -5
  40. package/dist/common/src/query.types.d.ts +118 -118
  41. package/dist/common/src/regions.d.ts +22 -22
  42. package/dist/common/src/schema/schema.types.d.ts +54 -54
  43. package/dist/common/src/secret.schemas.d.ts +6 -6
  44. package/dist/common/src/secret.types.d.ts +49 -49
  45. package/dist/common/src/security.types.d.ts +3 -3
  46. package/dist/common/src/socket.schemas.d.ts +3 -3
  47. package/dist/common/src/socket.types.d.ts +108 -108
  48. package/dist/common/src/time-units.d.ts +5 -5
  49. package/dist/common/src/trigger.types.d.ts +15 -15
  50. package/dist/common/src/types.d.ts +15 -15
  51. package/dist/common/src/utils/array.d.ts +8 -8
  52. package/dist/common/src/utils/assert.d.ts +8 -8
  53. package/dist/common/src/utils/error.d.ts +4 -4
  54. package/dist/common/src/utils/http.d.ts +2 -2
  55. package/dist/common/src/utils/id.d.ts +2 -2
  56. package/dist/common/src/utils/lock.manager.d.ts +14 -14
  57. package/dist/common/src/utils/nullish.d.ts +1 -1
  58. package/dist/common/src/utils/object.d.ts +6 -6
  59. package/dist/common/src/utils/serialization.d.ts +6 -6
  60. package/dist/common/src/utils/transforms.d.ts +18 -18
  61. package/dist/common/src/utils/url.d.ts +1 -1
  62. package/dist/common/src/utils/validation.d.ts +30 -30
  63. package/dist/common/src/webhook-response.d.ts +7 -7
  64. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
  65. package/dist/typescript-client/src/ai-assistant-client.d.ts +66 -66
  66. package/dist/typescript-client/src/ai-client.factory.d.ts +13 -13
  67. package/dist/typescript-client/src/api.manager.d.ts +15 -15
  68. package/dist/typescript-client/src/auth.manager.d.ts +23 -23
  69. package/dist/typescript-client/src/backend-function.manager.d.ts +13 -13
  70. package/dist/typescript-client/src/client-id.service.d.ts +24 -24
  71. package/dist/typescript-client/src/collection-reference.d.ts +81 -81
  72. package/dist/typescript-client/src/collection-reference.factory.d.ts +16 -16
  73. package/dist/typescript-client/src/data.manager.d.ts +172 -172
  74. package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
  75. package/dist/typescript-client/src/distributed-lock.manager.d.ts +19 -19
  76. package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
  77. package/dist/typescript-client/src/document-reference.d.ts +134 -134
  78. package/dist/typescript-client/src/document-reference.factory.d.ts +9 -9
  79. package/dist/typescript-client/src/document-store.d.ts +11 -11
  80. package/dist/typescript-client/src/graphql-client.d.ts +12 -12
  81. package/dist/typescript-client/src/graphql-client.factory.d.ts +9 -9
  82. package/dist/typescript-client/src/index.d.ts +8 -8
  83. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +12 -12
  84. package/dist/typescript-client/src/named-query.manager.d.ts +14 -14
  85. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +72 -72
  86. package/dist/typescript-client/src/query/query-builder.factory.d.ts +83 -83
  87. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +64 -64
  88. package/dist/typescript-client/src/query/query.types.d.ts +14 -14
  89. package/dist/typescript-client/src/rpc.manager.d.ts +28 -28
  90. package/dist/typescript-client/src/socket.manager.d.ts +32 -32
  91. package/dist/typescript-client/src/squid.d.ts +188 -188
  92. package/dist/typescript-client/src/state/action.applier.d.ts +7 -7
  93. package/dist/typescript-client/src/state/actions.d.ts +29 -29
  94. package/dist/typescript-client/src/state/path_trie.d.ts +27 -27
  95. package/dist/typescript-client/src/state/state.service.d.ts +22 -22
  96. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
  97. package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
  98. package/dist/typescript-client/src/types.d.ts +2 -2
  99. package/package.json +1 -1
@@ -1,83 +1,83 @@
1
- import { CollectionName, DocumentData, FieldSort, IntegrationId, SimpleQueryBuilder, SquidDocId } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import DocumentIdentityService from '../document-identity.service';
4
- import { DocumentReference } from '../document-reference';
5
- import { DocumentReferenceFactory } from '../document-reference.factory';
6
- import { QuerySubscriptionManager } from './query-subscription.manager';
7
- export declare class QueryBuilderFactory {
8
- private readonly querySubscriptionManager;
9
- private readonly documentReferenceFactory;
10
- private readonly documentIdentityService;
11
- constructor(querySubscriptionManager: QuerySubscriptionManager, documentReferenceFactory: DocumentReferenceFactory, documentIdentityService: DocumentIdentityService);
12
- getForDocument<DocumentType extends DocumentData>(squidDocId: SquidDocId): QueryBuilder<DocumentType>;
13
- get<DocumentType extends DocumentData>(collectionName: CollectionName, integrationId: IntegrationId): QueryBuilder<DocumentType>;
14
- }
15
- /** An interface for the different actions that can be performed on a query. */
16
- export interface QueryActions<DocumentType extends DocumentData> {
17
- /**
18
- * Returns a promise that resolves to the query results.
19
- *
20
- * @returns A promise that resolves to the query results.
21
- */
22
- snapshot(): Promise<Array<DocumentReference<DocumentType>>>;
23
- /**
24
- * Returns an observable that emits the query results and updates whenever the query results change unless
25
- * `subscribe=false` is provided.
26
- *
27
- * Important: Make sure to unsubscribe from the observable when you are done with it.
28
- *
29
- * @param subscribe Whether to subscribe to changes to the query results. Defaults to `true`.
30
- * @returns An observable for the query results.
31
- */
32
- snapshots(subscribe?: boolean): Observable<Array<DocumentReference<DocumentType>>>;
33
- /**
34
- * Similar to `snapshots` but returns an observable that emits the changes to the query results. The first result
35
- * will contain only inserts.
36
- *
37
- * @returns An observable for the query changes.
38
- */
39
- changes(): Observable<Changes<DocumentType>>;
40
- }
41
- /** A query builder that can be used to build a query that returns a list of documents. */
42
- export declare class QueryBuilder<DocumentType extends DocumentData> extends SimpleQueryBuilder<DocumentType> implements QueryActions<DocumentType> {
43
- private readonly querySubscriptionManager;
44
- private readonly documentReferenceFactory;
45
- private readonly queryBuilderFactory;
46
- private readonly documentIdentityService;
47
- getSortOrder(): FieldSort<DocumentType>[];
48
- /**
49
- * @inheritDoc
50
- */
51
- snapshot(): Promise<Array<DocumentReference<DocumentType>>>;
52
- /**
53
- * @inheritDoc
54
- */
55
- snapshots(subscribe?: boolean): Observable<Array<DocumentReference<DocumentType>>>;
56
- /**
57
- * @inheritDoc
58
- */
59
- changes(): Observable<Changes<DocumentType>>;
60
- /**
61
- * A unique hash for the query. Identical queries should return the same hash
62
- * value.
63
- *
64
- * @returns The query's hash string.
65
- */
66
- get hash(): string;
67
- }
68
- /** Describes the changes to a query result. */
69
- export declare class Changes<DocumentType extends DocumentData> {
70
- /** The newly inserted documents to the query result */
71
- readonly inserts: Array<DocumentReference<DocumentType>>;
72
- /** The documents that were updated in the query result */
73
- readonly updates: Array<DocumentReference<DocumentType>>;
74
- /** The actual document data that was deleted from the query result */
75
- readonly deletes: Array<DocumentType>;
76
- constructor(
77
- /** The newly inserted documents to the query result */
78
- inserts: Array<DocumentReference<DocumentType>>,
79
- /** The documents that were updated in the query result */
80
- updates: Array<DocumentReference<DocumentType>>,
81
- /** The actual document data that was deleted from the query result */
82
- deletes: Array<DocumentType>);
83
- }
1
+ import { CollectionName, DocumentData, FieldSort, IntegrationId, SimpleQueryBuilder, SquidDocId } from '@squidcloud/common';
2
+ import { Observable } from 'rxjs';
3
+ import DocumentIdentityService from '../document-identity.service';
4
+ import { DocumentReference } from '../document-reference';
5
+ import { DocumentReferenceFactory } from '../document-reference.factory';
6
+ import { QuerySubscriptionManager } from './query-subscription.manager';
7
+ export declare class QueryBuilderFactory {
8
+ private readonly querySubscriptionManager;
9
+ private readonly documentReferenceFactory;
10
+ private readonly documentIdentityService;
11
+ constructor(querySubscriptionManager: QuerySubscriptionManager, documentReferenceFactory: DocumentReferenceFactory, documentIdentityService: DocumentIdentityService);
12
+ getForDocument<DocumentType extends DocumentData>(squidDocId: SquidDocId): QueryBuilder<DocumentType>;
13
+ get<DocumentType extends DocumentData>(collectionName: CollectionName, integrationId: IntegrationId): QueryBuilder<DocumentType>;
14
+ }
15
+ /** An interface for the different actions that can be performed on a query. */
16
+ export interface QueryActions<DocumentType extends DocumentData> {
17
+ /**
18
+ * Returns a promise that resolves to the query results.
19
+ *
20
+ * @returns A promise that resolves to the query results.
21
+ */
22
+ snapshot(): Promise<Array<DocumentReference<DocumentType>>>;
23
+ /**
24
+ * Returns an observable that emits the query results and updates whenever the query results change unless
25
+ * `subscribe=false` is provided.
26
+ *
27
+ * Important: Make sure to unsubscribe from the observable when you are done with it.
28
+ *
29
+ * @param subscribe Whether to subscribe to changes to the query results. Defaults to `true`.
30
+ * @returns An observable for the query results.
31
+ */
32
+ snapshots(subscribe?: boolean): Observable<Array<DocumentReference<DocumentType>>>;
33
+ /**
34
+ * Similar to `snapshots` but returns an observable that emits the changes to the query results. The first result
35
+ * will contain only inserts.
36
+ *
37
+ * @returns An observable for the query changes.
38
+ */
39
+ changes(): Observable<Changes<DocumentType>>;
40
+ }
41
+ /** A query builder that can be used to build a query that returns a list of documents. */
42
+ export declare class QueryBuilder<DocumentType extends DocumentData> extends SimpleQueryBuilder<DocumentType> implements QueryActions<DocumentType> {
43
+ private readonly querySubscriptionManager;
44
+ private readonly documentReferenceFactory;
45
+ private readonly queryBuilderFactory;
46
+ private readonly documentIdentityService;
47
+ getSortOrder(): FieldSort<DocumentType>[];
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ snapshot(): Promise<Array<DocumentReference<DocumentType>>>;
52
+ /**
53
+ * @inheritDoc
54
+ */
55
+ snapshots(subscribe?: boolean): Observable<Array<DocumentReference<DocumentType>>>;
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ changes(): Observable<Changes<DocumentType>>;
60
+ /**
61
+ * A unique hash for the query. Identical queries should return the same hash
62
+ * value.
63
+ *
64
+ * @returns The query's hash string.
65
+ */
66
+ get hash(): string;
67
+ }
68
+ /** Describes the changes to a query result. */
69
+ export declare class Changes<DocumentType extends DocumentData> {
70
+ /** The newly inserted documents to the query result */
71
+ readonly inserts: Array<DocumentReference<DocumentType>>;
72
+ /** The documents that were updated in the query result */
73
+ readonly updates: Array<DocumentReference<DocumentType>>;
74
+ /** The actual document data that was deleted from the query result */
75
+ readonly deletes: Array<DocumentType>;
76
+ constructor(
77
+ /** The newly inserted documents to the query result */
78
+ inserts: Array<DocumentReference<DocumentType>>,
79
+ /** The documents that were updated in the query result */
80
+ updates: Array<DocumentReference<DocumentType>>,
81
+ /** The actual document data that was deleted from the query result */
82
+ deletes: Array<DocumentType>);
83
+ }
@@ -1,64 +1,64 @@
1
- import { ClientRequestId, Query, QuerySubscriptionId, SquidDocId, SquidDocument } from '@squidcloud/common';
2
- import { BehaviorSubject, Observable, Subject } from 'rxjs';
3
- import { DestructManager } from '../destruct.manager';
4
- import DocumentIdentityService from '../document-identity.service';
5
- import { DocumentStore } from '../document-store';
6
- import { RpcManager } from '../rpc.manager';
7
- import { Alias, JoinCondition } from './query.types';
8
- import { ClientIdService } from '../client-id.service';
9
- export declare class QuerySubscriptionManager {
10
- private readonly rpcManager;
11
- private readonly clientIdService;
12
- private readonly documentStore;
13
- private readonly destructManager;
14
- private readonly documentIdentityService;
15
- readonly safeToSendQueriesToServer: BehaviorSubject<boolean>;
16
- onOrphanDocuments: Subject<string[]>;
17
- private readonly ongoingQueries;
18
- private readonly inflightQueriesCount;
19
- /**
20
- * The two maps below maintain the relation between document ids we know about locally to clientRequestIds (queries).
21
- * This relation is used for determining whether a document can be safely removed.
22
- */
23
- private readonly clientRequestIdToLocalDocuments;
24
- private readonly localDocumentToClientRequestIds;
25
- private readonly queryMappingManager;
26
- constructor(rpcManager: RpcManager, clientIdService: ClientIdService, documentStore: DocumentStore, destructManager: DestructManager, documentIdentityService: DocumentIdentityService);
27
- hasOngoingQuery(clientRequestId: ClientRequestId): boolean;
28
- getQuery(clientRequestId: ClientRequestId): Query;
29
- setGotResponseFromServer(clientRequestId: ClientRequestId): void;
30
- findQueriesForDocument(doc: SquidDocument, squidDocId: SquidDocId): Array<QuerySubscriptionId>;
31
- /**
32
- * Given the new document's properties, finds all the queries that should be notified with the new properties and
33
- * updates the internal mappings (squidDocId --> client request Ids and, clientRequestId --> squidDocIds).
34
- * Returns an array with all the previous and current client request ids (basically all the client request ids that
35
- * will need to be notified due to the change of properties).
36
- */
37
- setClientRequestIdsForLocalDoc(squidDocId: SquidDocId, properties: SquidDocument | undefined): Array<ClientRequestId>;
38
- errorOutAllQueries(squidDocId: SquidDocId, err: any): void;
39
- notifyAllSubscriptions(clientRequestIds: ClientRequestId[]): void;
40
- processQuery(query: Query, rootAlias: Alias, joins: Record<string, Query>, joinConditions: Record<Alias, JoinCondition>, subscribe: boolean): Observable<Array<Record<Alias, SquidDocument | undefined>>>;
41
- hasOngoingQueryForDocId(squidDocId: string): boolean;
42
- private removeClientRequestIdMapping;
43
- waitForAllQueriesToFinish(): Promise<void>;
44
- private registerQueryFinalizer;
45
- /** Creates a graph of ongoing queries and returns the root of the graph. */
46
- private createOngoingQueryGraph;
47
- private collectAllObservables;
48
- private joinResults;
49
- private join;
50
- private getOngoingQueriesBfs;
51
- private updateOngoingQueryWithNewDataFromSupportingQuery;
52
- private allOngoingQueriesGotServerResult;
53
- private completeAllSupportedQueries;
54
- private predestruct;
55
- unsubscribe(): void;
56
- hasSubscription(clientRequestId: ClientRequestId): boolean;
57
- /** Sends the query request to the server and makes sure to unsubscribe once the subject completes. */
58
- private sendQueryToServer;
59
- /**
60
- * naive way to refresh queries/subscriptions when we have a new client id
61
- */
62
- private refreshOngoingQueries;
63
- private migrateDocIds;
64
- }
1
+ import { ClientRequestId, Query, QuerySubscriptionId, SquidDocId, SquidDocument } from '@squidcloud/common';
2
+ import { BehaviorSubject, Observable, Subject } from 'rxjs';
3
+ import { DestructManager } from '../destruct.manager';
4
+ import DocumentIdentityService from '../document-identity.service';
5
+ import { DocumentStore } from '../document-store';
6
+ import { RpcManager } from '../rpc.manager';
7
+ import { Alias, JoinCondition } from './query.types';
8
+ import { ClientIdService } from '../client-id.service';
9
+ export declare class QuerySubscriptionManager {
10
+ private readonly rpcManager;
11
+ private readonly clientIdService;
12
+ private readonly documentStore;
13
+ private readonly destructManager;
14
+ private readonly documentIdentityService;
15
+ readonly safeToSendQueriesToServer: BehaviorSubject<boolean>;
16
+ onOrphanDocuments: Subject<string[]>;
17
+ private readonly ongoingQueries;
18
+ private readonly inflightQueriesCount;
19
+ /**
20
+ * The two maps below maintain the relation between document ids we know about locally to clientRequestIds (queries).
21
+ * This relation is used for determining whether a document can be safely removed.
22
+ */
23
+ private readonly clientRequestIdToLocalDocuments;
24
+ private readonly localDocumentToClientRequestIds;
25
+ private readonly queryMappingManager;
26
+ constructor(rpcManager: RpcManager, clientIdService: ClientIdService, documentStore: DocumentStore, destructManager: DestructManager, documentIdentityService: DocumentIdentityService);
27
+ hasOngoingQuery(clientRequestId: ClientRequestId): boolean;
28
+ getQuery(clientRequestId: ClientRequestId): Query;
29
+ setGotResponseFromServer(clientRequestId: ClientRequestId): void;
30
+ findQueriesForDocument(doc: SquidDocument, squidDocId: SquidDocId): Array<QuerySubscriptionId>;
31
+ /**
32
+ * Given the new document's properties, finds all the queries that should be notified with the new properties and
33
+ * updates the internal mappings (squidDocId --> client request Ids and, clientRequestId --> squidDocIds).
34
+ * Returns an array with all the previous and current client request ids (basically all the client request ids that
35
+ * will need to be notified due to the change of properties).
36
+ */
37
+ setClientRequestIdsForLocalDoc(squidDocId: SquidDocId, properties: SquidDocument | undefined): Array<ClientRequestId>;
38
+ errorOutAllQueries(squidDocId: SquidDocId, err: any): void;
39
+ notifyAllSubscriptions(clientRequestIds: ClientRequestId[]): void;
40
+ processQuery(query: Query, rootAlias: Alias, joins: Record<string, Query>, joinConditions: Record<Alias, JoinCondition>, subscribe: boolean): Observable<Array<Record<Alias, SquidDocument | undefined>>>;
41
+ hasOngoingQueryForDocId(squidDocId: string): boolean;
42
+ private removeClientRequestIdMapping;
43
+ waitForAllQueriesToFinish(): Promise<void>;
44
+ private registerQueryFinalizer;
45
+ /** Creates a graph of ongoing queries and returns the root of the graph. */
46
+ private createOngoingQueryGraph;
47
+ private collectAllObservables;
48
+ private joinResults;
49
+ private join;
50
+ private getOngoingQueriesBfs;
51
+ private updateOngoingQueryWithNewDataFromSupportingQuery;
52
+ private allOngoingQueriesGotServerResult;
53
+ private completeAllSupportedQueries;
54
+ private predestruct;
55
+ unsubscribe(): void;
56
+ hasSubscription(clientRequestId: ClientRequestId): boolean;
57
+ /** Sends the query request to the server and makes sure to unsubscribe once the subject completes. */
58
+ private sendQueryToServer;
59
+ /**
60
+ * naive way to refresh queries/subscriptions when we have a new client id
61
+ */
62
+ private refreshOngoingQueries;
63
+ private migrateDocIds;
64
+ }
@@ -1,14 +1,14 @@
1
- import { FieldName } from '@squidcloud/common';
2
- /**
3
- * An alias for a join result. This is used to disambiguate fields in the result.
4
- */
5
- export type Alias = string;
6
- /**
7
- * A join condition.
8
- * The join conditions defines the alias for the left side of the join and the field names to join on.
9
- */
10
- export interface JoinCondition {
11
- leftAlias: Alias;
12
- leftFieldName: FieldName;
13
- rightFieldName: FieldName;
14
- }
1
+ import { FieldName } from '@squidcloud/common';
2
+ /**
3
+ * An alias for a join result. This is used to disambiguate fields in the result.
4
+ */
5
+ export type Alias = string;
6
+ /**
7
+ * A join condition.
8
+ * The join conditions defines the alias for the left side of the join and the field names to join on.
9
+ */
10
+ export interface JoinCondition {
11
+ leftAlias: Alias;
12
+ leftFieldName: FieldName;
13
+ rightFieldName: FieldName;
14
+ }
@@ -1,28 +1,28 @@
1
- import { AuthManager } from './auth.manager';
2
- import { ClientIdService } from './client-id.service';
3
- import { DestructManager } from './destruct.manager';
4
- import { SocketManager } from './socket.manager';
5
- export declare class RpcManager {
6
- private readonly rpcEndpoint;
7
- private readonly socketManager;
8
- private readonly destructManager;
9
- private readonly headers;
10
- private readonly authManager;
11
- private readonly clientIdService;
12
- private readonly staticHeaders;
13
- private readonly onGoingRpcCounter;
14
- constructor(rpcEndpoint: string, socketManager: SocketManager, destructManager: DestructManager, headers: Record<string, string>, authManager: AuthManager, clientIdService: ClientIdService);
15
- awaitAllSettled(): Promise<void>;
16
- setStaticHeader(key: string, value: string): void;
17
- deleteStaticHeader(key: string): void;
18
- getEndpoint(): string;
19
- getStaticHeaders(): Record<string, string>;
20
- post<T>(path: string, message: any): Promise<T>;
21
- }
22
- export declare class RpcError extends Error {
23
- readonly statusCode: number;
24
- readonly statusText: string;
25
- readonly headers: Headers;
26
- readonly url: string;
27
- constructor(statusCode: number, statusText: string, headers: Headers, url: string, message?: string);
28
- }
1
+ import { AuthManager } from './auth.manager';
2
+ import { ClientIdService } from './client-id.service';
3
+ import { DestructManager } from './destruct.manager';
4
+ import { SocketManager } from './socket.manager';
5
+ export declare class RpcManager {
6
+ private readonly rpcEndpoint;
7
+ private readonly socketManager;
8
+ private readonly destructManager;
9
+ private readonly headers;
10
+ private readonly authManager;
11
+ private readonly clientIdService;
12
+ private readonly staticHeaders;
13
+ private readonly onGoingRpcCounter;
14
+ constructor(rpcEndpoint: string, socketManager: SocketManager, destructManager: DestructManager, headers: Record<string, string>, authManager: AuthManager, clientIdService: ClientIdService);
15
+ awaitAllSettled(): Promise<void>;
16
+ setStaticHeader(key: string, value: string): void;
17
+ deleteStaticHeader(key: string): void;
18
+ getEndpoint(): string;
19
+ getStaticHeaders(): Record<string, string>;
20
+ post<T>(path: string, message: any): Promise<T>;
21
+ }
22
+ export declare class RpcError extends Error {
23
+ readonly statusCode: number;
24
+ readonly statusText: string;
25
+ readonly headers: Headers;
26
+ readonly url: string;
27
+ constructor(statusCode: number, statusText: string, headers: Headers, url: string, message?: string);
28
+ }
@@ -1,32 +1,32 @@
1
- import { MessageFromClient, MessageToClient } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import { DestructManager } from './destruct.manager';
4
- import { AuthManager } from './auth.manager';
5
- import { ClientIdService } from './client-id.service';
6
- export declare class SocketManager {
7
- private readonly clientIdService;
8
- private readonly socketIoEndpoint;
9
- private readonly messageNotificationWrapper;
10
- private readonly destructManager;
11
- private readonly authManager;
12
- private readonly webSocketObserver;
13
- private readonly allMessagesObserver;
14
- private readonly connectionReady;
15
- private readonly seenMessageIds;
16
- private socket;
17
- private firstConnection;
18
- /**
19
- * On a client disconnecting, we wait for a bit to see if the client reconnects,
20
- * if no reconnect happens within the timeout, we consider the client to be too old.
21
- * This value means we wait for 5 minutes before considering the client to be too old.
22
- * Note: we make this a function so that we can easily override it in tests.
23
- */
24
- private clientTooOldThreshold;
25
- constructor(clientIdService: ClientIdService, socketIoEndpoint: string, messageNotificationWrapper: (fn: () => any) => any, destructManager: DestructManager, extraHeaders: Record<string, string> | undefined, authManager: AuthManager);
26
- observeNotifications<T extends MessageToClient>(): Observable<T>;
27
- observeConnectionReady(): Observable<boolean>;
28
- sendMessage(message: MessageFromClient): void;
29
- private connect;
30
- private setupMessageAcknowledgments;
31
- private destruct;
32
- }
1
+ import { MessageFromClient, MessageToClient } from '@squidcloud/common';
2
+ import { Observable } from 'rxjs';
3
+ import { DestructManager } from './destruct.manager';
4
+ import { AuthManager } from './auth.manager';
5
+ import { ClientIdService } from './client-id.service';
6
+ export declare class SocketManager {
7
+ private readonly clientIdService;
8
+ private readonly socketIoEndpoint;
9
+ private readonly messageNotificationWrapper;
10
+ private readonly destructManager;
11
+ private readonly authManager;
12
+ private readonly webSocketObserver;
13
+ private readonly allMessagesObserver;
14
+ private readonly connectionReady;
15
+ private readonly seenMessageIds;
16
+ private socket;
17
+ private firstConnection;
18
+ /**
19
+ * On a client disconnecting, we wait for a bit to see if the client reconnects,
20
+ * if no reconnect happens within the timeout, we consider the client to be too old.
21
+ * This value means we wait for 5 minutes before considering the client to be too old.
22
+ * Note: we make this a function so that we can easily override it in tests.
23
+ */
24
+ private clientTooOldThreshold;
25
+ constructor(clientIdService: ClientIdService, socketIoEndpoint: string, messageNotificationWrapper: (fn: () => any) => any, destructManager: DestructManager, extraHeaders: Record<string, string> | undefined, authManager: AuthManager);
26
+ observeNotifications<T extends MessageToClient>(): Observable<T>;
27
+ observeConnectionReady(): Observable<boolean>;
28
+ sendMessage(message: MessageFromClient): void;
29
+ private connect;
30
+ private setupMessageAcknowledgments;
31
+ private destruct;
32
+ }