@squidcloud/client 1.0.28 → 1.0.30

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 (32) hide show
  1. package/dist/common/src/api-call.context.d.ts +8 -13
  2. package/dist/common/src/api.types.d.ts +14 -1
  3. package/dist/common/src/application.schemas.d.ts +343 -51
  4. package/dist/common/src/application.types.d.ts +10 -4
  5. package/dist/common/src/backend-run.types.d.ts +0 -1
  6. package/dist/common/src/context.types.d.ts +10 -0
  7. package/dist/common/src/graphql.context.d.ts +0 -8
  8. package/dist/common/src/graphql.types.d.ts +8 -0
  9. package/dist/common/src/index.d.ts +1 -1
  10. package/dist/common/src/integration.types.d.ts +102 -22
  11. package/dist/common/src/logger.types.d.ts +0 -1
  12. package/dist/common/src/metrics.types.d.ts +56 -63
  13. package/dist/common/src/mutation.context.d.ts +0 -1
  14. package/dist/common/src/query/query-context.d.ts +0 -1
  15. package/dist/common/src/query/simple-query-builder.d.ts +78 -2
  16. package/dist/common/src/regions.d.ts +1 -0
  17. package/dist/common/src/secret.types.d.ts +2 -0
  18. package/dist/common/src/security.types.d.ts +3 -0
  19. package/dist/common/src/utils/validation.d.ts +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/package.json +1 -1
  22. package/dist/typescript-client/src/collection-reference.d.ts +38 -6
  23. package/dist/typescript-client/src/destruct.manager.d.ts +1 -1
  24. package/dist/typescript-client/src/document-reference.d.ts +74 -6
  25. package/dist/typescript-client/src/graphql-client.d.ts +3 -0
  26. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +49 -13
  27. package/dist/typescript-client/src/query/query-builder.factory.d.ts +27 -11
  28. package/dist/typescript-client/src/query/query.types.d.ts +7 -0
  29. package/dist/typescript-client/src/squid.d.ts +132 -12
  30. package/dist/typescript-client/src/types.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/dist/common/src/metrics.schemas.d.ts +0 -3
@@ -1,17 +1,12 @@
1
- import { ApiEndpoint, ApiEndpointId, ApiIntegration } from './integration.types';
2
- interface ApiRequest {
3
- endpointId: ApiEndpointId;
4
- endpoint: ApiEndpoint;
5
- apiIntegration: ApiIntegration;
6
- request: Record<string, any>;
7
- serverUrlOverride: string | undefined;
8
- }
1
+ import { ApiHeaders } from './api.types';
2
+ import { ApiEndpointId, HttpMethod } from './integration.types';
9
3
  export declare class ApiCallContext {
10
4
  readonly endpointId: ApiEndpointId;
11
- readonly endpoint: ApiEndpoint;
12
- readonly apiIntegration: ApiIntegration;
5
+ readonly url: string;
6
+ readonly method: HttpMethod;
7
+ readonly headers: ApiHeaders;
8
+ readonly body: Record<string, any>;
9
+ readonly queryParams: Record<string, string | number | boolean>;
10
+ readonly pathParams: Record<string, string>;
13
11
  readonly serverUrlOverride: string | undefined;
14
- readonly request: Record<string, any>;
15
- constructor(apiRequest: ApiRequest);
16
12
  }
17
- export {};
@@ -1,5 +1,6 @@
1
1
  import { ClientId, ClientRequestId, IntegrationId } from './communication.types';
2
- import { ApiEndpointId } from './integration.types';
2
+ import { ApiEndpointId, HttpMethod } from './integration.types';
3
+ export type ApiHeaders = Record<string, string | number | boolean>;
3
4
  export interface CallApiRequest {
4
5
  integrationId: IntegrationId;
5
6
  clientId: ClientId;
@@ -8,3 +9,15 @@ export interface CallApiRequest {
8
9
  serverUrlOverride?: string;
9
10
  request: Record<string, any>;
10
11
  }
12
+ export interface ExtractedApiParams {
13
+ headers: ApiHeaders;
14
+ queryParams: Record<string, string | number | boolean>;
15
+ body: Record<string, any>;
16
+ pathParams: Record<string, string>;
17
+ }
18
+ export interface SecureApiRequest extends ExtractedApiParams {
19
+ endpointId: ApiEndpointId;
20
+ url: string;
21
+ method: HttpMethod;
22
+ serverUrlOverride: string | undefined;
23
+ }
@@ -28,8 +28,7 @@ export declare const UpsertIntegrationRequestSchema: {
28
28
  };
29
29
  supportsExternalChanges?: undefined;
30
30
  configuration?: undefined;
31
- baseUrl?: undefined;
32
- endpoints?: undefined;
31
+ schema?: undefined;
33
32
  };
34
33
  } | {
35
34
  type: string;
@@ -82,10 +81,14 @@ export declare const UpsertIntegrationRequestSchema: {
82
81
  };
83
82
  };
84
83
  };
84
+ discoveryOptions?: undefined;
85
+ apiKey?: undefined;
86
+ appKey?: undefined;
87
+ datadogRegion?: undefined;
88
+ newRelicRegion?: undefined;
85
89
  };
86
90
  };
87
- baseUrl?: undefined;
88
- endpoints?: undefined;
91
+ schema?: undefined;
89
92
  };
90
93
  } | {
91
94
  type: string;
@@ -164,67 +167,77 @@ export declare const UpsertIntegrationRequestSchema: {
164
167
  };
165
168
  };
166
169
  };
170
+ discoveryOptions?: undefined;
171
+ apiKey?: undefined;
172
+ appKey?: undefined;
173
+ datadogRegion?: undefined;
174
+ newRelicRegion?: undefined;
167
175
  };
168
176
  };
169
- baseUrl?: undefined;
170
- endpoints?: undefined;
177
+ schema?: undefined;
171
178
  };
172
179
  } | {
173
180
  type: string;
174
- required: string[];
181
+ required: never[];
175
182
  properties: {
176
183
  type: {
177
184
  const: IntegrationType;
178
185
  };
179
- baseUrl: {
180
- type: string;
181
- nullable: boolean;
182
- format: string;
183
- };
184
- endpoints: {
186
+ schema: {
185
187
  type: string;
186
- patternProperties: {
187
- '^\\S+$': {
188
+ required: never[];
189
+ properties: {
190
+ baseUrl: {
188
191
  type: string;
189
- required: string[];
190
- properties: {
191
- relativePath: {
192
- type: string;
193
- };
194
- method: {
195
- type: string;
196
- enum: string[];
197
- };
198
- requestSchema: {
192
+ nullable: boolean;
193
+ format: string;
194
+ };
195
+ endpoints: {
196
+ type: string;
197
+ patternProperties: {
198
+ '^\\S+$': {
199
199
  type: string;
200
- patternProperties: {
201
- '^\\S+$': {
200
+ required: string[];
201
+ properties: {
202
+ relativePath: {
202
203
  type: string;
203
- properties: {
204
- paramLocation: {
205
- type: string;
206
- enum: string[];
207
- };
208
- fieldNameInRequest: {
204
+ };
205
+ method: {
206
+ type: string;
207
+ enum: string[];
208
+ };
209
+ requestSchema: {
210
+ type: string;
211
+ patternProperties: {
212
+ '^\\S+$': {
209
213
  type: string;
214
+ properties: {
215
+ location: {
216
+ type: string;
217
+ enum: string[];
218
+ };
219
+ fieldNameInRequest: {
220
+ type: string;
221
+ };
222
+ };
210
223
  };
211
224
  };
212
225
  };
213
- };
214
- };
215
- responseSchema: {
216
- type: string;
217
- patternProperties: {
218
- '^\\S+$': {
226
+ responseSchema: {
219
227
  type: string;
220
- required: string[];
221
- properties: {
222
- paramLocation: {
223
- type: string;
224
- enum: string[];
225
- };
226
- fieldPathInResponse: {
228
+ patternProperties: {
229
+ '^\\S+$': {
227
230
  type: string;
231
+ required: string[];
232
+ properties: {
233
+ location: {
234
+ type: string;
235
+ enum: string[];
236
+ };
237
+ path: {
238
+ type: string;
239
+ };
240
+ };
228
241
  };
229
242
  };
230
243
  };
@@ -237,6 +250,39 @@ export declare const UpsertIntegrationRequestSchema: {
237
250
  supportsExternalChanges?: undefined;
238
251
  configuration?: undefined;
239
252
  };
253
+ } | {
254
+ type: string;
255
+ required: string[];
256
+ properties: {
257
+ type: {
258
+ const: IntegrationType;
259
+ };
260
+ configuration: {
261
+ type: string;
262
+ nullable: boolean;
263
+ required: string[];
264
+ properties: {
265
+ discoveryOptions: {
266
+ type: string;
267
+ nullable: boolean;
268
+ required: string[];
269
+ properties: {
270
+ openApiSpecUrl: {
271
+ type: string;
272
+ nullable: boolean;
273
+ };
274
+ };
275
+ };
276
+ connectionOptions?: undefined;
277
+ apiKey?: undefined;
278
+ appKey?: undefined;
279
+ datadogRegion?: undefined;
280
+ newRelicRegion?: undefined;
281
+ };
282
+ };
283
+ supportsExternalChanges?: undefined;
284
+ schema?: undefined;
285
+ };
240
286
  } | {
241
287
  type: string;
242
288
  required: string[];
@@ -261,11 +307,145 @@ export declare const UpsertIntegrationRequestSchema: {
261
307
  };
262
308
  };
263
309
  };
310
+ discoveryOptions?: undefined;
311
+ apiKey?: undefined;
312
+ appKey?: undefined;
313
+ datadogRegion?: undefined;
314
+ newRelicRegion?: undefined;
315
+ };
316
+ };
317
+ supportsExternalChanges?: undefined;
318
+ schema?: undefined;
319
+ };
320
+ } | {
321
+ type: string;
322
+ required: string[];
323
+ properties: {
324
+ type: {
325
+ const: IntegrationType;
326
+ };
327
+ configuration: {
328
+ type: string;
329
+ nullable: boolean;
330
+ required: string[];
331
+ properties: {
332
+ connectionOptions: {
333
+ type: string;
334
+ required: never[];
335
+ properties: {
336
+ account: {
337
+ type: string;
338
+ nullable: boolean;
339
+ };
340
+ username: {
341
+ type: string;
342
+ nullable: boolean;
343
+ };
344
+ database: {
345
+ type: string;
346
+ nullable: boolean;
347
+ };
348
+ schema: {
349
+ type: string;
350
+ nullable: boolean;
351
+ };
352
+ warehouse: {
353
+ type: string;
354
+ nullable: boolean;
355
+ };
356
+ role: {
357
+ type: string;
358
+ nullable: boolean;
359
+ };
360
+ secrets: {
361
+ type: string;
362
+ required: string[];
363
+ nullable: boolean;
364
+ properties: {
365
+ password: {
366
+ type: string;
367
+ nullable: boolean;
368
+ isSecret: {};
369
+ };
370
+ };
371
+ };
372
+ };
373
+ };
374
+ discoveryOptions?: undefined;
375
+ apiKey?: undefined;
376
+ appKey?: undefined;
377
+ datadogRegion?: undefined;
378
+ newRelicRegion?: undefined;
379
+ };
380
+ };
381
+ supportsExternalChanges?: undefined;
382
+ schema?: undefined;
383
+ };
384
+ } | {
385
+ type: string;
386
+ required: string[];
387
+ properties: {
388
+ type: {
389
+ const: IntegrationType;
390
+ };
391
+ configuration: {
392
+ type: string;
393
+ nullable: boolean;
394
+ required: string[];
395
+ properties: {
396
+ apiKey: {
397
+ type: string;
398
+ nullable: boolean;
399
+ isSecret: {};
400
+ };
401
+ appKey: {
402
+ type: string;
403
+ nullable: boolean;
404
+ isSecret: {};
405
+ };
406
+ datadogRegion: {
407
+ type: string;
408
+ nullable: boolean;
409
+ enum: string[];
410
+ };
411
+ connectionOptions?: undefined;
412
+ discoveryOptions?: undefined;
413
+ newRelicRegion?: undefined;
414
+ };
415
+ };
416
+ supportsExternalChanges?: undefined;
417
+ schema?: undefined;
418
+ };
419
+ } | {
420
+ type: string;
421
+ required: string[];
422
+ properties: {
423
+ type: {
424
+ const: IntegrationType;
425
+ };
426
+ configuration: {
427
+ type: string;
428
+ nullable: boolean;
429
+ required: string[];
430
+ properties: {
431
+ apiKey: {
432
+ type: string;
433
+ nullable: boolean;
434
+ isSecret: {};
435
+ };
436
+ newRelicRegion: {
437
+ type: string;
438
+ nullable: boolean;
439
+ enum: string[];
440
+ };
441
+ connectionOptions?: undefined;
442
+ discoveryOptions?: undefined;
443
+ appKey?: undefined;
444
+ datadogRegion?: undefined;
264
445
  };
265
446
  };
266
447
  supportsExternalChanges?: undefined;
267
- baseUrl?: undefined;
268
- endpoints?: undefined;
448
+ schema?: undefined;
269
449
  };
270
450
  })[];
271
451
  };
@@ -406,6 +586,62 @@ export declare const TestDataConnectionRequestSchema: {
406
586
  };
407
587
  };
408
588
  };
589
+ } | {
590
+ type: string;
591
+ required: string[];
592
+ properties: {
593
+ type: {
594
+ const: IntegrationType;
595
+ };
596
+ configuration: {
597
+ type: string;
598
+ required: string[];
599
+ properties: {
600
+ connectionOptions: {
601
+ type: string;
602
+ required: never[];
603
+ properties: {
604
+ account: {
605
+ type: string;
606
+ nullable: boolean;
607
+ };
608
+ username: {
609
+ type: string;
610
+ nullable: boolean;
611
+ };
612
+ database: {
613
+ type: string;
614
+ nullable: boolean;
615
+ };
616
+ schema: {
617
+ type: string;
618
+ nullable: boolean;
619
+ };
620
+ warehouse: {
621
+ type: string;
622
+ nullable: boolean;
623
+ };
624
+ role: {
625
+ type: string;
626
+ nullable: boolean;
627
+ };
628
+ secrets: {
629
+ type: string;
630
+ required: string[];
631
+ nullable: boolean;
632
+ properties: {
633
+ password: {
634
+ type: string;
635
+ nullable: boolean;
636
+ isSecret: {};
637
+ };
638
+ };
639
+ };
640
+ };
641
+ };
642
+ };
643
+ };
644
+ };
409
645
  } | {
410
646
  type: string;
411
647
  required: string[];
@@ -480,6 +716,56 @@ export declare const DiscoverDataConnectionSchemaRequestSchema: {
480
716
  };
481
717
  };
482
718
  };
719
+ } | {
720
+ type: string;
721
+ required: string[];
722
+ properties: {
723
+ integrationType: {
724
+ const: IntegrationType;
725
+ };
726
+ connectionOptions: {
727
+ type: string;
728
+ required: never[];
729
+ properties: {
730
+ account: {
731
+ type: string;
732
+ nullable: boolean;
733
+ };
734
+ username: {
735
+ type: string;
736
+ nullable: boolean;
737
+ };
738
+ database: {
739
+ type: string;
740
+ nullable: boolean;
741
+ };
742
+ schema: {
743
+ type: string;
744
+ nullable: boolean;
745
+ };
746
+ warehouse: {
747
+ type: string;
748
+ nullable: boolean;
749
+ };
750
+ role: {
751
+ type: string;
752
+ nullable: boolean;
753
+ };
754
+ secrets: {
755
+ type: string;
756
+ required: string[];
757
+ nullable: boolean;
758
+ properties: {
759
+ password: {
760
+ type: string;
761
+ nullable: boolean;
762
+ isSecret: {};
763
+ };
764
+ };
765
+ };
766
+ };
767
+ };
768
+ };
483
769
  } | {
484
770
  type: string;
485
771
  required: string[];
@@ -596,13 +882,19 @@ export declare const UpdateAllowedHostsRequestSchema: {
596
882
  };
597
883
  };
598
884
  };
599
- export declare const DiscoverOpenApiEndpointsRequestSchema: {
885
+ export declare const DiscoverOpenApiSchemaRequestSchema: {
600
886
  type: string;
601
887
  required: string[];
602
888
  properties: {
603
- openApiSpecUrl: {
889
+ discoveryOptions: {
604
890
  type: string;
605
- format: string;
891
+ required: string[];
892
+ properties: {
893
+ openApiSpecUrl: {
894
+ type: string;
895
+ format: string;
896
+ };
897
+ };
606
898
  };
607
899
  };
608
900
  };
@@ -1,7 +1,7 @@
1
1
  import { ApplicationBundleData, ServiceFunctionName } from './bundle-data.types';
2
2
  import { AppId, IntegrationId } from './communication.types';
3
3
  import { CollectionName } from './document.types';
4
- import { ApiEndpoint, ApiEndpointId, GraphQLConnectionOptions, Integration, IntegrationDataSchema, IntegrationGraphQLSchema, IntegrationType, MongoConnectionOptions, MssqlConnectionOptions, MySqlConnectionOptions, PostgresConnectionOptions } from './integration.types';
4
+ import { GraphQLConnectionOptions, Integration, IntegrationApiSchema, IntegrationDataSchema, IntegrationGraphQLSchema, IntegrationType, MongoConnectionOptions, MssqlConnectionOptions, MySqlConnectionOptions, PostgresConnectionOptions, SnowflakeConnectionOptions } from './integration.types';
5
5
  export type WebhookId = string;
6
6
  export type QueryName = string;
7
7
  export type TriggerId = string;
@@ -128,7 +128,7 @@ export interface CreateApplicationResponse {
128
128
  appId: AppId;
129
129
  }
130
130
  export type UpsertIntegrationRequest = UpsertDataIntegrationRequest | UpsertGraphQLIntegrationRequest | UpsertApiIntegrationRequest;
131
- export type UpsertDataIntegrationRequest = UpsertInternalIntegrationRequest | UpsertMongoDbIntegrationRequest | UpsertMssqlIntegrationRequest | UpsertMySqlIntegrationRequest | UpsertPostgresIntegrationRequest | UpsertCockroachIntegrationRequest;
131
+ export type UpsertDataIntegrationRequest = UpsertInternalIntegrationRequest | UpsertMongoDbIntegrationRequest | UpsertMssqlIntegrationRequest | UpsertMySqlIntegrationRequest | UpsertPostgresIntegrationRequest | UpsertCockroachIntegrationRequest | UpsertSnowflakeIntegrationRequest;
132
132
  interface BaseUpsertIntegrationRequest {
133
133
  id: IntegrationId;
134
134
  type: IntegrationType;
@@ -176,6 +176,13 @@ export interface UpsertCockroachIntegrationRequest extends BaseUpsertDataIntegra
176
176
  connectionOptions: PostgresConnectionOptions;
177
177
  };
178
178
  }
179
+ export interface UpsertSnowflakeIntegrationRequest extends BaseUpsertDataIntegrationRequest {
180
+ type: IntegrationType.snowflake;
181
+ schema?: IntegrationDataSchema;
182
+ configuration: {
183
+ connectionOptions: SnowflakeConnectionOptions;
184
+ };
185
+ }
179
186
  export interface UpsertGraphQLIntegrationRequest extends BaseUpsertIntegrationRequest {
180
187
  type: IntegrationType.graphql;
181
188
  schema?: IntegrationGraphQLSchema;
@@ -185,8 +192,7 @@ export interface UpsertGraphQLIntegrationRequest extends BaseUpsertIntegrationRe
185
192
  }
186
193
  export interface UpsertApiIntegrationRequest extends BaseUpsertIntegrationRequest {
187
194
  type: IntegrationType.api;
188
- baseUrl: string;
189
- endpoints: Record<ApiEndpointId, ApiEndpoint>;
195
+ schema?: IntegrationApiSchema;
190
196
  }
191
197
  export interface DeleteIntegrationRequest {
192
198
  integrationId: IntegrationId;
@@ -53,7 +53,6 @@ export type WorkerActionType = 'loadJs' | 'executeFunction' | 'ping' | 'terminat
53
53
  export interface ActionRequest {
54
54
  action: WorkerActionType;
55
55
  payload?: LoadJsPayload | ExecuteFunctionPayload;
56
- traceContext?: any;
57
56
  }
58
57
  export type LoadJsResponse = GeneralResponse;
59
58
  export type TerminateResponse = GeneralResponse;
@@ -1,19 +1,29 @@
1
1
  export type AuthType = 'Bearer' | 'ApiKey';
2
+ /**
3
+ * The payload of a JWT token in case an auth token was used.
4
+ */
2
5
  export interface AuthWithBearer {
3
6
  type: 'Bearer';
4
7
  userId: string;
5
8
  expiration: number;
6
9
  attributes: Record<string, any>;
7
10
  }
11
+ /**
12
+ * The authentication object for the current request in case an API key is used.
13
+ */
8
14
  export interface AuthWithApiKey {
9
15
  type: 'ApiKey';
10
16
  apiKey: string;
11
17
  }
18
+ /** The authentication object for the current request. */
12
19
  export type Auth = AuthWithBearer | AuthWithApiKey;
13
20
  export interface AuthToken {
14
21
  type: AuthType;
15
22
  token: string;
16
23
  }
24
+ /**
25
+ * The context of a request to a service.
26
+ */
17
27
  export interface RunContext {
18
28
  appId: string;
19
29
  sourceIp?: string;
@@ -1,14 +1,6 @@
1
- interface GraphQlRequest {
2
- isGraphiQL: boolean;
3
- query?: string;
4
- operationName?: string;
5
- variables?: string | Record<string, any>;
6
- }
7
1
  export declare class GraphqlContext {
8
2
  readonly isGraphiQL: boolean;
9
3
  readonly query: string | undefined;
10
4
  readonly variables: string | Record<string, any> | undefined;
11
5
  readonly operationName: string | undefined;
12
- constructor(graphQlRequest: GraphQlRequest);
13
6
  }
14
- export {};
@@ -1,8 +1,16 @@
1
1
  import { IntrospectionQuery } from 'graphql';
2
+ import { ApiHeaders } from './api.types';
2
3
  export { ExecutionResult, IntrospectionQuery } from 'graphql';
4
+ export interface ExtractedGraphQLParams {
5
+ headers: ApiHeaders;
6
+ }
3
7
  export interface GraphQLRequest {
4
8
  operationName?: string;
5
9
  query?: string;
6
10
  variables?: string | Record<string, any>;
7
11
  }
12
+ export interface SecureGraphQLRequest extends GraphQLRequest {
13
+ isGraphiQL: boolean;
14
+ headers: ApiHeaders;
15
+ }
8
16
  export declare const EmptyIntrospection: IntrospectionQuery;
@@ -15,7 +15,6 @@ export * from './graphql.types';
15
15
  export * from './http-status.enum';
16
16
  export * from './integration.types';
17
17
  export * from './logger.types';
18
- export * from './metrics.schemas';
19
18
  export * from './metrics.types';
20
19
  export * from './mutation.context';
21
20
  export * from './mutation.schemas';
@@ -30,6 +29,7 @@ export * from './regions';
30
29
  export * from './schema/schema.types';
31
30
  export * from './secret.schemas';
32
31
  export * from './secret.types';
32
+ export * from './security.types';
33
33
  export * from './socket.schemas';
34
34
  export * from './socket.types';
35
35
  export * from './time-units';