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