@squidcloud/client 1.0.57 → 1.0.58
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 +35 -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,137 +1,137 @@
|
|
|
1
|
-
import { IntegrationId } from '../communication.types';
|
|
2
|
-
import { CollectionName, DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
|
|
3
|
-
import { Operator, Query } from '../query.types';
|
|
4
|
-
/** Base interface for a query builder. */
|
|
5
|
-
export interface BaseQueryBuilderInterface<MyDocType extends DocumentData> {
|
|
6
|
-
/**
|
|
7
|
-
* Adds a condition to the query.
|
|
8
|
-
* @param fieldName The name of the field to query.
|
|
9
|
-
* @param operator The operator to use.
|
|
10
|
-
* @param value The value to compare against.
|
|
11
|
-
* @returns The query builder.
|
|
12
|
-
*/
|
|
13
|
-
where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
14
|
-
/**
|
|
15
|
-
* A shortcut for where(fieldName, '==', value)
|
|
16
|
-
*
|
|
17
|
-
* @param fieldName The name of the field to query.
|
|
18
|
-
* @param value The value to compare against.
|
|
19
|
-
* @returns The query builder.
|
|
20
|
-
*/
|
|
21
|
-
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
22
|
-
/**
|
|
23
|
-
* A shortcut for where(fieldName, '!=', value)
|
|
24
|
-
* @param fieldName The name of the field to query.
|
|
25
|
-
* @param value The value to compare against.
|
|
26
|
-
* @returns The query builder.
|
|
27
|
-
*/
|
|
28
|
-
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
29
|
-
/**
|
|
30
|
-
* A shortcut for where(fieldName, 'in', value)
|
|
31
|
-
* @param fieldName The name of the field to query.
|
|
32
|
-
* @param value An array of values to compare against.
|
|
33
|
-
* @returns The query builder.
|
|
34
|
-
*/
|
|
35
|
-
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
36
|
-
/**
|
|
37
|
-
* A shortcut for where(fieldName, 'not in', value)
|
|
38
|
-
* @param fieldName The name of the field to query.
|
|
39
|
-
* @param value An array of values to compare against.
|
|
40
|
-
* @returns The query builder.
|
|
41
|
-
*/
|
|
42
|
-
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
43
|
-
/**
|
|
44
|
-
* A shortcut for where(fieldName, '>', value)
|
|
45
|
-
* @param fieldName The name of the field to query.
|
|
46
|
-
* @param value The value to compare against.
|
|
47
|
-
* @returns The query builder.
|
|
48
|
-
*/
|
|
49
|
-
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
50
|
-
/**
|
|
51
|
-
* A shortcut for where(fieldName, '>=', value)
|
|
52
|
-
* @param fieldName The name of the field to query.
|
|
53
|
-
* @param value The value to compare against.
|
|
54
|
-
* @returns The query builder.
|
|
55
|
-
*/
|
|
56
|
-
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
57
|
-
/**
|
|
58
|
-
* A shortcut for where(fieldName, '<', value)
|
|
59
|
-
* @param fieldName The name of the field to query.
|
|
60
|
-
* @param value The value to compare against.
|
|
61
|
-
* @returns The query builder.
|
|
62
|
-
*/
|
|
63
|
-
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
64
|
-
/**
|
|
65
|
-
* A shortcut for where(fieldName, '<=', value)
|
|
66
|
-
* @param fieldName The name of the field to query.
|
|
67
|
-
* @param value The value to compare against.
|
|
68
|
-
* @returns The query builder.
|
|
69
|
-
*/
|
|
70
|
-
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
71
|
-
/**
|
|
72
|
-
* A shortcut for where(fieldName, 'like', pattern).
|
|
73
|
-
*
|
|
74
|
-
* @param fieldName The name of the field to query.
|
|
75
|
-
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
76
|
-
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
77
|
-
* @returns The query builder.
|
|
78
|
-
*/
|
|
79
|
-
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
80
|
-
/**
|
|
81
|
-
* A shortcut for where(fieldName, 'not like', pattern).
|
|
82
|
-
*
|
|
83
|
-
* @param fieldName The name of the field to query.
|
|
84
|
-
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
85
|
-
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
86
|
-
* @returns The query builder.
|
|
87
|
-
*/
|
|
88
|
-
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
89
|
-
/**
|
|
90
|
-
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
91
|
-
* if none is provided.
|
|
92
|
-
* @param limit The limit to set.
|
|
93
|
-
* @returns The query builder.
|
|
94
|
-
*/
|
|
95
|
-
limit(limit: number): this;
|
|
96
|
-
/**
|
|
97
|
-
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
98
|
-
* determines the order in which they are applied.
|
|
99
|
-
* @param fieldName The name of the field to sort by.
|
|
100
|
-
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
101
|
-
* @returns The query builder.
|
|
102
|
-
*/
|
|
103
|
-
sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
104
|
-
}
|
|
105
|
-
/** A query builder that can be used to build a query that returns a list of documents. */
|
|
106
|
-
export declare class SimpleQueryBuilder<MyDocType extends DocumentData> implements BaseQueryBuilderInterface<MyDocType> {
|
|
107
|
-
protected readonly collectionName: CollectionName;
|
|
108
|
-
protected readonly integrationId: IntegrationId;
|
|
109
|
-
protected readonly query: Query<MyDocType>;
|
|
110
|
-
/** @inheritDoc */
|
|
111
|
-
where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
112
|
-
/** @inheritDoc */
|
|
113
|
-
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
114
|
-
/** @inheritDoc */
|
|
115
|
-
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
116
|
-
/** @inheritDoc */
|
|
117
|
-
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
118
|
-
/** @inheritDoc */
|
|
119
|
-
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
120
|
-
/** @inheritDoc */
|
|
121
|
-
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
122
|
-
/** @inheritDoc */
|
|
123
|
-
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
124
|
-
/** @inheritDoc */
|
|
125
|
-
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
126
|
-
/** @inheritDoc */
|
|
127
|
-
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
128
|
-
/** @inheritDoc */
|
|
129
|
-
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
130
|
-
/** @inheritDoc */
|
|
131
|
-
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
132
|
-
/** @inheritDoc */
|
|
133
|
-
limit(limit: number): this;
|
|
134
|
-
/** @inheritDoc */
|
|
135
|
-
sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
136
|
-
private mergeConditions;
|
|
137
|
-
}
|
|
1
|
+
import { IntegrationId } from '../communication.types';
|
|
2
|
+
import { CollectionName, DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
|
|
3
|
+
import { Operator, Query } from '../query.types';
|
|
4
|
+
/** Base interface for a query builder. */
|
|
5
|
+
export interface BaseQueryBuilderInterface<MyDocType extends DocumentData> {
|
|
6
|
+
/**
|
|
7
|
+
* Adds a condition to the query.
|
|
8
|
+
* @param fieldName The name of the field to query.
|
|
9
|
+
* @param operator The operator to use.
|
|
10
|
+
* @param value The value to compare against.
|
|
11
|
+
* @returns The query builder.
|
|
12
|
+
*/
|
|
13
|
+
where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
14
|
+
/**
|
|
15
|
+
* A shortcut for where(fieldName, '==', value)
|
|
16
|
+
*
|
|
17
|
+
* @param fieldName The name of the field to query.
|
|
18
|
+
* @param value The value to compare against.
|
|
19
|
+
* @returns The query builder.
|
|
20
|
+
*/
|
|
21
|
+
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
22
|
+
/**
|
|
23
|
+
* A shortcut for where(fieldName, '!=', value)
|
|
24
|
+
* @param fieldName The name of the field to query.
|
|
25
|
+
* @param value The value to compare against.
|
|
26
|
+
* @returns The query builder.
|
|
27
|
+
*/
|
|
28
|
+
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
29
|
+
/**
|
|
30
|
+
* A shortcut for where(fieldName, 'in', value)
|
|
31
|
+
* @param fieldName The name of the field to query.
|
|
32
|
+
* @param value An array of values to compare against.
|
|
33
|
+
* @returns The query builder.
|
|
34
|
+
*/
|
|
35
|
+
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
36
|
+
/**
|
|
37
|
+
* A shortcut for where(fieldName, 'not in', value)
|
|
38
|
+
* @param fieldName The name of the field to query.
|
|
39
|
+
* @param value An array of values to compare against.
|
|
40
|
+
* @returns The query builder.
|
|
41
|
+
*/
|
|
42
|
+
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
43
|
+
/**
|
|
44
|
+
* A shortcut for where(fieldName, '>', value)
|
|
45
|
+
* @param fieldName The name of the field to query.
|
|
46
|
+
* @param value The value to compare against.
|
|
47
|
+
* @returns The query builder.
|
|
48
|
+
*/
|
|
49
|
+
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
50
|
+
/**
|
|
51
|
+
* A shortcut for where(fieldName, '>=', value)
|
|
52
|
+
* @param fieldName The name of the field to query.
|
|
53
|
+
* @param value The value to compare against.
|
|
54
|
+
* @returns The query builder.
|
|
55
|
+
*/
|
|
56
|
+
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
57
|
+
/**
|
|
58
|
+
* A shortcut for where(fieldName, '<', value)
|
|
59
|
+
* @param fieldName The name of the field to query.
|
|
60
|
+
* @param value The value to compare against.
|
|
61
|
+
* @returns The query builder.
|
|
62
|
+
*/
|
|
63
|
+
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
64
|
+
/**
|
|
65
|
+
* A shortcut for where(fieldName, '<=', value)
|
|
66
|
+
* @param fieldName The name of the field to query.
|
|
67
|
+
* @param value The value to compare against.
|
|
68
|
+
* @returns The query builder.
|
|
69
|
+
*/
|
|
70
|
+
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
71
|
+
/**
|
|
72
|
+
* A shortcut for where(fieldName, 'like', pattern).
|
|
73
|
+
*
|
|
74
|
+
* @param fieldName The name of the field to query.
|
|
75
|
+
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
76
|
+
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
77
|
+
* @returns The query builder.
|
|
78
|
+
*/
|
|
79
|
+
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
80
|
+
/**
|
|
81
|
+
* A shortcut for where(fieldName, 'not like', pattern).
|
|
82
|
+
*
|
|
83
|
+
* @param fieldName The name of the field to query.
|
|
84
|
+
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
85
|
+
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
86
|
+
* @returns The query builder.
|
|
87
|
+
*/
|
|
88
|
+
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
89
|
+
/**
|
|
90
|
+
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
91
|
+
* if none is provided.
|
|
92
|
+
* @param limit The limit to set.
|
|
93
|
+
* @returns The query builder.
|
|
94
|
+
*/
|
|
95
|
+
limit(limit: number): this;
|
|
96
|
+
/**
|
|
97
|
+
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
98
|
+
* determines the order in which they are applied.
|
|
99
|
+
* @param fieldName The name of the field to sort by.
|
|
100
|
+
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
101
|
+
* @returns The query builder.
|
|
102
|
+
*/
|
|
103
|
+
sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
104
|
+
}
|
|
105
|
+
/** A query builder that can be used to build a query that returns a list of documents. */
|
|
106
|
+
export declare class SimpleQueryBuilder<MyDocType extends DocumentData> implements BaseQueryBuilderInterface<MyDocType> {
|
|
107
|
+
protected readonly collectionName: CollectionName;
|
|
108
|
+
protected readonly integrationId: IntegrationId;
|
|
109
|
+
protected readonly query: Query<MyDocType>;
|
|
110
|
+
/** @inheritDoc */
|
|
111
|
+
where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
112
|
+
/** @inheritDoc */
|
|
113
|
+
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
114
|
+
/** @inheritDoc */
|
|
115
|
+
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
116
|
+
/** @inheritDoc */
|
|
117
|
+
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
118
|
+
/** @inheritDoc */
|
|
119
|
+
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
120
|
+
/** @inheritDoc */
|
|
121
|
+
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
122
|
+
/** @inheritDoc */
|
|
123
|
+
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
124
|
+
/** @inheritDoc */
|
|
125
|
+
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
126
|
+
/** @inheritDoc */
|
|
127
|
+
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
128
|
+
/** @inheritDoc */
|
|
129
|
+
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
130
|
+
/** @inheritDoc */
|
|
131
|
+
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
132
|
+
/** @inheritDoc */
|
|
133
|
+
limit(limit: number): this;
|
|
134
|
+
/** @inheritDoc */
|
|
135
|
+
sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
136
|
+
private mergeConditions;
|
|
137
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JSONSchemaType } from 'ajv';
|
|
2
|
-
import { Query, QueryRequest, QueryUnsubscribeRequest } from './query.types';
|
|
3
|
-
export declare const QuerySchema: JSONSchemaType<Query>;
|
|
4
|
-
export declare const QueryRequestSchema: JSONSchemaType<QueryRequest>;
|
|
5
|
-
export declare const QueryUnsubscribeRequestSchema: JSONSchemaType<QueryUnsubscribeRequest>;
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { Query, QueryRequest, QueryUnsubscribeRequest } from './query.types';
|
|
3
|
+
export declare const QuerySchema: JSONSchemaType<Query>;
|
|
4
|
+
export declare const QueryRequestSchema: JSONSchemaType<QueryRequest>;
|
|
5
|
+
export declare const QueryUnsubscribeRequestSchema: JSONSchemaType<QueryUnsubscribeRequest>;
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { TriggerId } from './application.types';
|
|
2
|
-
import { AppId, ClientId, ClientRequestId, IntegrationId } from './communication.types';
|
|
3
|
-
import { CollectionName, FieldName, PrimitiveFieldType, SquidDocument } from './document.types';
|
|
4
|
-
export type Conditions<Doc = any, F extends FieldName<Doc> = any> = Array<Condition<Doc, F>>;
|
|
5
|
-
export interface Condition<Doc = any, F extends FieldName<Doc> = any> {
|
|
6
|
-
fieldName: F;
|
|
7
|
-
operator: Operator;
|
|
8
|
-
value: Doc[F] | null;
|
|
9
|
-
}
|
|
10
|
-
export type Operator = '==' | '>=' | '<=' | '>' | '<' | '!=' | 'like' | 'not like' | 'like_cs' | 'not like_cs';
|
|
11
|
-
export type ContextConditions<Doc = any, F extends FieldName<Doc> = any> = Array<ContextCondition<Doc, F>>;
|
|
12
|
-
export type GenericValue<Doc = any, F extends FieldName<Doc> = any, O extends AllOperators = any> = O extends 'in' ? Array<Doc[F]> | null : O extends 'not in' ? Array<Doc[F]> | null : Doc[F] | null;
|
|
13
|
-
export type ContextCondition<Doc = any, F extends FieldName<Doc> = any> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
14
|
-
interface InContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
15
|
-
operator: 'in';
|
|
16
|
-
value: Array<Doc[F]>;
|
|
17
|
-
}
|
|
18
|
-
interface NotInContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
19
|
-
operator: 'not in';
|
|
20
|
-
value: Array<Doc[F]>;
|
|
21
|
-
}
|
|
22
|
-
interface OtherContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator'> {
|
|
23
|
-
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
24
|
-
}
|
|
25
|
-
export interface GeneralCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
26
|
-
operator: AllOperators;
|
|
27
|
-
value: any;
|
|
28
|
-
}
|
|
29
|
-
export type GeneralConditions<Doc = any, F extends FieldName<Doc> = any> = Array<GeneralCondition<Doc, F>>;
|
|
30
|
-
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
31
|
-
export type AllOperators = Operator | 'in' | 'not in';
|
|
32
|
-
export interface FieldSort<Doc> {
|
|
33
|
-
fieldName: FieldName<Doc>;
|
|
34
|
-
asc: boolean;
|
|
35
|
-
}
|
|
36
|
-
interface RegularQueryKey {
|
|
37
|
-
queryType: 'query';
|
|
38
|
-
clientId: string;
|
|
39
|
-
clientRequestId: string;
|
|
40
|
-
}
|
|
41
|
-
interface TriggerKey {
|
|
42
|
-
queryType: 'trigger';
|
|
43
|
-
triggerId: TriggerId;
|
|
44
|
-
}
|
|
45
|
-
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
46
|
-
export interface Query<Doc = any> {
|
|
47
|
-
collectionName: CollectionName;
|
|
48
|
-
integrationId: string;
|
|
49
|
-
conditions: Conditions<Doc>;
|
|
50
|
-
sortOrder: Array<FieldSort<Doc>>;
|
|
51
|
-
limit: number;
|
|
52
|
-
}
|
|
53
|
-
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
54
|
-
export interface QueryRequest {
|
|
55
|
-
clientId: ClientId;
|
|
56
|
-
clientRequestId: ClientRequestId;
|
|
57
|
-
query: Query;
|
|
58
|
-
subscribe: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface QueryUnsubscribeRequest {
|
|
61
|
-
clientId: ClientId;
|
|
62
|
-
clientRequestId: ClientRequestId;
|
|
63
|
-
}
|
|
64
|
-
interface QueryMetadata {
|
|
65
|
-
condCount: number;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Example query mapping:
|
|
69
|
-
* {
|
|
70
|
-
* unconditional: ['cid_123'],
|
|
71
|
-
* conditional: {
|
|
72
|
-
* age: {
|
|
73
|
-
* '==': {
|
|
74
|
-
* 10: ['cid2_321'],
|
|
75
|
-
* 11: ['cid2_321'],
|
|
76
|
-
* 12: ['cid2_321'],
|
|
77
|
-
* },
|
|
78
|
-
* '>': {
|
|
79
|
-
* 20: ['cid_456']
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
* },
|
|
83
|
-
* queriesMetadata: {
|
|
84
|
-
* 'cid_123': {
|
|
85
|
-
* condCount: 0
|
|
86
|
-
* },
|
|
87
|
-
* 'cid2_321': {
|
|
88
|
-
* condCount: 1
|
|
89
|
-
* },
|
|
90
|
-
* 'cid2_456': {
|
|
91
|
-
* condCount: 1
|
|
92
|
-
* }
|
|
93
|
-
* }
|
|
94
|
-
* }
|
|
95
|
-
*/
|
|
96
|
-
export type QueryMapping<T extends string> = {
|
|
97
|
-
unconditional: Array<T>;
|
|
98
|
-
conditional: Record<FieldName, Record<Operator, Record<PrimitiveFieldType & string, Array<T>>>>;
|
|
99
|
-
queriesMetadata: Record<T, QueryMetadata>;
|
|
100
|
-
};
|
|
101
|
-
export declare abstract class QueryMappingManager<T> {
|
|
102
|
-
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
103
|
-
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
104
|
-
abstract findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T> | undefined>;
|
|
105
|
-
}
|
|
106
|
-
export declare abstract class SimpleQueryMappingManager<T extends string> extends QueryMappingManager<T> {
|
|
107
|
-
abstract getMapping(appId: AppId, collectionName: CollectionName, integrationId: IntegrationId): Promise<QueryMapping<T> | undefined> | (QueryMapping<T> | undefined);
|
|
108
|
-
findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T>>;
|
|
109
|
-
}
|
|
110
|
-
export declare function findQueriesForDocumentSync<T extends string>(mapping: QueryMapping<T>, doc: SquidDocument): Array<T>;
|
|
111
|
-
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
112
|
-
/** Returns a unique identifier for the query which includes both the client id and the client request id. */
|
|
113
|
-
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
114
|
-
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
115
|
-
clientId: string;
|
|
116
|
-
clientRequestId: string;
|
|
117
|
-
};
|
|
118
|
-
export {};
|
|
1
|
+
import { TriggerId } from './application.types';
|
|
2
|
+
import { AppId, ClientId, ClientRequestId, IntegrationId } from './communication.types';
|
|
3
|
+
import { CollectionName, FieldName, PrimitiveFieldType, SquidDocument } from './document.types';
|
|
4
|
+
export type Conditions<Doc = any, F extends FieldName<Doc> = any> = Array<Condition<Doc, F>>;
|
|
5
|
+
export interface Condition<Doc = any, F extends FieldName<Doc> = any> {
|
|
6
|
+
fieldName: F;
|
|
7
|
+
operator: Operator;
|
|
8
|
+
value: Doc[F] | null;
|
|
9
|
+
}
|
|
10
|
+
export type Operator = '==' | '>=' | '<=' | '>' | '<' | '!=' | 'like' | 'not like' | 'like_cs' | 'not like_cs';
|
|
11
|
+
export type ContextConditions<Doc = any, F extends FieldName<Doc> = any> = Array<ContextCondition<Doc, F>>;
|
|
12
|
+
export type GenericValue<Doc = any, F extends FieldName<Doc> = any, O extends AllOperators = any> = O extends 'in' ? Array<Doc[F]> | null : O extends 'not in' ? Array<Doc[F]> | null : Doc[F] | null;
|
|
13
|
+
export type ContextCondition<Doc = any, F extends FieldName<Doc> = any> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
14
|
+
interface InContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
15
|
+
operator: 'in';
|
|
16
|
+
value: Array<Doc[F]>;
|
|
17
|
+
}
|
|
18
|
+
interface NotInContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
19
|
+
operator: 'not in';
|
|
20
|
+
value: Array<Doc[F]>;
|
|
21
|
+
}
|
|
22
|
+
interface OtherContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator'> {
|
|
23
|
+
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
24
|
+
}
|
|
25
|
+
export interface GeneralCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
26
|
+
operator: AllOperators;
|
|
27
|
+
value: any;
|
|
28
|
+
}
|
|
29
|
+
export type GeneralConditions<Doc = any, F extends FieldName<Doc> = any> = Array<GeneralCondition<Doc, F>>;
|
|
30
|
+
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
31
|
+
export type AllOperators = Operator | 'in' | 'not in';
|
|
32
|
+
export interface FieldSort<Doc> {
|
|
33
|
+
fieldName: FieldName<Doc>;
|
|
34
|
+
asc: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface RegularQueryKey {
|
|
37
|
+
queryType: 'query';
|
|
38
|
+
clientId: string;
|
|
39
|
+
clientRequestId: string;
|
|
40
|
+
}
|
|
41
|
+
interface TriggerKey {
|
|
42
|
+
queryType: 'trigger';
|
|
43
|
+
triggerId: TriggerId;
|
|
44
|
+
}
|
|
45
|
+
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
46
|
+
export interface Query<Doc = any> {
|
|
47
|
+
collectionName: CollectionName;
|
|
48
|
+
integrationId: string;
|
|
49
|
+
conditions: Conditions<Doc>;
|
|
50
|
+
sortOrder: Array<FieldSort<Doc>>;
|
|
51
|
+
limit: number;
|
|
52
|
+
}
|
|
53
|
+
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
54
|
+
export interface QueryRequest {
|
|
55
|
+
clientId: ClientId;
|
|
56
|
+
clientRequestId: ClientRequestId;
|
|
57
|
+
query: Query;
|
|
58
|
+
subscribe: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface QueryUnsubscribeRequest {
|
|
61
|
+
clientId: ClientId;
|
|
62
|
+
clientRequestId: ClientRequestId;
|
|
63
|
+
}
|
|
64
|
+
interface QueryMetadata {
|
|
65
|
+
condCount: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Example query mapping:
|
|
69
|
+
* {
|
|
70
|
+
* unconditional: ['cid_123'],
|
|
71
|
+
* conditional: {
|
|
72
|
+
* age: {
|
|
73
|
+
* '==': {
|
|
74
|
+
* 10: ['cid2_321'],
|
|
75
|
+
* 11: ['cid2_321'],
|
|
76
|
+
* 12: ['cid2_321'],
|
|
77
|
+
* },
|
|
78
|
+
* '>': {
|
|
79
|
+
* 20: ['cid_456']
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* },
|
|
83
|
+
* queriesMetadata: {
|
|
84
|
+
* 'cid_123': {
|
|
85
|
+
* condCount: 0
|
|
86
|
+
* },
|
|
87
|
+
* 'cid2_321': {
|
|
88
|
+
* condCount: 1
|
|
89
|
+
* },
|
|
90
|
+
* 'cid2_456': {
|
|
91
|
+
* condCount: 1
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
*/
|
|
96
|
+
export type QueryMapping<T extends string> = {
|
|
97
|
+
unconditional: Array<T>;
|
|
98
|
+
conditional: Record<FieldName, Record<Operator, Record<PrimitiveFieldType & string, Array<T>>>>;
|
|
99
|
+
queriesMetadata: Record<T, QueryMetadata>;
|
|
100
|
+
};
|
|
101
|
+
export declare abstract class QueryMappingManager<T> {
|
|
102
|
+
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
103
|
+
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
104
|
+
abstract findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T> | undefined>;
|
|
105
|
+
}
|
|
106
|
+
export declare abstract class SimpleQueryMappingManager<T extends string> extends QueryMappingManager<T> {
|
|
107
|
+
abstract getMapping(appId: AppId, collectionName: CollectionName, integrationId: IntegrationId): Promise<QueryMapping<T> | undefined> | (QueryMapping<T> | undefined);
|
|
108
|
+
findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T>>;
|
|
109
|
+
}
|
|
110
|
+
export declare function findQueriesForDocumentSync<T extends string>(mapping: QueryMapping<T>, doc: SquidDocument): Array<T>;
|
|
111
|
+
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
112
|
+
/** Returns a unique identifier for the query which includes both the client id and the client request id. */
|
|
113
|
+
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
114
|
+
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
115
|
+
clientId: string;
|
|
116
|
+
clientRequestId: string;
|
|
117
|
+
};
|
|
118
|
+
export {};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export type SquidCloudId = 'aws' | 'gcp' | 'azure';
|
|
2
|
-
/** The list of supported Squid regions. */
|
|
3
|
-
export type SupportedSquidRegion = 'us-east-1.aws' | 'local';
|
|
4
|
-
export declare const supportedSquidRegions: Array<SupportedSquidRegion>;
|
|
5
|
-
export interface SquidCloudRegion {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SquidSupportedCloud {
|
|
10
|
-
id: SquidCloudId;
|
|
11
|
-
name: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
regions: Array<SquidCloudRegion>;
|
|
14
|
-
tooltip?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const squidSupportedRegionMap: Record<SupportedSquidRegion, SquidCloudRegion>;
|
|
17
|
-
export declare function getSquidSupportedCloudMap(isLocal?: boolean): Record<SquidCloudId, SquidSupportedCloud>;
|
|
18
|
-
export declare function convertToSquidRegion(cloudId: SquidCloudId, region: string): SupportedSquidRegion;
|
|
19
|
-
export declare function convertFromSquidRegion(regionAndCloud: SupportedSquidRegion): {
|
|
20
|
-
cloudId: SquidCloudId;
|
|
21
|
-
region: string;
|
|
22
|
-
};
|
|
1
|
+
export type SquidCloudId = 'aws' | 'gcp' | 'azure';
|
|
2
|
+
/** The list of supported Squid regions. */
|
|
3
|
+
export type SupportedSquidRegion = 'us-east-1.aws' | 'local';
|
|
4
|
+
export declare const supportedSquidRegions: Array<SupportedSquidRegion>;
|
|
5
|
+
export interface SquidCloudRegion {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SquidSupportedCloud {
|
|
10
|
+
id: SquidCloudId;
|
|
11
|
+
name: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
regions: Array<SquidCloudRegion>;
|
|
14
|
+
tooltip?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const squidSupportedRegionMap: Record<SupportedSquidRegion, SquidCloudRegion>;
|
|
17
|
+
export declare function getSquidSupportedCloudMap(isLocal?: boolean): Record<SquidCloudId, SquidSupportedCloud>;
|
|
18
|
+
export declare function convertToSquidRegion(cloudId: SquidCloudId, region: string): SupportedSquidRegion;
|
|
19
|
+
export declare function convertFromSquidRegion(regionAndCloud: SupportedSquidRegion): {
|
|
20
|
+
cloudId: SquidCloudId;
|
|
21
|
+
region: string;
|
|
22
|
+
};
|