pgbeam 0.3.13 → 0.4.0

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/index.mjs CHANGED
@@ -1,787 +1,4 @@
1
- /**
2
- * Generated by generate-sdk-ts-maps.ts — do not edit manually.
3
- * Run: pnpm --filter pgbeam generate
4
- */ const operationsByTag = {
5
- account: {
6
- exportAccountData: {
7
- method: "GET",
8
- path: "/v1/account/export"
9
- },
10
- getOnboardingProgress: {
11
- method: "GET",
12
- path: "/v1/organizations/{org_id}/onboarding"
13
- },
14
- updateOnboardingProgress: {
15
- method: "PATCH",
16
- path: "/v1/organizations/{org_id}/onboarding"
17
- },
18
- listOrganizations: {
19
- method: "GET",
20
- path: "/v1/organizations"
21
- }
22
- },
23
- agents: {
24
- listAgentCredentials: {
25
- method: "GET",
26
- path: "/v1/projects/{project_id}/agents"
27
- },
28
- createAgentCredential: {
29
- method: "POST",
30
- path: "/v1/projects/{project_id}/agents"
31
- },
32
- getAgentCredential: {
33
- method: "GET",
34
- path: "/v1/projects/{project_id}/agents/{agent_id}"
35
- },
36
- updateAgentCredentialStatus: {
37
- method: "PATCH",
38
- path: "/v1/projects/{project_id}/agents/{agent_id}"
39
- },
40
- revokeAgentCredential: {
41
- method: "DELETE",
42
- path: "/v1/projects/{project_id}/agents/{agent_id}"
43
- },
44
- rotateAgentCredential: {
45
- method: "POST",
46
- path: "/v1/projects/{project_id}/agents/{agent_id}/rotate"
47
- },
48
- listAuditLogs: {
49
- method: "GET",
50
- path: "/v1/projects/{project_id}/audit-logs"
51
- },
52
- exportAuditLogs: {
53
- method: "GET",
54
- path: "/v1/projects/{project_id}/audit-logs/export"
55
- },
56
- verifyAuditChain: {
57
- method: "GET",
58
- path: "/v1/projects/{project_id}/audit-logs/verify"
59
- }
60
- },
61
- policies: {
62
- recommendAgentPolicy: {
63
- method: "POST",
64
- path: "/v1/projects/{project_id}/agents/{agent_id}/policy-recommendation"
65
- },
66
- listPolicyProfiles: {
67
- method: "GET",
68
- path: "/v1/projects/{project_id}/policies"
69
- },
70
- createPolicyProfile: {
71
- method: "POST",
72
- path: "/v1/projects/{project_id}/policies"
73
- },
74
- getPolicyProfile: {
75
- method: "GET",
76
- path: "/v1/projects/{project_id}/policies/{policy_id}"
77
- },
78
- updatePolicyProfile: {
79
- method: "PUT",
80
- path: "/v1/projects/{project_id}/policies/{policy_id}"
81
- },
82
- deletePolicyProfile: {
83
- method: "DELETE",
84
- path: "/v1/projects/{project_id}/policies/{policy_id}"
85
- },
86
- dryEvalPolicy: {
87
- method: "POST",
88
- path: "/v1/projects/{project_id}/policy-evaluations"
89
- },
90
- replayPolicy: {
91
- method: "POST",
92
- path: "/v1/projects/{project_id}/policy-replays"
93
- }
94
- },
95
- anomalies: {
96
- listAnomalyAlerts: {
97
- method: "GET",
98
- path: "/v1/projects/{project_id}/anomalies"
99
- },
100
- updateAnomalyAlert: {
101
- method: "PATCH",
102
- path: "/v1/projects/{project_id}/anomalies/{anomaly_id}"
103
- }
104
- },
105
- approvals: {
106
- listApprovalRequests: {
107
- method: "GET",
108
- path: "/v1/projects/{project_id}/approvals"
109
- },
110
- approveApprovalRequest: {
111
- method: "POST",
112
- path: "/v1/projects/{project_id}/approvals/{approval_id}/approve"
113
- },
114
- rejectApprovalRequest: {
115
- method: "POST",
116
- path: "/v1/projects/{project_id}/approvals/{approval_id}/reject"
117
- }
118
- },
119
- analytics: {
120
- listPlans: {
121
- method: "GET",
122
- path: "/v1/plans"
123
- },
124
- getOrganizationPlan: {
125
- method: "GET",
126
- path: "/v1/organizations/{org_id}/plan"
127
- },
128
- getVercelInstallation: {
129
- method: "GET",
130
- path: "/v1/organizations/{org_id}/vercel-installation"
131
- },
132
- updateSpendLimit: {
133
- method: "PUT",
134
- path: "/v1/organizations/{org_id}/spend-limit"
135
- },
136
- submitCancellationFeedback: {
137
- method: "POST",
138
- path: "/v1/organizations/{org_id}/cancellation-feedback"
139
- },
140
- getProjectInsights: {
141
- method: "GET",
142
- path: "/v1/projects/{project_id}/insights"
143
- },
144
- getOrganizationUsage: {
145
- method: "GET",
146
- path: "/v1/organizations/{org_id}/usage"
147
- },
148
- getProjectUsage: {
149
- method: "GET",
150
- path: "/v1/projects/{project_id}/usage"
151
- }
152
- },
153
- branches: {
154
- listDatabaseBranches: {
155
- method: "GET",
156
- path: "/v1/projects/{project_id}/branches"
157
- },
158
- discardDatabaseBranch: {
159
- method: "DELETE",
160
- path: "/v1/projects/{project_id}/branches/{branch_id}"
161
- }
162
- },
163
- projects: {
164
- listCacheRules: {
165
- method: "GET",
166
- path: "/v1/projects/{project_id}/databases/{database_id}/cache-rules"
167
- },
168
- updateCacheRule: {
169
- method: "PUT",
170
- path: "/v1/projects/{project_id}/databases/{database_id}/cache-rules/{query_hash}"
171
- },
172
- listCustomDomains: {
173
- method: "GET",
174
- path: "/v1/projects/{project_id}/domains"
175
- },
176
- createCustomDomain: {
177
- method: "POST",
178
- path: "/v1/projects/{project_id}/domains"
179
- },
180
- deleteCustomDomain: {
181
- method: "DELETE",
182
- path: "/v1/projects/{project_id}/domains/{domain_id}"
183
- },
184
- verifyCustomDomain: {
185
- method: "POST",
186
- path: "/v1/projects/{project_id}/domains/{domain_id}/verify"
187
- },
188
- listProjects: {
189
- method: "GET",
190
- path: "/v1/projects"
191
- },
192
- createProject: {
193
- method: "POST",
194
- path: "/v1/projects"
195
- },
196
- getProject: {
197
- method: "GET",
198
- path: "/v1/projects/{project_id}"
199
- },
200
- updateProject: {
201
- method: "PATCH",
202
- path: "/v1/projects/{project_id}"
203
- },
204
- deleteProject: {
205
- method: "DELETE",
206
- path: "/v1/projects/{project_id}"
207
- },
208
- getProjectMetrics: {
209
- method: "GET",
210
- path: "/v1/projects/{project_id}/metrics"
211
- },
212
- listReplicas: {
213
- method: "GET",
214
- path: "/v1/databases/{database_id}/replicas"
215
- },
216
- createReplica: {
217
- method: "POST",
218
- path: "/v1/databases/{database_id}/replicas"
219
- },
220
- deleteReplica: {
221
- method: "DELETE",
222
- path: "/v1/databases/{database_id}/replicas/{replica_id}"
223
- }
224
- },
225
- databases: {
226
- listDatabases: {
227
- method: "GET",
228
- path: "/v1/projects/{project_id}/databases"
229
- },
230
- createDatabase: {
231
- method: "POST",
232
- path: "/v1/projects/{project_id}/databases"
233
- },
234
- getDatabase: {
235
- method: "GET",
236
- path: "/v1/projects/{project_id}/databases/{database_id}"
237
- },
238
- updateDatabase: {
239
- method: "PATCH",
240
- path: "/v1/projects/{project_id}/databases/{database_id}"
241
- },
242
- deleteDatabase: {
243
- method: "DELETE",
244
- path: "/v1/projects/{project_id}/databases/{database_id}"
245
- },
246
- testDatabaseConnection: {
247
- method: "POST",
248
- path: "/v1/projects/{project_id}/databases/{database_id}/test-connection"
249
- },
250
- scanDatabaseForPii: {
251
- method: "POST",
252
- path: "/v1/projects/{project_id}/databases/{database_id}/scan-pii"
253
- },
254
- getSchemaCatalog: {
255
- method: "GET",
256
- path: "/v1/projects/{project_id}/databases/{database_id}/schema-catalog"
257
- }
258
- },
259
- platform: {
260
- getHealth: {
261
- method: "GET",
262
- path: "/v1/health"
263
- },
264
- listRegions: {
265
- method: "GET",
266
- path: "/v1/regions"
267
- },
268
- listSelfHostEnrollments: {
269
- method: "GET",
270
- path: "/v1/organizations/{org_id}/self-host-enrollments"
271
- },
272
- createSelfHostEnrollment: {
273
- method: "POST",
274
- path: "/v1/organizations/{org_id}/self-host-enrollments"
275
- },
276
- revokeSelfHostEnrollment: {
277
- method: "DELETE",
278
- path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}"
279
- },
280
- rotateSelfHostEnrollment: {
281
- method: "POST",
282
- path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}/rotate"
283
- }
284
- },
285
- honeytokens: {
286
- listHoneytokens: {
287
- method: "GET",
288
- path: "/v1/projects/{project_id}/honeytokens"
289
- },
290
- createHoneytoken: {
291
- method: "POST",
292
- path: "/v1/projects/{project_id}/honeytokens"
293
- },
294
- getHoneytoken: {
295
- method: "GET",
296
- path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}"
297
- },
298
- updateHoneytoken: {
299
- method: "PUT",
300
- path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}"
301
- },
302
- deleteHoneytoken: {
303
- method: "DELETE",
304
- path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}"
305
- }
306
- },
307
- migrations: {
308
- lintMigration: {
309
- method: "POST",
310
- path: "/v1/projects/{project_id}/migrations:lint"
311
- }
312
- },
313
- support: {
314
- listSupportCases: {
315
- method: "GET",
316
- path: "/v1/organizations/{org_id}/support/cases"
317
- },
318
- createSupportCase: {
319
- method: "POST",
320
- path: "/v1/organizations/{org_id}/support/cases"
321
- },
322
- getSupportCase: {
323
- method: "GET",
324
- path: "/v1/organizations/{org_id}/support/cases/{case_id}"
325
- },
326
- updateSupportCase: {
327
- method: "PATCH",
328
- path: "/v1/organizations/{org_id}/support/cases/{case_id}"
329
- },
330
- createSupportMessage: {
331
- method: "POST",
332
- path: "/v1/organizations/{org_id}/support/cases/{case_id}/messages"
333
- }
334
- },
335
- internal: {
336
- handleSlackSupportEvent: {
337
- method: "POST",
338
- path: "/v1/internal/support/slack-event"
339
- }
340
- },
341
- webhooks: {
342
- listWebhookEndpoints: {
343
- method: "GET",
344
- path: "/v1/projects/{project_id}/webhooks"
345
- },
346
- createWebhookEndpoint: {
347
- method: "POST",
348
- path: "/v1/projects/{project_id}/webhooks"
349
- },
350
- getWebhookEndpoint: {
351
- method: "GET",
352
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}"
353
- },
354
- updateWebhookEndpoint: {
355
- method: "PUT",
356
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}"
357
- },
358
- deleteWebhookEndpoint: {
359
- method: "DELETE",
360
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}"
361
- },
362
- testWebhookEndpoint: {
363
- method: "POST",
364
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}/test"
365
- }
366
- }
367
- };
368
- const operationsByPath = {
369
- "GET /v1/account/export": {
370
- method: "GET",
371
- path: "/v1/account/export",
372
- operationId: "exportAccountData"
373
- },
374
- "GET /v1/projects/{project_id}/agents": {
375
- method: "GET",
376
- path: "/v1/projects/{project_id}/agents",
377
- operationId: "listAgentCredentials"
378
- },
379
- "POST /v1/projects/{project_id}/agents": {
380
- method: "POST",
381
- path: "/v1/projects/{project_id}/agents",
382
- operationId: "createAgentCredential"
383
- },
384
- "GET /v1/projects/{project_id}/agents/{agent_id}": {
385
- method: "GET",
386
- path: "/v1/projects/{project_id}/agents/{agent_id}",
387
- operationId: "getAgentCredential"
388
- },
389
- "PATCH /v1/projects/{project_id}/agents/{agent_id}": {
390
- method: "PATCH",
391
- path: "/v1/projects/{project_id}/agents/{agent_id}",
392
- operationId: "updateAgentCredentialStatus"
393
- },
394
- "DELETE /v1/projects/{project_id}/agents/{agent_id}": {
395
- method: "DELETE",
396
- path: "/v1/projects/{project_id}/agents/{agent_id}",
397
- operationId: "revokeAgentCredential"
398
- },
399
- "POST /v1/projects/{project_id}/agents/{agent_id}/rotate": {
400
- method: "POST",
401
- path: "/v1/projects/{project_id}/agents/{agent_id}/rotate",
402
- operationId: "rotateAgentCredential"
403
- },
404
- "POST /v1/projects/{project_id}/agents/{agent_id}/policy-recommendation": {
405
- method: "POST",
406
- path: "/v1/projects/{project_id}/agents/{agent_id}/policy-recommendation",
407
- operationId: "recommendAgentPolicy"
408
- },
409
- "GET /v1/projects/{project_id}/anomalies": {
410
- method: "GET",
411
- path: "/v1/projects/{project_id}/anomalies",
412
- operationId: "listAnomalyAlerts"
413
- },
414
- "PATCH /v1/projects/{project_id}/anomalies/{anomaly_id}": {
415
- method: "PATCH",
416
- path: "/v1/projects/{project_id}/anomalies/{anomaly_id}",
417
- operationId: "updateAnomalyAlert"
418
- },
419
- "GET /v1/projects/{project_id}/approvals": {
420
- method: "GET",
421
- path: "/v1/projects/{project_id}/approvals",
422
- operationId: "listApprovalRequests"
423
- },
424
- "POST /v1/projects/{project_id}/approvals/{approval_id}/approve": {
425
- method: "POST",
426
- path: "/v1/projects/{project_id}/approvals/{approval_id}/approve",
427
- operationId: "approveApprovalRequest"
428
- },
429
- "POST /v1/projects/{project_id}/approvals/{approval_id}/reject": {
430
- method: "POST",
431
- path: "/v1/projects/{project_id}/approvals/{approval_id}/reject",
432
- operationId: "rejectApprovalRequest"
433
- },
434
- "GET /v1/projects/{project_id}/audit-logs": {
435
- method: "GET",
436
- path: "/v1/projects/{project_id}/audit-logs",
437
- operationId: "listAuditLogs"
438
- },
439
- "GET /v1/projects/{project_id}/audit-logs/export": {
440
- method: "GET",
441
- path: "/v1/projects/{project_id}/audit-logs/export",
442
- operationId: "exportAuditLogs"
443
- },
444
- "GET /v1/projects/{project_id}/audit-logs/verify": {
445
- method: "GET",
446
- path: "/v1/projects/{project_id}/audit-logs/verify",
447
- operationId: "verifyAuditChain"
448
- },
449
- "GET /v1/plans": {
450
- method: "GET",
451
- path: "/v1/plans",
452
- operationId: "listPlans"
453
- },
454
- "GET /v1/organizations/{org_id}/plan": {
455
- method: "GET",
456
- path: "/v1/organizations/{org_id}/plan",
457
- operationId: "getOrganizationPlan"
458
- },
459
- "GET /v1/organizations/{org_id}/vercel-installation": {
460
- method: "GET",
461
- path: "/v1/organizations/{org_id}/vercel-installation",
462
- operationId: "getVercelInstallation"
463
- },
464
- "PUT /v1/organizations/{org_id}/spend-limit": {
465
- method: "PUT",
466
- path: "/v1/organizations/{org_id}/spend-limit",
467
- operationId: "updateSpendLimit"
468
- },
469
- "POST /v1/organizations/{org_id}/cancellation-feedback": {
470
- method: "POST",
471
- path: "/v1/organizations/{org_id}/cancellation-feedback",
472
- operationId: "submitCancellationFeedback"
473
- },
474
- "GET /v1/projects/{project_id}/branches": {
475
- method: "GET",
476
- path: "/v1/projects/{project_id}/branches",
477
- operationId: "listDatabaseBranches"
478
- },
479
- "DELETE /v1/projects/{project_id}/branches/{branch_id}": {
480
- method: "DELETE",
481
- path: "/v1/projects/{project_id}/branches/{branch_id}",
482
- operationId: "discardDatabaseBranch"
483
- },
484
- "GET /v1/projects/{project_id}/databases/{database_id}/cache-rules": {
485
- method: "GET",
486
- path: "/v1/projects/{project_id}/databases/{database_id}/cache-rules",
487
- operationId: "listCacheRules"
488
- },
489
- "PUT /v1/projects/{project_id}/databases/{database_id}/cache-rules/{query_hash}": {
490
- method: "PUT",
491
- path: "/v1/projects/{project_id}/databases/{database_id}/cache-rules/{query_hash}",
492
- operationId: "updateCacheRule"
493
- },
494
- "GET /v1/projects/{project_id}/databases": {
495
- method: "GET",
496
- path: "/v1/projects/{project_id}/databases",
497
- operationId: "listDatabases"
498
- },
499
- "POST /v1/projects/{project_id}/databases": {
500
- method: "POST",
501
- path: "/v1/projects/{project_id}/databases",
502
- operationId: "createDatabase"
503
- },
504
- "GET /v1/projects/{project_id}/databases/{database_id}": {
505
- method: "GET",
506
- path: "/v1/projects/{project_id}/databases/{database_id}",
507
- operationId: "getDatabase"
508
- },
509
- "PATCH /v1/projects/{project_id}/databases/{database_id}": {
510
- method: "PATCH",
511
- path: "/v1/projects/{project_id}/databases/{database_id}",
512
- operationId: "updateDatabase"
513
- },
514
- "DELETE /v1/projects/{project_id}/databases/{database_id}": {
515
- method: "DELETE",
516
- path: "/v1/projects/{project_id}/databases/{database_id}",
517
- operationId: "deleteDatabase"
518
- },
519
- "POST /v1/projects/{project_id}/databases/{database_id}/test-connection": {
520
- method: "POST",
521
- path: "/v1/projects/{project_id}/databases/{database_id}/test-connection",
522
- operationId: "testDatabaseConnection"
523
- },
524
- "POST /v1/projects/{project_id}/databases/{database_id}/scan-pii": {
525
- method: "POST",
526
- path: "/v1/projects/{project_id}/databases/{database_id}/scan-pii",
527
- operationId: "scanDatabaseForPii"
528
- },
529
- "GET /v1/projects/{project_id}/databases/{database_id}/schema-catalog": {
530
- method: "GET",
531
- path: "/v1/projects/{project_id}/databases/{database_id}/schema-catalog",
532
- operationId: "getSchemaCatalog"
533
- },
534
- "GET /v1/projects/{project_id}/domains": {
535
- method: "GET",
536
- path: "/v1/projects/{project_id}/domains",
537
- operationId: "listCustomDomains"
538
- },
539
- "POST /v1/projects/{project_id}/domains": {
540
- method: "POST",
541
- path: "/v1/projects/{project_id}/domains",
542
- operationId: "createCustomDomain"
543
- },
544
- "DELETE /v1/projects/{project_id}/domains/{domain_id}": {
545
- method: "DELETE",
546
- path: "/v1/projects/{project_id}/domains/{domain_id}",
547
- operationId: "deleteCustomDomain"
548
- },
549
- "POST /v1/projects/{project_id}/domains/{domain_id}/verify": {
550
- method: "POST",
551
- path: "/v1/projects/{project_id}/domains/{domain_id}/verify",
552
- operationId: "verifyCustomDomain"
553
- },
554
- "GET /v1/health": {
555
- method: "GET",
556
- path: "/v1/health",
557
- operationId: "getHealth"
558
- },
559
- "GET /v1/projects/{project_id}/honeytokens": {
560
- method: "GET",
561
- path: "/v1/projects/{project_id}/honeytokens",
562
- operationId: "listHoneytokens"
563
- },
564
- "POST /v1/projects/{project_id}/honeytokens": {
565
- method: "POST",
566
- path: "/v1/projects/{project_id}/honeytokens",
567
- operationId: "createHoneytoken"
568
- },
569
- "GET /v1/projects/{project_id}/honeytokens/{honeytoken_id}": {
570
- method: "GET",
571
- path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}",
572
- operationId: "getHoneytoken"
573
- },
574
- "PUT /v1/projects/{project_id}/honeytokens/{honeytoken_id}": {
575
- method: "PUT",
576
- path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}",
577
- operationId: "updateHoneytoken"
578
- },
579
- "DELETE /v1/projects/{project_id}/honeytokens/{honeytoken_id}": {
580
- method: "DELETE",
581
- path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}",
582
- operationId: "deleteHoneytoken"
583
- },
584
- "GET /v1/projects/{project_id}/insights": {
585
- method: "GET",
586
- path: "/v1/projects/{project_id}/insights",
587
- operationId: "getProjectInsights"
588
- },
589
- "POST /v1/projects/{project_id}/migrations:lint": {
590
- method: "POST",
591
- path: "/v1/projects/{project_id}/migrations:lint",
592
- operationId: "lintMigration"
593
- },
594
- "GET /v1/organizations/{org_id}/onboarding": {
595
- method: "GET",
596
- path: "/v1/organizations/{org_id}/onboarding",
597
- operationId: "getOnboardingProgress"
598
- },
599
- "PATCH /v1/organizations/{org_id}/onboarding": {
600
- method: "PATCH",
601
- path: "/v1/organizations/{org_id}/onboarding",
602
- operationId: "updateOnboardingProgress"
603
- },
604
- "GET /v1/organizations": {
605
- method: "GET",
606
- path: "/v1/organizations",
607
- operationId: "listOrganizations"
608
- },
609
- "GET /v1/projects/{project_id}/policies": {
610
- method: "GET",
611
- path: "/v1/projects/{project_id}/policies",
612
- operationId: "listPolicyProfiles"
613
- },
614
- "POST /v1/projects/{project_id}/policies": {
615
- method: "POST",
616
- path: "/v1/projects/{project_id}/policies",
617
- operationId: "createPolicyProfile"
618
- },
619
- "GET /v1/projects/{project_id}/policies/{policy_id}": {
620
- method: "GET",
621
- path: "/v1/projects/{project_id}/policies/{policy_id}",
622
- operationId: "getPolicyProfile"
623
- },
624
- "PUT /v1/projects/{project_id}/policies/{policy_id}": {
625
- method: "PUT",
626
- path: "/v1/projects/{project_id}/policies/{policy_id}",
627
- operationId: "updatePolicyProfile"
628
- },
629
- "DELETE /v1/projects/{project_id}/policies/{policy_id}": {
630
- method: "DELETE",
631
- path: "/v1/projects/{project_id}/policies/{policy_id}",
632
- operationId: "deletePolicyProfile"
633
- },
634
- "POST /v1/projects/{project_id}/policy-evaluations": {
635
- method: "POST",
636
- path: "/v1/projects/{project_id}/policy-evaluations",
637
- operationId: "dryEvalPolicy"
638
- },
639
- "POST /v1/projects/{project_id}/policy-replays": {
640
- method: "POST",
641
- path: "/v1/projects/{project_id}/policy-replays",
642
- operationId: "replayPolicy"
643
- },
644
- "GET /v1/projects": {
645
- method: "GET",
646
- path: "/v1/projects",
647
- operationId: "listProjects"
648
- },
649
- "POST /v1/projects": {
650
- method: "POST",
651
- path: "/v1/projects",
652
- operationId: "createProject"
653
- },
654
- "GET /v1/projects/{project_id}": {
655
- method: "GET",
656
- path: "/v1/projects/{project_id}",
657
- operationId: "getProject"
658
- },
659
- "PATCH /v1/projects/{project_id}": {
660
- method: "PATCH",
661
- path: "/v1/projects/{project_id}",
662
- operationId: "updateProject"
663
- },
664
- "DELETE /v1/projects/{project_id}": {
665
- method: "DELETE",
666
- path: "/v1/projects/{project_id}",
667
- operationId: "deleteProject"
668
- },
669
- "GET /v1/projects/{project_id}/metrics": {
670
- method: "GET",
671
- path: "/v1/projects/{project_id}/metrics",
672
- operationId: "getProjectMetrics"
673
- },
674
- "GET /v1/regions": {
675
- method: "GET",
676
- path: "/v1/regions",
677
- operationId: "listRegions"
678
- },
679
- "GET /v1/databases/{database_id}/replicas": {
680
- method: "GET",
681
- path: "/v1/databases/{database_id}/replicas",
682
- operationId: "listReplicas"
683
- },
684
- "POST /v1/databases/{database_id}/replicas": {
685
- method: "POST",
686
- path: "/v1/databases/{database_id}/replicas",
687
- operationId: "createReplica"
688
- },
689
- "DELETE /v1/databases/{database_id}/replicas/{replica_id}": {
690
- method: "DELETE",
691
- path: "/v1/databases/{database_id}/replicas/{replica_id}",
692
- operationId: "deleteReplica"
693
- },
694
- "GET /v1/organizations/{org_id}/self-host-enrollments": {
695
- method: "GET",
696
- path: "/v1/organizations/{org_id}/self-host-enrollments",
697
- operationId: "listSelfHostEnrollments"
698
- },
699
- "POST /v1/organizations/{org_id}/self-host-enrollments": {
700
- method: "POST",
701
- path: "/v1/organizations/{org_id}/self-host-enrollments",
702
- operationId: "createSelfHostEnrollment"
703
- },
704
- "DELETE /v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}": {
705
- method: "DELETE",
706
- path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}",
707
- operationId: "revokeSelfHostEnrollment"
708
- },
709
- "POST /v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}/rotate": {
710
- method: "POST",
711
- path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}/rotate",
712
- operationId: "rotateSelfHostEnrollment"
713
- },
714
- "GET /v1/organizations/{org_id}/support/cases": {
715
- method: "GET",
716
- path: "/v1/organizations/{org_id}/support/cases",
717
- operationId: "listSupportCases"
718
- },
719
- "POST /v1/organizations/{org_id}/support/cases": {
720
- method: "POST",
721
- path: "/v1/organizations/{org_id}/support/cases",
722
- operationId: "createSupportCase"
723
- },
724
- "GET /v1/organizations/{org_id}/support/cases/{case_id}": {
725
- method: "GET",
726
- path: "/v1/organizations/{org_id}/support/cases/{case_id}",
727
- operationId: "getSupportCase"
728
- },
729
- "PATCH /v1/organizations/{org_id}/support/cases/{case_id}": {
730
- method: "PATCH",
731
- path: "/v1/organizations/{org_id}/support/cases/{case_id}",
732
- operationId: "updateSupportCase"
733
- },
734
- "POST /v1/organizations/{org_id}/support/cases/{case_id}/messages": {
735
- method: "POST",
736
- path: "/v1/organizations/{org_id}/support/cases/{case_id}/messages",
737
- operationId: "createSupportMessage"
738
- },
739
- "POST /v1/internal/support/slack-event": {
740
- method: "POST",
741
- path: "/v1/internal/support/slack-event",
742
- operationId: "handleSlackSupportEvent"
743
- },
744
- "GET /v1/organizations/{org_id}/usage": {
745
- method: "GET",
746
- path: "/v1/organizations/{org_id}/usage",
747
- operationId: "getOrganizationUsage"
748
- },
749
- "GET /v1/projects/{project_id}/usage": {
750
- method: "GET",
751
- path: "/v1/projects/{project_id}/usage",
752
- operationId: "getProjectUsage"
753
- },
754
- "GET /v1/projects/{project_id}/webhooks": {
755
- method: "GET",
756
- path: "/v1/projects/{project_id}/webhooks",
757
- operationId: "listWebhookEndpoints"
758
- },
759
- "POST /v1/projects/{project_id}/webhooks": {
760
- method: "POST",
761
- path: "/v1/projects/{project_id}/webhooks",
762
- operationId: "createWebhookEndpoint"
763
- },
764
- "GET /v1/projects/{project_id}/webhooks/{webhook_id}": {
765
- method: "GET",
766
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}",
767
- operationId: "getWebhookEndpoint"
768
- },
769
- "PUT /v1/projects/{project_id}/webhooks/{webhook_id}": {
770
- method: "PUT",
771
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}",
772
- operationId: "updateWebhookEndpoint"
773
- },
774
- "DELETE /v1/projects/{project_id}/webhooks/{webhook_id}": {
775
- method: "DELETE",
776
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}",
777
- operationId: "deleteWebhookEndpoint"
778
- },
779
- "POST /v1/projects/{project_id}/webhooks/{webhook_id}/test": {
780
- method: "POST",
781
- path: "/v1/projects/{project_id}/webhooks/{webhook_id}/test",
782
- operationId: "testWebhookEndpoint"
783
- }
784
- };
1
+ import { o as operationsByPath, a as operationsByTag } from './operations-map.gen-g44nmkz5.js';
785
2
 
786
3
  class ApiError extends Error {
787
4
  constructor(status, statusText, body){
@@ -804,6 +21,61 @@ class ApiError extends Error {
804
21
  if (typeof obj.message === "string") return obj.message;
805
22
  return undefined;
806
23
  }
24
+ /**
25
+ * A request that never got an HTTP answer: DNS failure, refused or reset
26
+ * connection, or a timeout. Distinct from `ApiError`, which means the server
27
+ * did answer and the answer was an error.
28
+ *
29
+ * Node reports every connection-level failure as `TypeError: fetch failed` and
30
+ * hangs the real reason off `cause`, so the message flattens that chain. A log
31
+ * line should say which URL was called and why it did not answer without the
32
+ * reader having to inspect the object.
33
+ */ class NetworkError extends Error {
34
+ constructor(args){
35
+ const reason = args.timedOut ? `timed out after ${args.timeoutMs}ms` : describeError(args.cause);
36
+ super(`${args.method} ${args.url} failed after ${args.attempts} attempt(s) in ${args.elapsedMs}ms: ${reason}`, {
37
+ cause: args.cause
38
+ });
39
+ this.name = "NetworkError";
40
+ this.url = args.url;
41
+ this.method = args.method;
42
+ this.attempts = args.attempts;
43
+ this.elapsedMs = args.elapsedMs;
44
+ this.timedOut = args.timedOut;
45
+ }
46
+ }
47
+ /**
48
+ * Flatten an error and its `cause` chain into one line.
49
+ *
50
+ * `TypeError: fetch failed` on its own says nothing. The useful detail (an
51
+ * `ECONNREFUSED` with the address it tried, a TLS failure, a DNS `EAI_AGAIN`)
52
+ * is always one or two `cause` levels down.
53
+ */ function describeError(err, depth = 0) {
54
+ if (depth > 5) return "…";
55
+ if (err === null || err === undefined) return String(err);
56
+ if (typeof err !== "object") return String(err);
57
+ const candidate = err;
58
+ const name = typeof candidate.name === "string" ? candidate.name : "Error";
59
+ const message = typeof candidate.message === "string" ? candidate.message : String(err);
60
+ const code = typeof candidate.code === "string" ? ` [${candidate.code}]` : "";
61
+ const head = `${name}: ${message}${code}`;
62
+ // AggregateError (what undici raises when every address for a host fails)
63
+ // carries the real reasons in `errors`, not in `cause`.
64
+ const errors = err.errors;
65
+ if (Array.isArray(errors) && errors.length > 0) {
66
+ const inner = errors.map((e)=>describeError(e, depth + 1)).join("; ");
67
+ return `${head} (caused by ${inner})`;
68
+ }
69
+ if (candidate.cause !== undefined && candidate.cause !== null) {
70
+ return `${head} (caused by ${describeError(candidate.cause, depth + 1)})`;
71
+ }
72
+ return head;
73
+ }
74
+ /** `AbortSignal.timeout` rejects with TimeoutError; an aborted fetch with AbortError. */ function isAbortError(err) {
75
+ if (err === null || typeof err !== "object") return false;
76
+ const name = err.name;
77
+ return name === "AbortError" || name === "TimeoutError";
78
+ }
807
79
  const RETRYABLE_STATUS_CODES = [
808
80
  408,
809
81
  429,
@@ -811,11 +83,17 @@ const RETRYABLE_STATUS_CODES = [
811
83
  503,
812
84
  504
813
85
  ];
86
+ /**
87
+ * Long enough for the slowest legitimate call (an audit-log CSV export), short
88
+ * enough that a black-holed connection fails in a sane time instead of hanging
89
+ * until the platform gives up.
90
+ */ const DEFAULT_TIMEOUT_MS = 30_000;
814
91
  const DEFAULT_RETRY = {
815
92
  maxRetries: 5,
816
93
  initialDelayMs: 500,
817
94
  maxDelayMs: 30_000,
818
- idempotencyKeys: true
95
+ idempotencyKeys: true,
96
+ totalBudgetMs: 120_000
819
97
  };
820
98
  function resolveRetry(config) {
821
99
  if (!config) return {
@@ -843,6 +121,10 @@ function resolveRetry(config) {
843
121
  }
844
122
  return undefined;
845
123
  }
124
+ /** Whether waiting `delayMs` and trying again would land past the total budget. */ function outOfBudget(startedAt, delayMs, totalBudgetMs) {
125
+ if (totalBudgetMs <= 0) return false;
126
+ return Date.now() - startedAt + delayMs >= totalBudgetMs;
127
+ }
846
128
  /** Compute exponential backoff with jitter. */ function backoff(attempt, initialDelayMs, maxDelayMs) {
847
129
  const delay = Math.min(initialDelayMs * 2 ** attempt, maxDelayMs);
848
130
  return delay * (0.5 + Math.random());
@@ -886,6 +168,8 @@ async function fetcher(options) {
886
168
  }
887
169
  const fetchFn = options.fetchImpl ?? globalThis.fetch;
888
170
  const retry = resolveRetry(options.retry);
171
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
172
+ const startedAt = Date.now();
889
173
  const urlStr = fullUrl.toString();
890
174
  const fetchBody = options.body !== undefined ? JSON.stringify(options.body) : undefined;
891
175
  // Generate idempotency key once, reused across all retry attempts.
@@ -898,32 +182,53 @@ async function fetcher(options) {
898
182
  if (idempotencyKey) {
899
183
  reqHeaders["Idempotency-Key"] = idempotencyKey;
900
184
  }
185
+ // Distinguishes a transport failure from an `onResponse` hook that threw
186
+ // after the server had already answered.
187
+ let answered = false;
901
188
  try {
902
189
  const response = await fetchFn(urlStr, {
903
190
  method: options.method,
904
191
  headers: reqHeaders,
905
- body: fetchBody
192
+ body: fetchBody,
193
+ ...timeoutMs > 0 ? {
194
+ signal: AbortSignal.timeout(timeoutMs)
195
+ } : {}
906
196
  });
197
+ answered = true;
907
198
  if (options.onResponse) {
908
199
  await options.onResponse(response);
909
200
  }
910
201
  if (response.ok) {
911
202
  return parseResponseBody(response);
912
203
  }
913
- // Non-retryable error or last attempt — throw immediately.
914
- if (!RETRYABLE_STATUS_CODES.includes(response.status) || attempt === retry.maxRetries) {
204
+ const retryable = RETRYABLE_STATUS_CODES.includes(response.status) && attempt < retry.maxRetries;
205
+ const delay = retryable ? parseRetryAfter(response) ?? backoff(attempt, retry.initialDelayMs, retry.maxDelayMs) : 0;
206
+ // Not retryable, out of attempts, or the wait would outlive the budget.
207
+ if (!retryable || outOfBudget(startedAt, delay, retry.totalBudgetMs)) {
915
208
  const errorBody = await response.json().catch(()=>null);
916
209
  throw new ApiError(response.status, response.statusText, errorBody);
917
210
  }
918
- // Retryable error — wait and retry.
919
- const delay = parseRetryAfter(response) ?? backoff(attempt, retry.initialDelayMs, retry.maxDelayMs);
920
211
  await sleep(delay);
921
212
  } catch (err) {
922
213
  // If it's already an ApiError, rethrow (we threw it above).
923
214
  if (err instanceof ApiError) throw err;
924
- // Network error — retry if we have attempts left.
925
- if (attempt === retry.maxRetries) throw err;
215
+ // The request never got an answer. Retry while attempts and budget last,
216
+ // then report the endpoint and the real underlying cause.
926
217
  const delay = backoff(attempt, retry.initialDelayMs, retry.maxDelayMs);
218
+ if (attempt === retry.maxRetries || outOfBudget(startedAt, delay, retry.totalBudgetMs)) {
219
+ // The server did answer, so this is not a reachability problem. Report
220
+ // it as it came rather than dressing it up as one.
221
+ if (answered) throw err;
222
+ throw new NetworkError({
223
+ method: options.method,
224
+ url: urlStr,
225
+ attempts: attempt + 1,
226
+ elapsedMs: Date.now() - startedAt,
227
+ timedOut: isAbortError(err),
228
+ timeoutMs,
229
+ cause: err
230
+ });
231
+ }
927
232
  await sleep(delay);
928
233
  }
929
234
  }
@@ -951,6 +256,10 @@ function sleep(ms) {
951
256
  return new Promise((resolve)=>setTimeout(resolve, ms));
952
257
  }
953
258
 
259
+ const publicRegistry = {
260
+ byTag: operationsByTag,
261
+ byPath: operationsByPath
262
+ };
954
263
  class PgBeamClient {
955
264
  constructor(options){
956
265
  this._baseUrl = options.baseUrl;
@@ -962,6 +271,8 @@ class PgBeamClient {
962
271
  } : options.retry ?? {
963
272
  maxRetries: 5
964
273
  };
274
+ this._timeoutMs = options.timeoutMs;
275
+ this._operations = options.operations ?? publicRegistry;
965
276
  }
966
277
  async _resolveToken() {
967
278
  if (typeof this._tokenOrFn === "function") {
@@ -969,53 +280,44 @@ class PgBeamClient {
969
280
  }
970
281
  return this._tokenOrFn;
971
282
  }
972
- _call(method, path) {
973
- return async (params = {})=>{
974
- const token = await this._resolveToken();
975
- return fetcher({
976
- method,
977
- path,
978
- pathParams: params.pathParams,
979
- queryParams: params.queryParams,
980
- body: params.body,
981
- baseUrl: this._baseUrl,
982
- token,
983
- fetchImpl: this._fetchImpl,
984
- onResponse: this._onResponse,
985
- retry: this._retry
986
- });
987
- };
283
+ async _send(meta, params) {
284
+ const token = await this._resolveToken();
285
+ return fetcher({
286
+ method: meta.method,
287
+ path: meta.path,
288
+ pathParams: params.pathParams,
289
+ queryParams: params.queryParams,
290
+ body: params.body,
291
+ baseUrl: this._baseUrl,
292
+ token,
293
+ fetchImpl: this._fetchImpl,
294
+ onResponse: this._onResponse,
295
+ retry: this._retry,
296
+ timeoutMs: this._timeoutMs
297
+ });
298
+ }
299
+ _call(meta) {
300
+ return (params = {})=>this._send(meta, params);
988
301
  }
989
302
  /** Access API operations via tag-based namespaces or `.request()`. */ get api() {
990
303
  if (this._api) return this._api;
991
- const request = async (route, params)=>{
992
- const meta = operationsByPath[route];
993
- if (!meta) throw new Error(`Unknown route: ${String(route)}`);
994
- const token = await this._resolveToken();
995
- return fetcher({
996
- method: meta.method,
997
- path: meta.path,
998
- pathParams: params?.pathParams,
999
- queryParams: params?.queryParams,
1000
- body: params?.body,
1001
- baseUrl: this._baseUrl,
1002
- token,
1003
- fetchImpl: this._fetchImpl,
1004
- onResponse: this._onResponse,
1005
- retry: this._retry
1006
- });
304
+ // Async so an unknown route rejects rather than throwing synchronously,
305
+ // which is what callers awaiting .request() expect.
306
+ const request = async (route, params = {})=>{
307
+ const meta = this._operations.byPath[route];
308
+ if (!meta) throw new Error(`Unknown route: ${route}`);
309
+ return this._send(meta, params);
1007
310
  };
1008
311
  this._api = new Proxy({}, {
1009
312
  get: (_, prop)=>{
1010
313
  if (prop === "request") return request;
1011
- const tagOps = operationsByTag[prop];
314
+ const tagOps = this._operations.byTag[prop];
1012
315
  if (!tagOps) return undefined;
1013
316
  return new Proxy({}, {
1014
317
  get: (_, method)=>{
1015
- const ops = tagOps;
1016
- const opMeta = ops[method];
318
+ const opMeta = tagOps[method];
1017
319
  if (!opMeta) return undefined;
1018
- return this._call(opMeta.method, opMeta.path);
320
+ return this._call(opMeta);
1019
321
  }
1020
322
  });
1021
323
  }
@@ -1024,4 +326,4 @@ class PgBeamClient {
1024
326
  }
1025
327
  }
1026
328
 
1027
- export { ApiError, PgBeamClient, extractMessage };
329
+ export { ApiError, NetworkError, PgBeamClient, describeError, extractMessage };