@squidcloud/client 1.0.147 → 1.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/cjs/index.js +8793 -8803
  2. package/dist/common/src/ai-assistant.types.d.ts +25 -25
  3. package/dist/common/src/ai-chatbot.context.d.ts +12 -12
  4. package/dist/common/src/ai-chatbot.schemas.d.ts +1 -1
  5. package/dist/common/src/ai-chatbot.types.d.ts +27 -27
  6. package/dist/common/src/api-call.context.d.ts +13 -13
  7. package/dist/common/src/api.types.d.ts +4 -4
  8. package/dist/common/src/application.schemas.d.ts +66 -66
  9. package/dist/common/src/application.types.d.ts +141 -143
  10. package/dist/common/src/backend-function.schemas.d.ts +1 -1
  11. package/dist/common/src/backend-function.types.d.ts +1 -1
  12. package/dist/common/src/backend-run.types.d.ts +2 -2
  13. package/dist/common/src/bundle-api.types.d.ts +41 -43
  14. package/dist/common/src/bundle-data.types.d.ts +5 -5
  15. package/dist/common/src/communication.types.d.ts +10 -8
  16. package/dist/common/src/context.types.d.ts +40 -40
  17. package/dist/common/src/distributed-lock.context.d.ts +4 -4
  18. package/dist/common/src/document.types.d.ts +22 -22
  19. package/dist/common/src/graphql.context.d.ts +7 -7
  20. package/dist/common/src/graphql.types.d.ts +9 -9
  21. package/dist/common/src/heartbeat.types.d.ts +1 -1
  22. package/dist/common/src/http-status.enum.d.ts +50 -50
  23. package/dist/common/src/index.d.ts +54 -57
  24. package/dist/common/src/integrations/ai_chatbot.types.d.ts +31 -31
  25. package/dist/common/src/integrations/api.types.d.ts +80 -80
  26. package/dist/common/src/integrations/auth.types.d.ts +47 -47
  27. package/dist/common/src/integrations/database.types.d.ts +274 -274
  28. package/dist/common/src/integrations/index.d.ts +134 -134
  29. package/dist/common/src/integrations/observability.types.d.ts +23 -23
  30. package/dist/common/src/logger.types.d.ts +21 -21
  31. package/dist/common/src/metrics.types.d.ts +1 -1
  32. package/dist/common/src/mutation.context.d.ts +14 -14
  33. package/dist/common/src/mutation.schemas.d.ts +1 -1
  34. package/dist/common/src/mutation.types.d.ts +53 -53
  35. package/dist/common/src/native-query.context.d.ts +7 -7
  36. package/dist/common/src/native-query.types.d.ts +16 -16
  37. package/dist/common/src/query/base-query-builder.d.ts +147 -147
  38. package/dist/common/src/query/index.d.ts +4 -4
  39. package/dist/common/src/query/pagination.d.ts +62 -62
  40. package/dist/common/src/query/query-context.d.ts +137 -137
  41. package/dist/common/src/query/serialized-query.types.d.ts +24 -24
  42. package/dist/common/src/query.types.d.ts +64 -64
  43. package/dist/common/src/regions.d.ts +1 -1
  44. package/dist/common/src/schema/schema.types.d.ts +54 -54
  45. package/dist/common/src/secret.schemas.d.ts +1 -1
  46. package/dist/common/src/secret.types.d.ts +22 -22
  47. package/dist/common/src/security.types.d.ts +1 -1
  48. package/dist/common/src/socket.schemas.d.ts +1 -1
  49. package/dist/common/src/socket.types.d.ts +5 -5
  50. package/dist/common/src/time-units.d.ts +1 -1
  51. package/dist/common/src/trigger.types.d.ts +1 -1
  52. package/dist/common/src/types.d.ts +14 -14
  53. package/dist/common/src/utils/array.d.ts +1 -1
  54. package/dist/common/src/utils/assert.d.ts +1 -1
  55. package/dist/common/src/utils/error.d.ts +4 -4
  56. package/dist/common/src/utils/global.utils.d.ts +1 -1
  57. package/dist/common/src/utils/http.d.ts +2 -2
  58. package/dist/common/src/utils/id.d.ts +2 -2
  59. package/dist/common/src/utils/lock.manager.d.ts +14 -14
  60. package/dist/common/src/utils/object.d.ts +5 -5
  61. package/dist/common/src/utils/serialization.d.ts +5 -6
  62. package/dist/common/src/utils/transforms.d.ts +18 -18
  63. package/dist/common/src/utils/url.d.ts +1 -1
  64. package/dist/common/src/utils/validation.d.ts +25 -25
  65. package/dist/common/src/webhook-response.d.ts +1 -1
  66. package/dist/common/src/websocket.impl.d.ts +21 -21
  67. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
  68. package/dist/typescript-client/src/ai-assistant-client.d.ts +73 -73
  69. package/dist/typescript-client/src/ai-chatbot-client.d.ts +174 -174
  70. package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +8 -8
  71. package/dist/typescript-client/src/ai.types.d.ts +61 -61
  72. package/dist/typescript-client/src/api.manager.d.ts +11 -11
  73. package/dist/typescript-client/src/auth.manager.d.ts +26 -26
  74. package/dist/typescript-client/src/backend-function.manager.d.ts +9 -9
  75. package/dist/typescript-client/src/client-id.service.d.ts +27 -27
  76. package/dist/typescript-client/src/collection-reference.d.ts +80 -80
  77. package/dist/typescript-client/src/collection-reference.factory.d.ts +13 -13
  78. package/dist/typescript-client/src/connection-details.d.ts +23 -23
  79. package/dist/typescript-client/src/data.manager.d.ts +174 -173
  80. package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
  81. package/dist/typescript-client/src/distributed-lock.manager.d.ts +16 -16
  82. package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
  83. package/dist/typescript-client/src/document-reference.d.ts +140 -140
  84. package/dist/typescript-client/src/document-reference.factory.d.ts +13 -13
  85. package/dist/typescript-client/src/document-store.d.ts +14 -14
  86. package/dist/typescript-client/src/graphql-client.d.ts +14 -14
  87. package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -11
  88. package/dist/typescript-client/src/index.d.ts +9 -9
  89. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +10 -10
  90. package/dist/typescript-client/src/native-query-manager.d.ts +7 -7
  91. package/dist/typescript-client/src/query/deserializer.d.ts +3 -3
  92. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -161
  93. package/dist/typescript-client/src/query/local-query-manager.d.ts +9 -9
  94. package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -77
  95. package/dist/typescript-client/src/query/query-sender.d.ts +33 -33
  96. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +131 -130
  97. package/dist/typescript-client/src/query/query.types.d.ts +49 -49
  98. package/dist/typescript-client/src/rate-limiter.d.ts +32 -32
  99. package/dist/typescript-client/src/rpc.manager.d.ts +30 -30
  100. package/dist/typescript-client/src/secret.client.d.ts +22 -22
  101. package/dist/typescript-client/src/socket.manager.d.ts +43 -43
  102. package/dist/typescript-client/src/squid.d.ts +238 -269
  103. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
  104. package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
  105. package/dist/typescript-client/src/types.d.ts +2 -2
  106. package/package.json +3 -2
  107. package/dist/common/src/named-query.context.d.ts +0 -4
  108. package/dist/common/src/named-query.schemas.d.ts +0 -1
  109. package/dist/common/src/named-query.types.d.ts +0 -1
  110. package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
@@ -1,137 +1,137 @@
1
- import { IntegrationId } from '../communication.types';
2
- import { CollectionName, DocumentData } from '../document.types';
3
- import { FieldSort, Operator, Query, SimpleCondition } from '../query.types';
4
- import { DeepRecord, FieldOf, PartialBy, Paths } from '../types';
5
- export declare class QueryContext<T extends DocumentData = any> {
6
- readonly query: Query<T>;
7
- private readonly parsedConditions;
8
- /**
9
- * The ID of the integration being queried.
10
- */
11
- get integrationId(): IntegrationId;
12
- /**
13
- * The name of the collection being queried.
14
- */
15
- get collectionName(): CollectionName;
16
- /**
17
- * The query limit if one exists, -1 otherwise.
18
- */
19
- get limit(): number;
20
- /**
21
- * Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
22
- * parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
23
- * additional fields in its sort order, but only after the specified sorts.
24
- *
25
- * @param sorts An array of field sorts.
26
- * @returns Whether the query's sorts matches the provided field sorts.
27
- */
28
- sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
29
- /**
30
- * Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
31
- * `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
32
- * in the query.
33
- *
34
- * @param sorts An array of field sorts.
35
- * @returns Whether the query's sorts exactly match the provided field sorts.
36
- */
37
- sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
38
- /**
39
- * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
40
- * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
41
- * additional conditions, as these only narrow the result set.
42
- *
43
- * @param fieldName The name of the field for the condition.
44
- * @param operator The operator of the condition.
45
- * @param value The value of the condition.
46
- * @returns Whether the query is a subquery of the parent condition.
47
- */
48
- isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
49
- /**
50
- * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
51
- * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
52
- * additional conditions, as these only narrow the result set.
53
- *
54
- * @param condition The condition to validate.
55
- * @returns Whether the query is a subquery of the parent condition.
56
- */
57
- isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
58
- /**
59
- * Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
60
- * to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
61
- * additional conditions, as these only narrow the result set.
62
- *
63
- * @param conditions The conditions to validate.
64
- * @returns Whether the query includes subquery of the parent conditions.
65
- */
66
- isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
67
- /**
68
- * Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
69
- * to a subset of the results that obtained for the parent query, including sorts and limits.
70
- *
71
- * @param query The query to validate.
72
- * @returns Whether the query is a subquery of the parent query.
73
- */
74
- isSubqueryOfQuery(query: Query<T>): boolean;
75
- /**
76
- * Returns all conditions that apply to any of the specified field names. This method
77
- * provides a convenient way to retrieve all conditions that involve a specific set of fields.
78
- *
79
- * @param fieldNames The field names for which to retrieve conditions.
80
- * @returns An array of conditions that involve any of the specified field names.
81
- */
82
- getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
83
- /**
84
- * Returns all conditions that apply to the specified field name. This method provides
85
- * a convenient way to retrieve all conditions that involve a specific field.
86
- *
87
- * @param fieldName The field name for which to retrieve conditions.
88
- * @returns An array of conditions that involve the specified field name.
89
- */
90
- getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
91
- /**
92
- * Returns true if the given document can be a result of the query.
93
- * The method does not account for limit and sort order.
94
- */
95
- documentMatchesQuery(doc: DocumentData): boolean;
96
- /**
97
- * Compares a condition against a given operator and value to determine if the
98
- * provided condition is a subset of the operator and value. A condition is
99
- * considered a subset if all values that satisfy (return true for) the
100
- * condition also satisfy the operator and value.
101
- *
102
- * This is done using the underlying CompareTable, which provides a comparison
103
- * function for each operator pair, or undefined if the comparison would
104
- * always be false, regardless of the values.
105
- */
106
- private evaluateSubset;
107
- private evaluateIncludes;
108
- private parseConditions;
109
- }
110
- /** A list of context conditions */
111
- export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
112
- /** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
113
- type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
114
- interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
115
- operator: 'in';
116
- value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
117
- }
118
- interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
119
- operator: 'not in';
120
- value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
121
- }
122
- interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
123
- operator: Exclude<ContextOperator, 'in' | 'not in'>;
124
- value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
125
- }
126
- /** A condition that includes the 'in' and 'not in' operators. */
127
- interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
128
- operator: AllOperators;
129
- value: any;
130
- }
131
- /** A list of general conditions. */
132
- type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
133
- type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
134
- type AllOperators = Operator | 'in' | 'not in';
135
- /** A generic value that can exist in a query. */
136
- type GenericValue<Doc = any, F extends Paths<Doc> = Paths<Doc>, O extends AllOperators = any> = O extends 'in' ? Array<DeepRecord<Doc>[F]> | null : O extends 'not in' ? Array<DeepRecord<Doc>[F]> | null : DeepRecord<Doc>[F] | null;
137
- export {};
1
+ import { IntegrationId } from '../communication.types';
2
+ import { CollectionName, DocumentData } from '../document.types';
3
+ import { FieldSort, Operator, Query, SimpleCondition } from '../query.types';
4
+ import { DeepRecord, FieldOf, PartialBy, Paths } from '../types';
5
+ export declare class QueryContext<T extends DocumentData = any> {
6
+ readonly query: Query<T>;
7
+ private readonly parsedConditions;
8
+ /**
9
+ * The ID of the integration being queried.
10
+ */
11
+ get integrationId(): IntegrationId;
12
+ /**
13
+ * The name of the collection being queried.
14
+ */
15
+ get collectionName(): CollectionName;
16
+ /**
17
+ * The query limit if one exists, -1 otherwise.
18
+ */
19
+ get limit(): number;
20
+ /**
21
+ * Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
22
+ * parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
23
+ * additional fields in its sort order, but only after the specified sorts.
24
+ *
25
+ * @param sorts An array of field sorts.
26
+ * @returns Whether the query's sorts matches the provided field sorts.
27
+ */
28
+ sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
29
+ /**
30
+ * Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
31
+ * `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
32
+ * in the query.
33
+ *
34
+ * @param sorts An array of field sorts.
35
+ * @returns Whether the query's sorts exactly match the provided field sorts.
36
+ */
37
+ sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
38
+ /**
39
+ * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
40
+ * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
41
+ * additional conditions, as these only narrow the result set.
42
+ *
43
+ * @param fieldName The name of the field for the condition.
44
+ * @param operator The operator of the condition.
45
+ * @param value The value of the condition.
46
+ * @returns Whether the query is a subquery of the parent condition.
47
+ */
48
+ isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
49
+ /**
50
+ * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
51
+ * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
52
+ * additional conditions, as these only narrow the result set.
53
+ *
54
+ * @param condition The condition to validate.
55
+ * @returns Whether the query is a subquery of the parent condition.
56
+ */
57
+ isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
58
+ /**
59
+ * Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
60
+ * to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
61
+ * additional conditions, as these only narrow the result set.
62
+ *
63
+ * @param conditions The conditions to validate.
64
+ * @returns Whether the query includes subquery of the parent conditions.
65
+ */
66
+ isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
67
+ /**
68
+ * Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
69
+ * to a subset of the results that obtained for the parent query, including sorts and limits.
70
+ *
71
+ * @param query The query to validate.
72
+ * @returns Whether the query is a subquery of the parent query.
73
+ */
74
+ isSubqueryOfQuery(query: Query<T>): boolean;
75
+ /**
76
+ * Returns all conditions that apply to any of the specified field names. This method
77
+ * provides a convenient way to retrieve all conditions that involve a specific set of fields.
78
+ *
79
+ * @param fieldNames The field names for which to retrieve conditions.
80
+ * @returns An array of conditions that involve any of the specified field names.
81
+ */
82
+ getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
83
+ /**
84
+ * Returns all conditions that apply to the specified field name. This method provides
85
+ * a convenient way to retrieve all conditions that involve a specific field.
86
+ *
87
+ * @param fieldName The field name for which to retrieve conditions.
88
+ * @returns An array of conditions that involve the specified field name.
89
+ */
90
+ getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
91
+ /**
92
+ * Returns true if the given document can be a result of the query.
93
+ * The method does not account for limit and sort order.
94
+ */
95
+ documentMatchesQuery(doc: DocumentData): boolean;
96
+ /**
97
+ * Compares a condition against a given operator and value to determine if the
98
+ * provided condition is a subset of the operator and value. A condition is
99
+ * considered a subset if all values that satisfy (return true for) the
100
+ * condition also satisfy the operator and value.
101
+ *
102
+ * This is done using the underlying CompareTable, which provides a comparison
103
+ * function for each operator pair, or undefined if the comparison would
104
+ * always be false, regardless of the values.
105
+ */
106
+ private evaluateSubset;
107
+ private evaluateIncludes;
108
+ private parseConditions;
109
+ }
110
+ /** A list of context conditions */
111
+ export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
112
+ /** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
113
+ type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
114
+ interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
115
+ operator: 'in';
116
+ value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
117
+ }
118
+ interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
119
+ operator: 'not in';
120
+ value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
121
+ }
122
+ interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
123
+ operator: Exclude<ContextOperator, 'in' | 'not in'>;
124
+ value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
125
+ }
126
+ /** A condition that includes the 'in' and 'not in' operators. */
127
+ interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
128
+ operator: AllOperators;
129
+ value: any;
130
+ }
131
+ /** A list of general conditions. */
132
+ type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
133
+ type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
134
+ type AllOperators = Operator | 'in' | 'not in';
135
+ /** A generic value that can exist in a query. */
136
+ type GenericValue<Doc = any, F extends Paths<Doc> = Paths<Doc>, O extends AllOperators = any> = O extends 'in' ? Array<DeepRecord<Doc>[F]> | null : O extends 'not in' ? Array<DeepRecord<Doc>[F]> | null : DeepRecord<Doc>[F] | null;
137
+ export {};
@@ -1,24 +1,24 @@
1
- import { DocumentData } from '../document.types';
2
- import { Query, Alias, JoinCondition } from '../query.types';
3
- export type SerializedSimpleQuery = {
4
- type: 'simple';
5
- query: Query;
6
- dereference: boolean;
7
- };
8
- export type SerializedJoinQuery = {
9
- type: 'join';
10
- grouped: boolean;
11
- dereference: boolean;
12
- root: {
13
- alias: Alias;
14
- query: Query;
15
- };
16
- leftToRight: Record<Alias, Alias[]>;
17
- joins: Record<Alias, Query<DocumentData>>;
18
- joinConditions: Record<Alias, JoinCondition>;
19
- };
20
- export type SerializedMergedQuery = {
21
- type: 'merged';
22
- queries: Array<SerializedQuery>;
23
- };
24
- export type SerializedQuery = SerializedSimpleQuery | SerializedJoinQuery | SerializedMergedQuery;
1
+ import { DocumentData } from '../document.types';
2
+ import { Query, Alias, JoinCondition } from '../query.types';
3
+ export type SerializedSimpleQuery = {
4
+ type: 'simple';
5
+ query: Query;
6
+ dereference: boolean;
7
+ };
8
+ export type SerializedJoinQuery = {
9
+ type: 'join';
10
+ grouped: boolean;
11
+ dereference: boolean;
12
+ root: {
13
+ alias: Alias;
14
+ query: Query;
15
+ };
16
+ leftToRight: Record<Alias, Alias[]>;
17
+ joins: Record<Alias, Query<DocumentData>>;
18
+ joinConditions: Record<Alias, JoinCondition>;
19
+ };
20
+ export type SerializedMergedQuery = {
21
+ type: 'merged';
22
+ queries: Array<SerializedQuery>;
23
+ };
24
+ export type SerializedQuery = SerializedSimpleQuery | SerializedJoinQuery | SerializedMergedQuery;
@@ -1,64 +1,64 @@
1
- import { ClientRequestId } from './communication.types';
2
- import { CollectionName, DocumentData, FieldName } from './document.types';
3
- import { Paths } from './types';
4
- /**
5
- * An alias for a join result. This is used to disambiguate fields in the result.
6
- */
7
- export type Alias = string;
8
- /**
9
- * A join condition.
10
- * The join conditions defines the alias for the left side of the join and the field names to join on.
11
- */
12
- export interface JoinCondition {
13
- leftAlias: Alias;
14
- left: FieldName;
15
- right: FieldName;
16
- isInner: boolean;
17
- }
18
- /** A list of query conditions. */
19
- export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
20
- export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
21
- /** A single field query condition. */
22
- export interface SimpleCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>, MyOperator = Operator> {
23
- fieldName: F;
24
- operator: MyOperator;
25
- value: any;
26
- }
27
- /**
28
- * A composite fields query condition.
29
- * Just a list of simple conditions with specific set of operators. It should be
30
- * evaluated this way:
31
- * If A, B, C are the conditions and A` = A with '==' operator:
32
- * A || (A' && B) || (A' && B' && C)
33
- */
34
- export interface CompositeCondition<Doc extends DocumentData = any> {
35
- fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
36
- }
37
- export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
38
- type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
39
- /** An operator in a query condition. */
40
- export type Operator = '==' | '!=' | CompositeConditionOperator | 'like' | 'not like' | 'like_cs' | 'not like_cs';
41
- /** A definition of a sort by a filed. */
42
- export interface FieldSort<Doc> {
43
- fieldName: FieldName<Doc>;
44
- asc: boolean;
45
- }
46
- /** A query object. */
47
- export interface Query<Doc extends DocumentData = any> {
48
- collectionName: CollectionName;
49
- integrationId: string;
50
- conditions: Conditions<Doc>;
51
- sortOrder: Array<FieldSort<Doc>>;
52
- limit: number;
53
- limitBy?: {
54
- limit: number;
55
- fields: Array<FieldName<Doc>>;
56
- reverseSort: boolean;
57
- };
58
- }
59
- export interface QueryRegisterRequest {
60
- clientRequestId: ClientRequestId;
61
- query: Query;
62
- parentClientRequestId: ClientRequestId;
63
- }
64
- export {};
1
+ import { ClientRequestId } from './communication.types';
2
+ import { CollectionName, DocumentData, FieldName } from './document.types';
3
+ import { Paths } from './types';
4
+ /**
5
+ * An alias for a join result. This is used to disambiguate fields in the result.
6
+ */
7
+ export type Alias = string;
8
+ /**
9
+ * A join condition.
10
+ * The join conditions defines the alias for the left side of the join and the field names to join on.
11
+ */
12
+ export interface JoinCondition {
13
+ leftAlias: Alias;
14
+ left: FieldName;
15
+ right: FieldName;
16
+ isInner: boolean;
17
+ }
18
+ /** A list of query conditions. */
19
+ export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
20
+ export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
21
+ /** A single field query condition. */
22
+ export interface SimpleCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>, MyOperator = Operator> {
23
+ fieldName: F;
24
+ operator: MyOperator;
25
+ value: any;
26
+ }
27
+ /**
28
+ * A composite fields query condition.
29
+ * Just a list of simple conditions with specific set of operators. It should be
30
+ * evaluated this way:
31
+ * If A, B, C are the conditions and A` = A with '==' operator:
32
+ * A || (A' && B) || (A' && B' && C)
33
+ */
34
+ export interface CompositeCondition<Doc extends DocumentData = any> {
35
+ fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
36
+ }
37
+ export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
38
+ type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
39
+ /** An operator in a query condition. */
40
+ export type Operator = '==' | '!=' | CompositeConditionOperator | 'like' | 'not like' | 'like_cs' | 'not like_cs';
41
+ /** A definition of a sort by a filed. */
42
+ export interface FieldSort<Doc> {
43
+ fieldName: FieldName<Doc>;
44
+ asc: boolean;
45
+ }
46
+ /** A query object. */
47
+ export interface Query<Doc extends DocumentData = any> {
48
+ collectionName: CollectionName;
49
+ integrationId: string;
50
+ conditions: Conditions<Doc>;
51
+ sortOrder: Array<FieldSort<Doc>>;
52
+ limit: number;
53
+ limitBy?: {
54
+ limit: number;
55
+ fields: Array<FieldName<Doc>>;
56
+ reverseSort: boolean;
57
+ };
58
+ }
59
+ export interface QueryRegisterRequest {
60
+ clientRequestId: ClientRequestId;
61
+ query: Query;
62
+ parentClientRequestId: ClientRequestId;
63
+ }
64
+ export {};
@@ -1 +1 @@
1
- export type SupportedSquidRegion = (typeof SupportedSquidRegions)[number];
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' | '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
+ 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 +1 @@
1
- export {};
1
+ export {};
@@ -1,22 +1,22 @@
1
- /** The secret key, an alias for a string. */
2
- export type SecretKey = string;
3
- /** The secret value. */
4
- export type SecretValue = string | number | boolean;
5
- /** A type alias for an ApiKey. */
6
- export type ApiKey = string;
7
- export type SetSecretEntry = {
8
- key: SecretKey;
9
- value?: SecretValue;
10
- };
11
- export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
12
- export declare const APP_API_KEY = "APP_API_KEY";
13
- export interface SecretEntry<T extends SecretValue = SecretValue> extends SecretMetadata {
14
- value: T;
15
- }
16
- export interface ApiKeyEntry extends SecretMetadata {
17
- value: string;
18
- }
19
- export interface SetSecretRequestEntry {
20
- key: SecretKey;
21
- value: SecretValue;
22
- }
1
+ /** The secret key, an alias for a string. */
2
+ export type SecretKey = string;
3
+ /** The secret value. */
4
+ export type SecretValue = string | number | boolean;
5
+ /** A type alias for an ApiKey. */
6
+ export type ApiKey = string;
7
+ export type SetSecretEntry = {
8
+ key: SecretKey;
9
+ value?: SecretValue;
10
+ };
11
+ export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
12
+ export declare const APP_API_KEY = "APP_API_KEY";
13
+ export interface SecretEntry<T extends SecretValue = SecretValue> extends SecretMetadata {
14
+ value: T;
15
+ }
16
+ export interface ApiKeyEntry extends SecretMetadata {
17
+ value: string;
18
+ }
19
+ export interface SetSecretRequestEntry {
20
+ key: SecretKey;
21
+ value: SecretValue;
22
+ }
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,5 +1,5 @@
1
- export declare enum ClientConnectionState {
2
- CONNECTED = "CONNECTED",
3
- DISCONNECTED = "DISCONNECTED",
4
- REMOVED = "REMOVED"
5
- }
1
+ export declare enum ClientConnectionState {
2
+ CONNECTED = "CONNECTED",
3
+ DISCONNECTED = "DISCONNECTED",
4
+ REMOVED = "REMOVED"
5
+ }