@squidcloud/client 1.0.57 → 1.0.59
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/api-call.context.d.ts +12 -12
- package/dist/common/src/api.types.d.ts +24 -24
- package/dist/common/src/application.schemas.d.ts +1029 -883
- package/dist/common/src/application.types.d.ts +212 -206
- package/dist/common/src/auth.types.d.ts +4 -0
- package/dist/common/src/backend-function.schemas.d.ts +3 -3
- package/dist/common/src/backend-function.types.d.ts +7 -7
- package/dist/common/src/backend-run.types.d.ts +53 -53
- package/dist/common/src/bundle-api.types.d.ts +66 -66
- package/dist/common/src/bundle-data.types.d.ts +52 -52
- package/dist/common/src/communication.types.d.ts +4 -4
- package/dist/common/src/context.types.d.ts +32 -31
- package/dist/common/src/distributed-lock.context.d.ts +5 -5
- package/dist/common/src/document.types.d.ts +37 -35
- package/dist/common/src/graphql.context.d.ts +6 -6
- package/dist/common/src/graphql.types.d.ts +11 -11
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/index.d.ts +52 -51
- package/dist/common/src/integration.types.d.ts +404 -351
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/metrics.types.d.ts +58 -58
- package/dist/common/src/mutation.context.d.ts +10 -10
- package/dist/common/src/mutation.schemas.d.ts +5 -5
- package/dist/common/src/mutation.types.d.ts +72 -72
- package/dist/common/src/named-query.context.d.ts +4 -4
- package/dist/common/src/named-query.schemas.d.ts +3 -3
- package/dist/common/src/named-query.types.d.ts +9 -9
- package/dist/common/src/query/index.d.ts +2 -2
- package/dist/common/src/query/query-context.d.ts +37 -37
- package/dist/common/src/query/simple-query-builder.d.ts +137 -137
- package/dist/common/src/query.schemas.d.ts +5 -5
- package/dist/common/src/query.types.d.ts +118 -118
- package/dist/common/src/regions.d.ts +22 -22
- package/dist/common/src/schema/schema.types.d.ts +54 -54
- package/dist/common/src/secret.schemas.d.ts +6 -6
- package/dist/common/src/secret.types.d.ts +40 -40
- package/dist/common/src/security.types.d.ts +3 -3
- package/dist/common/src/socket.schemas.d.ts +3 -3
- package/dist/common/src/socket.types.d.ts +100 -100
- package/dist/common/src/time-units.d.ts +5 -5
- package/dist/common/src/trigger.types.d.ts +15 -15
- package/dist/common/src/types.d.ts +15 -15
- package/dist/common/src/utils/array.d.ts +8 -8
- package/dist/common/src/utils/assert.d.ts +8 -8
- package/dist/common/src/utils/error.d.ts +4 -4
- 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/nullish.d.ts +1 -1
- package/dist/common/src/utils/object.d.ts +6 -6
- package/dist/common/src/utils/serialization.d.ts +6 -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 +30 -30
- package/dist/common/src/webhook-response.d.ts +7 -7
- package/dist/index.js +6 -6
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/api.manager.d.ts +14 -14
- package/dist/typescript-client/src/auth.manager.d.ts +23 -17
- package/dist/typescript-client/src/backend-function.manager.d.ts +13 -13
- package/dist/typescript-client/src/collection-reference.d.ts +65 -65
- package/dist/typescript-client/src/collection-reference.factory.d.ts +16 -16
- package/dist/typescript-client/src/data.manager.d.ts +172 -172
- package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +19 -19
- package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
- package/dist/typescript-client/src/document-reference.d.ts +134 -134
- package/dist/typescript-client/src/document-reference.factory.d.ts +9 -9
- package/dist/typescript-client/src/document-store.d.ts +11 -11
- package/dist/typescript-client/src/graphql-client.d.ts +12 -12
- package/dist/typescript-client/src/graphql-client.factory.d.ts +9 -9
- package/dist/typescript-client/src/index.d.ts +8 -8
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +11 -11
- package/dist/typescript-client/src/named-query.manager.d.ts +13 -13
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +72 -72
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +83 -83
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +59 -59
- package/dist/typescript-client/src/query/query.types.d.ts +14 -14
- package/dist/typescript-client/src/rpc.manager.d.ts +27 -27
- package/dist/typescript-client/src/socket.manager.d.ts +24 -24
- package/dist/typescript-client/src/squid.d.ts +187 -186
- package/dist/typescript-client/src/state/action.applier.d.ts +7 -7
- package/dist/typescript-client/src/state/actions.d.ts +29 -29
- package/dist/typescript-client/src/state/path_trie.d.ts +27 -27
- package/dist/typescript-client/src/state/state.service.d.ts +22 -22
- 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 +1 -1
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { DocumentData, FieldName, Operator, PrimitiveFieldType } from '@squidcloud/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { DocumentReference } from '../document-reference';
|
|
4
|
-
import { Alias } from './query.types';
|
|
5
|
-
/**
|
|
6
|
-
* A query builder that can participate in a join.
|
|
7
|
-
* To learn more about join queries, see
|
|
8
|
-
* {@link https://docs.squid.cloud/docs/client-sdk/queries#joining-data-across-collections-and-integrations}.
|
|
9
|
-
*/
|
|
10
|
-
export declare class JoinQueryBuilder<DocumentType extends DocumentData, MyAlias extends Alias, ReturnType extends Record<MyAlias, DocumentReference<DocumentType> | undefined>> {
|
|
11
|
-
private readonly collectionName;
|
|
12
|
-
private readonly integrationId;
|
|
13
|
-
private readonly querySubscriptionManager;
|
|
14
|
-
private readonly documentReferenceFactory;
|
|
15
|
-
private readonly alias;
|
|
16
|
-
private readonly joinQueryBuilderFactory;
|
|
17
|
-
private readonly queryBuilderFactory;
|
|
18
|
-
private readonly simpleQueryBuilder;
|
|
19
|
-
private readonly joins;
|
|
20
|
-
/** Record that maps the right alias to the left condition */
|
|
21
|
-
private readonly joinConditions;
|
|
22
|
-
/**
|
|
23
|
-
* Adds a condition to the query.
|
|
24
|
-
*
|
|
25
|
-
* @param fieldName The name of the field to query
|
|
26
|
-
* @param operator The operator to use
|
|
27
|
-
* @param value The value to compare against
|
|
28
|
-
* @returns The query builder
|
|
29
|
-
*/
|
|
30
|
-
where(fieldName: (keyof DocumentType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
31
|
-
/**
|
|
32
|
-
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
33
|
-
* if none is provided.
|
|
34
|
-
*
|
|
35
|
-
* @param limit The maximum number of results to return
|
|
36
|
-
* @returns The query builder
|
|
37
|
-
*/
|
|
38
|
-
limit(limit: number): this;
|
|
39
|
-
/**
|
|
40
|
-
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
41
|
-
* determines the order in which they are applied.
|
|
42
|
-
* @param fieldName The name of the field to sort by
|
|
43
|
-
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
44
|
-
* @returns The query builder
|
|
45
|
-
*/
|
|
46
|
-
sortBy(fieldName: keyof DocumentType & FieldName, asc?: boolean): this;
|
|
47
|
-
/**
|
|
48
|
-
* Joins this query with another join query and return a new query builder that can be used to query the joined
|
|
49
|
-
* documents.
|
|
50
|
-
* @param queryBuilder The query builder to join with
|
|
51
|
-
* @param leftFieldName The name of the field on the left side of the join
|
|
52
|
-
* @param rightFieldName The name of the field on the right side of the join
|
|
53
|
-
* @returns A new query builder that can be used to query the joined documents
|
|
54
|
-
*/
|
|
55
|
-
join<J extends DocumentData, RightAlias extends Alias, RightReturnType extends Record<RightAlias, DocumentReference<J> | undefined>>(queryBuilder: JoinQueryBuilder<J, RightAlias, RightReturnType>, leftFieldName: keyof DocumentType & FieldName, rightFieldName: keyof J & FieldName): JoinQueryBuilder<DocumentType, MyAlias, ReturnType & Partial<RightReturnType>>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns a promise that resolves to the query results.
|
|
58
|
-
*
|
|
59
|
-
* @returns A promise that resolves to the query results
|
|
60
|
-
*/
|
|
61
|
-
snapshot(): Promise<Array<ReturnType>>;
|
|
62
|
-
/**
|
|
63
|
-
* Returns an observable that emits the query results and updates whenever the query results change unless
|
|
64
|
-
* `subscribe=false` is provided.
|
|
65
|
-
*
|
|
66
|
-
* Important: Make sure to unsubscribe from the observable when you are done with it.
|
|
67
|
-
*
|
|
68
|
-
* @param subscribe Whether to subscribe to the query. Defaults to true.
|
|
69
|
-
* @returns An observable for the query results
|
|
70
|
-
*/
|
|
71
|
-
snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
|
|
72
|
-
}
|
|
1
|
+
import { DocumentData, FieldName, Operator, PrimitiveFieldType } from '@squidcloud/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DocumentReference } from '../document-reference';
|
|
4
|
+
import { Alias } from './query.types';
|
|
5
|
+
/**
|
|
6
|
+
* A query builder that can participate in a join.
|
|
7
|
+
* To learn more about join queries, see
|
|
8
|
+
* {@link https://docs.squid.cloud/docs/client-sdk/queries#joining-data-across-collections-and-integrations}.
|
|
9
|
+
*/
|
|
10
|
+
export declare class JoinQueryBuilder<DocumentType extends DocumentData, MyAlias extends Alias, ReturnType extends Record<MyAlias, DocumentReference<DocumentType> | undefined>> {
|
|
11
|
+
private readonly collectionName;
|
|
12
|
+
private readonly integrationId;
|
|
13
|
+
private readonly querySubscriptionManager;
|
|
14
|
+
private readonly documentReferenceFactory;
|
|
15
|
+
private readonly alias;
|
|
16
|
+
private readonly joinQueryBuilderFactory;
|
|
17
|
+
private readonly queryBuilderFactory;
|
|
18
|
+
private readonly simpleQueryBuilder;
|
|
19
|
+
private readonly joins;
|
|
20
|
+
/** Record that maps the right alias to the left condition */
|
|
21
|
+
private readonly joinConditions;
|
|
22
|
+
/**
|
|
23
|
+
* Adds a condition to the query.
|
|
24
|
+
*
|
|
25
|
+
* @param fieldName The name of the field to query
|
|
26
|
+
* @param operator The operator to use
|
|
27
|
+
* @param value The value to compare against
|
|
28
|
+
* @returns The query builder
|
|
29
|
+
*/
|
|
30
|
+
where(fieldName: (keyof DocumentType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
31
|
+
/**
|
|
32
|
+
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
33
|
+
* if none is provided.
|
|
34
|
+
*
|
|
35
|
+
* @param limit The maximum number of results to return
|
|
36
|
+
* @returns The query builder
|
|
37
|
+
*/
|
|
38
|
+
limit(limit: number): this;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
41
|
+
* determines the order in which they are applied.
|
|
42
|
+
* @param fieldName The name of the field to sort by
|
|
43
|
+
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
44
|
+
* @returns The query builder
|
|
45
|
+
*/
|
|
46
|
+
sortBy(fieldName: keyof DocumentType & FieldName, asc?: boolean): this;
|
|
47
|
+
/**
|
|
48
|
+
* Joins this query with another join query and return a new query builder that can be used to query the joined
|
|
49
|
+
* documents.
|
|
50
|
+
* @param queryBuilder The query builder to join with
|
|
51
|
+
* @param leftFieldName The name of the field on the left side of the join
|
|
52
|
+
* @param rightFieldName The name of the field on the right side of the join
|
|
53
|
+
* @returns A new query builder that can be used to query the joined documents
|
|
54
|
+
*/
|
|
55
|
+
join<J extends DocumentData, RightAlias extends Alias, RightReturnType extends Record<RightAlias, DocumentReference<J> | undefined>>(queryBuilder: JoinQueryBuilder<J, RightAlias, RightReturnType>, leftFieldName: keyof DocumentType & FieldName, rightFieldName: keyof J & FieldName): JoinQueryBuilder<DocumentType, MyAlias, ReturnType & Partial<RightReturnType>>;
|
|
56
|
+
/**
|
|
57
|
+
* Returns a promise that resolves to the query results.
|
|
58
|
+
*
|
|
59
|
+
* @returns A promise that resolves to the query results
|
|
60
|
+
*/
|
|
61
|
+
snapshot(): Promise<Array<ReturnType>>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns an observable that emits the query results and updates whenever the query results change unless
|
|
64
|
+
* `subscribe=false` is provided.
|
|
65
|
+
*
|
|
66
|
+
* Important: Make sure to unsubscribe from the observable when you are done with it.
|
|
67
|
+
*
|
|
68
|
+
* @param subscribe Whether to subscribe to the query. Defaults to true.
|
|
69
|
+
* @returns An observable for the query results
|
|
70
|
+
*/
|
|
71
|
+
snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
|
|
72
|
+
}
|
|
@@ -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,59 +1,59 @@
|
|
|
1
|
-
import { ClientId, 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
|
-
export declare class QuerySubscriptionManager {
|
|
9
|
-
private readonly rpcManager;
|
|
10
|
-
private readonly clientId;
|
|
11
|
-
private readonly documentStore;
|
|
12
|
-
private readonly destructManager;
|
|
13
|
-
private readonly documentIdentityService;
|
|
14
|
-
readonly safeToSendQueriesToServer: BehaviorSubject<boolean>;
|
|
15
|
-
onOrphanDocuments: Subject<string[]>;
|
|
16
|
-
private readonly ongoingQueries;
|
|
17
|
-
private readonly inflightQueriesCount;
|
|
18
|
-
/**
|
|
19
|
-
* The two maps below maintain the relation between document ids we know about locally to clientRequestIds (queries).
|
|
20
|
-
* This relation is used for determining whether a document can be safely removed.
|
|
21
|
-
*/
|
|
22
|
-
private readonly clientRequestIdToLocalDocuments;
|
|
23
|
-
private readonly localDocumentToClientRequestIds;
|
|
24
|
-
private readonly queryMappingManager;
|
|
25
|
-
constructor(rpcManager: RpcManager, clientId: ClientId, documentStore: DocumentStore, destructManager: DestructManager, documentIdentityService: DocumentIdentityService);
|
|
26
|
-
hasOngoingQuery(clientRequestId: ClientRequestId): boolean;
|
|
27
|
-
getQuery(clientRequestId: ClientRequestId): Query;
|
|
28
|
-
setGotResponseFromServer(clientRequestId: ClientRequestId): void;
|
|
29
|
-
findQueriesForDocument(doc: SquidDocument, squidDocId: SquidDocId): Array<QuerySubscriptionId>;
|
|
30
|
-
/**
|
|
31
|
-
* Given the new document's properties, finds all the queries that should be notified with the new properties and
|
|
32
|
-
* updates the internal mappings (squidDocId --> client request Ids and, clientRequestId --> squidDocIds).
|
|
33
|
-
* Returns an array with all the previous and current client request ids (basically all the client request ids that
|
|
34
|
-
* will need to be notified due to the change of properties).
|
|
35
|
-
*/
|
|
36
|
-
setClientRequestIdsForLocalDoc(squidDocId: SquidDocId, properties: SquidDocument | undefined): Array<ClientRequestId>;
|
|
37
|
-
errorOutAllQueries(squidDocId: SquidDocId, err: any): void;
|
|
38
|
-
notifyAllSubscriptions(clientRequestIds: ClientRequestId[]): void;
|
|
39
|
-
processQuery(query: Query, rootAlias: Alias, joins: Record<string, Query>, joinConditions: Record<Alias, JoinCondition>, subscribe: boolean): Observable<Array<Record<Alias, SquidDocument | undefined>>>;
|
|
40
|
-
hasOngoingQueryForDocId(squidDocId: string): boolean;
|
|
41
|
-
private removeClientRequestId;
|
|
42
|
-
waitForAllQueriesToFinish(): Promise<void>;
|
|
43
|
-
private registerQueryFinalizer;
|
|
44
|
-
/** Creates a graph of ongoing queries and returns the root of the graph. */
|
|
45
|
-
private createOngoingQueryGraph;
|
|
46
|
-
private collectAllObservables;
|
|
47
|
-
private joinResults;
|
|
48
|
-
private join;
|
|
49
|
-
private getOngoingQueriesBfs;
|
|
50
|
-
private updateOngoingQueryWithNewDataFromSupportingQuery;
|
|
51
|
-
private allOngoingQueriesGotServerResult;
|
|
52
|
-
private completeAllSupportedQueries;
|
|
53
|
-
private predestruct;
|
|
54
|
-
unsubscribe(): void;
|
|
55
|
-
hasSubscription(clientRequestId: ClientRequestId): boolean;
|
|
56
|
-
/** Sends the query request to the server and makes sure to unsubscribe once the subject completes. */
|
|
57
|
-
private sendQueryToServer;
|
|
58
|
-
private migrateDocIds;
|
|
59
|
-
}
|
|
1
|
+
import { ClientId, 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
|
+
export declare class QuerySubscriptionManager {
|
|
9
|
+
private readonly rpcManager;
|
|
10
|
+
private readonly clientId;
|
|
11
|
+
private readonly documentStore;
|
|
12
|
+
private readonly destructManager;
|
|
13
|
+
private readonly documentIdentityService;
|
|
14
|
+
readonly safeToSendQueriesToServer: BehaviorSubject<boolean>;
|
|
15
|
+
onOrphanDocuments: Subject<string[]>;
|
|
16
|
+
private readonly ongoingQueries;
|
|
17
|
+
private readonly inflightQueriesCount;
|
|
18
|
+
/**
|
|
19
|
+
* The two maps below maintain the relation between document ids we know about locally to clientRequestIds (queries).
|
|
20
|
+
* This relation is used for determining whether a document can be safely removed.
|
|
21
|
+
*/
|
|
22
|
+
private readonly clientRequestIdToLocalDocuments;
|
|
23
|
+
private readonly localDocumentToClientRequestIds;
|
|
24
|
+
private readonly queryMappingManager;
|
|
25
|
+
constructor(rpcManager: RpcManager, clientId: ClientId, documentStore: DocumentStore, destructManager: DestructManager, documentIdentityService: DocumentIdentityService);
|
|
26
|
+
hasOngoingQuery(clientRequestId: ClientRequestId): boolean;
|
|
27
|
+
getQuery(clientRequestId: ClientRequestId): Query;
|
|
28
|
+
setGotResponseFromServer(clientRequestId: ClientRequestId): void;
|
|
29
|
+
findQueriesForDocument(doc: SquidDocument, squidDocId: SquidDocId): Array<QuerySubscriptionId>;
|
|
30
|
+
/**
|
|
31
|
+
* Given the new document's properties, finds all the queries that should be notified with the new properties and
|
|
32
|
+
* updates the internal mappings (squidDocId --> client request Ids and, clientRequestId --> squidDocIds).
|
|
33
|
+
* Returns an array with all the previous and current client request ids (basically all the client request ids that
|
|
34
|
+
* will need to be notified due to the change of properties).
|
|
35
|
+
*/
|
|
36
|
+
setClientRequestIdsForLocalDoc(squidDocId: SquidDocId, properties: SquidDocument | undefined): Array<ClientRequestId>;
|
|
37
|
+
errorOutAllQueries(squidDocId: SquidDocId, err: any): void;
|
|
38
|
+
notifyAllSubscriptions(clientRequestIds: ClientRequestId[]): void;
|
|
39
|
+
processQuery(query: Query, rootAlias: Alias, joins: Record<string, Query>, joinConditions: Record<Alias, JoinCondition>, subscribe: boolean): Observable<Array<Record<Alias, SquidDocument | undefined>>>;
|
|
40
|
+
hasOngoingQueryForDocId(squidDocId: string): boolean;
|
|
41
|
+
private removeClientRequestId;
|
|
42
|
+
waitForAllQueriesToFinish(): Promise<void>;
|
|
43
|
+
private registerQueryFinalizer;
|
|
44
|
+
/** Creates a graph of ongoing queries and returns the root of the graph. */
|
|
45
|
+
private createOngoingQueryGraph;
|
|
46
|
+
private collectAllObservables;
|
|
47
|
+
private joinResults;
|
|
48
|
+
private join;
|
|
49
|
+
private getOngoingQueriesBfs;
|
|
50
|
+
private updateOngoingQueryWithNewDataFromSupportingQuery;
|
|
51
|
+
private allOngoingQueriesGotServerResult;
|
|
52
|
+
private completeAllSupportedQueries;
|
|
53
|
+
private predestruct;
|
|
54
|
+
unsubscribe(): void;
|
|
55
|
+
hasSubscription(clientRequestId: ClientRequestId): boolean;
|
|
56
|
+
/** Sends the query request to the server and makes sure to unsubscribe once the subject completes. */
|
|
57
|
+
private sendQueryToServer;
|
|
58
|
+
private migrateDocIds;
|
|
59
|
+
}
|
|
@@ -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,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class RpcManager {
|
|
5
|
-
private readonly rpcEndpoint;
|
|
6
|
-
private readonly socketManager;
|
|
7
|
-
private readonly destructManager;
|
|
8
|
-
private readonly headers;
|
|
9
|
-
private readonly authManager;
|
|
10
|
-
private readonly staticHeaders;
|
|
11
|
-
private readonly onGoingRpcCounter;
|
|
12
|
-
constructor(rpcEndpoint: string, socketManager: SocketManager, destructManager: DestructManager, headers: Record<string, string>, authManager: AuthManager);
|
|
13
|
-
awaitAllSettled(): Promise<void>;
|
|
14
|
-
setStaticHeader(key: string, value: string): void;
|
|
15
|
-
deleteStaticHeader(key: string): void;
|
|
16
|
-
getEndpoint(): string;
|
|
17
|
-
getStaticHeaders(): Record<string, string>;
|
|
18
|
-
post<T>(path: string, message: any): Promise<T>;
|
|
19
|
-
}
|
|
20
|
-
export declare class RpcError extends Error {
|
|
21
|
-
readonly statusCode: number;
|
|
22
|
-
readonly statusText: string;
|
|
23
|
-
readonly headers: Headers;
|
|
24
|
-
readonly url: string;
|
|
25
|
-
readonly body: string;
|
|
26
|
-
constructor(statusCode: number, statusText: string, headers: Headers, url: string, body: string);
|
|
27
|
-
}
|
|
1
|
+
import { AuthManager } from './auth.manager';
|
|
2
|
+
import { DestructManager } from './destruct.manager';
|
|
3
|
+
import { SocketManager } from './socket.manager';
|
|
4
|
+
export declare class RpcManager {
|
|
5
|
+
private readonly rpcEndpoint;
|
|
6
|
+
private readonly socketManager;
|
|
7
|
+
private readonly destructManager;
|
|
8
|
+
private readonly headers;
|
|
9
|
+
private readonly authManager;
|
|
10
|
+
private readonly staticHeaders;
|
|
11
|
+
private readonly onGoingRpcCounter;
|
|
12
|
+
constructor(rpcEndpoint: string, socketManager: SocketManager, destructManager: DestructManager, headers: Record<string, string>, authManager: AuthManager);
|
|
13
|
+
awaitAllSettled(): Promise<void>;
|
|
14
|
+
setStaticHeader(key: string, value: string): void;
|
|
15
|
+
deleteStaticHeader(key: string): void;
|
|
16
|
+
getEndpoint(): string;
|
|
17
|
+
getStaticHeaders(): Record<string, string>;
|
|
18
|
+
post<T>(path: string, message: any): Promise<T>;
|
|
19
|
+
}
|
|
20
|
+
export declare class RpcError extends Error {
|
|
21
|
+
readonly statusCode: number;
|
|
22
|
+
readonly statusText: string;
|
|
23
|
+
readonly headers: Headers;
|
|
24
|
+
readonly url: string;
|
|
25
|
+
readonly body: string;
|
|
26
|
+
constructor(statusCode: number, statusText: string, headers: Headers, url: string, body: string);
|
|
27
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { ClientId, MessageFromClient, MessageToClient } from '@squidcloud/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { DestructManager } from './destruct.manager';
|
|
4
|
-
import { AuthManager } from './auth.manager';
|
|
5
|
-
export declare class SocketManager {
|
|
6
|
-
private readonly clientId;
|
|
7
|
-
private readonly socketIoEndpoint;
|
|
8
|
-
private readonly messageNotificationWrapper;
|
|
9
|
-
private readonly destructManager;
|
|
10
|
-
private readonly authManager;
|
|
11
|
-
private readonly webSocketObserver;
|
|
12
|
-
private readonly allMessagesObserver;
|
|
13
|
-
private readonly connectionReady;
|
|
14
|
-
private readonly seenMessageIds;
|
|
15
|
-
private socket;
|
|
16
|
-
private firstConnection;
|
|
17
|
-
constructor(clientId: ClientId, socketIoEndpoint: string, messageNotificationWrapper: (fn: () => any) => any, destructManager: DestructManager, extraHeaders: Record<string, string> | undefined, authManager: AuthManager);
|
|
18
|
-
observeNotifications<T extends MessageToClient>(): Observable<T>;
|
|
19
|
-
observeConnectionReady(): Observable<boolean>;
|
|
20
|
-
sendMessage(message: MessageFromClient): void;
|
|
21
|
-
private connect;
|
|
22
|
-
private setupMessageAcknowledgments;
|
|
23
|
-
private destruct;
|
|
24
|
-
}
|
|
1
|
+
import { ClientId, MessageFromClient, MessageToClient } from '@squidcloud/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DestructManager } from './destruct.manager';
|
|
4
|
+
import { AuthManager } from './auth.manager';
|
|
5
|
+
export declare class SocketManager {
|
|
6
|
+
private readonly clientId;
|
|
7
|
+
private readonly socketIoEndpoint;
|
|
8
|
+
private readonly messageNotificationWrapper;
|
|
9
|
+
private readonly destructManager;
|
|
10
|
+
private readonly authManager;
|
|
11
|
+
private readonly webSocketObserver;
|
|
12
|
+
private readonly allMessagesObserver;
|
|
13
|
+
private readonly connectionReady;
|
|
14
|
+
private readonly seenMessageIds;
|
|
15
|
+
private socket;
|
|
16
|
+
private firstConnection;
|
|
17
|
+
constructor(clientId: ClientId, socketIoEndpoint: string, messageNotificationWrapper: (fn: () => any) => any, destructManager: DestructManager, extraHeaders: Record<string, string> | undefined, authManager: AuthManager);
|
|
18
|
+
observeNotifications<T extends MessageToClient>(): Observable<T>;
|
|
19
|
+
observeConnectionReady(): Observable<boolean>;
|
|
20
|
+
sendMessage(message: MessageFromClient): void;
|
|
21
|
+
private connect;
|
|
22
|
+
private setupMessageAcknowledgments;
|
|
23
|
+
private destruct;
|
|
24
|
+
}
|