@squidcloud/client 1.0.64 → 1.0.66
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/ai-assistant.context.d.ts +12 -11
- package/dist/common/src/ai-assistant.schemas.d.ts +1 -210
- package/dist/common/src/ai-assistant.types.d.ts +2 -81
- package/dist/common/src/api-call.context.d.ts +13 -12
- package/dist/common/src/api.types.d.ts +4 -24
- package/dist/common/src/application.schemas.d.ts +1 -1060
- package/dist/common/src/application.types.d.ts +184 -224
- package/dist/common/src/auth.types.d.ts +1 -4
- package/dist/common/src/backend-function.schemas.d.ts +1 -3
- package/dist/common/src/backend-function.types.d.ts +1 -7
- package/dist/common/src/backend-run.types.d.ts +2 -53
- package/dist/common/src/bundle-api.types.d.ts +36 -68
- package/dist/common/src/bundle-data.types.d.ts +4 -59
- package/dist/common/src/communication.types.d.ts +22 -4
- package/dist/common/src/context.types.d.ts +32 -32
- package/dist/common/src/distributed-lock.context.d.ts +5 -5
- package/dist/common/src/document.types.d.ts +22 -37
- package/dist/common/src/graphql.context.d.ts +7 -6
- package/dist/common/src/graphql.types.d.ts +9 -11
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/index.d.ts +54 -54
- package/dist/common/src/integrations/ai_assistant.types.d.ts +30 -30
- package/dist/common/src/integrations/api.types.d.ts +80 -80
- package/dist/common/src/integrations/auth.types.d.ts +22 -22
- package/dist/common/src/integrations/database.types.d.ts +236 -236
- package/dist/common/src/integrations/index.d.ts +97 -97
- package/dist/common/src/integrations/observability.types.d.ts +22 -22
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/metrics.types.d.ts +1 -58
- package/dist/common/src/mutation.context.d.ts +12 -10
- package/dist/common/src/mutation.schemas.d.ts +1 -5
- package/dist/common/src/mutation.types.d.ts +53 -72
- package/dist/common/src/named-query.context.d.ts +4 -4
- package/dist/common/src/named-query.schemas.d.ts +1 -3
- package/dist/common/src/named-query.types.d.ts +1 -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 +1 -5
- package/dist/common/src/query.types.d.ts +51 -118
- package/dist/common/src/regions.d.ts +1 -22
- package/dist/common/src/schema/schema.types.d.ts +54 -54
- package/dist/common/src/secret.schemas.d.ts +1 -6
- package/dist/common/src/secret.types.d.ts +8 -49
- package/dist/common/src/security.types.d.ts +1 -3
- package/dist/common/src/socket.schemas.d.ts +1 -3
- package/dist/common/src/socket.types.d.ts +1 -108
- package/dist/common/src/time-units.d.ts +1 -5
- package/dist/common/src/trigger.types.d.ts +1 -15
- package/dist/common/src/types.d.ts +8 -15
- package/dist/common/src/utils/array.d.ts +1 -8
- package/dist/common/src/utils/assert.d.ts +1 -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 +1 -7
- package/dist/index.js +2 -2
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/ai-assistant-client.d.ts +66 -66
- package/dist/typescript-client/src/ai-client.factory.d.ts +13 -13
- package/dist/typescript-client/src/api.manager.d.ts +15 -15
- package/dist/typescript-client/src/auth.manager.d.ts +23 -23
- package/dist/typescript-client/src/backend-function.manager.d.ts +13 -13
- package/dist/typescript-client/src/client-id.service.d.ts +24 -24
- package/dist/typescript-client/src/collection-reference.d.ts +81 -81
- 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 +12 -12
- package/dist/typescript-client/src/named-query.manager.d.ts +14 -14
- 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 +64 -64
- package/dist/typescript-client/src/query/query.types.d.ts +14 -14
- package/dist/typescript-client/src/rpc.manager.d.ts +28 -28
- package/dist/typescript-client/src/socket.manager.d.ts +32 -32
- package/dist/typescript-client/src/squid.d.ts +196 -188
- 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 @@
|
|
|
1
|
-
|
|
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
|
+
export {};
|
|
@@ -1,118 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface Condition<Doc = any, F extends FieldName<Doc> = any> {
|
|
6
|
-
fieldName: F;
|
|
7
|
-
operator: Operator;
|
|
8
|
-
value: Doc[F] | null;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
interface
|
|
19
|
-
operator: '
|
|
20
|
-
value: Array<Doc[F]>;
|
|
21
|
-
}
|
|
22
|
-
interface
|
|
23
|
-
operator:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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 { CollectionName, FieldName } from './document.types';
|
|
2
|
+
/** A list of query conditions. */
|
|
3
|
+
export type Conditions<Doc = any, F extends FieldName<Doc> = any> = Array<Condition<Doc, F>>;
|
|
4
|
+
/** A single query condition. */
|
|
5
|
+
export interface Condition<Doc = any, F extends FieldName<Doc> = any> {
|
|
6
|
+
fieldName: F;
|
|
7
|
+
operator: Operator;
|
|
8
|
+
value: Doc[F] | null;
|
|
9
|
+
}
|
|
10
|
+
/** An operator in a query condition. */
|
|
11
|
+
export type Operator = '==' | '>=' | '<=' | '>' | '<' | '!=' | 'like' | 'not like' | 'like_cs' | 'not like_cs';
|
|
12
|
+
/** A list of context conditions */
|
|
13
|
+
export type ContextConditions<Doc = any, F extends FieldName<Doc> = any> = Array<ContextCondition<Doc, F>>;
|
|
14
|
+
/** A generic value that can exist in a query. */
|
|
15
|
+
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;
|
|
16
|
+
/** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
|
|
17
|
+
export type ContextCondition<Doc = any, F extends FieldName<Doc> = any> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
18
|
+
interface InContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
19
|
+
operator: 'in';
|
|
20
|
+
value: Array<Doc[F]>;
|
|
21
|
+
}
|
|
22
|
+
interface NotInContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
23
|
+
operator: 'not in';
|
|
24
|
+
value: Array<Doc[F]>;
|
|
25
|
+
}
|
|
26
|
+
interface OtherContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator'> {
|
|
27
|
+
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
28
|
+
}
|
|
29
|
+
/** A condition that includes the 'in' and 'not in' operators. */
|
|
30
|
+
export interface GeneralCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
31
|
+
operator: AllOperators;
|
|
32
|
+
value: any;
|
|
33
|
+
}
|
|
34
|
+
/** A list of general conditions. */
|
|
35
|
+
export type GeneralConditions<Doc = any, F extends FieldName<Doc> = any> = Array<GeneralCondition<Doc, F>>;
|
|
36
|
+
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
37
|
+
export type AllOperators = Operator | 'in' | 'not in';
|
|
38
|
+
/** A definition of a sort by a filed. */
|
|
39
|
+
export interface FieldSort<Doc> {
|
|
40
|
+
fieldName: FieldName<Doc>;
|
|
41
|
+
asc: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** A query object. */
|
|
44
|
+
export interface Query<Doc = any> {
|
|
45
|
+
collectionName: CollectionName;
|
|
46
|
+
integrationId: string;
|
|
47
|
+
conditions: Conditions<Doc>;
|
|
48
|
+
sortOrder: Array<FieldSort<Doc>>;
|
|
49
|
+
limit: number;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
export type
|
|
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 SupportedSquidRegion = (typeof SupportedSquidRegions)[number];
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
-
export type FieldPlaceholder = '__SQUID_SERVER_TIMESTAMP__' | '__SQUID_CLIENT_IP__' | '__SQUID_USER_ID__' | '__SQUID_API_KEY__';
|
|
3
|
-
export type BasicFieldType = 'string' | 'integer' | 'number' | 'boolean' | 'map' | 'array' | 'any';
|
|
4
|
-
export type CustomFieldType = 'date' | 'json';
|
|
5
|
-
export type SupportedFieldType = BasicFieldType | CustomFieldType;
|
|
6
|
-
export declare const SUPPORTED_FIELD_TYPES_ARRAY: Array<SupportedFieldType>;
|
|
7
|
-
type ConvertDeep<T extends JSONSchema> = Exclude<T, boolean> & {
|
|
8
|
-
properties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
9
|
-
patternProperties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
10
|
-
nullable?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* The default value will be applied (default to 'empty'):
|
|
13
|
-
* 'always' - no matter what the client sent, both on update and insert. In case of readOnly - applies only on insert.
|
|
14
|
-
* 'empty' - only if the value of the filed is empty (undefined)
|
|
15
|
-
* 'updateOrEmpty' - no matter what the client sent, updating the record will use the default value
|
|
16
|
-
*/
|
|
17
|
-
applyDefaultValueOn?: 'always' | 'empty' | 'updateOrEmpty';
|
|
18
|
-
isDate?: boolean;
|
|
19
|
-
isJSON?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Applies to the top level schema, a record in a nested object, or a regular property.
|
|
22
|
-
* Basically, whether this property can participate in an insert mutation.
|
|
23
|
-
*/
|
|
24
|
-
insertable?: boolean;
|
|
25
|
-
/** Applies to the top level schema or a record in a nested object. */
|
|
26
|
-
deletable?: boolean;
|
|
27
|
-
};
|
|
28
|
-
export type PropertySchema = ConvertDeep<JSONSchema>;
|
|
29
|
-
export type TopLevelPropertySchema = PropertySchema & {
|
|
30
|
-
primaryKey?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the property is computed based on other properties or some formula.
|
|
33
|
-
* If true, readonly also needs to be true and this field should not be part of an insert statement.
|
|
34
|
-
*/
|
|
35
|
-
isComputed?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the default value generated by the database. CURRENT_DATE is something generated by the database vs
|
|
38
|
-
* 'Hello' which is a constant.
|
|
39
|
-
*/
|
|
40
|
-
isDefaultComputed?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The database data type that is represented by this property. This is often different from the actual property
|
|
43
|
-
* type, with is a Javascript primitive. For example, for a SMALLINT the dataType would be 'smallint', but the type
|
|
44
|
-
* would be 'integer'.
|
|
45
|
-
*/
|
|
46
|
-
dataType?: string;
|
|
47
|
-
};
|
|
48
|
-
export type CollectionSchema = Omit<ConvertDeep<JSONSchema>, 'properties'> & {
|
|
49
|
-
properties?: Record<string, TopLevelPropertySchema>;
|
|
50
|
-
};
|
|
51
|
-
export declare function compileSchema<S extends CollectionSchema>(schema: S): any;
|
|
52
|
-
export declare function validateSchema<S extends CollectionSchema>(schema: S, data: any, updatedPaths?: Array<string>, dataBefore?: any): void;
|
|
53
|
-
export declare function findMatchingPropertiesForKey<S extends CollectionSchema | PropertySchema>(schema: S, key: string): Array<PropertySchema>;
|
|
54
|
-
export {};
|
|
1
|
+
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
+
export type FieldPlaceholder = '__SQUID_SERVER_TIMESTAMP__' | '__SQUID_CLIENT_IP__' | '__SQUID_USER_ID__' | '__SQUID_API_KEY__';
|
|
3
|
+
export type BasicFieldType = 'string' | 'integer' | 'number' | 'boolean' | 'map' | 'array' | 'any';
|
|
4
|
+
export type CustomFieldType = 'date' | 'json' | 'objectId';
|
|
5
|
+
export type SupportedFieldType = BasicFieldType | CustomFieldType;
|
|
6
|
+
export declare const SUPPORTED_FIELD_TYPES_ARRAY: Array<SupportedFieldType>;
|
|
7
|
+
type ConvertDeep<T extends JSONSchema> = Exclude<T, boolean> & {
|
|
8
|
+
properties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
9
|
+
patternProperties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
10
|
+
nullable?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The default value will be applied (default to 'empty'):
|
|
13
|
+
* 'always' - no matter what the client sent, both on update and insert. In case of readOnly - applies only on insert.
|
|
14
|
+
* 'empty' - only if the value of the filed is empty (undefined)
|
|
15
|
+
* 'updateOrEmpty' - no matter what the client sent, updating the record will use the default value
|
|
16
|
+
*/
|
|
17
|
+
applyDefaultValueOn?: 'always' | 'empty' | 'updateOrEmpty';
|
|
18
|
+
isDate?: boolean;
|
|
19
|
+
isJSON?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Applies to the top level schema, a record in a nested object, or a regular property.
|
|
22
|
+
* Basically, whether this property can participate in an insert mutation.
|
|
23
|
+
*/
|
|
24
|
+
insertable?: boolean;
|
|
25
|
+
/** Applies to the top level schema or a record in a nested object. */
|
|
26
|
+
deletable?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type PropertySchema = ConvertDeep<JSONSchema>;
|
|
29
|
+
export type TopLevelPropertySchema = PropertySchema & {
|
|
30
|
+
primaryKey?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the property is computed based on other properties or some formula.
|
|
33
|
+
* If true, readonly also needs to be true and this field should not be part of an insert statement.
|
|
34
|
+
*/
|
|
35
|
+
isComputed?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the default value generated by the database. CURRENT_DATE is something generated by the database vs
|
|
38
|
+
* 'Hello' which is a constant.
|
|
39
|
+
*/
|
|
40
|
+
isDefaultComputed?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The database data type that is represented by this property. This is often different from the actual property
|
|
43
|
+
* type, with is a Javascript primitive. For example, for a SMALLINT the dataType would be 'smallint', but the type
|
|
44
|
+
* would be 'integer'.
|
|
45
|
+
*/
|
|
46
|
+
dataType?: string;
|
|
47
|
+
};
|
|
48
|
+
export type CollectionSchema = Omit<ConvertDeep<JSONSchema>, 'properties'> & {
|
|
49
|
+
properties?: Record<string, TopLevelPropertySchema>;
|
|
50
|
+
};
|
|
51
|
+
export declare function compileSchema<S extends CollectionSchema>(schema: S): any;
|
|
52
|
+
export declare function validateSchema<S extends CollectionSchema>(schema: S, data: any, updatedPaths?: Array<string>, dataBefore?: any): void;
|
|
53
|
+
export declare function findMatchingPropertiesForKey<S extends CollectionSchema | PropertySchema>(schema: S, key: string): Array<PropertySchema>;
|
|
54
|
+
export {};
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { DeleteApiKeyRequest, DeleteCustomSecretRequest, GenerateNewApiKeyRequest, SetCustomSecretRequest } from './secret.types';
|
|
3
|
-
export declare const SetCustomSecretRequestSchema: JSONSchemaType<SetCustomSecretRequest>;
|
|
4
|
-
export declare const DeleteCustomSecretRequestSchema: JSONSchemaType<DeleteCustomSecretRequest>;
|
|
5
|
-
export declare const DeleteApiKeyRequestSchema: JSONSchemaType<DeleteApiKeyRequest>;
|
|
6
|
-
export declare const GenerateNewApiKeyRequestSchema: JSONSchemaType<GenerateNewApiKeyRequest>;
|
|
1
|
+
export {};
|