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.cjs +132 -828
- package/dist/index.d.cts +76 -12672
- package/dist/index.d.mts +76 -12672
- package/dist/index.mjs +131 -829
- package/dist/operations-map.gen-c7vqzfzd.cjs +816 -0
- package/dist/operations-map.gen-g44nmkz5.js +815 -0
- package/dist/operations-map.gen-kbfu8kjk.d.ts +13896 -0
- package/dist/operations.cjs +101 -789
- package/dist/operations.d.cts +6 -10343
- package/dist/operations.d.mts +6 -10343
- package/dist/operations.mjs +100 -788
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,789 +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
|
-
databases: {
|
|
228
|
-
listDatabases: {
|
|
229
|
-
method: "GET",
|
|
230
|
-
path: "/v1/projects/{project_id}/databases"
|
|
231
|
-
},
|
|
232
|
-
createDatabase: {
|
|
233
|
-
method: "POST",
|
|
234
|
-
path: "/v1/projects/{project_id}/databases"
|
|
235
|
-
},
|
|
236
|
-
getDatabase: {
|
|
237
|
-
method: "GET",
|
|
238
|
-
path: "/v1/projects/{project_id}/databases/{database_id}"
|
|
239
|
-
},
|
|
240
|
-
updateDatabase: {
|
|
241
|
-
method: "PATCH",
|
|
242
|
-
path: "/v1/projects/{project_id}/databases/{database_id}"
|
|
243
|
-
},
|
|
244
|
-
deleteDatabase: {
|
|
245
|
-
method: "DELETE",
|
|
246
|
-
path: "/v1/projects/{project_id}/databases/{database_id}"
|
|
247
|
-
},
|
|
248
|
-
testDatabaseConnection: {
|
|
249
|
-
method: "POST",
|
|
250
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/test-connection"
|
|
251
|
-
},
|
|
252
|
-
scanDatabaseForPii: {
|
|
253
|
-
method: "POST",
|
|
254
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/scan-pii"
|
|
255
|
-
},
|
|
256
|
-
getSchemaCatalog: {
|
|
257
|
-
method: "GET",
|
|
258
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/schema-catalog"
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
platform: {
|
|
262
|
-
getHealth: {
|
|
263
|
-
method: "GET",
|
|
264
|
-
path: "/v1/health"
|
|
265
|
-
},
|
|
266
|
-
listRegions: {
|
|
267
|
-
method: "GET",
|
|
268
|
-
path: "/v1/regions"
|
|
269
|
-
},
|
|
270
|
-
listSelfHostEnrollments: {
|
|
271
|
-
method: "GET",
|
|
272
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments"
|
|
273
|
-
},
|
|
274
|
-
createSelfHostEnrollment: {
|
|
275
|
-
method: "POST",
|
|
276
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments"
|
|
277
|
-
},
|
|
278
|
-
revokeSelfHostEnrollment: {
|
|
279
|
-
method: "DELETE",
|
|
280
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}"
|
|
281
|
-
},
|
|
282
|
-
rotateSelfHostEnrollment: {
|
|
283
|
-
method: "POST",
|
|
284
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}/rotate"
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
honeytokens: {
|
|
288
|
-
listHoneytokens: {
|
|
289
|
-
method: "GET",
|
|
290
|
-
path: "/v1/projects/{project_id}/honeytokens"
|
|
291
|
-
},
|
|
292
|
-
createHoneytoken: {
|
|
293
|
-
method: "POST",
|
|
294
|
-
path: "/v1/projects/{project_id}/honeytokens"
|
|
295
|
-
},
|
|
296
|
-
getHoneytoken: {
|
|
297
|
-
method: "GET",
|
|
298
|
-
path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}"
|
|
299
|
-
},
|
|
300
|
-
updateHoneytoken: {
|
|
301
|
-
method: "PUT",
|
|
302
|
-
path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}"
|
|
303
|
-
},
|
|
304
|
-
deleteHoneytoken: {
|
|
305
|
-
method: "DELETE",
|
|
306
|
-
path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}"
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
migrations: {
|
|
310
|
-
lintMigration: {
|
|
311
|
-
method: "POST",
|
|
312
|
-
path: "/v1/projects/{project_id}/migrations:lint"
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
support: {
|
|
316
|
-
listSupportCases: {
|
|
317
|
-
method: "GET",
|
|
318
|
-
path: "/v1/organizations/{org_id}/support/cases"
|
|
319
|
-
},
|
|
320
|
-
createSupportCase: {
|
|
321
|
-
method: "POST",
|
|
322
|
-
path: "/v1/organizations/{org_id}/support/cases"
|
|
323
|
-
},
|
|
324
|
-
getSupportCase: {
|
|
325
|
-
method: "GET",
|
|
326
|
-
path: "/v1/organizations/{org_id}/support/cases/{case_id}"
|
|
327
|
-
},
|
|
328
|
-
updateSupportCase: {
|
|
329
|
-
method: "PATCH",
|
|
330
|
-
path: "/v1/organizations/{org_id}/support/cases/{case_id}"
|
|
331
|
-
},
|
|
332
|
-
createSupportMessage: {
|
|
333
|
-
method: "POST",
|
|
334
|
-
path: "/v1/organizations/{org_id}/support/cases/{case_id}/messages"
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
internal: {
|
|
338
|
-
handleSlackSupportEvent: {
|
|
339
|
-
method: "POST",
|
|
340
|
-
path: "/v1/internal/support/slack-event"
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
webhooks: {
|
|
344
|
-
listWebhookEndpoints: {
|
|
345
|
-
method: "GET",
|
|
346
|
-
path: "/v1/projects/{project_id}/webhooks"
|
|
347
|
-
},
|
|
348
|
-
createWebhookEndpoint: {
|
|
349
|
-
method: "POST",
|
|
350
|
-
path: "/v1/projects/{project_id}/webhooks"
|
|
351
|
-
},
|
|
352
|
-
getWebhookEndpoint: {
|
|
353
|
-
method: "GET",
|
|
354
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}"
|
|
355
|
-
},
|
|
356
|
-
updateWebhookEndpoint: {
|
|
357
|
-
method: "PUT",
|
|
358
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}"
|
|
359
|
-
},
|
|
360
|
-
deleteWebhookEndpoint: {
|
|
361
|
-
method: "DELETE",
|
|
362
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}"
|
|
363
|
-
},
|
|
364
|
-
testWebhookEndpoint: {
|
|
365
|
-
method: "POST",
|
|
366
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}/test"
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
const operationsByPath = {
|
|
371
|
-
"GET /v1/account/export": {
|
|
372
|
-
method: "GET",
|
|
373
|
-
path: "/v1/account/export",
|
|
374
|
-
operationId: "exportAccountData"
|
|
375
|
-
},
|
|
376
|
-
"GET /v1/projects/{project_id}/agents": {
|
|
377
|
-
method: "GET",
|
|
378
|
-
path: "/v1/projects/{project_id}/agents",
|
|
379
|
-
operationId: "listAgentCredentials"
|
|
380
|
-
},
|
|
381
|
-
"POST /v1/projects/{project_id}/agents": {
|
|
382
|
-
method: "POST",
|
|
383
|
-
path: "/v1/projects/{project_id}/agents",
|
|
384
|
-
operationId: "createAgentCredential"
|
|
385
|
-
},
|
|
386
|
-
"GET /v1/projects/{project_id}/agents/{agent_id}": {
|
|
387
|
-
method: "GET",
|
|
388
|
-
path: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
389
|
-
operationId: "getAgentCredential"
|
|
390
|
-
},
|
|
391
|
-
"PATCH /v1/projects/{project_id}/agents/{agent_id}": {
|
|
392
|
-
method: "PATCH",
|
|
393
|
-
path: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
394
|
-
operationId: "updateAgentCredentialStatus"
|
|
395
|
-
},
|
|
396
|
-
"DELETE /v1/projects/{project_id}/agents/{agent_id}": {
|
|
397
|
-
method: "DELETE",
|
|
398
|
-
path: "/v1/projects/{project_id}/agents/{agent_id}",
|
|
399
|
-
operationId: "revokeAgentCredential"
|
|
400
|
-
},
|
|
401
|
-
"POST /v1/projects/{project_id}/agents/{agent_id}/rotate": {
|
|
402
|
-
method: "POST",
|
|
403
|
-
path: "/v1/projects/{project_id}/agents/{agent_id}/rotate",
|
|
404
|
-
operationId: "rotateAgentCredential"
|
|
405
|
-
},
|
|
406
|
-
"POST /v1/projects/{project_id}/agents/{agent_id}/policy-recommendation": {
|
|
407
|
-
method: "POST",
|
|
408
|
-
path: "/v1/projects/{project_id}/agents/{agent_id}/policy-recommendation",
|
|
409
|
-
operationId: "recommendAgentPolicy"
|
|
410
|
-
},
|
|
411
|
-
"GET /v1/projects/{project_id}/anomalies": {
|
|
412
|
-
method: "GET",
|
|
413
|
-
path: "/v1/projects/{project_id}/anomalies",
|
|
414
|
-
operationId: "listAnomalyAlerts"
|
|
415
|
-
},
|
|
416
|
-
"PATCH /v1/projects/{project_id}/anomalies/{anomaly_id}": {
|
|
417
|
-
method: "PATCH",
|
|
418
|
-
path: "/v1/projects/{project_id}/anomalies/{anomaly_id}",
|
|
419
|
-
operationId: "updateAnomalyAlert"
|
|
420
|
-
},
|
|
421
|
-
"GET /v1/projects/{project_id}/approvals": {
|
|
422
|
-
method: "GET",
|
|
423
|
-
path: "/v1/projects/{project_id}/approvals",
|
|
424
|
-
operationId: "listApprovalRequests"
|
|
425
|
-
},
|
|
426
|
-
"POST /v1/projects/{project_id}/approvals/{approval_id}/approve": {
|
|
427
|
-
method: "POST",
|
|
428
|
-
path: "/v1/projects/{project_id}/approvals/{approval_id}/approve",
|
|
429
|
-
operationId: "approveApprovalRequest"
|
|
430
|
-
},
|
|
431
|
-
"POST /v1/projects/{project_id}/approvals/{approval_id}/reject": {
|
|
432
|
-
method: "POST",
|
|
433
|
-
path: "/v1/projects/{project_id}/approvals/{approval_id}/reject",
|
|
434
|
-
operationId: "rejectApprovalRequest"
|
|
435
|
-
},
|
|
436
|
-
"GET /v1/projects/{project_id}/audit-logs": {
|
|
437
|
-
method: "GET",
|
|
438
|
-
path: "/v1/projects/{project_id}/audit-logs",
|
|
439
|
-
operationId: "listAuditLogs"
|
|
440
|
-
},
|
|
441
|
-
"GET /v1/projects/{project_id}/audit-logs/export": {
|
|
442
|
-
method: "GET",
|
|
443
|
-
path: "/v1/projects/{project_id}/audit-logs/export",
|
|
444
|
-
operationId: "exportAuditLogs"
|
|
445
|
-
},
|
|
446
|
-
"GET /v1/projects/{project_id}/audit-logs/verify": {
|
|
447
|
-
method: "GET",
|
|
448
|
-
path: "/v1/projects/{project_id}/audit-logs/verify",
|
|
449
|
-
operationId: "verifyAuditChain"
|
|
450
|
-
},
|
|
451
|
-
"GET /v1/plans": {
|
|
452
|
-
method: "GET",
|
|
453
|
-
path: "/v1/plans",
|
|
454
|
-
operationId: "listPlans"
|
|
455
|
-
},
|
|
456
|
-
"GET /v1/organizations/{org_id}/plan": {
|
|
457
|
-
method: "GET",
|
|
458
|
-
path: "/v1/organizations/{org_id}/plan",
|
|
459
|
-
operationId: "getOrganizationPlan"
|
|
460
|
-
},
|
|
461
|
-
"GET /v1/organizations/{org_id}/vercel-installation": {
|
|
462
|
-
method: "GET",
|
|
463
|
-
path: "/v1/organizations/{org_id}/vercel-installation",
|
|
464
|
-
operationId: "getVercelInstallation"
|
|
465
|
-
},
|
|
466
|
-
"PUT /v1/organizations/{org_id}/spend-limit": {
|
|
467
|
-
method: "PUT",
|
|
468
|
-
path: "/v1/organizations/{org_id}/spend-limit",
|
|
469
|
-
operationId: "updateSpendLimit"
|
|
470
|
-
},
|
|
471
|
-
"POST /v1/organizations/{org_id}/cancellation-feedback": {
|
|
472
|
-
method: "POST",
|
|
473
|
-
path: "/v1/organizations/{org_id}/cancellation-feedback",
|
|
474
|
-
operationId: "submitCancellationFeedback"
|
|
475
|
-
},
|
|
476
|
-
"GET /v1/projects/{project_id}/branches": {
|
|
477
|
-
method: "GET",
|
|
478
|
-
path: "/v1/projects/{project_id}/branches",
|
|
479
|
-
operationId: "listDatabaseBranches"
|
|
480
|
-
},
|
|
481
|
-
"DELETE /v1/projects/{project_id}/branches/{branch_id}": {
|
|
482
|
-
method: "DELETE",
|
|
483
|
-
path: "/v1/projects/{project_id}/branches/{branch_id}",
|
|
484
|
-
operationId: "discardDatabaseBranch"
|
|
485
|
-
},
|
|
486
|
-
"GET /v1/projects/{project_id}/databases/{database_id}/cache-rules": {
|
|
487
|
-
method: "GET",
|
|
488
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/cache-rules",
|
|
489
|
-
operationId: "listCacheRules"
|
|
490
|
-
},
|
|
491
|
-
"PUT /v1/projects/{project_id}/databases/{database_id}/cache-rules/{query_hash}": {
|
|
492
|
-
method: "PUT",
|
|
493
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/cache-rules/{query_hash}",
|
|
494
|
-
operationId: "updateCacheRule"
|
|
495
|
-
},
|
|
496
|
-
"GET /v1/projects/{project_id}/databases": {
|
|
497
|
-
method: "GET",
|
|
498
|
-
path: "/v1/projects/{project_id}/databases",
|
|
499
|
-
operationId: "listDatabases"
|
|
500
|
-
},
|
|
501
|
-
"POST /v1/projects/{project_id}/databases": {
|
|
502
|
-
method: "POST",
|
|
503
|
-
path: "/v1/projects/{project_id}/databases",
|
|
504
|
-
operationId: "createDatabase"
|
|
505
|
-
},
|
|
506
|
-
"GET /v1/projects/{project_id}/databases/{database_id}": {
|
|
507
|
-
method: "GET",
|
|
508
|
-
path: "/v1/projects/{project_id}/databases/{database_id}",
|
|
509
|
-
operationId: "getDatabase"
|
|
510
|
-
},
|
|
511
|
-
"PATCH /v1/projects/{project_id}/databases/{database_id}": {
|
|
512
|
-
method: "PATCH",
|
|
513
|
-
path: "/v1/projects/{project_id}/databases/{database_id}",
|
|
514
|
-
operationId: "updateDatabase"
|
|
515
|
-
},
|
|
516
|
-
"DELETE /v1/projects/{project_id}/databases/{database_id}": {
|
|
517
|
-
method: "DELETE",
|
|
518
|
-
path: "/v1/projects/{project_id}/databases/{database_id}",
|
|
519
|
-
operationId: "deleteDatabase"
|
|
520
|
-
},
|
|
521
|
-
"POST /v1/projects/{project_id}/databases/{database_id}/test-connection": {
|
|
522
|
-
method: "POST",
|
|
523
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/test-connection",
|
|
524
|
-
operationId: "testDatabaseConnection"
|
|
525
|
-
},
|
|
526
|
-
"POST /v1/projects/{project_id}/databases/{database_id}/scan-pii": {
|
|
527
|
-
method: "POST",
|
|
528
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/scan-pii",
|
|
529
|
-
operationId: "scanDatabaseForPii"
|
|
530
|
-
},
|
|
531
|
-
"GET /v1/projects/{project_id}/databases/{database_id}/schema-catalog": {
|
|
532
|
-
method: "GET",
|
|
533
|
-
path: "/v1/projects/{project_id}/databases/{database_id}/schema-catalog",
|
|
534
|
-
operationId: "getSchemaCatalog"
|
|
535
|
-
},
|
|
536
|
-
"GET /v1/projects/{project_id}/domains": {
|
|
537
|
-
method: "GET",
|
|
538
|
-
path: "/v1/projects/{project_id}/domains",
|
|
539
|
-
operationId: "listCustomDomains"
|
|
540
|
-
},
|
|
541
|
-
"POST /v1/projects/{project_id}/domains": {
|
|
542
|
-
method: "POST",
|
|
543
|
-
path: "/v1/projects/{project_id}/domains",
|
|
544
|
-
operationId: "createCustomDomain"
|
|
545
|
-
},
|
|
546
|
-
"DELETE /v1/projects/{project_id}/domains/{domain_id}": {
|
|
547
|
-
method: "DELETE",
|
|
548
|
-
path: "/v1/projects/{project_id}/domains/{domain_id}",
|
|
549
|
-
operationId: "deleteCustomDomain"
|
|
550
|
-
},
|
|
551
|
-
"POST /v1/projects/{project_id}/domains/{domain_id}/verify": {
|
|
552
|
-
method: "POST",
|
|
553
|
-
path: "/v1/projects/{project_id}/domains/{domain_id}/verify",
|
|
554
|
-
operationId: "verifyCustomDomain"
|
|
555
|
-
},
|
|
556
|
-
"GET /v1/health": {
|
|
557
|
-
method: "GET",
|
|
558
|
-
path: "/v1/health",
|
|
559
|
-
operationId: "getHealth"
|
|
560
|
-
},
|
|
561
|
-
"GET /v1/projects/{project_id}/honeytokens": {
|
|
562
|
-
method: "GET",
|
|
563
|
-
path: "/v1/projects/{project_id}/honeytokens",
|
|
564
|
-
operationId: "listHoneytokens"
|
|
565
|
-
},
|
|
566
|
-
"POST /v1/projects/{project_id}/honeytokens": {
|
|
567
|
-
method: "POST",
|
|
568
|
-
path: "/v1/projects/{project_id}/honeytokens",
|
|
569
|
-
operationId: "createHoneytoken"
|
|
570
|
-
},
|
|
571
|
-
"GET /v1/projects/{project_id}/honeytokens/{honeytoken_id}": {
|
|
572
|
-
method: "GET",
|
|
573
|
-
path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}",
|
|
574
|
-
operationId: "getHoneytoken"
|
|
575
|
-
},
|
|
576
|
-
"PUT /v1/projects/{project_id}/honeytokens/{honeytoken_id}": {
|
|
577
|
-
method: "PUT",
|
|
578
|
-
path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}",
|
|
579
|
-
operationId: "updateHoneytoken"
|
|
580
|
-
},
|
|
581
|
-
"DELETE /v1/projects/{project_id}/honeytokens/{honeytoken_id}": {
|
|
582
|
-
method: "DELETE",
|
|
583
|
-
path: "/v1/projects/{project_id}/honeytokens/{honeytoken_id}",
|
|
584
|
-
operationId: "deleteHoneytoken"
|
|
585
|
-
},
|
|
586
|
-
"GET /v1/projects/{project_id}/insights": {
|
|
587
|
-
method: "GET",
|
|
588
|
-
path: "/v1/projects/{project_id}/insights",
|
|
589
|
-
operationId: "getProjectInsights"
|
|
590
|
-
},
|
|
591
|
-
"POST /v1/projects/{project_id}/migrations:lint": {
|
|
592
|
-
method: "POST",
|
|
593
|
-
path: "/v1/projects/{project_id}/migrations:lint",
|
|
594
|
-
operationId: "lintMigration"
|
|
595
|
-
},
|
|
596
|
-
"GET /v1/organizations/{org_id}/onboarding": {
|
|
597
|
-
method: "GET",
|
|
598
|
-
path: "/v1/organizations/{org_id}/onboarding",
|
|
599
|
-
operationId: "getOnboardingProgress"
|
|
600
|
-
},
|
|
601
|
-
"PATCH /v1/organizations/{org_id}/onboarding": {
|
|
602
|
-
method: "PATCH",
|
|
603
|
-
path: "/v1/organizations/{org_id}/onboarding",
|
|
604
|
-
operationId: "updateOnboardingProgress"
|
|
605
|
-
},
|
|
606
|
-
"GET /v1/organizations": {
|
|
607
|
-
method: "GET",
|
|
608
|
-
path: "/v1/organizations",
|
|
609
|
-
operationId: "listOrganizations"
|
|
610
|
-
},
|
|
611
|
-
"GET /v1/projects/{project_id}/policies": {
|
|
612
|
-
method: "GET",
|
|
613
|
-
path: "/v1/projects/{project_id}/policies",
|
|
614
|
-
operationId: "listPolicyProfiles"
|
|
615
|
-
},
|
|
616
|
-
"POST /v1/projects/{project_id}/policies": {
|
|
617
|
-
method: "POST",
|
|
618
|
-
path: "/v1/projects/{project_id}/policies",
|
|
619
|
-
operationId: "createPolicyProfile"
|
|
620
|
-
},
|
|
621
|
-
"GET /v1/projects/{project_id}/policies/{policy_id}": {
|
|
622
|
-
method: "GET",
|
|
623
|
-
path: "/v1/projects/{project_id}/policies/{policy_id}",
|
|
624
|
-
operationId: "getPolicyProfile"
|
|
625
|
-
},
|
|
626
|
-
"PUT /v1/projects/{project_id}/policies/{policy_id}": {
|
|
627
|
-
method: "PUT",
|
|
628
|
-
path: "/v1/projects/{project_id}/policies/{policy_id}",
|
|
629
|
-
operationId: "updatePolicyProfile"
|
|
630
|
-
},
|
|
631
|
-
"DELETE /v1/projects/{project_id}/policies/{policy_id}": {
|
|
632
|
-
method: "DELETE",
|
|
633
|
-
path: "/v1/projects/{project_id}/policies/{policy_id}",
|
|
634
|
-
operationId: "deletePolicyProfile"
|
|
635
|
-
},
|
|
636
|
-
"POST /v1/projects/{project_id}/policy-evaluations": {
|
|
637
|
-
method: "POST",
|
|
638
|
-
path: "/v1/projects/{project_id}/policy-evaluations",
|
|
639
|
-
operationId: "dryEvalPolicy"
|
|
640
|
-
},
|
|
641
|
-
"POST /v1/projects/{project_id}/policy-replays": {
|
|
642
|
-
method: "POST",
|
|
643
|
-
path: "/v1/projects/{project_id}/policy-replays",
|
|
644
|
-
operationId: "replayPolicy"
|
|
645
|
-
},
|
|
646
|
-
"GET /v1/projects": {
|
|
647
|
-
method: "GET",
|
|
648
|
-
path: "/v1/projects",
|
|
649
|
-
operationId: "listProjects"
|
|
650
|
-
},
|
|
651
|
-
"POST /v1/projects": {
|
|
652
|
-
method: "POST",
|
|
653
|
-
path: "/v1/projects",
|
|
654
|
-
operationId: "createProject"
|
|
655
|
-
},
|
|
656
|
-
"GET /v1/projects/{project_id}": {
|
|
657
|
-
method: "GET",
|
|
658
|
-
path: "/v1/projects/{project_id}",
|
|
659
|
-
operationId: "getProject"
|
|
660
|
-
},
|
|
661
|
-
"PATCH /v1/projects/{project_id}": {
|
|
662
|
-
method: "PATCH",
|
|
663
|
-
path: "/v1/projects/{project_id}",
|
|
664
|
-
operationId: "updateProject"
|
|
665
|
-
},
|
|
666
|
-
"DELETE /v1/projects/{project_id}": {
|
|
667
|
-
method: "DELETE",
|
|
668
|
-
path: "/v1/projects/{project_id}",
|
|
669
|
-
operationId: "deleteProject"
|
|
670
|
-
},
|
|
671
|
-
"GET /v1/projects/{project_id}/metrics": {
|
|
672
|
-
method: "GET",
|
|
673
|
-
path: "/v1/projects/{project_id}/metrics",
|
|
674
|
-
operationId: "getProjectMetrics"
|
|
675
|
-
},
|
|
676
|
-
"GET /v1/regions": {
|
|
677
|
-
method: "GET",
|
|
678
|
-
path: "/v1/regions",
|
|
679
|
-
operationId: "listRegions"
|
|
680
|
-
},
|
|
681
|
-
"GET /v1/databases/{database_id}/replicas": {
|
|
682
|
-
method: "GET",
|
|
683
|
-
path: "/v1/databases/{database_id}/replicas",
|
|
684
|
-
operationId: "listReplicas"
|
|
685
|
-
},
|
|
686
|
-
"POST /v1/databases/{database_id}/replicas": {
|
|
687
|
-
method: "POST",
|
|
688
|
-
path: "/v1/databases/{database_id}/replicas",
|
|
689
|
-
operationId: "createReplica"
|
|
690
|
-
},
|
|
691
|
-
"DELETE /v1/databases/{database_id}/replicas/{replica_id}": {
|
|
692
|
-
method: "DELETE",
|
|
693
|
-
path: "/v1/databases/{database_id}/replicas/{replica_id}",
|
|
694
|
-
operationId: "deleteReplica"
|
|
695
|
-
},
|
|
696
|
-
"GET /v1/organizations/{org_id}/self-host-enrollments": {
|
|
697
|
-
method: "GET",
|
|
698
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments",
|
|
699
|
-
operationId: "listSelfHostEnrollments"
|
|
700
|
-
},
|
|
701
|
-
"POST /v1/organizations/{org_id}/self-host-enrollments": {
|
|
702
|
-
method: "POST",
|
|
703
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments",
|
|
704
|
-
operationId: "createSelfHostEnrollment"
|
|
705
|
-
},
|
|
706
|
-
"DELETE /v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}": {
|
|
707
|
-
method: "DELETE",
|
|
708
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}",
|
|
709
|
-
operationId: "revokeSelfHostEnrollment"
|
|
710
|
-
},
|
|
711
|
-
"POST /v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}/rotate": {
|
|
712
|
-
method: "POST",
|
|
713
|
-
path: "/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}/rotate",
|
|
714
|
-
operationId: "rotateSelfHostEnrollment"
|
|
715
|
-
},
|
|
716
|
-
"GET /v1/organizations/{org_id}/support/cases": {
|
|
717
|
-
method: "GET",
|
|
718
|
-
path: "/v1/organizations/{org_id}/support/cases",
|
|
719
|
-
operationId: "listSupportCases"
|
|
720
|
-
},
|
|
721
|
-
"POST /v1/organizations/{org_id}/support/cases": {
|
|
722
|
-
method: "POST",
|
|
723
|
-
path: "/v1/organizations/{org_id}/support/cases",
|
|
724
|
-
operationId: "createSupportCase"
|
|
725
|
-
},
|
|
726
|
-
"GET /v1/organizations/{org_id}/support/cases/{case_id}": {
|
|
727
|
-
method: "GET",
|
|
728
|
-
path: "/v1/organizations/{org_id}/support/cases/{case_id}",
|
|
729
|
-
operationId: "getSupportCase"
|
|
730
|
-
},
|
|
731
|
-
"PATCH /v1/organizations/{org_id}/support/cases/{case_id}": {
|
|
732
|
-
method: "PATCH",
|
|
733
|
-
path: "/v1/organizations/{org_id}/support/cases/{case_id}",
|
|
734
|
-
operationId: "updateSupportCase"
|
|
735
|
-
},
|
|
736
|
-
"POST /v1/organizations/{org_id}/support/cases/{case_id}/messages": {
|
|
737
|
-
method: "POST",
|
|
738
|
-
path: "/v1/organizations/{org_id}/support/cases/{case_id}/messages",
|
|
739
|
-
operationId: "createSupportMessage"
|
|
740
|
-
},
|
|
741
|
-
"POST /v1/internal/support/slack-event": {
|
|
742
|
-
method: "POST",
|
|
743
|
-
path: "/v1/internal/support/slack-event",
|
|
744
|
-
operationId: "handleSlackSupportEvent"
|
|
745
|
-
},
|
|
746
|
-
"GET /v1/organizations/{org_id}/usage": {
|
|
747
|
-
method: "GET",
|
|
748
|
-
path: "/v1/organizations/{org_id}/usage",
|
|
749
|
-
operationId: "getOrganizationUsage"
|
|
750
|
-
},
|
|
751
|
-
"GET /v1/projects/{project_id}/usage": {
|
|
752
|
-
method: "GET",
|
|
753
|
-
path: "/v1/projects/{project_id}/usage",
|
|
754
|
-
operationId: "getProjectUsage"
|
|
755
|
-
},
|
|
756
|
-
"GET /v1/projects/{project_id}/webhooks": {
|
|
757
|
-
method: "GET",
|
|
758
|
-
path: "/v1/projects/{project_id}/webhooks",
|
|
759
|
-
operationId: "listWebhookEndpoints"
|
|
760
|
-
},
|
|
761
|
-
"POST /v1/projects/{project_id}/webhooks": {
|
|
762
|
-
method: "POST",
|
|
763
|
-
path: "/v1/projects/{project_id}/webhooks",
|
|
764
|
-
operationId: "createWebhookEndpoint"
|
|
765
|
-
},
|
|
766
|
-
"GET /v1/projects/{project_id}/webhooks/{webhook_id}": {
|
|
767
|
-
method: "GET",
|
|
768
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}",
|
|
769
|
-
operationId: "getWebhookEndpoint"
|
|
770
|
-
},
|
|
771
|
-
"PUT /v1/projects/{project_id}/webhooks/{webhook_id}": {
|
|
772
|
-
method: "PUT",
|
|
773
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}",
|
|
774
|
-
operationId: "updateWebhookEndpoint"
|
|
775
|
-
},
|
|
776
|
-
"DELETE /v1/projects/{project_id}/webhooks/{webhook_id}": {
|
|
777
|
-
method: "DELETE",
|
|
778
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}",
|
|
779
|
-
operationId: "deleteWebhookEndpoint"
|
|
780
|
-
},
|
|
781
|
-
"POST /v1/projects/{project_id}/webhooks/{webhook_id}/test": {
|
|
782
|
-
method: "POST",
|
|
783
|
-
path: "/v1/projects/{project_id}/webhooks/{webhook_id}/test",
|
|
784
|
-
operationId: "testWebhookEndpoint"
|
|
785
|
-
}
|
|
786
|
-
};
|
|
3
|
+
var operationsMap_gen = require('./operations-map.gen-c7vqzfzd.cjs');
|
|
787
4
|
|
|
788
5
|
class ApiError extends Error {
|
|
789
6
|
constructor(status, statusText, body){
|
|
@@ -806,6 +23,61 @@ class ApiError extends Error {
|
|
|
806
23
|
if (typeof obj.message === "string") return obj.message;
|
|
807
24
|
return undefined;
|
|
808
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
|
+
}
|
|
809
81
|
const RETRYABLE_STATUS_CODES = [
|
|
810
82
|
408,
|
|
811
83
|
429,
|
|
@@ -813,11 +85,17 @@ const RETRYABLE_STATUS_CODES = [
|
|
|
813
85
|
503,
|
|
814
86
|
504
|
|
815
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;
|
|
816
93
|
const DEFAULT_RETRY = {
|
|
817
94
|
maxRetries: 5,
|
|
818
95
|
initialDelayMs: 500,
|
|
819
96
|
maxDelayMs: 30_000,
|
|
820
|
-
idempotencyKeys: true
|
|
97
|
+
idempotencyKeys: true,
|
|
98
|
+
totalBudgetMs: 120_000
|
|
821
99
|
};
|
|
822
100
|
function resolveRetry(config) {
|
|
823
101
|
if (!config) return {
|
|
@@ -845,6 +123,10 @@ function resolveRetry(config) {
|
|
|
845
123
|
}
|
|
846
124
|
return undefined;
|
|
847
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
|
+
}
|
|
848
130
|
/** Compute exponential backoff with jitter. */ function backoff(attempt, initialDelayMs, maxDelayMs) {
|
|
849
131
|
const delay = Math.min(initialDelayMs * 2 ** attempt, maxDelayMs);
|
|
850
132
|
return delay * (0.5 + Math.random());
|
|
@@ -888,6 +170,8 @@ async function fetcher(options) {
|
|
|
888
170
|
}
|
|
889
171
|
const fetchFn = options.fetchImpl ?? globalThis.fetch;
|
|
890
172
|
const retry = resolveRetry(options.retry);
|
|
173
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
174
|
+
const startedAt = Date.now();
|
|
891
175
|
const urlStr = fullUrl.toString();
|
|
892
176
|
const fetchBody = options.body !== undefined ? JSON.stringify(options.body) : undefined;
|
|
893
177
|
// Generate idempotency key once, reused across all retry attempts.
|
|
@@ -900,32 +184,53 @@ async function fetcher(options) {
|
|
|
900
184
|
if (idempotencyKey) {
|
|
901
185
|
reqHeaders["Idempotency-Key"] = idempotencyKey;
|
|
902
186
|
}
|
|
187
|
+
// Distinguishes a transport failure from an `onResponse` hook that threw
|
|
188
|
+
// after the server had already answered.
|
|
189
|
+
let answered = false;
|
|
903
190
|
try {
|
|
904
191
|
const response = await fetchFn(urlStr, {
|
|
905
192
|
method: options.method,
|
|
906
193
|
headers: reqHeaders,
|
|
907
|
-
body: fetchBody
|
|
194
|
+
body: fetchBody,
|
|
195
|
+
...timeoutMs > 0 ? {
|
|
196
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
197
|
+
} : {}
|
|
908
198
|
});
|
|
199
|
+
answered = true;
|
|
909
200
|
if (options.onResponse) {
|
|
910
201
|
await options.onResponse(response);
|
|
911
202
|
}
|
|
912
203
|
if (response.ok) {
|
|
913
204
|
return parseResponseBody(response);
|
|
914
205
|
}
|
|
915
|
-
|
|
916
|
-
|
|
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)) {
|
|
917
210
|
const errorBody = await response.json().catch(()=>null);
|
|
918
211
|
throw new ApiError(response.status, response.statusText, errorBody);
|
|
919
212
|
}
|
|
920
|
-
// Retryable error — wait and retry.
|
|
921
|
-
const delay = parseRetryAfter(response) ?? backoff(attempt, retry.initialDelayMs, retry.maxDelayMs);
|
|
922
213
|
await sleep(delay);
|
|
923
214
|
} catch (err) {
|
|
924
215
|
// If it's already an ApiError, rethrow (we threw it above).
|
|
925
216
|
if (err instanceof ApiError) throw err;
|
|
926
|
-
//
|
|
927
|
-
|
|
217
|
+
// The request never got an answer. Retry while attempts and budget last,
|
|
218
|
+
// then report the endpoint and the real underlying cause.
|
|
928
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
|
+
}
|
|
929
234
|
await sleep(delay);
|
|
930
235
|
}
|
|
931
236
|
}
|
|
@@ -953,6 +258,10 @@ function sleep(ms) {
|
|
|
953
258
|
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
954
259
|
}
|
|
955
260
|
|
|
261
|
+
const publicRegistry = {
|
|
262
|
+
byTag: operationsMap_gen.operationsByTag,
|
|
263
|
+
byPath: operationsMap_gen.operationsByPath
|
|
264
|
+
};
|
|
956
265
|
class PgBeamClient {
|
|
957
266
|
constructor(options){
|
|
958
267
|
this._baseUrl = options.baseUrl;
|
|
@@ -964,6 +273,8 @@ class PgBeamClient {
|
|
|
964
273
|
} : options.retry ?? {
|
|
965
274
|
maxRetries: 5
|
|
966
275
|
};
|
|
276
|
+
this._timeoutMs = options.timeoutMs;
|
|
277
|
+
this._operations = options.operations ?? publicRegistry;
|
|
967
278
|
}
|
|
968
279
|
async _resolveToken() {
|
|
969
280
|
if (typeof this._tokenOrFn === "function") {
|
|
@@ -971,53 +282,44 @@ class PgBeamClient {
|
|
|
971
282
|
}
|
|
972
283
|
return this._tokenOrFn;
|
|
973
284
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
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);
|
|
990
303
|
}
|
|
991
304
|
/** Access API operations via tag-based namespaces or `.request()`. */ get api() {
|
|
992
305
|
if (this._api) return this._api;
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
path: meta.path,
|
|
1000
|
-
pathParams: params?.pathParams,
|
|
1001
|
-
queryParams: params?.queryParams,
|
|
1002
|
-
body: params?.body,
|
|
1003
|
-
baseUrl: this._baseUrl,
|
|
1004
|
-
token,
|
|
1005
|
-
fetchImpl: this._fetchImpl,
|
|
1006
|
-
onResponse: this._onResponse,
|
|
1007
|
-
retry: this._retry
|
|
1008
|
-
});
|
|
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);
|
|
1009
312
|
};
|
|
1010
313
|
this._api = new Proxy({}, {
|
|
1011
314
|
get: (_, prop)=>{
|
|
1012
315
|
if (prop === "request") return request;
|
|
1013
|
-
const tagOps =
|
|
316
|
+
const tagOps = this._operations.byTag[prop];
|
|
1014
317
|
if (!tagOps) return undefined;
|
|
1015
318
|
return new Proxy({}, {
|
|
1016
319
|
get: (_, method)=>{
|
|
1017
|
-
const
|
|
1018
|
-
const opMeta = ops[method];
|
|
320
|
+
const opMeta = tagOps[method];
|
|
1019
321
|
if (!opMeta) return undefined;
|
|
1020
|
-
return this._call(opMeta
|
|
322
|
+
return this._call(opMeta);
|
|
1021
323
|
}
|
|
1022
324
|
});
|
|
1023
325
|
}
|
|
@@ -1027,5 +329,7 @@ class PgBeamClient {
|
|
|
1027
329
|
}
|
|
1028
330
|
|
|
1029
331
|
exports.ApiError = ApiError;
|
|
332
|
+
exports.NetworkError = NetworkError;
|
|
1030
333
|
exports.PgBeamClient = PgBeamClient;
|
|
334
|
+
exports.describeError = describeError;
|
|
1031
335
|
exports.extractMessage = extractMessage;
|