@squidcloud/client 1.0.145 → 1.0.146-beta
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/cjs/index.js +1 -53942
- package/dist/esm/index.js +1 -0
- package/dist/internal-common/src/metric-name.d.ts +9 -0
- package/dist/internal-common/src/public-types/ai-agent-integrations.public-types.d.ts +47 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +895 -0
- package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +31 -0
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +185 -0
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +431 -0
- package/dist/internal-common/src/public-types/ai-matchmaking.public-types.d.ts +186 -0
- package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +170 -0
- package/dist/internal-common/src/public-types/api-client.public-types.d.ts +9 -0
- package/dist/internal-common/src/public-types/api.public-types.d.ts +91 -0
- package/dist/internal-common/src/public-types/backend.public-types.d.ts +50 -0
- package/dist/{common/src/backend-function.schemas.d.ts → internal-common/src/public-types/code-executor.public-types.d.ts} +1 -1
- package/dist/internal-common/src/public-types/communication.public-types.d.ts +30 -0
- package/dist/internal-common/src/public-types/context.public-types.d.ts +83 -0
- package/dist/internal-common/src/public-types/document.public-types.d.ts +71 -0
- package/dist/internal-common/src/public-types/external-auth/external-auth.public-types.d.ts +39 -0
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +183 -0
- package/dist/internal-common/src/public-types/http-status.public-types.d.ts +415 -0
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +51 -0
- package/dist/internal-common/src/public-types/job.public-types.d.ts +59 -0
- package/dist/internal-common/src/public-types/metric.public-types.d.ts +154 -0
- package/dist/internal-common/src/public-types/openapi.public-types.d.ts +9 -0
- package/dist/internal-common/src/public-types/query.public-types.d.ts +113 -0
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +4 -0
- package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +43 -0
- package/dist/{common/src/schema/schema.types.d.ts → internal-common/src/public-types/schema.public-types.d.ts} +54 -54
- package/dist/internal-common/src/public-types/secret.public-types.d.ts +51 -0
- package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +60 -0
- package/dist/internal-common/src/public-types/socket.public-types.d.ts +4 -0
- package/dist/{common/src/types.d.ts → internal-common/src/public-types/typescript.public-types.d.ts} +20 -14
- package/dist/internal-common/src/public-types/web.public-types.d.ts +93 -0
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +148 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +72 -0
- package/dist/{common/src/query/query-context.d.ts → internal-common/src/public-types-backend/query.public-context.d.ts} +177 -137
- package/dist/{common/src/ai-chatbot.schemas.d.ts → internal-common/src/public-utils/context-utils.d.ts} +1 -1
- package/dist/internal-common/src/public-utils/id-utils.d.ts +44 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +199 -0
- package/dist/{common/src/mutation.schemas.d.ts → internal-common/src/types/ai-assistant.types.d.ts} +1 -1
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +202 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +59 -0
- package/dist/{common/src → internal-common/src/types}/backend-function.types.d.ts +1 -1
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +17 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +5 -0
- package/dist/internal-common/src/types/observability.types.d.ts +78 -0
- package/dist/internal-common/src/types/query.types.d.ts +13 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/{common/src → internal-common/src/types}/time-units.d.ts +1 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +41 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/{common → internal-common}/src/utils/global.utils.d.ts +1 -1
- package/dist/internal-common/src/utils/http.d.ts +5 -0
- package/dist/{common → internal-common}/src/utils/lock.manager.d.ts +14 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +58 -0
- package/dist/internal-common/src/utils/serialization.d.ts +17 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +1 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +19 -0
- package/dist/{common → internal-common}/src/websocket.impl.d.ts +26 -21
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/admin-client.d.ts +23 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +181 -0
- package/dist/typescript-client/src/agent/ai-agent-client.d.ts +37 -0
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +69 -0
- package/dist/typescript-client/src/ai-assistant-client.d.ts +72 -73
- package/dist/typescript-client/src/ai-audio-client.d.ts +25 -0
- package/dist/typescript-client/src/ai-client.d.ts +129 -0
- package/dist/typescript-client/src/ai-files-client.d.ts +33 -0
- package/dist/typescript-client/src/ai-image-client.d.ts +25 -0
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +86 -0
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +28 -0
- package/dist/typescript-client/src/ai-matchmaking-client.d.ts +99 -0
- package/dist/typescript-client/src/api-client.d.ts +69 -0
- package/dist/typescript-client/src/auth.manager.d.ts +11 -26
- package/dist/typescript-client/src/backend-function.manager.d.ts +1 -9
- package/dist/typescript-client/src/client-customization.utils.d.ts +1 -0
- package/dist/typescript-client/src/client-id.service.d.ts +1 -27
- package/dist/typescript-client/src/collection-reference.d.ts +105 -80
- package/dist/typescript-client/src/collection-reference.factory.d.ts +1 -13
- package/dist/typescript-client/src/connection-details.d.ts +24 -23
- package/dist/typescript-client/src/console-utils.d.ts +1 -0
- package/dist/typescript-client/src/data.manager.d.ts +1 -173
- package/dist/typescript-client/src/destruct.manager.d.ts +1 -12
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +39 -16
- package/dist/typescript-client/src/document-identity.service.d.ts +1 -12
- package/dist/typescript-client/src/document-reference.d.ts +151 -140
- package/dist/typescript-client/src/document-reference.factory.d.ts +1 -13
- package/dist/typescript-client/src/document-store.d.ts +1 -14
- package/dist/typescript-client/src/execute-function-options.d.ts +73 -0
- package/dist/typescript-client/src/external-auth-client.d.ts +36 -0
- package/dist/typescript-client/src/extraction-client.d.ts +32 -0
- package/dist/typescript-client/src/file-args-transformer.d.ts +1 -0
- package/dist/typescript-client/src/file-utils.d.ts +1 -0
- package/dist/typescript-client/src/index.d.ts +63 -9
- package/dist/typescript-client/src/integration-client.d.ts +60 -0
- package/dist/typescript-client/src/job-client.d.ts +32 -0
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +1 -10
- package/dist/typescript-client/src/native-query-manager.d.ts +1 -7
- package/dist/typescript-client/src/notification-client.d.ts +20 -0
- package/dist/typescript-client/src/observability-client.d.ts +43 -0
- package/dist/typescript-client/src/public-types.d.ts +30 -0
- package/dist/typescript-client/src/public-utils.d.ts +1 -0
- package/dist/typescript-client/src/query/deserializer.d.ts +10 -3
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +316 -161
- package/dist/typescript-client/src/query/local-query-manager.d.ts +1 -9
- package/dist/{common → typescript-client}/src/query/pagination.d.ts +65 -62
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +228 -77
- package/dist/typescript-client/src/query/query-sender.d.ts +1 -33
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -130
- package/dist/typescript-client/src/query/query.types.d.ts +16 -49
- package/dist/typescript-client/src/query/snapshot-emitter.d.ts +41 -0
- package/dist/typescript-client/src/query-utils.d.ts +18 -0
- package/dist/typescript-client/src/queue.manager.d.ts +12 -0
- package/dist/typescript-client/src/rate-limiter.d.ts +1 -32
- package/dist/typescript-client/src/rpc.manager.d.ts +1 -30
- package/dist/typescript-client/src/scheduler-client.d.ts +31 -0
- package/dist/typescript-client/src/secret.client.d.ts +96 -22
- package/dist/typescript-client/src/socket.manager.d.ts +1 -43
- package/dist/typescript-client/src/squid-http-client.d.ts +11 -0
- package/dist/typescript-client/src/squid.d.ts +378 -269
- package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
- package/dist/typescript-client/src/storage-client.d.ts +145 -0
- package/dist/typescript-client/src/types.d.ts +27 -2
- package/dist/typescript-client/src/version.d.ts +5 -0
- package/dist/typescript-client/src/web-client.d.ts +63 -0
- package/dist/typescript-client/src/webhook.manager.d.ts +10 -0
- package/package.json +34 -18
- package/dist/common/src/ai-assistant.types.d.ts +0 -25
- package/dist/common/src/ai-chatbot.context.d.ts +0 -12
- package/dist/common/src/ai-chatbot.types.d.ts +0 -27
- package/dist/common/src/api-call.context.d.ts +0 -13
- package/dist/common/src/api.types.d.ts +0 -4
- package/dist/common/src/application.schemas.d.ts +0 -66
- package/dist/common/src/application.types.d.ts +0 -143
- package/dist/common/src/backend-run.types.d.ts +0 -2
- package/dist/common/src/bundle-api.types.d.ts +0 -43
- package/dist/common/src/bundle-data.types.d.ts +0 -5
- package/dist/common/src/communication.types.d.ts +0 -8
- package/dist/common/src/context.types.d.ts +0 -40
- package/dist/common/src/distributed-lock.context.d.ts +0 -4
- package/dist/common/src/document.types.d.ts +0 -22
- package/dist/common/src/graphql.context.d.ts +0 -7
- package/dist/common/src/graphql.types.d.ts +0 -9
- package/dist/common/src/heartbeat.types.d.ts +0 -1
- package/dist/common/src/http-status.enum.d.ts +0 -50
- package/dist/common/src/index.d.ts +0 -57
- package/dist/common/src/integrations/ai_chatbot.types.d.ts +0 -31
- package/dist/common/src/integrations/api.types.d.ts +0 -80
- package/dist/common/src/integrations/auth.types.d.ts +0 -47
- package/dist/common/src/integrations/database.types.d.ts +0 -274
- package/dist/common/src/integrations/index.d.ts +0 -134
- package/dist/common/src/integrations/observability.types.d.ts +0 -23
- package/dist/common/src/logger.types.d.ts +0 -21
- package/dist/common/src/metrics.types.d.ts +0 -1
- package/dist/common/src/mutation.context.d.ts +0 -14
- package/dist/common/src/mutation.types.d.ts +0 -53
- package/dist/common/src/named-query.context.d.ts +0 -4
- package/dist/common/src/named-query.schemas.d.ts +0 -1
- package/dist/common/src/named-query.types.d.ts +0 -1
- package/dist/common/src/native-query.context.d.ts +0 -7
- package/dist/common/src/native-query.types.d.ts +0 -16
- package/dist/common/src/query/base-query-builder.d.ts +0 -147
- package/dist/common/src/query/index.d.ts +0 -4
- package/dist/common/src/query/serialized-query.types.d.ts +0 -24
- package/dist/common/src/query.types.d.ts +0 -64
- package/dist/common/src/regions.d.ts +0 -1
- package/dist/common/src/secret.schemas.d.ts +0 -1
- package/dist/common/src/secret.types.d.ts +0 -22
- package/dist/common/src/security.types.d.ts +0 -1
- package/dist/common/src/socket.schemas.d.ts +0 -1
- package/dist/common/src/socket.types.d.ts +0 -5
- package/dist/common/src/trigger.types.d.ts +0 -1
- package/dist/common/src/utils/array.d.ts +0 -1
- package/dist/common/src/utils/assert.d.ts +0 -1
- package/dist/common/src/utils/error.d.ts +0 -4
- package/dist/common/src/utils/http.d.ts +0 -2
- package/dist/common/src/utils/id.d.ts +0 -2
- package/dist/common/src/utils/object.d.ts +0 -5
- package/dist/common/src/utils/serialization.d.ts +0 -6
- package/dist/common/src/utils/transforms.d.ts +0 -18
- package/dist/common/src/utils/url.d.ts +0 -1
- package/dist/common/src/utils/validation.d.ts +0 -25
- package/dist/common/src/webhook-response.d.ts +0 -1
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +0 -174
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +0 -8
- package/dist/typescript-client/src/ai.types.d.ts +0 -61
- package/dist/typescript-client/src/api.manager.d.ts +0 -11
- package/dist/typescript-client/src/graphql-client.d.ts +0 -14
- package/dist/typescript-client/src/graphql-client.factory.d.ts +0 -11
- package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
- package/dist/typescript-client/src/state/action.applier.d.ts +0 -7
- package/dist/typescript-client/src/state/actions.d.ts +0 -29
- package/dist/typescript-client/src/state/path_trie.d.ts +0 -27
- package/dist/typescript-client/src/state/state.service.d.ts +0 -22
- package/dist/typescript-client/src/testing/setup-tests.d.ts +0 -1
|
@@ -1,269 +1,378 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
private readonly
|
|
99
|
-
private readonly
|
|
100
|
-
private readonly
|
|
101
|
-
private readonly
|
|
102
|
-
private
|
|
103
|
-
private readonly
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
*
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* @param integrationId The id of the integration
|
|
181
|
-
* @
|
|
182
|
-
* @
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* @
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* @param
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* @returns
|
|
214
|
-
*
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* @param
|
|
230
|
-
*
|
|
231
|
-
* @
|
|
232
|
-
*
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @returns A promise that resolves
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
1
|
+
import { AdminClient } from './admin-client';
|
|
2
|
+
import { AiClient } from './ai-client';
|
|
3
|
+
import { ApiClient } from './api-client';
|
|
4
|
+
import { CollectionReference } from './collection-reference';
|
|
5
|
+
import { ConnectionDetails } from './connection-details';
|
|
6
|
+
import { DistributedLock, DistributedLockOptions } from './distributed-lock.manager';
|
|
7
|
+
import { ExecuteFunctionOptions } from './execute-function-options';
|
|
8
|
+
import { ExternalAuthClient } from './external-auth-client';
|
|
9
|
+
import { ExtractionClient } from './extraction-client';
|
|
10
|
+
import { JobClient } from './job-client';
|
|
11
|
+
import { NotificationClient } from './notification-client';
|
|
12
|
+
import { ObservabilityClient } from './observability-client';
|
|
13
|
+
import { ApiKey, AppId, CollectionName, DocumentData, EnvironmentId, IntegrationId, SquidDeveloperId, SquidRegion } from './public-types';
|
|
14
|
+
import { QueueManager } from './queue.manager';
|
|
15
|
+
import { SchedulerClient } from './scheduler-client';
|
|
16
|
+
import { StorageClient } from './storage-client';
|
|
17
|
+
import { TransactionId } from './types';
|
|
18
|
+
import { WebClient } from './web-client';
|
|
19
|
+
import { ExecuteWebhookOptions } from './webhook.manager';
|
|
20
|
+
/**
|
|
21
|
+
* The different options that can be used to initialize a Squid instance.
|
|
22
|
+
* @category Platform
|
|
23
|
+
*/
|
|
24
|
+
export interface SquidOptions {
|
|
25
|
+
/**
|
|
26
|
+
* A function that can be used to wrap messages coming from Squid to the application. This is useful for
|
|
27
|
+
* different frameworks that need to wrap messages in order to detect changes (like Angular).
|
|
28
|
+
* @param fn The function to wrap.
|
|
29
|
+
*/
|
|
30
|
+
messageNotificationWrapper?: (fn: () => any) => any;
|
|
31
|
+
/**
|
|
32
|
+
* The application ID that is used to identify the application in Squid. The ID can be found in the Squid Cloud
|
|
33
|
+
* Console.
|
|
34
|
+
*/
|
|
35
|
+
appId: AppId;
|
|
36
|
+
/**
|
|
37
|
+
* The application API key, using the API key can be used to bypass security rules and other restrictions.
|
|
38
|
+
* The API key can be found in the Squid Console.
|
|
39
|
+
*/
|
|
40
|
+
apiKey?: ApiKey;
|
|
41
|
+
/**
|
|
42
|
+
* Access token provider for the Squid instance.
|
|
43
|
+
* Used for managing the process of verifying the identity and authorization of users who attempt to access this
|
|
44
|
+
* application via the current Squid instance.
|
|
45
|
+
*
|
|
46
|
+
* When the authProvider is set, the Squid service will fetch a token and include it with every request to the Squid
|
|
47
|
+
* backend.
|
|
48
|
+
*
|
|
49
|
+
* On the backend, Squid will validate the access token.
|
|
50
|
+
*/
|
|
51
|
+
authProvider?: SquidAuthProvider;
|
|
52
|
+
/**
|
|
53
|
+
* The region that the application is running in. This is used to determine the URL of the Squid API.
|
|
54
|
+
*/
|
|
55
|
+
region: SquidRegion;
|
|
56
|
+
/**
|
|
57
|
+
* The environment ID to work with, if not specified the default environment (prod) will be used.
|
|
58
|
+
*/
|
|
59
|
+
environmentId?: EnvironmentId;
|
|
60
|
+
/**
|
|
61
|
+
* The user ID of the developer that runs the environment locally.
|
|
62
|
+
*/
|
|
63
|
+
squidDeveloperId?: SquidDeveloperId;
|
|
64
|
+
/**
|
|
65
|
+
* The console region (optional and used for on-prem deployments of Squid)
|
|
66
|
+
*/
|
|
67
|
+
consoleRegion?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Authentication data provider for Squid requests.
|
|
71
|
+
* @category Authentication
|
|
72
|
+
*/
|
|
73
|
+
export interface SquidAuthProvider {
|
|
74
|
+
/**
|
|
75
|
+
* Optional Auth integration id.
|
|
76
|
+
* Sent as a part of all Squid requests to the backend.
|
|
77
|
+
*/
|
|
78
|
+
integrationId: string;
|
|
79
|
+
/**
|
|
80
|
+
* Returns a valid AccessToken or undefined if there is no active authorized session.
|
|
81
|
+
* Called by Squid every time a Squid client makes requests to the Squid backend.
|
|
82
|
+
*/
|
|
83
|
+
getToken(): Promise<string | undefined> | string | undefined;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The main entry point to the Squid Client SDK.
|
|
87
|
+
*
|
|
88
|
+
* The Squid class provides a comprehensive array of functionality for accessing the different integrations, executing
|
|
89
|
+
* backend functions, managing data, and more. Upon instantiating the Squid class, you will have access to all of these
|
|
90
|
+
* capabilities.
|
|
91
|
+
* All public Squid functions are bound to `this` and can be used with a destructuring patterns,
|
|
92
|
+
* like `const {setAuthProvider} = useSquid()`
|
|
93
|
+
*
|
|
94
|
+
* @category Platform
|
|
95
|
+
*/
|
|
96
|
+
export declare class Squid {
|
|
97
|
+
readonly options: SquidOptions;
|
|
98
|
+
private static readonly squidInstancesMap;
|
|
99
|
+
private readonly socketManager;
|
|
100
|
+
private readonly dataManager;
|
|
101
|
+
private readonly documentReferenceFactory;
|
|
102
|
+
private readonly documentStore;
|
|
103
|
+
private readonly lockManager;
|
|
104
|
+
private readonly querySubscriptionManager;
|
|
105
|
+
private readonly localQueryManager;
|
|
106
|
+
private readonly queryBuilderFactory;
|
|
107
|
+
private readonly collectionReferenceFactory;
|
|
108
|
+
private readonly backendFunctionManager;
|
|
109
|
+
private readonly webhookManager;
|
|
110
|
+
private readonly nativeQueryManager;
|
|
111
|
+
private readonly destructManager;
|
|
112
|
+
private readonly documentIdentityService;
|
|
113
|
+
private readonly distributedLockManager;
|
|
114
|
+
private readonly authManager;
|
|
115
|
+
private readonly clientIdService;
|
|
116
|
+
private readonly _connectionDetails;
|
|
117
|
+
private readonly querySender;
|
|
118
|
+
private readonly aiClient;
|
|
119
|
+
private readonly jobClient;
|
|
120
|
+
private readonly apiClient;
|
|
121
|
+
private readonly adminClient;
|
|
122
|
+
private readonly webClient;
|
|
123
|
+
private readonly observabilityClient;
|
|
124
|
+
private readonly queueManagerFactory;
|
|
125
|
+
private readonly schedulerClient;
|
|
126
|
+
private readonly notificationClient;
|
|
127
|
+
private readonly _appId;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new instance of Squid with the given options.
|
|
130
|
+
*
|
|
131
|
+
* @param options The options for initializing the Squid instance.
|
|
132
|
+
*/
|
|
133
|
+
constructor(options: SquidOptions);
|
|
134
|
+
/**
|
|
135
|
+
* Returns the observability client for metrics.
|
|
136
|
+
*/
|
|
137
|
+
get observability(): ObservabilityClient;
|
|
138
|
+
/**
|
|
139
|
+
* Returns the scheduler client for managing scheduled jobs and tasks.
|
|
140
|
+
*/
|
|
141
|
+
get schedulers(): SchedulerClient;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the application ID of the current Squid instance.
|
|
144
|
+
*/
|
|
145
|
+
get appId(): AppId;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the global Squid instance with the given options, creating a new instance if one with the same options
|
|
148
|
+
* does not exist.
|
|
149
|
+
*
|
|
150
|
+
* @param options The options for initializing the Squid instance.
|
|
151
|
+
* @returns A global Squid instance with the given options.
|
|
152
|
+
*/
|
|
153
|
+
static getInstance(options: SquidOptions): Squid;
|
|
154
|
+
/**
|
|
155
|
+
* Returns all the global Squid instances.
|
|
156
|
+
*
|
|
157
|
+
* @returns An array of all the global Squid instances.
|
|
158
|
+
*/
|
|
159
|
+
static getInstances(): Array<Squid>;
|
|
160
|
+
/**
|
|
161
|
+
* Sets the authorization access token (OAuth2.0) provider that will be sent to the server and will be used for
|
|
162
|
+
* providing the `auth` object to the security rules.
|
|
163
|
+
*
|
|
164
|
+
* @param authProvider The OAuth2.0 access token provider invoked for every backend request by Squid.
|
|
165
|
+
* When the provider returns undefined, no authorization information is sent.
|
|
166
|
+
* When a new provider is set, all future Squid backend requests will use the new token provider, and exising
|
|
167
|
+
* in-flight requests won't be affected.
|
|
168
|
+
* @returns void.
|
|
169
|
+
*/
|
|
170
|
+
setAuthProvider(authProvider: SquidAuthProvider): void;
|
|
171
|
+
/**
|
|
172
|
+
* Returns a reference to the collection in the provided integration.
|
|
173
|
+
*
|
|
174
|
+
* If the integrationId is not provided, the `built_in_db` integration id will be used.
|
|
175
|
+
*
|
|
176
|
+
* For more information on the CollectionReference object, please refer to the
|
|
177
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/collection-reference documentation}.
|
|
178
|
+
*
|
|
179
|
+
* @param collectionName The name of the collection.
|
|
180
|
+
* @param integrationId The id of the integration, default to `built_in_db`.
|
|
181
|
+
* @returns A reference to the collection in the provided integration.
|
|
182
|
+
* @typeParam T The type of the documents in the collection.
|
|
183
|
+
*/
|
|
184
|
+
collection<T extends DocumentData>(collectionName: CollectionName, integrationId?: IntegrationId): CollectionReference<T>;
|
|
185
|
+
/**
|
|
186
|
+
* Runs the given callback as an atomic change. All the mutations that are executed using the provided transactionId
|
|
187
|
+
* will be atomic. Note that mutations for different integrations will not be atomic.
|
|
188
|
+
*
|
|
189
|
+
* For more information about transactions in Squid, please refer to the
|
|
190
|
+
* {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/transactions documentation}.
|
|
191
|
+
*
|
|
192
|
+
* @param fn The callback to run as an atomic change. The function receives a transactionId that should be used for
|
|
193
|
+
* all the mutations that should be atomic. The function should return a promise.
|
|
194
|
+
*
|
|
195
|
+
* @returns A promise that resolves when the transactions are committed on the server.
|
|
196
|
+
*/
|
|
197
|
+
runInTransaction<T = any>(fn: (transactionId: TransactionId) => Promise<T>): Promise<T>;
|
|
198
|
+
/**
|
|
199
|
+
* Executes a backend function identified by its name, passing the provided parameters, and returns a promise with
|
|
200
|
+
* the result.
|
|
201
|
+
*
|
|
202
|
+
* For detailed information on backend functions in Squid, see the
|
|
203
|
+
* {@link https://docs.getsquid.ai/docs/sdk/backend-sdk/executables documentation}.
|
|
204
|
+
*
|
|
205
|
+
* Files support:
|
|
206
|
+
* - To send a file to the backend, simply include it as one of the parameters; it will be received as a `SquidFile`
|
|
207
|
+
* on the backend.
|
|
208
|
+
* - Arrays of files can also be passed directly as parameters.
|
|
209
|
+
*
|
|
210
|
+
* @param functionNameOrOptions - The name of the backend function to execute or detailed options which include
|
|
211
|
+
* additional advanced options along with the function name.
|
|
212
|
+
* @param params - A list of parameters to pass to the backend function.
|
|
213
|
+
* @returns A promise that resolves to the result of the backend function.
|
|
214
|
+
* @typeParam T - The expected type of the result returned by the backend function.
|
|
215
|
+
*/
|
|
216
|
+
executeFunction<T = any>(functionNameOrOptions: string | ExecuteFunctionOptions<T>, ...params: Array<any | File>): Promise<T>;
|
|
217
|
+
/**
|
|
218
|
+
* Executes a backend function with custom headers, passing the provided parameters, and returns a promise with
|
|
219
|
+
* the result. The headers will be accessible in the backend via `this.context.headers`.
|
|
220
|
+
*
|
|
221
|
+
* For detailed information on backend functions in Squid, see the
|
|
222
|
+
* {@link https://docs.getsquid.ai/docs/sdk/backend-sdk/executables documentation}.
|
|
223
|
+
*
|
|
224
|
+
* Files support:
|
|
225
|
+
* - To send a file to the backend, simply include it as one of the parameters; it will be received as a `SquidFile`
|
|
226
|
+
* on the backend.
|
|
227
|
+
* - Arrays of files can also be passed directly as parameters.
|
|
228
|
+
*
|
|
229
|
+
* @param functionNameOrOptions - The name of the backend function to execute or detailed options which include
|
|
230
|
+
* additional advanced options along with the function name.
|
|
231
|
+
* @param headers - Custom HTTP headers to send with the request. These headers will be available in the backend
|
|
232
|
+
* function via `this.context.headers`.
|
|
233
|
+
* @param params - A list of parameters to pass to the backend function.
|
|
234
|
+
* @returns A promise that resolves to the result of the backend function.
|
|
235
|
+
* @typeParam T - The expected type of the result returned by the backend function.
|
|
236
|
+
*/
|
|
237
|
+
executeFunctionWithHeaders<T = any>(functionNameOrOptions: string | ExecuteFunctionOptions<T>, headers: Record<string, string>, ...params: Array<any | File>): Promise<T>;
|
|
238
|
+
/**
|
|
239
|
+
* Executes a webhook identified by its ID, passing the provided options, and returns a promise with the result.
|
|
240
|
+
*
|
|
241
|
+
* For detailed information on webhooks in Squid, see the
|
|
242
|
+
* {@link https://docs.getsquid.ai/docs/sdk/backend-sdk/webhooks documentation}.
|
|
243
|
+
*
|
|
244
|
+
* Files support:
|
|
245
|
+
* - To send files to the webhook, include them in the options.files array; they will be received as `SquidFile`
|
|
246
|
+
* objects on the backend.
|
|
247
|
+
*
|
|
248
|
+
* @param webhookId - The ID of the webhook to execute.
|
|
249
|
+
* @param options - Optional configuration including headers, query parameters, body, and files.
|
|
250
|
+
* @returns A promise that resolves to the result of the webhook execution.
|
|
251
|
+
* @typeParam T - The expected type of the result returned by the webhook.
|
|
252
|
+
*/
|
|
253
|
+
executeWebhook<T = any>(webhookId: string, options?: ExecuteWebhookOptions): Promise<T>;
|
|
254
|
+
/**
|
|
255
|
+
* Executes a native relational query with the given parameters and returns a promise with the result.
|
|
256
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries.
|
|
257
|
+
*
|
|
258
|
+
* @param integrationId The id of the integration that the query is associated with.
|
|
259
|
+
* @param query The raw SQL or database-specific query string to execute. Use named bind variables enclosed in ${},
|
|
260
|
+
* e.g., ${firstName}.
|
|
261
|
+
* @param params (Optional) An object containing key-value pairs to bind to the query variables. Defaults to an empty
|
|
262
|
+
* object.
|
|
263
|
+
* @returns A promise that resolves with the result of the query.
|
|
264
|
+
*/
|
|
265
|
+
executeNativeRelationalQuery<T = any>(integrationId: IntegrationId, query: string, params?: Record<string, any>): Promise<Array<T>>;
|
|
266
|
+
/**
|
|
267
|
+
* Executes a native pure query with the given parameters and returns a promise with the result.
|
|
268
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries.
|
|
269
|
+
*
|
|
270
|
+
* @param integrationId The id of the integration that the query is associated with.
|
|
271
|
+
* @param query The raw SQL or database-specific query string to execute. Use named bind variables enclosed in ${},
|
|
272
|
+
* e.g., ${firstName}.
|
|
273
|
+
* @param params (Optional) An object containing key-value pairs to bind to the query variables. Defaults to an empty
|
|
274
|
+
* object.
|
|
275
|
+
* @returns A promise that resolves with the result of the query.
|
|
276
|
+
*/
|
|
277
|
+
executeNativePureQuery<T = any>(integrationId: IntegrationId, query: string, params?: Record<string, any>): Promise<Array<T>>;
|
|
278
|
+
/**
|
|
279
|
+
* Executes a native Mongo/built-in-db query with the given pipeline and returns a promise with the result.
|
|
280
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries#native-mongodb-queries.
|
|
281
|
+
*
|
|
282
|
+
* @param integrationId The id of the integration that the query is associated with.
|
|
283
|
+
* @param collectionName The collection to query.
|
|
284
|
+
* @param aggregationPipeline The aggregation pipeline for the query.
|
|
285
|
+
* @returns A promise that resolves with the result of the query.
|
|
286
|
+
*/
|
|
287
|
+
executeNativeMongoQuery<T = any>(integrationId: IntegrationId, collectionName: string, aggregationPipeline: Array<any | undefined>): Promise<Array<T>>;
|
|
288
|
+
/**
|
|
289
|
+
* Executes a native Elasticsearch query against the given index and endpoint.
|
|
290
|
+
* See https://docs.getsquid.ai/docs/sdk/client-sdk/database/native-queries.
|
|
291
|
+
*
|
|
292
|
+
* @param integrationId The id of the integration that the query is associated with.
|
|
293
|
+
* @param index The Elasticsearch index to query.
|
|
294
|
+
* @param body The raw request body to send (must be a valid ES query DSL object).
|
|
295
|
+
* @param endpoint The Elasticsearch endpoint to call (default: "_search").
|
|
296
|
+
* @param method The HTTP method to use (default: "GET").
|
|
297
|
+
* @returns A promise that resolves with the result array.
|
|
298
|
+
*/
|
|
299
|
+
executeNativeElasticQuery<T = any>(integrationId: IntegrationId, index: string, body: Record<string, any>, endpoint?: string, method?: 'GET' | 'POST'): Promise<Array<T>>;
|
|
300
|
+
/**
|
|
301
|
+
* Returns a set of AI specific clients.
|
|
302
|
+
*/
|
|
303
|
+
ai(): AiClient;
|
|
304
|
+
/**
|
|
305
|
+
* Returns a set of functionality for interacting with jobs.
|
|
306
|
+
*/
|
|
307
|
+
job(): JobClient;
|
|
308
|
+
/**
|
|
309
|
+
* Returns a set of functionality for interacting with API integrations.
|
|
310
|
+
*/
|
|
311
|
+
api(): ApiClient;
|
|
312
|
+
/**
|
|
313
|
+
* Returns the AdminClient instance for performing administrative operations.
|
|
314
|
+
*/
|
|
315
|
+
admin(): AdminClient;
|
|
316
|
+
/**
|
|
317
|
+
* Returns a set of functionality for interacting with the web.
|
|
318
|
+
*/
|
|
319
|
+
web(): WebClient;
|
|
320
|
+
/**
|
|
321
|
+
* Returns a client for accessing file storage for the current app.
|
|
322
|
+
* Defaults to the built-in storage integration if none is provided.
|
|
323
|
+
*
|
|
324
|
+
* @param integrationId The storage integration ID (default is 'built_in_storage').
|
|
325
|
+
*/
|
|
326
|
+
storage(integrationId?: IntegrationId): StorageClient;
|
|
327
|
+
/**
|
|
328
|
+
* Returns a client for managing external oauth tokens for integrations.
|
|
329
|
+
* Use this to save authorization codes and retrieve access tokens.
|
|
330
|
+
* Squid automatically handles token refresh when tokens expire.
|
|
331
|
+
*
|
|
332
|
+
* @param integrationId The integration ID
|
|
333
|
+
* @returns An ExternalAuthClient instance for the specified integration
|
|
334
|
+
*/
|
|
335
|
+
externalAuth(integrationId: IntegrationId): ExternalAuthClient;
|
|
336
|
+
/**
|
|
337
|
+
* Returns a client for working with structured data extraction tools.
|
|
338
|
+
*/
|
|
339
|
+
extraction(): ExtractionClient;
|
|
340
|
+
/**
|
|
341
|
+
* Returns a distributed lock for the given mutex. The lock can be used to synchronize access to a shared resource.
|
|
342
|
+
* The lock will be released when the release method on the returned object is invoked or whenever the connection
|
|
343
|
+
* with the server is lost.
|
|
344
|
+
* @param mutex A string that uniquely identifies the lock.
|
|
345
|
+
* @param options Optional configuration for the lock, including maxHoldTimeMillis to automatically release the lock
|
|
346
|
+
* after a specified duration.
|
|
347
|
+
* @returns A promise that resolves with the lock object. The promise will reject if failed to acquire the lock.
|
|
348
|
+
*/
|
|
349
|
+
acquireLock(mutex: string, options?: DistributedLockOptions): Promise<DistributedLock>;
|
|
350
|
+
/**
|
|
351
|
+
* Executes the given callback while holding a lock for the given mutex. The lock will be released when the callback
|
|
352
|
+
* finishes.
|
|
353
|
+
* @param mutex A string that uniquely identifies the lock.
|
|
354
|
+
* @param fn The callback to execute while holding the lock.
|
|
355
|
+
* @returns A promise that resolves with the result of the callback. The promise will reject if failed
|
|
356
|
+
* to acquire the lock.
|
|
357
|
+
*/
|
|
358
|
+
withLock<T>(mutex: string, fn: (lock: DistributedLock) => Promise<T>): Promise<T>;
|
|
359
|
+
/**
|
|
360
|
+
* Returns a queue manager for the given topic name and integration id. Using the queue manager you can consume and
|
|
361
|
+
* produce messages
|
|
362
|
+
*/
|
|
363
|
+
queue<T>(topicName: string, integrationId?: IntegrationId): QueueManager<T>;
|
|
364
|
+
/**
|
|
365
|
+
* Destructs the Squid Client. Unsubscribes from all ongoing queries or requests, and clears the local data.
|
|
366
|
+
* After invoking this method, the Squid client will not be usable.
|
|
367
|
+
*
|
|
368
|
+
* @returns A promise that resolves when the destruct process is complete.
|
|
369
|
+
*/
|
|
370
|
+
destruct(): Promise<void>;
|
|
371
|
+
/** Set to true if the client was destructured. */
|
|
372
|
+
get isDestructed(): boolean;
|
|
373
|
+
/** Provides information about the connection to the Squid Server. */
|
|
374
|
+
connectionDetails(): ConnectionDetails;
|
|
375
|
+
/** Returns the notification client for handling (publishing and receiving) custom messages. */
|
|
376
|
+
getNotificationClient(): NotificationClient;
|
|
377
|
+
private _validateNotDestructed;
|
|
378
|
+
}
|