vercel-api-js 0.7.1 → 0.8.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 DELETED
@@ -1,1060 +0,0 @@
1
- 'use strict';
2
-
3
- /******************************************************************************
4
- Copyright (c) Microsoft Corporation.
5
-
6
- Permission to use, copy, modify, and/or distribute this software for any
7
- purpose with or without fee is hereby granted.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- PERFORMANCE OF THIS SOFTWARE.
16
- ***************************************************************************** */
17
- /* global Reflect, Promise, SuppressedError, Symbol */
18
-
19
-
20
- function __classPrivateFieldGet(receiver, state, kind, f) {
21
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
22
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
23
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
24
- }
25
-
26
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
27
- if (kind === "m") throw new TypeError("Private method is not writable");
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
30
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
31
- }
32
-
33
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
34
- var e = new Error(message);
35
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
36
- };
37
-
38
- function notEmpty(value) {
39
- return value !== null && value !== undefined;
40
- }
41
- function compactObject(obj) {
42
- return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
43
- }
44
-
45
- const baseUrl = 'https://api.vercel.com';
46
- async function fetch$1({ url, method, body, headers, pathParams, queryParams, signal, token, fetchImpl }) {
47
- try {
48
- const requestHeaders = compactObject({
49
- 'Content-Type': 'application/json',
50
- Authorization: token ? `Bearer ${token}` : undefined,
51
- ...headers
52
- });
53
- /**
54
- * As the fetch API is being used, when multipart/form-data is specified
55
- * the Content-Type header must be deleted so that the browser can set
56
- * the correct boundary.
57
- * https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
58
- */
59
- if (requestHeaders['Content-Type']?.toLowerCase().includes('multipart/form-data')) {
60
- delete requestHeaders['Content-Type'];
61
- }
62
- const payload = body instanceof FormData
63
- ? body
64
- : requestHeaders['Content-Type'] === 'application/json'
65
- ? JSON.stringify(body)
66
- : body;
67
- const response = await fetchImpl(`${baseUrl}${resolveUrl(url, queryParams, pathParams)}`, {
68
- signal,
69
- method: method.toUpperCase(),
70
- body: payload,
71
- headers: requestHeaders
72
- });
73
- if (!response.ok) {
74
- let error;
75
- try {
76
- error = await response.json();
77
- }
78
- catch (e) {
79
- error = {
80
- status: 'unknown',
81
- payload: e instanceof Error ? `Unexpected error (${e.message})` : 'Unexpected error'
82
- };
83
- }
84
- throw error;
85
- }
86
- if (response.headers?.get('content-type')?.includes('json')) {
87
- return await response.json();
88
- }
89
- else {
90
- // if it is not a json response, assume it is a blob and cast it to TData
91
- return (await response.text());
92
- }
93
- }
94
- catch (e) {
95
- let errorObject = {
96
- name: 'unknown',
97
- message: e instanceof Error ? `Network error (${e.message})` : 'Network error',
98
- stack: e
99
- };
100
- throw errorObject;
101
- }
102
- }
103
- const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
104
- let query = new URLSearchParams(queryParams).toString();
105
- if (query)
106
- query = `?${query}`;
107
- return url.replace(/\{\w*\}/g, (key) => pathParams[key.slice(1, -1)] ?? '') + query;
108
- };
109
-
110
- /**
111
- * Records an artifacts cache usage event. The body of this request is an array of cache usage events. The supported event types are `HIT` and `MISS`. The source is either `LOCAL` the cache event was on the users filesystem cache or `REMOTE` if the cache event is for a remote cache. When the event is a `HIT` the request also accepts a number `duration` which is the time taken to generate the artifact in the cache.
112
- */
113
- const recordEvents = (variables, signal) => fetch$1({
114
- url: '/v8/artifacts/events',
115
- method: 'post',
116
- ...variables,
117
- signal
118
- });
119
- /**
120
- * Check the status of Remote Caching for this principal. Returns a JSON-encoded status indicating if Remote Caching is enabled, disabled, or disabled due to usage limits.
121
- */
122
- const status = (variables, signal) => fetch$1({
123
- url: '/v8/artifacts/status',
124
- method: 'get',
125
- ...variables,
126
- signal
127
- });
128
- /**
129
- * Uploads a cache artifact identified by the `hash` specified on the path. The cache artifact can then be downloaded with the provided `hash`.
130
- */
131
- const uploadArtifact = (variables, signal) => fetch$1({ url: '/v8/artifacts/{hash}', method: 'put', ...variables, signal });
132
- /**
133
- * Downloads a cache artifact indentified by its `hash` specified on the request path. The artifact is downloaded as an octet-stream. The client should verify the content-length header and response body.
134
- */
135
- const downloadArtifact = (variables, signal) => fetch$1({ url: '/v8/artifacts/{hash}', method: 'get', ...variables, signal });
136
- /**
137
- * Query information about an array of artifacts.
138
- */
139
- const artifactQuery = (variables, signal) => fetch$1({
140
- url: '/v8/artifacts',
141
- method: 'post',
142
- ...variables,
143
- signal
144
- });
145
- /**
146
- * Creates a new check. This endpoint must be called with an OAuth2 or it will produce a 400 error.
147
- */
148
- const createCheck = (variables, signal) => fetch$1({ url: '/v1/deployments/{deploymentId}/checks', method: 'post', ...variables, signal });
149
- /**
150
- * List all of the checks created for a deployment.
151
- */
152
- const getAllChecks = (variables, signal) => fetch$1({
153
- url: '/v1/deployments/{deploymentId}/checks',
154
- method: 'get',
155
- ...variables,
156
- signal
157
- });
158
- /**
159
- * Return a detailed response for a single check.
160
- */
161
- const getCheck = (variables, signal) => fetch$1({
162
- url: '/v1/deployments/{deploymentId}/checks/{checkId}',
163
- method: 'get',
164
- ...variables,
165
- signal
166
- });
167
- /**
168
- * Update an existing check. This endpoint must be called with an OAuth2 or it will produce a 400 error.
169
- */
170
- const updateCheck = (variables, signal) => fetch$1({ url: '/v1/deployments/{deploymentId}/checks/{checkId}', method: 'patch', ...variables, signal });
171
- /**
172
- * Rerequest a selected check that has failed.
173
- */
174
- const rerequestCheck = (variables, signal) => fetch$1({
175
- url: '/v1/deployments/{deploymentId}/checks/{checkId}/rerequest',
176
- method: 'post',
177
- ...variables,
178
- signal
179
- });
180
- /**
181
- * Update the data cache feature on a project.
182
- */
183
- const updateProjectDataCache = (variables, signal) => fetch$1({ url: '/v1/data-cache/projects/{projectId}', method: 'patch', ...variables, signal });
184
- /**
185
- * Get the build logs of a deployment by deployment ID and build ID. It can work as an infinite stream of logs or as a JSON endpoint depending on the input parameters.
186
- */
187
- const getDeploymentEvents = (variables, signal) => fetch$1({ url: '/v3/deployments/{idOrUrl}/events', method: 'get', ...variables, signal });
188
- /**
189
- * Retrieves information for a deployment either by supplying its ID (`id` property) or Hostname (`url` property). Additional details will be included when the authenticated user or team is an owner of the deployment.
190
- */
191
- const getDeployment = (variables, signal) => fetch$1({ url: '/v13/deployments/{idOrUrl}', method: 'get', ...variables, signal });
192
- /**
193
- * Create a new deployment with all the required and intended data. If the deployment is not a git deployment, all files must be provided with the request, either referenced or inlined. Additionally, a deployment id can be specified to redeploy a previous deployment.
194
- */
195
- const createDeployment = (variables, signal) => fetch$1({ url: '/v13/deployments', method: 'post', ...variables, signal });
196
- /**
197
- * This endpoint allows you to cancel a deployment which is currently building, by supplying its `id` in the URL.
198
- */
199
- const cancelDeployment = (variables, signal) => fetch$1({ url: '/v12/deployments/{id}/cancel', method: 'patch', ...variables, signal });
200
- /**
201
- * Allows to purchase the specified domain.
202
- */
203
- const buyDomain = (variables, signal) => fetch$1({
204
- url: '/v4/domains/buy',
205
- method: 'post',
206
- ...variables,
207
- signal
208
- });
209
- /**
210
- * Check the price to purchase a domain and how long a single purchase period is.
211
- */
212
- const checkDomainPrice = (variables, signal) => fetch$1({
213
- url: '/v4/domains/price',
214
- method: 'get',
215
- ...variables,
216
- signal
217
- });
218
- /**
219
- * Retrieves a list of DNS records created for a domain name. By default it returns 20 records if no limit is provided. The rest can be retrieved using the pagination options.
220
- */
221
- const getRecords = (variables, signal) => fetch$1({ url: '/v4/domains/{domain}/records', method: 'get', ...variables, signal });
222
- /**
223
- * Creates a DNS record for a domain.
224
- */
225
- const createRecord = (variables, signal) => fetch$1({ url: '/v2/domains/{domain}/records', method: 'post', ...variables, signal });
226
- /**
227
- * Updates an existing DNS record for a domain name.
228
- */
229
- const updateRecord = (variables, signal) => fetch$1({ url: '/v1/domains/records/{recordId}', method: 'patch', ...variables, signal });
230
- /**
231
- * Removes an existing DNS record from a domain name.
232
- */
233
- const removeRecord = (variables, signal) => fetch$1({
234
- url: '/v2/domains/{domain}/records/{recordId}',
235
- method: 'delete',
236
- ...variables,
237
- signal
238
- });
239
- /**
240
- * Check if a domain name is available for purchase.
241
- */
242
- const checkDomainStatus = (variables, signal) => fetch$1({
243
- url: '/v4/domains/status',
244
- method: 'get',
245
- ...variables,
246
- signal
247
- });
248
- /**
249
- * Fetch domain transfer availability or transfer status if a transfer is in progress.
250
- */
251
- const getDomainTransfer = (variables, signal) => fetch$1({
252
- url: '/v1/domains/{domain}/registry',
253
- method: 'get',
254
- ...variables,
255
- signal
256
- });
257
- /**
258
- * Get a Domain's configuration.
259
- */
260
- const getDomainConfig = (variables, signal) => fetch$1({ url: '/v6/domains/{domain}/config', method: 'get', ...variables, signal });
261
- /**
262
- * Get information for a single domain in an account or team.
263
- */
264
- const getDomain = (variables, signal) => fetch$1({
265
- url: '/v5/domains/{domain}',
266
- method: 'get',
267
- ...variables,
268
- signal
269
- });
270
- /**
271
- * Retrieves a list of domains registered for the authenticated user or team. By default it returns the last 20 domains if no limit is provided.
272
- */
273
- const getDomains = (variables, signal) => fetch$1({
274
- url: '/v5/domains',
275
- method: 'get',
276
- ...variables,
277
- signal
278
- });
279
- /**
280
- * This endpoint is used for adding a new apex domain name with Vercel for the authenticating user. Can also be used for initiating a domain transfer request from an external Registrar to Vercel.
281
- */
282
- const createOrTransferDomain = (variables, signal) => fetch$1({ url: '/v5/domains', method: 'post', ...variables, signal });
283
- /**
284
- * Update or move apex domain.
285
- */
286
- const patchDomain = (variables, signal) => fetch$1({ url: '/v3/domains/{domain}', method: 'patch', ...variables, signal });
287
- /**
288
- * Delete a previously registered domain name from Vercel. Deleting a domain will automatically remove any associated aliases.
289
- */
290
- const deleteDomain = (variables, signal) => fetch$1({
291
- url: '/v6/domains/{domain}',
292
- method: 'delete',
293
- ...variables,
294
- signal
295
- });
296
- /**
297
- * Returns all Edge Configs.
298
- */
299
- const getEdgeConfigs = (variables, signal) => fetch$1({
300
- url: '/v1/edge-config',
301
- method: 'get',
302
- ...variables,
303
- signal
304
- });
305
- /**
306
- * Creates an Edge Config.
307
- */
308
- const createEdgeConfig = (variables, signal) => fetch$1({ url: '/v1/edge-config', method: 'post', ...variables, signal });
309
- /**
310
- * Returns an Edge Config.
311
- */
312
- const getEdgeConfig = (variables, signal) => fetch$1({
313
- url: '/v1/edge-config/{edgeConfigId}',
314
- method: 'get',
315
- ...variables,
316
- signal
317
- });
318
- /**
319
- * Updates an Edge Config.
320
- */
321
- const updateEdgeConfig = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}', method: 'put', ...variables, signal });
322
- /**
323
- * Delete an Edge Config by id.
324
- */
325
- const deleteEdgeConfig = (variables, signal) => fetch$1({
326
- url: '/v1/edge-config/{edgeConfigId}',
327
- method: 'delete',
328
- ...variables,
329
- signal
330
- });
331
- /**
332
- * Returns all items of an Edge Config.
333
- */
334
- const getEdgeConfigItems = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/items', method: 'get', ...variables, signal });
335
- /**
336
- * Update multiple Edge Config Items in batch.
337
- */
338
- const patchEdgeConfigItems = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/items', method: 'patch', ...variables, signal });
339
- /**
340
- * Returns the schema of an Edge Config.
341
- */
342
- const getEdgeConfigSchema = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/schema', method: 'get', ...variables, signal });
343
- /**
344
- * Update an Edge Config's schema.
345
- */
346
- const patchEdgeConfigSchema = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/schema', method: 'post', ...variables, signal });
347
- /**
348
- * Deletes the schema of existing Edge Config.
349
- */
350
- const deleteEdgeConfigSchema = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/schema', method: 'delete', ...variables, signal });
351
- /**
352
- * Returns a specific Edge Config Item.
353
- */
354
- const getEdgeConfigItem = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/item/{edgeConfigItemKey}', method: 'get', ...variables, signal });
355
- /**
356
- * Returns all tokens of an Edge Config.
357
- */
358
- const getEdgeConfigTokens = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/tokens', method: 'get', ...variables, signal });
359
- /**
360
- * Deletes one or more tokens of an existing Edge Config.
361
- */
362
- const deleteEdgeConfigTokens = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/tokens', method: 'delete', ...variables, signal });
363
- /**
364
- * Return meta data about an Edge Config token.
365
- */
366
- const getEdgeConfigToken = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/token/{token}', method: 'get', ...variables, signal });
367
- /**
368
- * Adds a token to an existing Edge Config.
369
- */
370
- const createEdgeConfigToken = (variables, signal) => fetch$1({ url: '/v1/edge-config/{edgeConfigId}/token', method: 'post', ...variables, signal });
371
- /**
372
- * Retrieves a list of "events" generated by the User on Vercel. Events are generated when the User performs a particular action, such as logging in, creating a deployment, and joining a Team (just to name a few). When the `teamId` parameter is supplied, then the events that are returned will be in relation to the Team that was specified.
373
- */
374
- const listUserEvents = (variables, signal) => fetch$1({
375
- url: '/v3/events',
376
- method: 'get',
377
- ...variables,
378
- signal
379
- });
380
- /**
381
- * Allows to retrieve all configurations for an authenticated integration. When the `project` view is used, configurations generated for the authorization flow will be filtered out of the results.
382
- */
383
- const getConfigurations = (variables, signal) => fetch$1({ url: '/v1/integrations/configurations', method: 'get', ...variables, signal });
384
- /**
385
- * Allows to retrieve a the configuration with the provided id in case it exists. The authenticated user or team must be the owner of the config in order to access it.
386
- */
387
- const getConfiguration = (variables, signal) => fetch$1({ url: '/v1/integrations/configuration/{id}', method: 'get', ...variables, signal });
388
- /**
389
- * Allows to remove the configuration with the `id` provided in the parameters. The configuration and all of its resources will be removed. This includes Webhooks, LogDrains and Project Env variables.
390
- */
391
- const deleteConfiguration = (variables, signal) => fetch$1({ url: '/v1/integrations/configuration/{id}', method: 'delete', ...variables, signal });
392
- /**
393
- * Retrieves a list of all Integration log drains that are defined for the authenticated user or team. When using an OAuth2 token, the list is limited to log drains created by the authenticated integration.
394
- */
395
- const getIntegrationLogDrains = (variables, signal) => fetch$1({ url: '/v2/integrations/log-drains', method: 'get', ...variables, signal });
396
- /**
397
- * Creates an Integration log drain. This endpoint must be called with an OAuth2 client (integration), since log drains are tied to integrations. If it is called with a different token type it will produce a 400 error.
398
- */
399
- const createLogDrain = (variables, signal) => fetch$1({
400
- url: '/v2/integrations/log-drains',
401
- method: 'post',
402
- ...variables,
403
- signal
404
- });
405
- /**
406
- * Deletes the Integration log drain with the provided `id`. When using an OAuth2 Token, the log drain can be deleted only if the integration owns it.
407
- */
408
- const deleteIntegrationLogDrain = (variables, signal) => fetch$1({ url: '/v1/integrations/log-drains/{id}', method: 'delete', ...variables, signal });
409
- /**
410
- * Lists git namespaces for a supported provider. Supported providers are `github`, `gitlab` and `bitbucket`. If the provider is not provided, it will try to obtain it from the user that authenticated the request.
411
- */
412
- const gitNamespaces = (variables, signal) => fetch$1({
413
- url: '/v1/integrations/git-namespaces',
414
- method: 'get',
415
- ...variables,
416
- signal
417
- });
418
- /**
419
- * Lists git repositories linked to a namespace `id` for a supported provider. A specific namespace `id` can be obtained via the `git-namespaces` endpoint. Supported providers are `github`, `gitlab` and `bitbucket`. If the provider or namespace is not provided, it will try to obtain it from the user that authenticated the request.
420
- */
421
- const searchRepo = (variables, signal) => fetch$1({
422
- url: '/v1/integrations/search-repo',
423
- method: 'get',
424
- ...variables,
425
- signal
426
- });
427
- /**
428
- * Retrieves a Configurable Log Drain. This endpoint must be called with a team AccessToken (integration OAuth2 clients are not allowed). Only log drains owned by the authenticated team can be accessed.
429
- */
430
- const getConfigurableLogDrain = (variables, signal) => fetch$1({ url: '/v1/log-drains/{id}', method: 'get', ...variables, signal });
431
- /**
432
- * Deletes a Configurable Log Drain. This endpoint must be called with a team AccessToken (integration OAuth2 clients are not allowed). Only log drains owned by the authenticated team can be deleted.
433
- */
434
- const deleteConfigurableLogDrain = (variables, signal) => fetch$1({ url: '/v1/log-drains/{id}', method: 'delete', ...variables, signal });
435
- /**
436
- * Retrieves a list of all the Log Drains owned by the account. This endpoint must be called with an account AccessToken (integration OAuth2 clients are not allowed). Only log drains owned by the authenticated account can be accessed.
437
- */
438
- const getAllLogDrains = (variables, signal) => fetch$1({
439
- url: '/v1/log-drains',
440
- method: 'get',
441
- ...variables,
442
- signal
443
- });
444
- /**
445
- * Creates a configurable log drain. This endpoint must be called with a team AccessToken (integration OAuth2 clients are not allowed)
446
- */
447
- const createConfigurableLogDrain = (variables, signal) => fetch$1({ url: '/v1/log-drains', method: 'post', ...variables, signal });
448
- /**
449
- * Lists all members of a project.
450
- */
451
- const getProjectMembers = (variables, signal) => fetch$1({ url: '/v1/projects/{idOrName}/members', method: 'get', ...variables, signal });
452
- /**
453
- * Adds a new member to the project.
454
- */
455
- const addProjectMember = (variables, signal) => fetch$1({ url: '/v1/projects/{idOrName}/members', method: 'post', ...variables, signal });
456
- /**
457
- * Remove a member from a specific project
458
- */
459
- const removeProjectMember = (variables, signal) => fetch$1({ url: '/v1/projects/{idOrName}/members/{uid}', method: 'delete', ...variables, signal });
460
- /**
461
- * Allows to retrieve the list of projects of the authenticated user or team. The list will be paginated and the provided query parameters allow filtering the returned projects.
462
- */
463
- const getProjects = (variables, signal) => fetch$1({
464
- url: '/v9/projects',
465
- method: 'get',
466
- ...variables,
467
- signal
468
- });
469
- /**
470
- * Allows to create a new project with the provided configuration. It only requires the project `name` but more configuration can be provided to override the defaults.
471
- */
472
- const createProject = (variables, signal) => fetch$1({
473
- url: '/v10/projects',
474
- method: 'post',
475
- ...variables,
476
- signal
477
- });
478
- /**
479
- * Get the information for a specific project by passing either the project `id` or `name` in the URL.
480
- */
481
- const getProject = (variables, signal) => fetch$1({
482
- url: '/v9/projects/{idOrName}',
483
- method: 'get',
484
- ...variables,
485
- signal
486
- });
487
- /**
488
- * Update the fields of a project using either its `name` or `id`.
489
- */
490
- const updateProject = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}', method: 'patch', ...variables, signal });
491
- /**
492
- * Delete a specific project by passing either the project `id` or `name` in the URL.
493
- */
494
- const deleteProject = (variables, signal) => fetch$1({
495
- url: '/v9/projects/{idOrName}',
496
- method: 'delete',
497
- ...variables,
498
- signal
499
- });
500
- /**
501
- * Retrieve the domains associated with a given project by passing either the project `id` or `name` in the URL.
502
- */
503
- const getProjectDomains = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/domains', method: 'get', ...variables, signal });
504
- /**
505
- * Get project domain by project id/name and domain name.
506
- */
507
- const getProjectDomain = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/domains/{domain}', method: 'get', ...variables, signal });
508
- /**
509
- * Update a project domain's configuration, including the name, git branch and redirect of the domain.
510
- */
511
- const updateProjectDomain = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/domains/{domain}', method: 'patch', ...variables, signal });
512
- /**
513
- * Remove a domain from a project by passing the domain name and by specifying the project by either passing the project `id` or `name` in the URL.
514
- */
515
- const removeProjectDomain = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/domains/{domain}', method: 'delete', ...variables, signal });
516
- /**
517
- * Add a domain to the project by passing its domain name and by specifying the project by either passing the project `id` or `name` in the URL. If the domain is not yet verified to be used on this project, the request will return `verified = false`, and the domain will need to be verified according to the `verification` challenge via `POST /projects/:idOrName/domains/:domain/verify`. If the domain already exists on the project, the request will fail with a `400` status code.
518
- */
519
- const addProjectDomain = (variables, signal) => fetch$1({ url: '/v10/projects/{idOrName}/domains', method: 'post', ...variables, signal });
520
- /**
521
- * Attempts to verify a project domain with `verified = false` by checking the correctness of the project domain's `verification` challenge.
522
- */
523
- const verifyProjectDomain = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/domains/{domain}/verify', method: 'post', ...variables, signal });
524
- /**
525
- * Retrieve the environment variables for a given project by passing either the project `id` or `name` in the URL.
526
- */
527
- const filterProjectEnvs = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/env', method: 'get', ...variables, signal });
528
- /**
529
- * Retrieve the environment variable for a given project.
530
- */
531
- const getProjectEnv = (variables, signal) => fetch$1({ url: '/v1/projects/{idOrName}/env/{id}', method: 'get', ...variables, signal });
532
- /**
533
- * Create one ore more environment variables for a project by passing its `key`, `value`, `type` and `target` and by specifying the project by either passing the project `id` or `name` in the URL.
534
- */
535
- const createProjectEnv = (variables, signal) => fetch$1({ url: '/v10/projects/{idOrName}/env', method: 'post', ...variables, signal });
536
- /**
537
- * Delete a specific environment variable for a given project by passing the environment variable identifier and either passing the project `id` or `name` in the URL.
538
- */
539
- const removeProjectEnv = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/env/{id}', method: 'delete', ...variables, signal });
540
- /**
541
- * Edit a specific environment variable for a given project by passing the environment variable identifier and either passing the project `id` or `name` in the URL.
542
- */
543
- const editProjectEnv = (variables, signal) => fetch$1({ url: '/v9/projects/{idOrName}/env/{id}', method: 'patch', ...variables, signal });
544
- /**
545
- * Pause a project by passing its project `id` in the URL. If the project does not exist given the id then the request will fail with 400 status code. If the project disables auto assigning custom production domains and blocks the active Production Deployment then the request will return with 200 status code.
546
- */
547
- const pauseProject = (variables, signal) => fetch$1({
548
- url: '/v1/projects/{projectId}/pause',
549
- method: 'post',
550
- ...variables,
551
- signal
552
- });
553
- /**
554
- * Unpause a project by passing its project `id` in the URL. If the project does not exist given the id then the request will fail with 400 status code. If the project enables auto assigning custom production domains and unblocks the active Production Deployment then the request will return with 200 status code.
555
- */
556
- const unpauseProject = (variables, signal) => fetch$1({
557
- url: '/v1/projects/{projectId}/unpause',
558
- method: 'post',
559
- ...variables,
560
- signal
561
- });
562
- /**
563
- * Get a paginated list of team members for the provided team.
564
- */
565
- const getTeamMembers = (variables, signal) => fetch$1({
566
- url: '/v2/teams/{teamId}/members',
567
- method: 'get',
568
- ...variables,
569
- signal
570
- });
571
- /**
572
- * Invite a user to join the team specified in the URL. The authenticated user needs to be an `OWNER` in order to successfully invoke this endpoint. The user can be specified with an email or an ID. If both email and ID are provided, ID will take priority.
573
- */
574
- const inviteUserToTeam = (variables, signal) => fetch$1({ url: '/v1/teams/{teamId}/members', method: 'post', ...variables, signal });
575
- /**
576
- * Request access to a team as a member. An owner has to approve the request. Only 10 users can request access to a team at the same time.
577
- */
578
- const requestAccessToTeam = (variables, signal) => fetch$1({
579
- url: '/v1/teams/{teamId}/request',
580
- method: 'post',
581
- ...variables,
582
- signal
583
- });
584
- /**
585
- * Check the status of a join request. It'll respond with a 404 if the request has been declined. If no `userId` path segment was provided, this endpoint will instead return the status of the authenticated user.
586
- */
587
- const getTeamAccessRequest = (variables, signal) => fetch$1({
588
- url: '/v1/teams/{teamId}/request/{userId}',
589
- method: 'get',
590
- ...variables,
591
- signal
592
- });
593
- /**
594
- * Join a team with a provided invite code or team ID.
595
- */
596
- const joinTeam = (variables, signal) => fetch$1({
597
- url: '/v1/teams/{teamId}/members/teams/join',
598
- method: 'post',
599
- ...variables,
600
- signal
601
- });
602
- /**
603
- * Update the membership of a Team Member on the Team specified by `teamId`, such as changing the _role_ of the member, or confirming a request to join the Team for an unconfirmed member. The authenticated user must be an `OWNER` of the Team.
604
- */
605
- const updateTeamMember = (variables, signal) => fetch$1({ url: '/v1/teams/{teamId}/members/{uid}', method: 'patch', ...variables, signal });
606
- /**
607
- * Remove a Team Member from the Team, or dismiss a user that requested access, or leave a team.
608
- */
609
- const removeTeamMember = (variables, signal) => fetch$1({ url: '/v1/teams/{teamId}/members/{uid}', method: 'delete', ...variables, signal });
610
- /**
611
- * Get information for the Team specified by the `teamId` parameter.
612
- */
613
- const getTeam = (variables, signal) => fetch$1({
614
- url: '/v2/teams/{teamId}',
615
- method: 'get',
616
- ...variables,
617
- signal
618
- });
619
- /**
620
- * Update the information of a Team specified by the `teamId` parameter. The request body should contain the information that will be updated on the Team.
621
- */
622
- const patchTeam = (variables, signal) => fetch$1({
623
- url: '/v2/teams/{teamId}',
624
- method: 'patch',
625
- ...variables,
626
- signal
627
- });
628
- /**
629
- * Get a paginated list of all the Teams the authenticated User is a member of.
630
- */
631
- const getTeams = (variables, signal) => fetch$1({
632
- url: '/v2/teams',
633
- method: 'get',
634
- ...variables,
635
- signal
636
- });
637
- /**
638
- * Create a new Team under your account. You need to send a POST request with the desired Team slug, and optionally the Team name.
639
- */
640
- const createTeam = (variables, signal) => fetch$1({
641
- url: '/v1/teams',
642
- method: 'post',
643
- ...variables,
644
- signal
645
- });
646
- /**
647
- * Delete a team under your account. You need to send a `DELETE` request with the desired team `id`. An optional array of reasons for deletion may also be sent.
648
- */
649
- const deleteTeam = (variables, signal) => fetch$1({
650
- url: '/v1/teams/{teamId}',
651
- method: 'delete',
652
- ...variables,
653
- signal
654
- });
655
- /**
656
- * Delete an active Team invite code.
657
- */
658
- const deleteTeamInviteCode = (variables, signal) => fetch$1({
659
- url: '/v1/teams/{teamId}/invites/{inviteId}',
660
- method: 'delete',
661
- ...variables,
662
- signal
663
- });
664
- /**
665
- * Before you create a deployment you need to upload the required files for that deployment. To do it, you need to first upload each file to this endpoint. Once that's completed, you can create a new deployment with the uploaded files. The file content must be placed inside the body of the request. In the case of a successful response you'll receive a status code 200 with an empty body.
666
- */
667
- const uploadFile = (variables, signal) => fetch$1({ url: '/v2/files', method: 'post', ...variables, signal });
668
- /**
669
- * Retrieves information related to the currently authenticated User.
670
- */
671
- const getAuthUser = (variables, signal) => fetch$1({
672
- url: '/v2/user',
673
- method: 'get',
674
- ...variables,
675
- signal
676
- });
677
- /**
678
- * Initiates the deletion process for the currently authenticated User, by sending a deletion confirmation email. The email contains a link that the user needs to visit in order to proceed with the deletion process.
679
- */
680
- const requestDelete = (variables, signal) => fetch$1({
681
- url: '/v1/user',
682
- method: 'delete',
683
- ...variables,
684
- signal
685
- });
686
- /**
687
- * Retrieve a list of the current User's authentication tokens.
688
- */
689
- const listAuthTokens = (variables, signal) => fetch$1({
690
- url: '/v5/user/tokens',
691
- method: 'get',
692
- ...variables,
693
- signal
694
- });
695
- /**
696
- * Creates and returns a new authentication token for the currently authenticated User. The `bearerToken` property is only provided once, in the response body, so be sure to save it on the client for use with API requests.
697
- */
698
- const createAuthToken = (variables, signal) => fetch$1({ url: '/v3/user/tokens', method: 'post', ...variables, signal });
699
- /**
700
- * Retrieve metadata about an authentication token belonging to the currently authenticated User.
701
- */
702
- const getAuthToken = (variables, signal) => fetch$1({
703
- url: '/v5/user/tokens/{tokenId}',
704
- method: 'get',
705
- ...variables,
706
- signal
707
- });
708
- /**
709
- * Invalidate an authentication token, such that it will no longer be valid for future HTTP requests.
710
- */
711
- const deleteAuthToken = (variables, signal) => fetch$1({
712
- url: '/v3/user/tokens/{tokenId}',
713
- method: 'delete',
714
- ...variables,
715
- signal
716
- });
717
- /**
718
- * Creates a webhook
719
- */
720
- const createWebhook = (variables, signal) => fetch$1({
721
- url: '/v1/webhooks',
722
- method: 'post',
723
- ...variables,
724
- signal
725
- });
726
- /**
727
- * Get a list of webhooks
728
- */
729
- const getWebhooks = (variables, signal) => fetch$1({ url: '/v1/webhooks', method: 'get', ...variables, signal });
730
- /**
731
- * Get a webhook
732
- */
733
- const getWebhook = (variables, signal) => fetch$1({
734
- url: '/v1/webhooks/{id}',
735
- method: 'get',
736
- ...variables,
737
- signal
738
- });
739
- /**
740
- * Deletes a webhook
741
- */
742
- const deleteWebhook = (variables, signal) => fetch$1({
743
- url: '/v1/webhooks/{id}',
744
- method: 'delete',
745
- ...variables,
746
- signal
747
- });
748
- /**
749
- * Retrieves a list of aliases for the authenticated User or Team. When `domain` is provided, only aliases for that domain will be returned. When `projectId` is provided, it will only return the given project aliases.
750
- */
751
- const listAliases = (variables, signal) => fetch$1({
752
- url: '/v4/aliases',
753
- method: 'get',
754
- ...variables,
755
- signal
756
- });
757
- /**
758
- * Retrieves an Alias for the given host name or alias ID.
759
- */
760
- const getAlias = (variables, signal) => fetch$1({
761
- url: '/v4/aliases/{idOrAlias}',
762
- method: 'get',
763
- ...variables,
764
- signal
765
- });
766
- /**
767
- * Delete an Alias with the specified ID.
768
- */
769
- const deleteAlias = (variables, signal) => fetch$1({
770
- url: '/v2/aliases/{aliasId}',
771
- method: 'delete',
772
- ...variables,
773
- signal
774
- });
775
- /**
776
- * Retrieves all Aliases for the Deployment with the given ID. The authenticated user or team must own the deployment.
777
- */
778
- const listDeploymentAliases = (variables, signal) => fetch$1({ url: '/v2/deployments/{id}/aliases', method: 'get', ...variables, signal });
779
- /**
780
- * Creates a new alias for the deployment with the given deployment ID. The authenticated user or team must own this deployment. If the desired alias is already assigned to another deployment, then it will be removed from the old deployment and assigned to the new one.
781
- */
782
- const assignAlias = (variables, signal) => fetch$1({ url: '/v2/deployments/{id}/aliases', method: 'post', ...variables, signal });
783
- /**
784
- * Get cert by id
785
- */
786
- const getCertById = (variables, signal) => fetch$1({
787
- url: '/v7/certs/{id}',
788
- method: 'get',
789
- ...variables,
790
- signal
791
- });
792
- /**
793
- * Remove cert
794
- */
795
- const removeCert = (variables, signal) => fetch$1({
796
- url: '/v7/certs/{id}',
797
- method: 'delete',
798
- ...variables,
799
- signal
800
- });
801
- /**
802
- * Issue a new cert
803
- */
804
- const issueCert = (variables, signal) => fetch$1({
805
- url: '/v7/certs',
806
- method: 'post',
807
- ...variables,
808
- signal
809
- });
810
- /**
811
- * Upload a cert
812
- */
813
- const uploadCert = (variables, signal) => fetch$1({
814
- url: '/v7/certs',
815
- method: 'put',
816
- ...variables,
817
- signal
818
- });
819
- /**
820
- * Allows to retrieve the file structure of a deployment by supplying the deployment unique identifier.
821
- */
822
- const listDeploymentFiles = (variables, signal) => fetch$1({ url: '/v6/deployments/{id}/files', method: 'get', ...variables, signal });
823
- /**
824
- * Allows to retrieve the content of a file by supplying the file identifier and the deployment unique identifier. The response body will contain a JSON response containing the contents of the file encoded as base64.
825
- */
826
- const getDeploymentFileContents = (variables, signal) => fetch$1({ url: '/v7/deployments/{id}/files/{fileId}', method: 'get', ...variables, signal });
827
- /**
828
- * List deployments under the authenticated user or team. If a deployment hasn't finished uploading (is incomplete), the `url` property will have a value of `null`.
829
- */
830
- const getDeployments = (variables, signal) => fetch$1({
831
- url: '/v6/deployments',
832
- method: 'get',
833
- ...variables,
834
- signal
835
- });
836
- /**
837
- * Verify the user accepted the login request and get a authentication token. The user email address and the token received after requesting the login must be added to the URL as a query string with the names `email` and `token`.
838
- */
839
- const verifyToken = (variables, signal) => fetch$1({
840
- url: '/registration/verify',
841
- method: 'get',
842
- ...variables,
843
- signal
844
- });
845
- /**
846
- * Request a new login for a user to get a token. This will respond with a verification token and send an email to confirm the request. Once confirmed you can use the verification token to get an authentication token.
847
- */
848
- const emailLogin = (variables, signal) => fetch$1({ url: '/registration', method: 'post', ...variables, signal });
849
- /**
850
- * This API allows you to delete a deployment, either by supplying its `id` in the URL or the `url` of the deployment as a query parameter. You can obtain the ID, for example, by listing all deployments.
851
- */
852
- const deleteDeployment = (variables, signal) => fetch$1({ url: '/v13/deployments/{id}', method: 'delete', ...variables, signal });
853
- /**
854
- * Retrieves the active Vercel secrets for the authenticated user or team. By default it returns 20 secrets. The rest can be retrieved using the pagination options. The body will contain an entry for each secret.
855
- */
856
- const getSecrets = (variables, signal) => fetch$1({
857
- url: '/v3/secrets',
858
- method: 'get',
859
- ...variables,
860
- signal
861
- });
862
- /**
863
- * Allows to create a new secret.
864
- */
865
- const createSecret = (variables, signal) => fetch$1({
866
- url: '/v2/secrets/{name}',
867
- method: 'post',
868
- ...variables,
869
- signal
870
- });
871
- /**
872
- * Enables to edit the name of a secret. The name has to be unique to the user or team’s secrets.
873
- */
874
- const renameSecret = (variables, signal) => fetch$1({ url: '/v2/secrets/{name}', method: 'patch', ...variables, signal });
875
- /**
876
- * Retrieves the information for a specific secret by passing either the secret id or name in the URL.
877
- */
878
- const getSecret = (variables, signal) => fetch$1({
879
- url: '/v3/secrets/{idOrName}',
880
- method: 'get',
881
- ...variables,
882
- signal
883
- });
884
- /**
885
- * This deletes the user or team’s secret defined in the URL.
886
- */
887
- const deleteSecret = (variables, signal) => fetch$1({
888
- url: '/v2/secrets/{idOrName}',
889
- method: 'delete',
890
- ...variables,
891
- signal
892
- });
893
- const operationsByTag = {
894
- artifacts: { recordEvents, status, uploadArtifact, downloadArtifact, artifactQuery },
895
- checks: { createCheck, getAllChecks, getCheck, updateCheck, rerequestCheck },
896
- projects: {
897
- updateProjectDataCache,
898
- getProjects,
899
- createProject,
900
- getProject,
901
- updateProject,
902
- deleteProject,
903
- getProjectDomains,
904
- getProjectDomain,
905
- updateProjectDomain,
906
- removeProjectDomain,
907
- addProjectDomain,
908
- verifyProjectDomain,
909
- filterProjectEnvs,
910
- getProjectEnv,
911
- createProjectEnv,
912
- removeProjectEnv,
913
- editProjectEnv,
914
- pauseProject,
915
- unpauseProject
916
- },
917
- deployments: {
918
- getDeploymentEvents,
919
- getDeployment,
920
- createDeployment,
921
- cancelDeployment,
922
- uploadFile,
923
- listDeploymentFiles,
924
- getDeploymentFileContents,
925
- getDeployments,
926
- deleteDeployment
927
- },
928
- domains: {
929
- buyDomain,
930
- checkDomainPrice,
931
- checkDomainStatus,
932
- getDomainTransfer,
933
- getDomainConfig,
934
- getDomain,
935
- getDomains,
936
- createOrTransferDomain,
937
- patchDomain,
938
- deleteDomain
939
- },
940
- dns: { getRecords, createRecord, updateRecord, removeRecord },
941
- edgeConfig: {
942
- getEdgeConfigs,
943
- createEdgeConfig,
944
- getEdgeConfig,
945
- updateEdgeConfig,
946
- deleteEdgeConfig,
947
- getEdgeConfigItems,
948
- patchEdgeConfigItems,
949
- getEdgeConfigSchema,
950
- patchEdgeConfigSchema,
951
- deleteEdgeConfigSchema,
952
- getEdgeConfigItem,
953
- getEdgeConfigTokens,
954
- deleteEdgeConfigTokens,
955
- getEdgeConfigToken,
956
- createEdgeConfigToken
957
- },
958
- user: { listUserEvents, getAuthUser, requestDelete },
959
- integrations: { getConfigurations, getConfiguration, deleteConfiguration, gitNamespaces, searchRepo },
960
- logDrains: {
961
- getIntegrationLogDrains,
962
- createLogDrain,
963
- deleteIntegrationLogDrain,
964
- getConfigurableLogDrain,
965
- deleteConfigurableLogDrain,
966
- getAllLogDrains,
967
- createConfigurableLogDrain
968
- },
969
- projectMembers: { getProjectMembers, addProjectMember, removeProjectMember },
970
- teams: {
971
- getTeamMembers,
972
- inviteUserToTeam,
973
- requestAccessToTeam,
974
- getTeamAccessRequest,
975
- joinTeam,
976
- updateTeamMember,
977
- removeTeamMember,
978
- getTeam,
979
- patchTeam,
980
- getTeams,
981
- createTeam,
982
- deleteTeam,
983
- deleteTeamInviteCode
984
- },
985
- authentication: { listAuthTokens, createAuthToken, getAuthToken, deleteAuthToken, verifyToken, emailLogin },
986
- webhooks: { createWebhook, getWebhooks, getWebhook, deleteWebhook },
987
- aliases: { listAliases, getAlias, deleteAlias, listDeploymentAliases, assignAlias },
988
- certs: { getCertById, removeCert, issueCert, uploadCert },
989
- secrets: { getSecrets, createSecret, renameSecret, getSecret, deleteSecret }
990
- };
991
-
992
- function formEncoded(data) {
993
- return Object.entries(data)
994
- .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
995
- .join('&');
996
- }
997
-
998
- var _VercelApi_token, _VercelApi_fetch;
999
- class VercelApi {
1000
- constructor(options) {
1001
- _VercelApi_token.set(this, void 0);
1002
- _VercelApi_fetch.set(this, void 0);
1003
- __classPrivateFieldSet(this, _VercelApi_token, options.token, "f");
1004
- __classPrivateFieldSet(this, _VercelApi_fetch, options.fetch || fetch, "f");
1005
- if (!__classPrivateFieldGet(this, _VercelApi_fetch, "f"))
1006
- throw new Error('Fetch is required');
1007
- }
1008
- get api() {
1009
- const token = __classPrivateFieldGet(this, _VercelApi_token, "f");
1010
- const fetchImpl = __classPrivateFieldGet(this, _VercelApi_fetch, "f");
1011
- return new Proxy({}, {
1012
- get: (_target, namespace) => {
1013
- if (operationsByTag[namespace] === undefined) {
1014
- return undefined;
1015
- }
1016
- return new Proxy({}, {
1017
- get: (_target, operation) => {
1018
- if (operationsByTag[namespace][operation] === undefined) {
1019
- return undefined;
1020
- }
1021
- const method = operationsByTag[namespace][operation];
1022
- return async (params) => {
1023
- return await method({ ...params, token, fetchImpl });
1024
- };
1025
- }
1026
- });
1027
- }
1028
- });
1029
- }
1030
- get auth() {
1031
- return {
1032
- accessToken: async ({ code, redirectUri, clientId, clientSecret }) => {
1033
- const result = await fetch$1({
1034
- method: 'POST',
1035
- url: `/v2/oauth/access_token`,
1036
- token: null,
1037
- fetchImpl: __classPrivateFieldGet(this, _VercelApi_fetch, "f"),
1038
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
1039
- body: formEncoded({ code, redirect_uri: redirectUri, client_id: clientId, client_secret: clientSecret })
1040
- });
1041
- return {
1042
- accessToken: result.access_token,
1043
- tokenType: result.token_type,
1044
- installationId: result.installation_id,
1045
- userId: result.user_id,
1046
- teamId: result.team_id
1047
- };
1048
- }
1049
- };
1050
- }
1051
- async request(endpoint, params) {
1052
- const [method = '', url = ''] = endpoint.split(' ');
1053
- const extraParams = (params || {});
1054
- const result = await fetch$1({ ...extraParams, method, url, token: __classPrivateFieldGet(this, _VercelApi_token, "f"), fetchImpl: __classPrivateFieldGet(this, _VercelApi_fetch, "f") });
1055
- return result;
1056
- }
1057
- }
1058
- _VercelApi_token = new WeakMap(), _VercelApi_fetch = new WeakMap();
1059
-
1060
- exports.VercelApi = VercelApi;