@powersync/management-client 0.0.0-dev.84a4b832

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.
@@ -0,0 +1,1306 @@
1
+ import * as sdk from '@journeyapps-labs/common-sdk';
2
+ import { routes } from '@powersync/management-types';
3
+ export declare class PowerSyncManagementClient<C extends sdk.NetworkClient = sdk.NetworkClient> extends sdk.SDKClient<C> {
4
+ /**
5
+ * Lists all PowerSync instances for a given organization and application.
6
+ *
7
+ * @returns Promise resolving to a list of instances with their IDs, names, config status, and deployability
8
+ * @example
9
+ * ```typescript
10
+ * const response = await client.listInstances({
11
+ * org_id: 'org-123',
12
+ * app_id: 'app-456'
13
+ * });
14
+ * console.log(response.instances); // Array of instance objects
15
+ * ```
16
+ */
17
+ listInstances: sdk.Endpoint<{
18
+ org_id: string;
19
+ app_id: string;
20
+ }, {
21
+ instances: {
22
+ id: string;
23
+ name: string;
24
+ has_config: boolean;
25
+ deployable: boolean;
26
+ }[];
27
+ }, C>;
28
+ /**
29
+ * Creates a new PowerSync instance.
30
+ *
31
+ * @returns Promise resolving to the created instance ID
32
+ * @example
33
+ * ```typescript
34
+ * const response = await client.createInstance({
35
+ * org_id: 'org-123',
36
+ * app_id: 'app-456',
37
+ * name: 'my-instance',
38
+ * region: 'us'
39
+ * });
40
+ * console.log(response.id); // The new instance ID
41
+ * ```
42
+ */
43
+ createInstance: sdk.Endpoint<{
44
+ org_id: string;
45
+ app_id: string;
46
+ name: string;
47
+ region?: string | undefined;
48
+ }, {
49
+ id: string;
50
+ }, C>;
51
+ /**
52
+ * Destroys a PowerSync instance. This is a permanent operation.
53
+ *
54
+ * @returns Promise resolving to the destroyed instance ID and optional operation ID
55
+ * @example
56
+ * ```typescript
57
+ * const response = await client.destroyInstance({
58
+ * org_id: 'org-123',
59
+ * app_id: 'app-456',
60
+ * id: 'instance-789'
61
+ * });
62
+ * console.log(response.id); // The destroyed instance ID
63
+ * ```
64
+ */
65
+ destroyInstance: sdk.Endpoint<{
66
+ org_id: string;
67
+ app_id: string;
68
+ id: string;
69
+ }, {
70
+ id: string;
71
+ operation_id?: string | undefined;
72
+ }, C>;
73
+ /**
74
+ * Deactivates a PowerSync instance without destroying it.
75
+ *
76
+ * @returns Promise resolving to the deactivated instance ID and optional operation ID
77
+ * @example
78
+ * ```typescript
79
+ * const response = await client.deactivateInstance({
80
+ * org_id: 'org-123',
81
+ * app_id: 'app-456',
82
+ * id: 'instance-789'
83
+ * });
84
+ * console.log(response.id); // The deactivated instance ID
85
+ * ```
86
+ */
87
+ deactivateInstance: sdk.Endpoint<{
88
+ org_id: string;
89
+ app_id: string;
90
+ id: string;
91
+ }, {
92
+ id: string;
93
+ operation_id?: string | undefined;
94
+ }, C>;
95
+ /**
96
+ * Deploys a PowerSync instance with the specified configuration.
97
+ *
98
+ * @returns Promise resolving to the instance ID and operation ID for tracking deployment
99
+ * @example
100
+ * ```typescript
101
+ * const response = await client.deployInstance({
102
+ * org_id: 'org-123',
103
+ * app_id: 'app-456',
104
+ * id: 'instance-789',
105
+ * name: 'my-instance',
106
+ * config: {
107
+ * region: 'us',
108
+ * replication: {
109
+ * connections: [/* connection config *\/]
110
+ * }
111
+ * },
112
+ * sync_rules: 'SELECT * FROM users',
113
+ * program_version: {
114
+ * channel: 'stable',
115
+ * version_range: '^1.0.0'
116
+ * }
117
+ * });
118
+ * console.log(response.operation_id); // Track deployment progress
119
+ * ```
120
+ */
121
+ deployInstance: sdk.Endpoint<{
122
+ id: string;
123
+ org_id: string;
124
+ app_id: string;
125
+ } & {
126
+ config: {
127
+ region: string;
128
+ replication?: {
129
+ connections?: (({
130
+ type: import("@powersync/management-types").ConnectionType;
131
+ name?: string | undefined;
132
+ id?: string | undefined;
133
+ tag?: string | undefined;
134
+ username?: string | undefined;
135
+ password?: {
136
+ secret: string;
137
+ } | {
138
+ secret_ref: string;
139
+ } | undefined;
140
+ database?: string | undefined;
141
+ } & {
142
+ type: import("@powersync/management-types").ConnectionType.MONGODB;
143
+ uri: string;
144
+ post_images?: "off" | "auto_configure" | "read_only" | undefined;
145
+ vpc_endpoint_hostname?: string | undefined;
146
+ }) | ({
147
+ type: import("@powersync/management-types").ConnectionType;
148
+ name?: string | undefined;
149
+ id?: string | undefined;
150
+ tag?: string | undefined;
151
+ username?: string | undefined;
152
+ password?: {
153
+ secret: string;
154
+ } | {
155
+ secret_ref: string;
156
+ } | undefined;
157
+ database?: string | undefined;
158
+ } & {
159
+ type: import("@powersync/management-types").ConnectionType.MSSQL;
160
+ uri?: string | undefined;
161
+ hostname?: string | undefined;
162
+ port?: number | undefined;
163
+ schema?: string | undefined;
164
+ authentication?: ({
165
+ type: "default";
166
+ options: {
167
+ password: string;
168
+ userName: string;
169
+ };
170
+ } & {
171
+ options: {
172
+ password: {
173
+ secret: string;
174
+ } | {
175
+ secret_ref: string;
176
+ };
177
+ };
178
+ }) | ({
179
+ type: "azure-active-directory-password";
180
+ options: {
181
+ password: string;
182
+ userName: string;
183
+ clientId: string;
184
+ tenantId: string;
185
+ };
186
+ } & {
187
+ options: {
188
+ password: {
189
+ secret: string;
190
+ } | {
191
+ secret_ref: string;
192
+ };
193
+ };
194
+ }) | ({
195
+ type: "azure-active-directory-service-principal-secret";
196
+ options: {
197
+ clientId: string;
198
+ tenantId: string;
199
+ clientSecret: string;
200
+ };
201
+ } & {
202
+ options: {
203
+ clientSecret: {
204
+ secret: string;
205
+ } | {
206
+ secret_ref: string;
207
+ };
208
+ };
209
+ }) | undefined;
210
+ additionalConfig?: {
211
+ pollingIntervalMs?: number | undefined;
212
+ pollingBatchSize?: number | undefined;
213
+ trustServerCertificate?: boolean | undefined;
214
+ } | undefined;
215
+ debug_api?: boolean | undefined;
216
+ }) | ({
217
+ type: import("@powersync/management-types").ConnectionType;
218
+ name?: string | undefined;
219
+ id?: string | undefined;
220
+ tag?: string | undefined;
221
+ username?: string | undefined;
222
+ password?: {
223
+ secret: string;
224
+ } | {
225
+ secret_ref: string;
226
+ } | undefined;
227
+ database?: string | undefined;
228
+ } & {
229
+ type: import("@powersync/management-types").ConnectionType.MYSQL;
230
+ uri?: string | undefined;
231
+ hostname?: string | undefined;
232
+ port?: number | undefined;
233
+ debug_api?: boolean | undefined;
234
+ client_certificate?: string | undefined;
235
+ client_private_key?: {
236
+ secret: string;
237
+ } | {
238
+ secret_ref: string;
239
+ } | undefined;
240
+ }) | ({
241
+ type: import("@powersync/management-types").ConnectionType;
242
+ name?: string | undefined;
243
+ id?: string | undefined;
244
+ tag?: string | undefined;
245
+ username?: string | undefined;
246
+ password?: {
247
+ secret: string;
248
+ } | {
249
+ secret_ref: string;
250
+ } | undefined;
251
+ database?: string | undefined;
252
+ } & {
253
+ type: import("@powersync/management-types").ConnectionType.POSTGRES;
254
+ uri?: string | undefined;
255
+ vpc_endpoint_hostname?: string | undefined;
256
+ hostname?: string | undefined;
257
+ port?: number | undefined;
258
+ debug_api?: boolean | undefined;
259
+ client_certificate?: string | undefined;
260
+ client_private_key?: {
261
+ secret: string;
262
+ } | {
263
+ secret_ref: string;
264
+ } | undefined;
265
+ sslmode?: "verify-full" | "verify-ca" | undefined;
266
+ cacert?: string | undefined;
267
+ }))[] | undefined;
268
+ } | undefined;
269
+ client_auth?: {
270
+ jwks_uri?: string | undefined;
271
+ jwks?: {
272
+ keys: ({
273
+ kty: "oct";
274
+ kid: string;
275
+ k: {
276
+ secret: string;
277
+ } | {
278
+ secret_ref: string;
279
+ };
280
+ alg: "HS256" | "HS384" | "HS512";
281
+ use?: string | undefined;
282
+ } | {
283
+ kty: "RSA";
284
+ kid: string;
285
+ n: string;
286
+ e: string;
287
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
288
+ use?: string | undefined;
289
+ } | {
290
+ kty: "OKP";
291
+ alg: "EdDSA";
292
+ crv: "Ed25519" | "Ed448";
293
+ x: string;
294
+ kid?: string | undefined;
295
+ use?: string | undefined;
296
+ } | {
297
+ kty: "EC";
298
+ alg: "ES256" | "ES384" | "ES512";
299
+ crv: "P-256" | "P-384" | "P-512";
300
+ x: string;
301
+ y: string;
302
+ kid?: string | undefined;
303
+ use?: string | undefined;
304
+ })[];
305
+ } | undefined;
306
+ supabase?: boolean | undefined;
307
+ supabase_jwt_secret?: {
308
+ secret: string;
309
+ } | {
310
+ secret_ref: string;
311
+ } | undefined;
312
+ additional_audiences?: string[] | undefined;
313
+ allow_temporary_tokens?: boolean | undefined;
314
+ } | undefined;
315
+ };
316
+ name?: string | undefined;
317
+ sync_rules?: string | undefined;
318
+ program_version?: {
319
+ channel: string;
320
+ version_range?: string | undefined;
321
+ } | undefined;
322
+ }, {
323
+ id: string;
324
+ operation_id: string;
325
+ }, C>;
326
+ /**
327
+ * Retrieves the configuration for a PowerSync instance.
328
+ * This endpoint is retryable.
329
+ *
330
+ * @returns Promise resolving to the instance configuration including config, sync_rules, and program_version
331
+ * @example
332
+ * ```typescript
333
+ * const response = await client.getInstanceConfig({
334
+ * org_id: 'org-123',
335
+ * app_id: 'app-456',
336
+ * id: 'instance-789'
337
+ * });
338
+ * console.log(response.config); // The instance configuration
339
+ * console.log(response.sync_rules); // The sync rules
340
+ * ```
341
+ */
342
+ getInstanceConfig: sdk.Endpoint<{
343
+ org_id: string;
344
+ app_id: string;
345
+ id: string;
346
+ }, {
347
+ org_id: string;
348
+ id: string;
349
+ name: string;
350
+ program_version: {
351
+ channel: string;
352
+ version_range?: string | undefined;
353
+ };
354
+ project_id: string;
355
+ config?: {
356
+ region: string;
357
+ replication?: {
358
+ connections?: (({
359
+ type: import("@powersync/management-types").ConnectionType;
360
+ name?: string | undefined;
361
+ id?: string | undefined;
362
+ tag?: string | undefined;
363
+ username?: string | undefined;
364
+ password?: {
365
+ secret: string;
366
+ } | {
367
+ secret_ref: string;
368
+ } | undefined;
369
+ database?: string | undefined;
370
+ } & {
371
+ type: import("@powersync/management-types").ConnectionType.MONGODB;
372
+ uri: string;
373
+ post_images?: "off" | "auto_configure" | "read_only" | undefined;
374
+ vpc_endpoint_hostname?: string | undefined;
375
+ }) | ({
376
+ type: import("@powersync/management-types").ConnectionType;
377
+ name?: string | undefined;
378
+ id?: string | undefined;
379
+ tag?: string | undefined;
380
+ username?: string | undefined;
381
+ password?: {
382
+ secret: string;
383
+ } | {
384
+ secret_ref: string;
385
+ } | undefined;
386
+ database?: string | undefined;
387
+ } & {
388
+ type: import("@powersync/management-types").ConnectionType.MSSQL;
389
+ uri?: string | undefined;
390
+ hostname?: string | undefined;
391
+ port?: number | undefined;
392
+ schema?: string | undefined;
393
+ authentication?: ({
394
+ type: "default";
395
+ options: {
396
+ password: string;
397
+ userName: string;
398
+ };
399
+ } & {
400
+ options: {
401
+ password: {
402
+ secret: string;
403
+ } | {
404
+ secret_ref: string;
405
+ };
406
+ };
407
+ }) | ({
408
+ type: "azure-active-directory-password";
409
+ options: {
410
+ password: string;
411
+ userName: string;
412
+ clientId: string;
413
+ tenantId: string;
414
+ };
415
+ } & {
416
+ options: {
417
+ password: {
418
+ secret: string;
419
+ } | {
420
+ secret_ref: string;
421
+ };
422
+ };
423
+ }) | ({
424
+ type: "azure-active-directory-service-principal-secret";
425
+ options: {
426
+ clientId: string;
427
+ tenantId: string;
428
+ clientSecret: string;
429
+ };
430
+ } & {
431
+ options: {
432
+ clientSecret: {
433
+ secret: string;
434
+ } | {
435
+ secret_ref: string;
436
+ };
437
+ };
438
+ }) | undefined;
439
+ additionalConfig?: {
440
+ pollingIntervalMs?: number | undefined;
441
+ pollingBatchSize?: number | undefined;
442
+ trustServerCertificate?: boolean | undefined;
443
+ } | undefined;
444
+ debug_api?: boolean | undefined;
445
+ }) | ({
446
+ type: import("@powersync/management-types").ConnectionType;
447
+ name?: string | undefined;
448
+ id?: string | undefined;
449
+ tag?: string | undefined;
450
+ username?: string | undefined;
451
+ password?: {
452
+ secret: string;
453
+ } | {
454
+ secret_ref: string;
455
+ } | undefined;
456
+ database?: string | undefined;
457
+ } & {
458
+ type: import("@powersync/management-types").ConnectionType.MYSQL;
459
+ uri?: string | undefined;
460
+ hostname?: string | undefined;
461
+ port?: number | undefined;
462
+ debug_api?: boolean | undefined;
463
+ client_certificate?: string | undefined;
464
+ client_private_key?: {
465
+ secret: string;
466
+ } | {
467
+ secret_ref: string;
468
+ } | undefined;
469
+ }) | ({
470
+ type: import("@powersync/management-types").ConnectionType;
471
+ name?: string | undefined;
472
+ id?: string | undefined;
473
+ tag?: string | undefined;
474
+ username?: string | undefined;
475
+ password?: {
476
+ secret: string;
477
+ } | {
478
+ secret_ref: string;
479
+ } | undefined;
480
+ database?: string | undefined;
481
+ } & {
482
+ type: import("@powersync/management-types").ConnectionType.POSTGRES;
483
+ uri?: string | undefined;
484
+ vpc_endpoint_hostname?: string | undefined;
485
+ hostname?: string | undefined;
486
+ port?: number | undefined;
487
+ debug_api?: boolean | undefined;
488
+ client_certificate?: string | undefined;
489
+ client_private_key?: {
490
+ secret: string;
491
+ } | {
492
+ secret_ref: string;
493
+ } | undefined;
494
+ sslmode?: "verify-full" | "verify-ca" | undefined;
495
+ cacert?: string | undefined;
496
+ }))[] | undefined;
497
+ } | undefined;
498
+ client_auth?: {
499
+ jwks_uri?: string | undefined;
500
+ jwks?: {
501
+ keys: ({
502
+ kty: "oct";
503
+ kid: string;
504
+ k: {
505
+ secret: string;
506
+ } | {
507
+ secret_ref: string;
508
+ };
509
+ alg: "HS256" | "HS384" | "HS512";
510
+ use?: string | undefined;
511
+ } | {
512
+ kty: "RSA";
513
+ kid: string;
514
+ n: string;
515
+ e: string;
516
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
517
+ use?: string | undefined;
518
+ } | {
519
+ kty: "OKP";
520
+ alg: "EdDSA";
521
+ crv: "Ed25519" | "Ed448";
522
+ x: string;
523
+ kid?: string | undefined;
524
+ use?: string | undefined;
525
+ } | {
526
+ kty: "EC";
527
+ alg: "ES256" | "ES384" | "ES512";
528
+ crv: "P-256" | "P-384" | "P-512";
529
+ x: string;
530
+ y: string;
531
+ kid?: string | undefined;
532
+ use?: string | undefined;
533
+ })[];
534
+ } | undefined;
535
+ supabase?: boolean | undefined;
536
+ supabase_jwt_secret?: {
537
+ secret: string;
538
+ } | {
539
+ secret_ref: string;
540
+ } | undefined;
541
+ additional_audiences?: string[] | undefined;
542
+ allow_temporary_tokens?: boolean | undefined;
543
+ } | undefined;
544
+ } | undefined;
545
+ sync_rules?: string | undefined;
546
+ }, C>;
547
+ /**
548
+ * Gets the provisioning status and deployment operations for a PowerSync instance.
549
+ * This endpoint is retryable.
550
+ *
551
+ * @returns Promise resolving to instance status including provisioned flag, operations array, and optional instance_url
552
+ * @example
553
+ * ```typescript
554
+ * const response = await client.getInstanceStatus({
555
+ * org_id: 'org-123',
556
+ * app_id: 'app-456',
557
+ * id: 'instance-789'
558
+ * });
559
+ * console.log(response.provisioned); // true if instance is provisioned
560
+ * console.log(response.operations); // Array of deployment operations
561
+ * ```
562
+ */
563
+ getInstanceStatus: sdk.Endpoint<{
564
+ org_id: string;
565
+ app_id: string;
566
+ id: string;
567
+ }, {
568
+ id: string;
569
+ provisioned: boolean;
570
+ operations: {
571
+ id: string;
572
+ type: "up" | "down";
573
+ status: "pending" | "running" | "failed" | "completed";
574
+ created_at: string;
575
+ version: string;
576
+ started_at?: string | undefined;
577
+ finished_at?: string | undefined;
578
+ system_upgrade?: boolean | undefined;
579
+ teardown?: boolean | undefined;
580
+ compact?: boolean | undefined;
581
+ user_id?: string | undefined;
582
+ }[];
583
+ instance_url?: string | undefined;
584
+ }, C>;
585
+ /**
586
+ * Gets diagnostic information for a PowerSync instance.
587
+ * Only works if the instance is already provisioned.
588
+ * This endpoint is retryable.
589
+ *
590
+ * @returns Promise resolving to diagnostic information
591
+ * @example
592
+ * ```typescript
593
+ * const response = await client.getInstanceDiagnostics({
594
+ * org_id: 'org-123',
595
+ * app_id: 'app-456',
596
+ * id: 'instance-789'
597
+ * });
598
+ * // Diagnostic information about the instance
599
+ * ```
600
+ */
601
+ getInstanceDiagnostics: sdk.Endpoint<{
602
+ id: string;
603
+ org_id: string;
604
+ app_id: string;
605
+ } & {
606
+ sync_rules_content?: boolean | undefined;
607
+ }, {
608
+ connections: {
609
+ id: string;
610
+ postgres_uri: string;
611
+ connected: boolean;
612
+ errors: {
613
+ level: "warning" | "fatal";
614
+ message: string;
615
+ location?: {
616
+ start_offset: number;
617
+ end_offset: number;
618
+ } | undefined;
619
+ ts?: string | undefined;
620
+ }[];
621
+ }[];
622
+ active_sync_rules?: {
623
+ errors: {
624
+ level: "warning" | "fatal";
625
+ message: string;
626
+ location?: {
627
+ start_offset: number;
628
+ end_offset: number;
629
+ } | undefined;
630
+ ts?: string | undefined;
631
+ }[];
632
+ connections: {
633
+ id: string;
634
+ tag: string;
635
+ slot_name: string;
636
+ initial_replication_done: boolean;
637
+ tables: {
638
+ schema: string;
639
+ name: string;
640
+ replication_id: string[];
641
+ data_queries: boolean;
642
+ parameter_queries: boolean;
643
+ errors: {
644
+ level: "warning" | "fatal";
645
+ message: string;
646
+ location?: {
647
+ start_offset: number;
648
+ end_offset: number;
649
+ } | undefined;
650
+ ts?: string | undefined;
651
+ }[];
652
+ pattern?: string | undefined;
653
+ }[];
654
+ last_lsn?: string | undefined;
655
+ last_keepalive_ts?: string | undefined;
656
+ last_checkpoint_ts?: string | undefined;
657
+ replication_lag_bytes?: number | undefined;
658
+ }[];
659
+ content?: string | undefined;
660
+ } | undefined;
661
+ deploying_sync_rules?: {
662
+ errors: {
663
+ level: "warning" | "fatal";
664
+ message: string;
665
+ location?: {
666
+ start_offset: number;
667
+ end_offset: number;
668
+ } | undefined;
669
+ ts?: string | undefined;
670
+ }[];
671
+ connections: {
672
+ id: string;
673
+ tag: string;
674
+ slot_name: string;
675
+ initial_replication_done: boolean;
676
+ tables: {
677
+ schema: string;
678
+ name: string;
679
+ replication_id: string[];
680
+ data_queries: boolean;
681
+ parameter_queries: boolean;
682
+ errors: {
683
+ level: "warning" | "fatal";
684
+ message: string;
685
+ location?: {
686
+ start_offset: number;
687
+ end_offset: number;
688
+ } | undefined;
689
+ ts?: string | undefined;
690
+ }[];
691
+ pattern?: string | undefined;
692
+ }[];
693
+ last_lsn?: string | undefined;
694
+ last_keepalive_ts?: string | undefined;
695
+ last_checkpoint_ts?: string | undefined;
696
+ replication_lag_bytes?: number | undefined;
697
+ }[];
698
+ content?: string | undefined;
699
+ } | undefined;
700
+ }, C>;
701
+ /**
702
+ * Triggers a compaction operation on a PowerSync instance.
703
+ *
704
+ * @returns Promise resolving to the instance ID and optional operation ID
705
+ * @example
706
+ * ```typescript
707
+ * const response = await client.compact({
708
+ * org_id: 'org-123',
709
+ * app_id: 'app-456',
710
+ * id: 'instance-789'
711
+ * });
712
+ * console.log(response.operation_id); // Track compaction progress
713
+ * ```
714
+ */
715
+ compact: sdk.Endpoint<{
716
+ org_id: string;
717
+ app_id: string;
718
+ id: string;
719
+ }, {
720
+ id: string;
721
+ operation_id?: string | undefined;
722
+ }, C>;
723
+ /**
724
+ * Tests a database connection without deploying an instance.
725
+ * Validates connectivity and configuration for the specified connection.
726
+ *
727
+ * @returns Promise resolving to connection test results including success status, connection details, and optional configuration details
728
+ * @example
729
+ * ```typescript
730
+ * const response = await client.testConnection({
731
+ * org_id: 'org-123',
732
+ * app_id: 'app-456',
733
+ * connection: {
734
+ * type: 'postgres',
735
+ * uri: 'postgresql://user:pass@host:5432/db'
736
+ * }
737
+ * });
738
+ * console.log(response.success); // true if connection test passed
739
+ * console.log(response.connection.reachable); // true if TCP connection works
740
+ * ```
741
+ */
742
+ testConnection: sdk.Endpoint<{
743
+ org_id: string;
744
+ app_id: string;
745
+ connection: ({
746
+ type: import("@powersync/management-types").ConnectionType;
747
+ name?: string | undefined;
748
+ id?: string | undefined;
749
+ tag?: string | undefined;
750
+ username?: string | undefined;
751
+ password?: {
752
+ secret: string;
753
+ } | {
754
+ secret_ref: string;
755
+ } | undefined;
756
+ database?: string | undefined;
757
+ } & {
758
+ type: import("@powersync/management-types").ConnectionType.MONGODB;
759
+ uri: string;
760
+ post_images?: "off" | "auto_configure" | "read_only" | undefined;
761
+ vpc_endpoint_hostname?: string | undefined;
762
+ }) | ({
763
+ type: import("@powersync/management-types").ConnectionType;
764
+ name?: string | undefined;
765
+ id?: string | undefined;
766
+ tag?: string | undefined;
767
+ username?: string | undefined;
768
+ password?: {
769
+ secret: string;
770
+ } | {
771
+ secret_ref: string;
772
+ } | undefined;
773
+ database?: string | undefined;
774
+ } & {
775
+ type: import("@powersync/management-types").ConnectionType.MYSQL;
776
+ uri?: string | undefined;
777
+ hostname?: string | undefined;
778
+ port?: number | undefined;
779
+ debug_api?: boolean | undefined;
780
+ client_certificate?: string | undefined;
781
+ client_private_key?: {
782
+ secret: string;
783
+ } | {
784
+ secret_ref: string;
785
+ } | undefined;
786
+ }) | ({
787
+ type: import("@powersync/management-types").ConnectionType;
788
+ name?: string | undefined;
789
+ id?: string | undefined;
790
+ tag?: string | undefined;
791
+ username?: string | undefined;
792
+ password?: {
793
+ secret: string;
794
+ } | {
795
+ secret_ref: string;
796
+ } | undefined;
797
+ database?: string | undefined;
798
+ } & {
799
+ type: import("@powersync/management-types").ConnectionType.POSTGRES;
800
+ uri?: string | undefined;
801
+ vpc_endpoint_hostname?: string | undefined;
802
+ hostname?: string | undefined;
803
+ port?: number | undefined;
804
+ debug_api?: boolean | undefined;
805
+ client_certificate?: string | undefined;
806
+ client_private_key?: {
807
+ secret: string;
808
+ } | {
809
+ secret_ref: string;
810
+ } | undefined;
811
+ sslmode?: "verify-full" | "verify-ca" | undefined;
812
+ cacert?: string | undefined;
813
+ }) | ({
814
+ type: import("@powersync/management-types").ConnectionType;
815
+ name?: string | undefined;
816
+ id?: string | undefined;
817
+ tag?: string | undefined;
818
+ username?: string | undefined;
819
+ password?: {
820
+ secret: string;
821
+ } | {
822
+ secret_ref: string;
823
+ } | undefined;
824
+ database?: string | undefined;
825
+ } & {
826
+ type: import("@powersync/management-types").ConnectionType.MSSQL;
827
+ uri?: string | undefined;
828
+ hostname?: string | undefined;
829
+ port?: number | undefined;
830
+ schema?: string | undefined;
831
+ authentication?: ({
832
+ type: "default";
833
+ options: {
834
+ password: string;
835
+ userName: string;
836
+ };
837
+ } & {
838
+ options: {
839
+ password: {
840
+ secret: string;
841
+ } | {
842
+ secret_ref: string;
843
+ };
844
+ };
845
+ }) | ({
846
+ type: "azure-active-directory-password";
847
+ options: {
848
+ password: string;
849
+ userName: string;
850
+ clientId: string;
851
+ tenantId: string;
852
+ };
853
+ } & {
854
+ options: {
855
+ password: {
856
+ secret: string;
857
+ } | {
858
+ secret_ref: string;
859
+ };
860
+ };
861
+ }) | ({
862
+ type: "azure-active-directory-service-principal-secret";
863
+ options: {
864
+ clientId: string;
865
+ tenantId: string;
866
+ clientSecret: string;
867
+ };
868
+ } & {
869
+ options: {
870
+ clientSecret: {
871
+ secret: string;
872
+ } | {
873
+ secret_ref: string;
874
+ };
875
+ };
876
+ }) | undefined;
877
+ additionalConfig?: {
878
+ pollingIntervalMs?: number | undefined;
879
+ pollingBatchSize?: number | undefined;
880
+ trustServerCertificate?: boolean | undefined;
881
+ } | undefined;
882
+ debug_api?: boolean | undefined;
883
+ });
884
+ id?: string | undefined;
885
+ }, {
886
+ connection: {
887
+ success: boolean;
888
+ reachable: boolean;
889
+ };
890
+ success: boolean;
891
+ configuration?: {
892
+ success: boolean;
893
+ } | undefined;
894
+ error?: string | undefined;
895
+ } | ({
896
+ connection: {
897
+ success: boolean;
898
+ reachable: boolean;
899
+ };
900
+ success: boolean;
901
+ configuration?: {
902
+ success: boolean;
903
+ } | undefined;
904
+ error?: string | undefined;
905
+ } & {
906
+ connection: {
907
+ success: boolean;
908
+ reachable: boolean;
909
+ } & {
910
+ tls_valid?: boolean | undefined;
911
+ suggested_cacert?: string | undefined;
912
+ suggested_sslmode?: string | undefined;
913
+ authenticated?: boolean | undefined;
914
+ };
915
+ configuration?: ({
916
+ success: boolean;
917
+ } & {
918
+ wal_valid?: boolean | undefined;
919
+ publication_valid?: boolean | undefined;
920
+ }) | undefined;
921
+ }), C>;
922
+ /**
923
+ * Gets the database schema for a PowerSync instance.
924
+ * Only works if the instance is already provisioned.
925
+ * This endpoint is retryable.
926
+ *
927
+ * @returns Promise resolving to the instance schema including connections, tables, and columns
928
+ * @example
929
+ * ```typescript
930
+ * const response = await client.getInstanceSchema({
931
+ * org_id: 'org-123',
932
+ * app_id: 'app-456',
933
+ * id: 'instance-789'
934
+ * });
935
+ * console.log(response.connections); // Array of connection schemas
936
+ * ```
937
+ */
938
+ getInstanceSchema: sdk.Endpoint<{
939
+ org_id: string;
940
+ app_id: string;
941
+ id: string;
942
+ }, {
943
+ connections: {
944
+ tag: string;
945
+ schemas: {
946
+ name: string;
947
+ tables: {
948
+ name: string;
949
+ columns: {
950
+ name: string;
951
+ type: string;
952
+ pg_type: string;
953
+ sqlite_type?: number | routes.SqliteSchemaTypeText | undefined;
954
+ internal_type?: string | undefined;
955
+ description?: string | undefined;
956
+ }[];
957
+ }[];
958
+ }[];
959
+ id?: string | undefined;
960
+ }[];
961
+ defaultConnectionTag?: string | undefined;
962
+ defaultSchema?: string | undefined;
963
+ }, C>;
964
+ /**
965
+ * Executes SQL queries on a PowerSync instance.
966
+ * Only works if the instance is already provisioned.
967
+ *
968
+ * @returns Promise resolving to SQL execution results
969
+ * @example
970
+ * ```typescript
971
+ * const response = await client.executeSql({
972
+ * org_id: 'org-123',
973
+ * app_id: 'app-456',
974
+ * id: 'instance-789',
975
+ * sql: 'SELECT * FROM users WHERE id = ?',
976
+ * parameters: ['user-123']
977
+ * });
978
+ * // SQL query results
979
+ * ```
980
+ */
981
+ executeSql: sdk.Endpoint<{
982
+ id: string;
983
+ org_id: string;
984
+ app_id: string;
985
+ } & {
986
+ sql: {
987
+ query: string;
988
+ args: (string | number | boolean)[];
989
+ };
990
+ connection_id?: string | undefined;
991
+ }, {
992
+ success: boolean;
993
+ results: {
994
+ columns: string[];
995
+ rows: (string | number | boolean | null)[][];
996
+ };
997
+ error?: string | undefined;
998
+ }, C>;
999
+ /**
1000
+ * Validates sync rules for a PowerSync instance.
1001
+ * Only works if the instance is already provisioned.
1002
+ *
1003
+ * @returns Promise resolving to validation results
1004
+ * @example
1005
+ * ```typescript
1006
+ * const response = await client.validateSyncRules({
1007
+ * org_id: 'org-123',
1008
+ * app_id: 'app-456',
1009
+ * id: 'instance-789',
1010
+ * sync_rules: 'SELECT * FROM users'
1011
+ * });
1012
+ * // Validation results
1013
+ * ```
1014
+ */
1015
+ validateSyncRules: sdk.Endpoint<{
1016
+ id: string;
1017
+ org_id: string;
1018
+ app_id: string;
1019
+ } & {
1020
+ sync_rules: string;
1021
+ }, {
1022
+ connections: {
1023
+ id: string;
1024
+ tag: string;
1025
+ tables: {
1026
+ name: string;
1027
+ errors: {
1028
+ level: "warning" | "fatal";
1029
+ message: string;
1030
+ location?: {
1031
+ start_offset: number;
1032
+ end_offset: number;
1033
+ } | undefined;
1034
+ ts?: string | undefined;
1035
+ }[];
1036
+ schema: string;
1037
+ replication_id: string[];
1038
+ data_queries: boolean;
1039
+ parameter_queries: boolean;
1040
+ pattern?: string | undefined;
1041
+ }[];
1042
+ slot_name: string;
1043
+ initial_replication_done: boolean;
1044
+ last_lsn?: string | undefined;
1045
+ last_keepalive_ts?: string | undefined;
1046
+ last_checkpoint_ts?: string | undefined;
1047
+ replication_lag_bytes?: number | undefined;
1048
+ }[];
1049
+ errors: {
1050
+ level: "warning" | "fatal";
1051
+ message: string;
1052
+ location?: {
1053
+ start_offset: number;
1054
+ end_offset: number;
1055
+ } | undefined;
1056
+ ts?: string | undefined;
1057
+ }[];
1058
+ content?: string | undefined;
1059
+ }, C>;
1060
+ /**
1061
+ * Reprocesses sync rules for a PowerSync instance.
1062
+ * Only works if the instance is already provisioned.
1063
+ *
1064
+ * @returns Promise resolving to reprocessing results
1065
+ * @example
1066
+ * ```typescript
1067
+ * const response = await client.reprocessSyncRules({
1068
+ * org_id: 'org-123',
1069
+ * app_id: 'app-456',
1070
+ * id: 'instance-789',
1071
+ * sync_rules: 'SELECT * FROM users'
1072
+ * });
1073
+ * // Reprocessing results
1074
+ * ```
1075
+ */
1076
+ reprocessSyncRules: sdk.Endpoint<{
1077
+ id: string;
1078
+ org_id: string;
1079
+ app_id: string;
1080
+ } & {}, {
1081
+ connections: {
1082
+ tag: string;
1083
+ slot_name: string;
1084
+ id?: string | undefined;
1085
+ }[];
1086
+ }, C>;
1087
+ /**
1088
+ * Generates a development token for a PowerSync instance.
1089
+ *
1090
+ * @returns Promise resolving to the generated JWT token
1091
+ * @example
1092
+ * ```typescript
1093
+ * const response = await client.generateDevToken({
1094
+ * org_id: 'org-123',
1095
+ * app_id: 'app-456',
1096
+ * id: 'instance-789',
1097
+ * subject: 'user-123',
1098
+ * expiresInSeconds: 3600
1099
+ * });
1100
+ * console.log(response.token); // The JWT token
1101
+ * ```
1102
+ */
1103
+ generateDevToken: sdk.Endpoint<{
1104
+ id: string;
1105
+ org_id: string;
1106
+ app_id: string;
1107
+ } & {
1108
+ subject: string;
1109
+ expiresInSeconds: number;
1110
+ }, {
1111
+ token: string;
1112
+ }, C>;
1113
+ /**
1114
+ * Lists available regions for PowerSync deployments.
1115
+ * Returns region information including IP addresses for whitelisting.
1116
+ *
1117
+ * @returns Promise resolving to a list of regions with their names, deployability status, and IP addresses
1118
+ * @example
1119
+ * ```typescript
1120
+ * const response = await client.listRegions({});
1121
+ * console.log(response.regions); // Array of region objects with IPs for whitelisting
1122
+ * ```
1123
+ */
1124
+ listRegions: sdk.Endpoint<void, {
1125
+ regions: {
1126
+ name: string;
1127
+ deployable: boolean;
1128
+ ips: string[];
1129
+ }[];
1130
+ }, C>;
1131
+ /**
1132
+ * Lists available PowerSync program versions for a channel.
1133
+ *
1134
+ * @returns Promise resolving to an array of versions with their status (current, available, or deprecated)
1135
+ * @example
1136
+ * ```typescript
1137
+ * const response = await client.listVersionsV({
1138
+ * channel: 'stable'
1139
+ * });
1140
+ * console.log(response); // Array of version objects with status
1141
+ * ```
1142
+ */
1143
+ listVersions: sdk.Endpoint<{
1144
+ channel: string;
1145
+ }, {
1146
+ status: routes.VersionStatus;
1147
+ version: string;
1148
+ }[], C>;
1149
+ /**
1150
+ * Gets client connection reports for a PowerSync instance within a date range.
1151
+ *
1152
+ * @returns Promise resolving to connection report data including user counts and SDK breakdowns
1153
+ * @example
1154
+ * ```typescript
1155
+ * const response = await client.getClientConnectionReports({
1156
+ * org_id: 'org-123',
1157
+ * app_id: 'app-456',
1158
+ * id: 'instance-789',
1159
+ * start: '2024-01-01T00:00:00Z',
1160
+ * end: '2024-01-31T23:59:59Z'
1161
+ * });
1162
+ * console.log(response.users); // Total number of users
1163
+ * console.log(response.sdks); // Array of SDK connection reports
1164
+ * ```
1165
+ */
1166
+ getClientConnectionReports: sdk.Endpoint<{
1167
+ start: string;
1168
+ end: string;
1169
+ scrape_ttl?: {
1170
+ date: string;
1171
+ } | undefined;
1172
+ } & {
1173
+ org_id: string;
1174
+ app_id: string;
1175
+ id: string;
1176
+ }, {
1177
+ users: number;
1178
+ sdks: {
1179
+ users: number;
1180
+ sdk: string;
1181
+ clients: number;
1182
+ }[];
1183
+ }, C>;
1184
+ /**
1185
+ * Gets currently connected clients for a PowerSync instance.
1186
+ *
1187
+ * @returns Promise resolving to current connection data including user counts and SDK breakdowns
1188
+ * @example
1189
+ * ```typescript
1190
+ * const response = await client.getConnectedClients({
1191
+ * org_id: 'org-123',
1192
+ * app_id: 'app-456',
1193
+ * id: 'instance-789'
1194
+ * });
1195
+ * console.log(response.users); // Number of currently connected users
1196
+ * console.log(response.sdks); // Array of current SDK connections
1197
+ * ```
1198
+ */
1199
+ getConnectedClients: sdk.Endpoint<{
1200
+ org_id: string;
1201
+ app_id: string;
1202
+ id: string;
1203
+ }, {
1204
+ users: number;
1205
+ sdks: {
1206
+ users: number;
1207
+ sdk: string;
1208
+ clients: number;
1209
+ }[];
1210
+ }, C>;
1211
+ /**
1212
+ * Gets paginated general client connection analytics for a PowerSync instance.
1213
+ * Returns connection events including connect/disconnect times, user agents, and SDK information.
1214
+ *
1215
+ * @returns Promise resolving to paginated connection analytics events. Also includes a `paginate` method for iterating through all pages.
1216
+ * @example
1217
+ * ```typescript
1218
+ * // Single page request
1219
+ * const response = await client.getGeneralClientConnectionAnalytics({
1220
+ * org_id: 'org-123',
1221
+ * app_id: 'app-456',
1222
+ * id: 'instance-789',
1223
+ * date_range: {
1224
+ * start: '2024-01-01T00:00:00Z',
1225
+ * end: '2024-01-31T23:59:59Z'
1226
+ * },
1227
+ * limit: 100
1228
+ * });
1229
+ * console.log(response.items); // Array of connection events
1230
+ * console.log(response.total); // Total number of events
1231
+ * console.log(response.more); // true if there are more pages
1232
+ * console.log(response.cursor); // cursor for the next page
1233
+ *
1234
+ * // Iterate through all pages
1235
+ * for await (const page of client.getGeneralClientConnectionAnalytics.paginate({
1236
+ * org_id: 'org-123',
1237
+ * app_id: 'app-456',
1238
+ * id: 'instance-789',
1239
+ * date_range: {
1240
+ * start: '2024-01-01T00:00:00Z',
1241
+ * end: '2024-01-31T23:59:59Z'
1242
+ * },
1243
+ * limit: 100
1244
+ * })) {
1245
+ * console.log(page.items); // Process each page
1246
+ * }
1247
+ * ```
1248
+ */
1249
+ getGeneralClientConnectionAnalytics: ((params: {
1250
+ id: string;
1251
+ org_id: string;
1252
+ app_id: string;
1253
+ user_id?: string | undefined;
1254
+ client_id?: string | undefined;
1255
+ date_range?: {
1256
+ start: string;
1257
+ end: string;
1258
+ } | undefined;
1259
+ } & {
1260
+ cursor?: string | undefined;
1261
+ limit?: number | undefined;
1262
+ }) => Promise<{
1263
+ total: number;
1264
+ count: number;
1265
+ more: boolean;
1266
+ items: {
1267
+ user_id: string;
1268
+ sdk: string;
1269
+ client_id: string;
1270
+ connected_at: string;
1271
+ user_agent: string;
1272
+ disconnected_at?: string | undefined;
1273
+ jwt_exp?: string | undefined;
1274
+ }[];
1275
+ cursor?: string | undefined;
1276
+ }>) & {
1277
+ paginate: (params: {
1278
+ id: string;
1279
+ org_id: string;
1280
+ app_id: string;
1281
+ user_id?: string | undefined;
1282
+ client_id?: string | undefined;
1283
+ date_range?: {
1284
+ start: string;
1285
+ end: string;
1286
+ } | undefined;
1287
+ } & {
1288
+ cursor?: string | undefined;
1289
+ limit?: number | undefined;
1290
+ }) => AsyncGenerator<{
1291
+ total: number;
1292
+ count: number;
1293
+ more: boolean;
1294
+ items: {
1295
+ user_id: string;
1296
+ sdk: string;
1297
+ client_id: string;
1298
+ connected_at: string;
1299
+ user_agent: string;
1300
+ disconnected_at?: string | undefined;
1301
+ jwt_exp?: string | undefined;
1302
+ }[];
1303
+ cursor?: string | undefined;
1304
+ }, void, unknown>;
1305
+ };
1306
+ }