@powersync/management-types 0.0.0-dev.85b697f3

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 (64) hide show
  1. package/LICENSE +67 -0
  2. package/README.md +88 -0
  3. package/dist/config/HostedConfig.d.ts +1318 -0
  4. package/dist/config/HostedConfig.js +101 -0
  5. package/dist/config/HostedConfig.js.map +1 -0
  6. package/dist/config/HostedSecret.d.ts +18 -0
  7. package/dist/config/HostedSecret.js +12 -0
  8. package/dist/config/HostedSecret.js.map +1 -0
  9. package/dist/config/connections/ConnectionType.d.ts +6 -0
  10. package/dist/config/connections/ConnectionType.js +8 -0
  11. package/dist/config/connections/ConnectionType.js.map +1 -0
  12. package/dist/config/connections/HostedDatabaseSourceConfig.d.ts +23 -0
  13. package/dist/config/connections/HostedDatabaseSourceConfig.js +18 -0
  14. package/dist/config/connections/HostedDatabaseSourceConfig.js.map +1 -0
  15. package/dist/config/connections/HostedMSSQLConnection.d.ts +308 -0
  16. package/dist/config/connections/HostedMSSQLConnection.js +41 -0
  17. package/dist/config/connections/HostedMSSQLConnection.js.map +1 -0
  18. package/dist/config/connections/HostedMongoConnection.d.ts +33 -0
  19. package/dist/config/connections/HostedMongoConnection.js +10 -0
  20. package/dist/config/connections/HostedMongoConnection.js.map +1 -0
  21. package/dist/config/connections/HostedMySQLConnection.d.ts +46 -0
  22. package/dist/config/connections/HostedMySQLConnection.js +16 -0
  23. package/dist/config/connections/HostedMySQLConnection.js.map +1 -0
  24. package/dist/config/connections/HostedPostgresConnection.d.ts +52 -0
  25. package/dist/config/connections/HostedPostgresConnection.js +21 -0
  26. package/dist/config/connections/HostedPostgresConnection.js.map +1 -0
  27. package/dist/errors.d.ts +10 -0
  28. package/dist/errors.js +13 -0
  29. package/dist/errors.js.map +1 -0
  30. package/dist/index.d.ts +13 -0
  31. package/dist/index.js +14 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/routes/dashboard-routes.d.ts +13 -0
  34. package/dist/routes/dashboard-routes.js +16 -0
  35. package/dist/routes/dashboard-routes.js.map +1 -0
  36. package/dist/routes/dev-routes.d.ts +588 -0
  37. package/dist/routes/dev-routes.js +97 -0
  38. package/dist/routes/dev-routes.js.map +1 -0
  39. package/dist/routes/general-routes.d.ts +78 -0
  40. package/dist/routes/general-routes.js +57 -0
  41. package/dist/routes/general-routes.js.map +1 -0
  42. package/dist/routes/index.d.ts +6 -0
  43. package/dist/routes/index.js +7 -0
  44. package/dist/routes/index.js.map +1 -0
  45. package/dist/routes/manage-routes.d.ts +1055 -0
  46. package/dist/routes/manage-routes.js +109 -0
  47. package/dist/routes/manage-routes.js.map +1 -0
  48. package/dist/routes/reporting-routes.d.ts +112 -0
  49. package/dist/routes/reporting-routes.js +61 -0
  50. package/dist/routes/reporting-routes.js.map +1 -0
  51. package/dist/routes/schema.d.ts +131 -0
  52. package/dist/routes/schema.js +71 -0
  53. package/dist/routes/schema.js.map +1 -0
  54. package/dist/scripts/compile-json-schema.d.ts +1 -0
  55. package/dist/scripts/compile-json-schema.js +15 -0
  56. package/dist/scripts/compile-json-schema.js.map +1 -0
  57. package/dist/shared.d.ts +17 -0
  58. package/dist/shared.js +17 -0
  59. package/dist/shared.js.map +1 -0
  60. package/dist/utils/pagination.d.ts +12 -0
  61. package/dist/utils/pagination.js +13 -0
  62. package/dist/utils/pagination.js.map +1 -0
  63. package/json-schema/powersync-config.json +880 -0
  64. package/package.json +44 -0
@@ -0,0 +1,588 @@
1
+ import { internal_routes } from '@powersync/service-types';
2
+ import 'bson';
3
+ import * as t from 'ts-codec';
4
+ export declare enum DEV_ROUTES {
5
+ EXECUTE_SQL = "/api/v1/instances/dev/execute-sql",
6
+ GET_SCHEMA = "/api/v1/instances/dev/schema",
7
+ VALIDATE_SYNC_RULES = "/api/v1/instances/dev/validate-sync-rules",
8
+ REPROCESS_SYNC_RULES = "/api/v1/instances/dev/reprocess-sync-rules",
9
+ GENERATE_DEV_TOKEN = "/api/v1/instances/dev/generate-dev-token",
10
+ TEST_CONNECTION = "/api/v1/connections/test",
11
+ TEST_MONGODB_CONNECTION = "/api/v1/connections/test/mongodb"
12
+ }
13
+ export declare const TestConnectionRequest: t.ObjectCodec<{
14
+ org_id: t.IdentityCodec<t.CodecType.String>;
15
+ app_id: t.IdentityCodec<t.CodecType.String>;
16
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
17
+ connection: t.Union<t.Codec<({
18
+ type: import("../index.js").ConnectionType;
19
+ name?: string | undefined;
20
+ id?: string | undefined;
21
+ tag?: string | undefined;
22
+ username?: string | undefined;
23
+ password?: {
24
+ secret: string;
25
+ } | {
26
+ secret_ref: string;
27
+ } | undefined;
28
+ database?: string | undefined;
29
+ } & {
30
+ type: import("../index.js").ConnectionType.MONGODB;
31
+ uri: string;
32
+ post_images?: "off" | "auto_configure" | "read_only" | undefined;
33
+ vpc_endpoint_hostname?: string | undefined;
34
+ }) | ({
35
+ type: import("../index.js").ConnectionType;
36
+ name?: string | undefined;
37
+ id?: string | undefined;
38
+ tag?: string | undefined;
39
+ username?: string | undefined;
40
+ password?: {
41
+ secret: string;
42
+ } | {
43
+ secret_ref: string;
44
+ } | undefined;
45
+ database?: string | undefined;
46
+ } & {
47
+ type: import("../index.js").ConnectionType.MYSQL;
48
+ uri?: string | undefined;
49
+ hostname?: string | undefined;
50
+ port?: number | undefined;
51
+ debug_api?: boolean | undefined;
52
+ client_certificate?: string | undefined;
53
+ client_private_key?: {
54
+ secret: string;
55
+ } | {
56
+ secret_ref: string;
57
+ } | undefined;
58
+ }) | ({
59
+ type: import("../index.js").ConnectionType;
60
+ name?: string | undefined;
61
+ id?: string | undefined;
62
+ tag?: string | undefined;
63
+ username?: string | undefined;
64
+ password?: {
65
+ secret: string;
66
+ } | {
67
+ secret_ref: string;
68
+ } | undefined;
69
+ database?: string | undefined;
70
+ } & {
71
+ type: import("../index.js").ConnectionType.POSTGRES;
72
+ uri?: string | undefined;
73
+ vpc_endpoint_hostname?: string | undefined;
74
+ hostname?: string | undefined;
75
+ port?: number | undefined;
76
+ debug_api?: boolean | undefined;
77
+ client_certificate?: string | undefined;
78
+ client_private_key?: {
79
+ secret: string;
80
+ } | {
81
+ secret_ref: string;
82
+ } | undefined;
83
+ sslmode?: "verify-full" | "verify-ca" | undefined;
84
+ cacert?: string | undefined;
85
+ }), ({
86
+ type: import("../index.js").ConnectionType;
87
+ name?: string | undefined;
88
+ id?: string | undefined;
89
+ tag?: string | undefined;
90
+ username?: string | undefined;
91
+ password?: {
92
+ secret: string;
93
+ } | {
94
+ secret_ref: string;
95
+ } | undefined;
96
+ database?: string | undefined;
97
+ } & {
98
+ type: import("../index.js").ConnectionType.MONGODB;
99
+ uri: string;
100
+ post_images?: "off" | "auto_configure" | "read_only" | undefined;
101
+ vpc_endpoint_hostname?: string | undefined;
102
+ }) | ({
103
+ type: import("../index.js").ConnectionType;
104
+ name?: string | undefined;
105
+ id?: string | undefined;
106
+ tag?: string | undefined;
107
+ username?: string | undefined;
108
+ password?: {
109
+ secret: string;
110
+ } | {
111
+ secret_ref: string;
112
+ } | undefined;
113
+ database?: string | undefined;
114
+ } & {
115
+ type: import("../index.js").ConnectionType.MYSQL;
116
+ uri?: string | undefined;
117
+ hostname?: string | undefined;
118
+ port?: number | undefined;
119
+ debug_api?: boolean | undefined;
120
+ client_certificate?: string | undefined;
121
+ client_private_key?: {
122
+ secret: string;
123
+ } | {
124
+ secret_ref: string;
125
+ } | undefined;
126
+ }) | ({
127
+ type: import("../index.js").ConnectionType;
128
+ name?: string | undefined;
129
+ id?: string | undefined;
130
+ tag?: string | undefined;
131
+ username?: string | undefined;
132
+ password?: {
133
+ secret: string;
134
+ } | {
135
+ secret_ref: string;
136
+ } | undefined;
137
+ database?: string | undefined;
138
+ } & {
139
+ type: import("../index.js").ConnectionType.POSTGRES;
140
+ uri?: string | undefined;
141
+ vpc_endpoint_hostname?: string | undefined;
142
+ hostname?: string | undefined;
143
+ port?: number | undefined;
144
+ debug_api?: boolean | undefined;
145
+ client_certificate?: string | undefined;
146
+ client_private_key?: {
147
+ secret: string;
148
+ } | {
149
+ secret_ref: string;
150
+ } | undefined;
151
+ sslmode?: "verify-full" | "verify-ca" | undefined;
152
+ cacert?: string | undefined;
153
+ }), string, t.CodecProps>, t.Intersection<t.Codec<{
154
+ type: import("../index.js").ConnectionType;
155
+ name?: string | undefined;
156
+ id?: string | undefined;
157
+ tag?: string | undefined;
158
+ username?: string | undefined;
159
+ password?: {
160
+ secret: string;
161
+ } | {
162
+ secret_ref: string;
163
+ } | undefined;
164
+ database?: string | undefined;
165
+ }, {
166
+ type: import("../index.js").ConnectionType;
167
+ name?: string | undefined;
168
+ id?: string | undefined;
169
+ tag?: string | undefined;
170
+ username?: string | undefined;
171
+ password?: {
172
+ secret: string;
173
+ } | {
174
+ secret_ref: string;
175
+ } | undefined;
176
+ database?: string | undefined;
177
+ }, string, t.CodecProps>, t.ObjectCodec<{
178
+ type: t.LiteralCodec<import("../index.js").ConnectionType.MSSQL>;
179
+ uri: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
180
+ hostname: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
181
+ port: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
182
+ schema: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
183
+ authentication: t.OptionalCodec<t.Codec<({
184
+ type: "default";
185
+ options: {
186
+ password: string;
187
+ userName: string;
188
+ };
189
+ } & {
190
+ options: {
191
+ password: {
192
+ secret: string;
193
+ } | {
194
+ secret_ref: string;
195
+ };
196
+ };
197
+ }) | ({
198
+ type: "azure-active-directory-password";
199
+ options: {
200
+ password: string;
201
+ userName: string;
202
+ clientId: string;
203
+ tenantId: string;
204
+ };
205
+ } & {
206
+ options: {
207
+ password: {
208
+ secret: string;
209
+ } | {
210
+ secret_ref: string;
211
+ };
212
+ };
213
+ }) | ({
214
+ type: "azure-active-directory-service-principal-secret";
215
+ options: {
216
+ clientId: string;
217
+ tenantId: string;
218
+ clientSecret: string;
219
+ };
220
+ } & {
221
+ options: {
222
+ clientSecret: {
223
+ secret: string;
224
+ } | {
225
+ secret_ref: string;
226
+ };
227
+ };
228
+ }), ({
229
+ type: "default";
230
+ options: {
231
+ password: string;
232
+ userName: string;
233
+ };
234
+ } & {
235
+ options: {
236
+ password: {
237
+ secret: string;
238
+ } | {
239
+ secret_ref: string;
240
+ };
241
+ };
242
+ }) | ({
243
+ type: "azure-active-directory-password";
244
+ options: {
245
+ password: string;
246
+ userName: string;
247
+ clientId: string;
248
+ tenantId: string;
249
+ };
250
+ } & {
251
+ options: {
252
+ password: {
253
+ secret: string;
254
+ } | {
255
+ secret_ref: string;
256
+ };
257
+ };
258
+ }) | ({
259
+ type: "azure-active-directory-service-principal-secret";
260
+ options: {
261
+ clientId: string;
262
+ tenantId: string;
263
+ clientSecret: string;
264
+ };
265
+ } & {
266
+ options: {
267
+ clientSecret: {
268
+ secret: string;
269
+ } | {
270
+ secret_ref: string;
271
+ };
272
+ };
273
+ }), string, t.CodecProps>>;
274
+ additionalConfig: t.OptionalCodec<t.Codec<{
275
+ pollingIntervalMs?: number | undefined;
276
+ pollingBatchSize?: number | undefined;
277
+ trustServerCertificate?: boolean | undefined;
278
+ }, {
279
+ pollingIntervalMs?: number | undefined;
280
+ pollingBatchSize?: number | undefined;
281
+ trustServerCertificate?: boolean | undefined;
282
+ }, string, t.CodecProps>>;
283
+ debug_api: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
284
+ }>>>;
285
+ }>;
286
+ export type TestConnectionRequest = t.Encoded<typeof TestConnectionRequest>;
287
+ export declare const ConnectionTestDetails: t.ObjectCodec<{
288
+ /** If false, check the fields below. */
289
+ success: t.IdentityCodec<t.CodecType.Boolean>;
290
+ /** Can open a TCP connection. */
291
+ reachable: t.IdentityCodec<t.CodecType.Boolean>;
292
+ }>;
293
+ /**
294
+ * Base results from testing a data source's connection
295
+ */
296
+ export type ConnectionTestDetails = t.Encoded<typeof ConnectionTestDetails>;
297
+ export declare const ConnectionTestConfigurationDetails: t.ObjectCodec<{
298
+ /** If false, check the fields below. */
299
+ success: t.IdentityCodec<t.CodecType.Boolean>;
300
+ }>;
301
+ /**
302
+ * Base results from testing a data source's configuration
303
+ */
304
+ export type ConnectionTestConfigurationDetails = t.Encoded<typeof ConnectionTestConfigurationDetails>;
305
+ export declare const BaseTestConnectionResponse: t.ObjectCodec<{
306
+ /** If false, check the fields below. */
307
+ success: t.IdentityCodec<t.CodecType.Boolean>;
308
+ connection: t.ObjectCodec<{
309
+ /** If false, check the fields below. */
310
+ success: t.IdentityCodec<t.CodecType.Boolean>;
311
+ /** Can open a TCP connection. */
312
+ reachable: t.IdentityCodec<t.CodecType.Boolean>;
313
+ }>;
314
+ /**
315
+ * Indicates potential configuration issues.
316
+ *
317
+ * Only present if the connection succeeded.
318
+ */
319
+ configuration: t.OptionalCodec<t.Codec<{
320
+ success: boolean;
321
+ }, {
322
+ success: boolean;
323
+ }, string, t.CodecProps>>;
324
+ /**
325
+ * A human-readable error message, always set if success = false.
326
+ *
327
+ * Use as a fallback if the specific reason is not clear from other response fields.
328
+ */
329
+ error: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
330
+ }>;
331
+ export type BaseTestConnectionResponse = t.Encoded<typeof BaseTestConnectionResponse>;
332
+ export declare const TestPostgresConnectionResponse: t.Intersection<t.Codec<{
333
+ connection: {
334
+ success: boolean;
335
+ reachable: boolean;
336
+ };
337
+ success: boolean;
338
+ configuration?: {
339
+ success: boolean;
340
+ } | undefined;
341
+ error?: string | undefined;
342
+ }, {
343
+ connection: {
344
+ success: boolean;
345
+ reachable: boolean;
346
+ };
347
+ success: boolean;
348
+ configuration?: {
349
+ success: boolean;
350
+ } | undefined;
351
+ error?: string | undefined;
352
+ }, string, t.CodecProps>, t.ObjectCodec<{
353
+ connection: t.Intersection<t.Codec<{
354
+ success: boolean;
355
+ reachable: boolean;
356
+ }, {
357
+ success: boolean;
358
+ reachable: boolean;
359
+ }, string, t.CodecProps>, t.ObjectCodec<{
360
+ /**
361
+ * Did TLS connection work? Only set if reachable.
362
+ */
363
+ tls_valid: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
364
+ /** If TLS connection failed, use this CA list. */
365
+ suggested_cacert: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
366
+ /** verify-full or verify-ca */
367
+ suggested_sslmode: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
368
+ /** Only set if reachable and tls_valid */
369
+ authenticated: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
370
+ }>>;
371
+ configuration: t.OptionalCodec<t.Codec<{
372
+ success: boolean;
373
+ } & {
374
+ wal_valid?: boolean | undefined;
375
+ publication_valid?: boolean | undefined;
376
+ }, {
377
+ success: boolean;
378
+ } & {
379
+ wal_valid?: boolean | undefined;
380
+ publication_valid?: boolean | undefined;
381
+ }, string, t.CodecProps>>;
382
+ }>>;
383
+ export type TestPostgresConnectionResponse = t.Encoded<typeof TestPostgresConnectionResponse>;
384
+ export declare const TestConnectionResponse: t.Union<t.Codec<{
385
+ connection: {
386
+ success: boolean;
387
+ reachable: boolean;
388
+ };
389
+ success: boolean;
390
+ configuration?: {
391
+ success: boolean;
392
+ } | undefined;
393
+ error?: string | undefined;
394
+ }, {
395
+ connection: {
396
+ success: boolean;
397
+ reachable: boolean;
398
+ };
399
+ success: boolean;
400
+ configuration?: {
401
+ success: boolean;
402
+ } | undefined;
403
+ error?: string | undefined;
404
+ }, string, t.CodecProps>, t.Intersection<t.Codec<{
405
+ connection: {
406
+ success: boolean;
407
+ reachable: boolean;
408
+ };
409
+ success: boolean;
410
+ configuration?: {
411
+ success: boolean;
412
+ } | undefined;
413
+ error?: string | undefined;
414
+ }, {
415
+ connection: {
416
+ success: boolean;
417
+ reachable: boolean;
418
+ };
419
+ success: boolean;
420
+ configuration?: {
421
+ success: boolean;
422
+ } | undefined;
423
+ error?: string | undefined;
424
+ }, string, t.CodecProps>, t.ObjectCodec<{
425
+ connection: t.Intersection<t.Codec<{
426
+ success: boolean;
427
+ reachable: boolean;
428
+ }, {
429
+ success: boolean;
430
+ reachable: boolean;
431
+ }, string, t.CodecProps>, t.ObjectCodec<{
432
+ /**
433
+ * Did TLS connection work? Only set if reachable.
434
+ */
435
+ tls_valid: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
436
+ /** If TLS connection failed, use this CA list. */
437
+ suggested_cacert: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
438
+ /** verify-full or verify-ca */
439
+ suggested_sslmode: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
440
+ /** Only set if reachable and tls_valid */
441
+ authenticated: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
442
+ }>>;
443
+ configuration: t.OptionalCodec<t.Codec<{
444
+ success: boolean;
445
+ } & {
446
+ wal_valid?: boolean | undefined;
447
+ publication_valid?: boolean | undefined;
448
+ }, {
449
+ success: boolean;
450
+ } & {
451
+ wal_valid?: boolean | undefined;
452
+ publication_valid?: boolean | undefined;
453
+ }, string, t.CodecProps>>;
454
+ }>>>;
455
+ export type TestConnectionResponse = t.Encoded<typeof TestConnectionResponse>;
456
+ export declare const GetSchemaRequest: t.ObjectCodec<{
457
+ org_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
458
+ app_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
459
+ id: t.IdentityCodec<t.CodecType.String>;
460
+ }>;
461
+ export type GetSchemaRequest = t.Encoded<typeof GetSchemaRequest>;
462
+ export declare const GetSchemaResponse: t.ObjectCodec<{
463
+ connections: t.ArrayCodec<t.ObjectCodec<{
464
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
465
+ tag: t.IdentityCodec<t.CodecType.String>;
466
+ schemas: t.ArrayCodec<t.ObjectCodec<{
467
+ name: t.IdentityCodec<t.CodecType.String>;
468
+ tables: t.ArrayCodec<t.ObjectCodec<{
469
+ name: t.IdentityCodec<t.CodecType.String>;
470
+ columns: t.ArrayCodec<t.ObjectCodec<{
471
+ name: t.IdentityCodec<t.CodecType.String>;
472
+ sqlite_type: t.OptionalCodec<t.Codec<number | import("./schema.js").SqliteSchemaTypeText, number | import("./schema.js").SqliteSchemaTypeText, string, t.CodecProps>>;
473
+ internal_type: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
474
+ description: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
475
+ type: t.IdentityCodec<t.CodecType.String>;
476
+ pg_type: t.IdentityCodec<t.CodecType.String>;
477
+ }>>;
478
+ }>>;
479
+ }>>;
480
+ }>>;
481
+ defaultConnectionTag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
482
+ defaultSchema: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
483
+ }>;
484
+ export type GetSchemaResponse = t.Encoded<typeof GetSchemaResponse>;
485
+ export declare const ExecuteSqlRequest: t.Intersection<t.Codec<{
486
+ id: string;
487
+ org_id: import("bson").ObjectId;
488
+ app_id: import("bson").ObjectId;
489
+ }, {
490
+ id: string;
491
+ org_id: string;
492
+ app_id: string;
493
+ }, string, t.CodecProps>, t.ObjectCodec<{
494
+ connection_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
495
+ sql: t.ObjectCodec<{
496
+ query: t.IdentityCodec<t.CodecType.String>;
497
+ args: t.ArrayCodec<t.Union<t.Codec<string | number, string | number, string, t.CodecProps>, t.IdentityCodec<t.CodecType.Boolean>>>;
498
+ }>;
499
+ }>>;
500
+ export type ExecuteSqlRequest = t.Encoded<typeof ExecuteSqlRequest>;
501
+ export declare const ExecuteSqlResponse: t.ObjectCodec<{
502
+ success: t.IdentityCodec<t.CodecType.Boolean>;
503
+ results: t.ObjectCodec<{
504
+ columns: t.ArrayCodec<t.IdentityCodec<t.CodecType.String>>;
505
+ rows: t.ArrayCodec<t.ArrayCodec<t.Union<t.Codec<string | number | boolean, string | number | boolean, string, t.CodecProps>, t.Codec<null, null, t.CodecType.Null, t.CodecProps>>>>;
506
+ }>;
507
+ error: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
508
+ }>;
509
+ export type ExecuteSqlResponse = internal_routes.ExecuteSqlResponse;
510
+ export declare const ValidateSyncRulesRequest: t.Intersection<t.Codec<{
511
+ id: string;
512
+ org_id: import("bson").ObjectId;
513
+ app_id: import("bson").ObjectId;
514
+ }, {
515
+ id: string;
516
+ org_id: string;
517
+ app_id: string;
518
+ }, string, t.CodecProps>, t.ObjectCodec<{
519
+ sync_rules: t.IdentityCodec<t.CodecType.String>;
520
+ }>>;
521
+ export type ValidateSyncRulesRequest = t.Encoded<typeof ValidateSyncRulesRequest>;
522
+ export declare const ValidateSyncRulesResponse: t.ObjectCodec<{
523
+ content: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
524
+ connections: t.ArrayCodec<t.ObjectCodec<{
525
+ id: t.IdentityCodec<t.CodecType.String>;
526
+ tag: t.IdentityCodec<t.CodecType.String>;
527
+ slot_name: t.IdentityCodec<t.CodecType.String>;
528
+ initial_replication_done: t.IdentityCodec<t.CodecType.Boolean>;
529
+ last_lsn: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
530
+ last_keepalive_ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
531
+ last_checkpoint_ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
532
+ replication_lag_bytes: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
533
+ tables: t.ArrayCodec<t.ObjectCodec<{
534
+ schema: t.IdentityCodec<t.CodecType.String>;
535
+ name: t.IdentityCodec<t.CodecType.String>;
536
+ pattern: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
537
+ replication_id: t.ArrayCodec<t.IdentityCodec<t.CodecType.String>>;
538
+ data_queries: t.IdentityCodec<t.CodecType.Boolean>;
539
+ parameter_queries: t.IdentityCodec<t.CodecType.Boolean>;
540
+ errors: t.ArrayCodec<t.ObjectCodec<{
541
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
542
+ message: t.IdentityCodec<t.CodecType.String>;
543
+ ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
544
+ }>>;
545
+ }>>;
546
+ }>>;
547
+ errors: t.ArrayCodec<t.ObjectCodec<{
548
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
549
+ message: t.IdentityCodec<t.CodecType.String>;
550
+ ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
551
+ }>>;
552
+ }>;
553
+ export type ValidateSyncRulesResponse = t.Encoded<typeof ValidateSyncRulesResponse>;
554
+ export declare const ReprocessSyncRulesRequest: t.Intersection<t.Codec<{
555
+ id: string;
556
+ org_id: import("bson").ObjectId;
557
+ app_id: import("bson").ObjectId;
558
+ }, {
559
+ id: string;
560
+ org_id: string;
561
+ app_id: string;
562
+ }, string, t.CodecProps>, t.ObjectCodec<{}>>;
563
+ export type ReprocessSyncRulesRequest = t.Encoded<typeof ReprocessSyncRulesRequest>;
564
+ export declare const ReprocessSyncRulesResponse: t.ObjectCodec<{
565
+ connections: t.ArrayCodec<t.ObjectCodec<{
566
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
567
+ tag: t.IdentityCodec<t.CodecType.String>;
568
+ slot_name: t.IdentityCodec<t.CodecType.String>;
569
+ }>>;
570
+ }>;
571
+ export type ReprocessSyncRulesResponse = t.Encoded<typeof ReprocessSyncRulesResponse>;
572
+ export declare const GenerateDevTokenRequest: t.Intersection<t.Codec<{
573
+ id: string;
574
+ org_id: import("bson").ObjectId;
575
+ app_id: import("bson").ObjectId;
576
+ }, {
577
+ id: string;
578
+ org_id: string;
579
+ app_id: string;
580
+ }, string, t.CodecProps>, t.ObjectCodec<{
581
+ subject: t.IdentityCodec<t.CodecType.String>;
582
+ expiresInSeconds: t.IdentityCodec<t.CodecType.Number>;
583
+ }>>;
584
+ export type GenerateDevTokenRequest = t.Encoded<typeof GenerateDevTokenRequest>;
585
+ export declare const GenerateDevTokenResponse: t.ObjectCodec<{
586
+ token: t.IdentityCodec<t.CodecType.String>;
587
+ }>;
588
+ export type GenerateDevTokenResponse = t.Encoded<typeof GenerateDevTokenResponse>;
@@ -0,0 +1,97 @@
1
+ import { internal_routes } from '@powersync/service-types';
2
+ // Required for the ObjectId codec
3
+ import 'bson';
4
+ import * as t from 'ts-codec';
5
+ import { AnyHostedConnection } from '../config/HostedConfig.js';
6
+ import { InstanceId } from '../shared.js';
7
+ import { InstanceSchema } from './schema.js';
8
+ export var DEV_ROUTES;
9
+ (function (DEV_ROUTES) {
10
+ DEV_ROUTES["EXECUTE_SQL"] = "/api/v1/instances/dev/execute-sql";
11
+ DEV_ROUTES["GET_SCHEMA"] = "/api/v1/instances/dev/schema";
12
+ DEV_ROUTES["VALIDATE_SYNC_RULES"] = "/api/v1/instances/dev/validate-sync-rules";
13
+ DEV_ROUTES["REPROCESS_SYNC_RULES"] = "/api/v1/instances/dev/reprocess-sync-rules";
14
+ DEV_ROUTES["GENERATE_DEV_TOKEN"] = "/api/v1/instances/dev/generate-dev-token";
15
+ DEV_ROUTES["TEST_CONNECTION"] = "/api/v1/connections/test";
16
+ DEV_ROUTES["TEST_MONGODB_CONNECTION"] = "/api/v1/connections/test/mongodb";
17
+ })(DEV_ROUTES || (DEV_ROUTES = {}));
18
+ // POST /api/v1/connections/test
19
+ // Test a connection without deploying
20
+ export const TestConnectionRequest = t.object({
21
+ org_id: t.string,
22
+ app_id: t.string,
23
+ id: t.string.optional(),
24
+ connection: AnyHostedConnection
25
+ });
26
+ export const ConnectionTestDetails = t.object({
27
+ /** If false, check the fields below. */
28
+ success: t.boolean,
29
+ /** Can open a TCP connection. */
30
+ reachable: t.boolean
31
+ });
32
+ export const ConnectionTestConfigurationDetails = t.object({
33
+ /** If false, check the fields below. */
34
+ success: t.boolean
35
+ });
36
+ export const BaseTestConnectionResponse = t.object({
37
+ /** If false, check the fields below. */
38
+ success: t.boolean,
39
+ connection: ConnectionTestDetails,
40
+ /**
41
+ * Indicates potential configuration issues.
42
+ *
43
+ * Only present if the connection succeeded.
44
+ */
45
+ configuration: ConnectionTestConfigurationDetails.optional(),
46
+ /**
47
+ * A human-readable error message, always set if success = false.
48
+ *
49
+ * Use as a fallback if the specific reason is not clear from other response fields.
50
+ */
51
+ error: t.string.optional()
52
+ });
53
+ export const TestPostgresConnectionResponse = BaseTestConnectionResponse.and(t.object({
54
+ connection: ConnectionTestDetails.and(t.object({
55
+ /**
56
+ * Did TLS connection work? Only set if reachable.
57
+ */
58
+ tls_valid: t.boolean.optional(),
59
+ /** If TLS connection failed, use this CA list. */
60
+ suggested_cacert: t.string.optional(),
61
+ /** verify-full or verify-ca */
62
+ suggested_sslmode: t.string.optional(),
63
+ /** Only set if reachable and tls_valid */
64
+ authenticated: t.boolean.optional()
65
+ })),
66
+ configuration: ConnectionTestConfigurationDetails.and(t.object({
67
+ /** True if no issues detected. */
68
+ wal_valid: t.boolean.optional(),
69
+ /** True if publication is configured correctly. */
70
+ publication_valid: t.boolean.optional()
71
+ })).optional()
72
+ }));
73
+ export const TestConnectionResponse = BaseTestConnectionResponse.or(TestPostgresConnectionResponse);
74
+ // POST /api/instances/dev/schema
75
+ // Only works if the instance is already provisioned.
76
+ export const GetSchemaRequest = InstanceId;
77
+ export const GetSchemaResponse = InstanceSchema;
78
+ // POST /api/v1/instances/dev/execute-sql
79
+ // Only works if the instance is already provisioned.
80
+ export const ExecuteSqlRequest = InstanceId.and(internal_routes.ExecuteSqlRequest);
81
+ export const ExecuteSqlResponse = internal_routes.ExecuteSqlResponse;
82
+ // POST /api/v1/instances/dev/validate-sync-rules
83
+ // Only works if the instance is already provisioned.
84
+ export const ValidateSyncRulesRequest = InstanceId.and(internal_routes.ValidateRequest);
85
+ export const ValidateSyncRulesResponse = internal_routes.ValidateResponse;
86
+ // POST /api/v1/instances/dev/reprocess-sync-rules
87
+ // Only works if the instance is already provisioned.
88
+ export const ReprocessSyncRulesRequest = InstanceId.and(internal_routes.ReprocessRequest);
89
+ export const ReprocessSyncRulesResponse = internal_routes.ReprocessResponse;
90
+ export const GenerateDevTokenRequest = InstanceId.and(t.object({
91
+ subject: t.string,
92
+ expiresInSeconds: t.number
93
+ }));
94
+ export const GenerateDevTokenResponse = t.object({
95
+ token: t.string
96
+ });
97
+ //# sourceMappingURL=dev-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-routes.js","sourceRoot":"","sources":["../../src/routes/dev-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,kCAAkC;AAClC,OAAO,MAAM,CAAC;AACd,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,+DAAiD,CAAA;IACjD,yDAA2C,CAAA;IAC3C,+EAAiE,CAAA;IACjE,iFAAmE,CAAA;IACnE,6EAA+D,CAAA;IAC/D,0DAA4C,CAAA;IAC5C,0EAA4D,CAAA;AAC9D,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB;AAED,gCAAgC;AAChC,sCAAsC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;IACvB,UAAU,EAAE,mBAAmB;CAChC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,C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