@vercel/functions 3.5.0 → 3.6.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/CHANGELOG.md +14 -0
- package/cache/in-memory-cache.d.ts +1 -0
- package/cache/index.js +4 -1
- package/cache/types.d.ts +1 -1
- package/docs/README.md +7 -5
- package/docs/index/README.md +37 -0
- package/docs/index/functions/addCacheTag.md +19 -0
- package/docs/index/functions/attachDatabasePool.md +45 -0
- package/docs/index/functions/dangerouslyDeleteBySrcImage.md +23 -0
- package/docs/index/functions/dangerouslyDeleteByTag.md +23 -0
- package/docs/index/functions/geolocation.md +49 -0
- package/docs/index/functions/getCache.md +36 -0
- package/docs/index/functions/getEnv.md +291 -0
- package/docs/index/functions/invalidateBySrcImage.md +19 -0
- package/docs/index/functions/invalidateByTag.md +19 -0
- package/docs/index/functions/ipAddress.md +36 -0
- package/docs/index/functions/next.md +47 -0
- package/docs/index/functions/rewrite.md +66 -0
- package/docs/index/functions/waitUntil.md +38 -0
- package/docs/index/interfaces/DangerouslyDeleteOptions.md +18 -0
- package/docs/index/interfaces/Geo.md +90 -0
- package/docs/index/interfaces/PurgeApi.md +123 -0
- package/docs/index/interfaces/Request.md +19 -0
- package/docs/index/interfaces/RuntimeCache.md +133 -0
- package/docs/index/type-aliases/AddCacheTagApi.md +26 -0
- package/docs/index/variables/experimental_attachDatabasePool.md +49 -0
- package/docs/oidc/README.md +15 -0
- package/docs/oidc/functions/awsCredentialsProvider.md +24 -0
- package/docs/oidc/functions/getVercelOidcToken.md +58 -0
- package/docs/oidc/functions/getVercelOidcTokenSync.md +36 -0
- package/docs/oidc/interfaces/AwsCredentialsProviderInit.md +195 -0
- package/package.json +5 -5
- package/docs/interfaces/index.DangerouslyDeleteOptions.md +0 -22
- package/docs/interfaces/index.Geo.md +0 -115
- package/docs/interfaces/index.PurgeApi.md +0 -134
- package/docs/interfaces/index.Request.md +0 -23
- package/docs/interfaces/index.RuntimeCache.md +0 -131
- package/docs/interfaces/oidc.AwsCredentialsProviderInit.md +0 -221
- package/docs/modules/index.md +0 -536
- package/docs/modules/oidc.md +0 -133
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[**@vercel/functions**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# ~~Function: getVercelOidcToken()~~
|
|
6
|
+
|
|
7
|
+
> **getVercelOidcToken**(`options?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
|
|
8
|
+
|
|
9
|
+
Defined in: packages/oidc/dist/get-vercel-oidc-token.d.ts:60
|
|
10
|
+
|
|
11
|
+
Gets the current OIDC token from the request context or the environment variable.
|
|
12
|
+
|
|
13
|
+
Do not cache this value, as it is subject to change in production!
|
|
14
|
+
|
|
15
|
+
This function is used to retrieve the OIDC token from the request context or the environment variable.
|
|
16
|
+
It checks for the `x-vercel-oidc-token` header in the request context and falls back to the `VERCEL_OIDC_TOKEN` environment variable if the header is not present.
|
|
17
|
+
|
|
18
|
+
Unlike the `getVercelOidcTokenSync` function, this function will refresh the token if it is expired in a development environment.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
### options?
|
|
23
|
+
|
|
24
|
+
`GetVercelOidcTokenOptions`
|
|
25
|
+
|
|
26
|
+
Optional configuration for token retrieval.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
|
|
31
|
+
|
|
32
|
+
A promise that resolves to the OIDC token.
|
|
33
|
+
|
|
34
|
+
## Throws
|
|
35
|
+
|
|
36
|
+
If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set. If the token
|
|
37
|
+
is expired in a development environment, will also throw an error if the token cannot be refreshed: no CLI credentials are available, CLI credentials are expired, no project configuration is available
|
|
38
|
+
or the token refresh request fails.
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
// Using the OIDC token
|
|
44
|
+
getVercelOidcToken().then((token) => {
|
|
45
|
+
console.log('OIDC Token:', token);
|
|
46
|
+
}).catch((error) => {
|
|
47
|
+
console.error('Error:', error.message);
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
// Using the OIDC token with explicit team and project (supports IDs and slugs)
|
|
53
|
+
getVercelOidcToken({ team: 'my-team', project: 'my-project' }).then((token) => {
|
|
54
|
+
console.log('OIDC Token:', token);
|
|
55
|
+
}).catch((error) => {
|
|
56
|
+
console.error('Error:', error.message);
|
|
57
|
+
});
|
|
58
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[**@vercel/functions**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# ~~Function: getVercelOidcTokenSync()~~
|
|
6
|
+
|
|
7
|
+
> **getVercelOidcTokenSync**(): `string`
|
|
8
|
+
|
|
9
|
+
Defined in: packages/oidc/dist/get-vercel-oidc-token.d.ts:82
|
|
10
|
+
|
|
11
|
+
Gets the current OIDC token from the request context or the environment variable.
|
|
12
|
+
|
|
13
|
+
Do not cache this value, as it is subject to change in production!
|
|
14
|
+
|
|
15
|
+
This function is used to retrieve the OIDC token from the request context or the environment variable.
|
|
16
|
+
It checks for the `x-vercel-oidc-token` header in the request context and falls back to the `VERCEL_OIDC_TOKEN` environment variable if the header is not present.
|
|
17
|
+
|
|
18
|
+
This function will not refresh the token if it is expired. For refreshing the token, use the @{link getVercelOidcToken} function.
|
|
19
|
+
|
|
20
|
+
## Returns
|
|
21
|
+
|
|
22
|
+
`string`
|
|
23
|
+
|
|
24
|
+
The OIDC token.
|
|
25
|
+
|
|
26
|
+
## Throws
|
|
27
|
+
|
|
28
|
+
If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set.
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// Using the OIDC token
|
|
34
|
+
const token = getVercelOidcTokenSync();
|
|
35
|
+
console.log('OIDC Token:', token);
|
|
36
|
+
```
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
[**@vercel/functions**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# Interface: AwsCredentialsProviderInit
|
|
6
|
+
|
|
7
|
+
Defined in: [packages/functions/src/oidc/aws-credentials-provider.ts:20](https://github.com/vercel/vercel/blob/main/packages/functions/src/oidc/aws-credentials-provider.ts#L20)
|
|
8
|
+
|
|
9
|
+
The init object for the `awsCredentialsProvider` function.
|
|
10
|
+
|
|
11
|
+
## Extends
|
|
12
|
+
|
|
13
|
+
- [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)\<`FromWebTokenInit`, `"webIdentityToken"`\>
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### clientConfig?
|
|
18
|
+
|
|
19
|
+
> `optional` **clientConfig?**: `any`
|
|
20
|
+
|
|
21
|
+
Defined in: node\_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0\_@aws-sdk+client-sts@3.806.0/node\_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:135
|
|
22
|
+
|
|
23
|
+
Custom STS client configurations overriding the default ones.
|
|
24
|
+
|
|
25
|
+
#### Inherited from
|
|
26
|
+
|
|
27
|
+
`Omit.clientConfig`
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### clientPlugins?
|
|
32
|
+
|
|
33
|
+
> `optional` **clientPlugins?**: `Pluggable`\<`any`, `any`\>[]
|
|
34
|
+
|
|
35
|
+
Defined in: node\_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0\_@aws-sdk+client-sts@3.806.0/node\_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:139
|
|
36
|
+
|
|
37
|
+
Custom STS client middleware plugin to modify the client default behavior.
|
|
38
|
+
|
|
39
|
+
#### Inherited from
|
|
40
|
+
|
|
41
|
+
`Omit.clientPlugins`
|
|
42
|
+
|
|
43
|
+
***
|
|
44
|
+
|
|
45
|
+
### durationSeconds?
|
|
46
|
+
|
|
47
|
+
> `optional` **durationSeconds?**: `number`
|
|
48
|
+
|
|
49
|
+
The duration, in seconds, of the role session. Defaults to 3600 seconds.
|
|
50
|
+
|
|
51
|
+
#### Inherited from
|
|
52
|
+
|
|
53
|
+
`Omit.durationSeconds`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### logger?
|
|
58
|
+
|
|
59
|
+
> `optional` **logger?**: `Logger`
|
|
60
|
+
|
|
61
|
+
Defined in: node\_modules/.pnpm/@aws-sdk+types@3.609.0/node\_modules/@aws-sdk/types/dist-types/credentials.d.ts:31
|
|
62
|
+
|
|
63
|
+
This logger is only used to provide information
|
|
64
|
+
on what credential providers were used during resolution.
|
|
65
|
+
|
|
66
|
+
It does not log credentials.
|
|
67
|
+
|
|
68
|
+
#### Inherited from
|
|
69
|
+
|
|
70
|
+
`Omit.logger`
|
|
71
|
+
|
|
72
|
+
***
|
|
73
|
+
|
|
74
|
+
### ~~parentClientConfig?~~
|
|
75
|
+
|
|
76
|
+
> `optional` **parentClientConfig?**: `object`
|
|
77
|
+
|
|
78
|
+
Defined in: node\_modules/.pnpm/@aws-sdk+types@3.609.0/node\_modules/@aws-sdk/types/dist-types/credentials.d.ts:45
|
|
79
|
+
|
|
80
|
+
**`Internal`**
|
|
81
|
+
|
|
82
|
+
Present if the credential provider was created by calling
|
|
83
|
+
the defaultCredentialProvider in a client's middleware, having
|
|
84
|
+
access to the client's config.
|
|
85
|
+
|
|
86
|
+
The region of that parent or outer client is important because
|
|
87
|
+
an inner client used by the credential provider may need
|
|
88
|
+
to match its default partition or region with that of
|
|
89
|
+
the outer client.
|
|
90
|
+
|
|
91
|
+
#### Index Signature
|
|
92
|
+
|
|
93
|
+
\[`key`: `string`\]: `unknown`
|
|
94
|
+
|
|
95
|
+
#### ~~region?~~
|
|
96
|
+
|
|
97
|
+
> `optional` **region?**: `string` \| `Provider`\<`string`\>
|
|
98
|
+
|
|
99
|
+
#### Deprecated
|
|
100
|
+
|
|
101
|
+
- not truly deprecated, marked as a warning to not use this.
|
|
102
|
+
|
|
103
|
+
#### Inherited from
|
|
104
|
+
|
|
105
|
+
`Omit.parentClientConfig`
|
|
106
|
+
|
|
107
|
+
***
|
|
108
|
+
|
|
109
|
+
### policy?
|
|
110
|
+
|
|
111
|
+
> `optional` **policy?**: `string`
|
|
112
|
+
|
|
113
|
+
An IAM policy in JSON format that you want to use as an inline session policy.
|
|
114
|
+
|
|
115
|
+
#### Inherited from
|
|
116
|
+
|
|
117
|
+
`Omit.policy`
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### policyArns?
|
|
122
|
+
|
|
123
|
+
> `optional` **policyArns?**: `object`[]
|
|
124
|
+
|
|
125
|
+
ARNs of the IAM managed policies that you want to use as managed session policies.
|
|
126
|
+
|
|
127
|
+
#### arn?
|
|
128
|
+
|
|
129
|
+
> `optional` **arn?**: `string`
|
|
130
|
+
|
|
131
|
+
#### Inherited from
|
|
132
|
+
|
|
133
|
+
`Omit.policyArns`
|
|
134
|
+
|
|
135
|
+
***
|
|
136
|
+
|
|
137
|
+
### providerId?
|
|
138
|
+
|
|
139
|
+
> `optional` **providerId?**: `string`
|
|
140
|
+
|
|
141
|
+
The fully qualified host component of the domain name of the identity provider.
|
|
142
|
+
|
|
143
|
+
#### Inherited from
|
|
144
|
+
|
|
145
|
+
`Omit.providerId`
|
|
146
|
+
|
|
147
|
+
***
|
|
148
|
+
|
|
149
|
+
### roleArn
|
|
150
|
+
|
|
151
|
+
> **roleArn**: `string`
|
|
152
|
+
|
|
153
|
+
ARN of the role that the caller is assuming.
|
|
154
|
+
|
|
155
|
+
#### Inherited from
|
|
156
|
+
|
|
157
|
+
`Omit.roleArn`
|
|
158
|
+
|
|
159
|
+
***
|
|
160
|
+
|
|
161
|
+
### roleAssumerWithWebIdentity?
|
|
162
|
+
|
|
163
|
+
> `optional` **roleAssumerWithWebIdentity?**: (`params`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`AwsCredentialIdentity`\>
|
|
164
|
+
|
|
165
|
+
Defined in: node\_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0\_@aws-sdk+client-sts@3.806.0/node\_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:130
|
|
166
|
+
|
|
167
|
+
A function that assumes a role with web identity and returns a promise fulfilled with credentials for the assumed role.
|
|
168
|
+
|
|
169
|
+
#### Parameters
|
|
170
|
+
|
|
171
|
+
##### params
|
|
172
|
+
|
|
173
|
+
`AssumeRoleWithWebIdentityParams`
|
|
174
|
+
|
|
175
|
+
#### Returns
|
|
176
|
+
|
|
177
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`AwsCredentialIdentity`\>
|
|
178
|
+
|
|
179
|
+
#### Inherited from
|
|
180
|
+
|
|
181
|
+
`Omit.roleAssumerWithWebIdentity`
|
|
182
|
+
|
|
183
|
+
***
|
|
184
|
+
|
|
185
|
+
### roleSessionName?
|
|
186
|
+
|
|
187
|
+
> `optional` **roleSessionName?**: `string`
|
|
188
|
+
|
|
189
|
+
Defined in: node\_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0\_@aws-sdk+client-sts@3.806.0/node\_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:123
|
|
190
|
+
|
|
191
|
+
An identifier for the assumed role session.
|
|
192
|
+
|
|
193
|
+
#### Inherited from
|
|
194
|
+
|
|
195
|
+
`Omit.roleSessionName`
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"require": "./middleware.js"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"version": "3.
|
|
33
|
+
"version": "3.6.0",
|
|
34
34
|
"repository": {
|
|
35
35
|
"directory": "packages/functions",
|
|
36
36
|
"type": "git",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"mysql2": "3.14.2",
|
|
52
52
|
"prettier": "3.8.3",
|
|
53
53
|
"tinyspawn": "1.3.1",
|
|
54
|
-
"typedoc": "0.
|
|
55
|
-
"typedoc-plugin-markdown": "
|
|
56
|
-
"typedoc-plugin-mdn-links": "
|
|
54
|
+
"typedoc": "0.28.19",
|
|
55
|
+
"typedoc-plugin-markdown": "4.11.0",
|
|
56
|
+
"typedoc-plugin-mdn-links": "5.1.1",
|
|
57
57
|
"vitest": "2.0.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@vercel/oidc": "3.4.
|
|
75
|
+
"@vercel/oidc": "3.4.1"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"pretest": "pnpm run build:code",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Interface: DangerouslyDeleteOptions
|
|
2
|
-
|
|
3
|
-
[index](../modules/index.md).DangerouslyDeleteOptions
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Properties
|
|
8
|
-
|
|
9
|
-
- [revalidationDeadlineSeconds](index.DangerouslyDeleteOptions.md#revalidationdeadlineseconds)
|
|
10
|
-
|
|
11
|
-
## Properties
|
|
12
|
-
|
|
13
|
-
### revalidationDeadlineSeconds
|
|
14
|
-
|
|
15
|
-
• `Optional` **revalidationDeadlineSeconds**: `number`
|
|
16
|
-
|
|
17
|
-
The time in seconds for how long the stale content can be served while revalidating the new content in the background.
|
|
18
|
-
If none is provided, the default is 0 and the content will be deleted immediately.
|
|
19
|
-
|
|
20
|
-
#### Defined in
|
|
21
|
-
|
|
22
|
-
[packages/functions/src/purge/types.ts:6](https://github.com/vercel/vercel/blob/main/packages/functions/src/purge/types.ts#L6)
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# Interface: Geo
|
|
2
|
-
|
|
3
|
-
[index](../modules/index.md).Geo
|
|
4
|
-
|
|
5
|
-
The location information of a given request.
|
|
6
|
-
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
### Properties
|
|
10
|
-
|
|
11
|
-
- [city](index.Geo.md#city)
|
|
12
|
-
- [country](index.Geo.md#country)
|
|
13
|
-
- [countryRegion](index.Geo.md#countryregion)
|
|
14
|
-
- [flag](index.Geo.md#flag)
|
|
15
|
-
- [latitude](index.Geo.md#latitude)
|
|
16
|
-
- [longitude](index.Geo.md#longitude)
|
|
17
|
-
- [postalCode](index.Geo.md#postalcode)
|
|
18
|
-
- [region](index.Geo.md#region)
|
|
19
|
-
|
|
20
|
-
## Properties
|
|
21
|
-
|
|
22
|
-
### city
|
|
23
|
-
|
|
24
|
-
• `Optional` **city**: `string`
|
|
25
|
-
|
|
26
|
-
The city that the request originated from.
|
|
27
|
-
|
|
28
|
-
#### Defined in
|
|
29
|
-
|
|
30
|
-
[packages/functions/src/headers.ts:59](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L59)
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
### country
|
|
35
|
-
|
|
36
|
-
• `Optional` **country**: `string`
|
|
37
|
-
|
|
38
|
-
The country that the request originated from.
|
|
39
|
-
|
|
40
|
-
#### Defined in
|
|
41
|
-
|
|
42
|
-
[packages/functions/src/headers.ts:62](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L62)
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
### countryRegion
|
|
47
|
-
|
|
48
|
-
• `Optional` **countryRegion**: `string`
|
|
49
|
-
|
|
50
|
-
The region part of the ISO 3166-2 code of the client IP.
|
|
51
|
-
See [docs](https://vercel.com/docs/concepts/edge-network/headers#x-vercel-ip-country-region).
|
|
52
|
-
|
|
53
|
-
#### Defined in
|
|
54
|
-
|
|
55
|
-
[packages/functions/src/headers.ts:73](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L73)
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
### flag
|
|
60
|
-
|
|
61
|
-
• `Optional` **flag**: `string`
|
|
62
|
-
|
|
63
|
-
The flag emoji for the country the request originated from.
|
|
64
|
-
|
|
65
|
-
#### Defined in
|
|
66
|
-
|
|
67
|
-
[packages/functions/src/headers.ts:65](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L65)
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
### latitude
|
|
72
|
-
|
|
73
|
-
• `Optional` **latitude**: `string`
|
|
74
|
-
|
|
75
|
-
The latitude of the client.
|
|
76
|
-
|
|
77
|
-
#### Defined in
|
|
78
|
-
|
|
79
|
-
[packages/functions/src/headers.ts:76](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L76)
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
### longitude
|
|
84
|
-
|
|
85
|
-
• `Optional` **longitude**: `string`
|
|
86
|
-
|
|
87
|
-
The longitude of the client.
|
|
88
|
-
|
|
89
|
-
#### Defined in
|
|
90
|
-
|
|
91
|
-
[packages/functions/src/headers.ts:79](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L79)
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
### postalCode
|
|
96
|
-
|
|
97
|
-
• `Optional` **postalCode**: `string`
|
|
98
|
-
|
|
99
|
-
The postal code of the client
|
|
100
|
-
|
|
101
|
-
#### Defined in
|
|
102
|
-
|
|
103
|
-
[packages/functions/src/headers.ts:82](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L82)
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
### region
|
|
108
|
-
|
|
109
|
-
• `Optional` **region**: `string`
|
|
110
|
-
|
|
111
|
-
The [Vercel Edge Network region](https://vercel.com/docs/concepts/edge-network/regions) that received the request.
|
|
112
|
-
|
|
113
|
-
#### Defined in
|
|
114
|
-
|
|
115
|
-
[packages/functions/src/headers.ts:68](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L68)
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Interface: PurgeApi
|
|
2
|
-
|
|
3
|
-
[index](../modules/index.md).PurgeApi
|
|
4
|
-
|
|
5
|
-
Vercel Cache Purge APIs.
|
|
6
|
-
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
### Properties
|
|
10
|
-
|
|
11
|
-
- [dangerouslyDeleteBySrcImage](index.PurgeApi.md#dangerouslydeletebysrcimage)
|
|
12
|
-
- [dangerouslyDeleteByTag](index.PurgeApi.md#dangerouslydeletebytag)
|
|
13
|
-
- [invalidateBySrcImage](index.PurgeApi.md#invalidatebysrcimage)
|
|
14
|
-
- [invalidateByTag](index.PurgeApi.md#invalidatebytag)
|
|
15
|
-
|
|
16
|
-
## Properties
|
|
17
|
-
|
|
18
|
-
### dangerouslyDeleteBySrcImage
|
|
19
|
-
|
|
20
|
-
• **dangerouslyDeleteBySrcImage**: (`src`: `string` \| `string`[], `options?`: [`DangerouslyDeleteOptions`](index.DangerouslyDeleteOptions.md)) => [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
21
|
-
|
|
22
|
-
#### Type declaration
|
|
23
|
-
|
|
24
|
-
▸ (`src`, `options?`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
25
|
-
|
|
26
|
-
Given a source image, delete all of its transformed images after a specified revalidation deadline.
|
|
27
|
-
If accessed prior to the revalidation deadline, the stale transformed image will be served and a background task will be triggered. After the revalidation deadline is reached, the transformed image will be deleted.
|
|
28
|
-
The default revalidation deadline is 0 and the content will be deleted immediately.
|
|
29
|
-
|
|
30
|
-
##### Parameters
|
|
31
|
-
|
|
32
|
-
| Name | Type | Description |
|
|
33
|
-
| :--------- | :-------------------------------------------------------------- | :----------------------------------------------------------------- |
|
|
34
|
-
| `src` | `string` \| `string`[] | The source image to delete. |
|
|
35
|
-
| `options?` | [`DangerouslyDeleteOptions`](index.DangerouslyDeleteOptions.md) | The options for the delete that specify the revalidation deadline. |
|
|
36
|
-
|
|
37
|
-
##### Returns
|
|
38
|
-
|
|
39
|
-
[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
40
|
-
|
|
41
|
-
A promise that resolves when the delete is complete.
|
|
42
|
-
|
|
43
|
-
#### Defined in
|
|
44
|
-
|
|
45
|
-
[packages/functions/src/purge/types.ts:54](https://github.com/vercel/vercel/blob/main/packages/functions/src/purge/types.ts#L54)
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
### dangerouslyDeleteByTag
|
|
50
|
-
|
|
51
|
-
• **dangerouslyDeleteByTag**: (`tag`: `string` \| `string`[], `options?`: [`DangerouslyDeleteOptions`](index.DangerouslyDeleteOptions.md)) => [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
52
|
-
|
|
53
|
-
#### Type declaration
|
|
54
|
-
|
|
55
|
-
▸ (`tag`, `options?`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
56
|
-
|
|
57
|
-
Delete all content associated with a tag or tags after a specified revalidation deadline.
|
|
58
|
-
If accessed prior to the revalidation deadline, the stale content will be served and a background revalidation will be triggered. After the revalidation deadline is reached, the content will be deleted.
|
|
59
|
-
The default revalidation deadline is 0 and the content will be deleted immediately.
|
|
60
|
-
|
|
61
|
-
##### Parameters
|
|
62
|
-
|
|
63
|
-
| Name | Type | Description |
|
|
64
|
-
| :--------- | :-------------------------------------------------------------- | :----------------------------------------------------------------- |
|
|
65
|
-
| `tag` | `string` \| `string`[] | The tag or tags to delete. |
|
|
66
|
-
| `options?` | [`DangerouslyDeleteOptions`](index.DangerouslyDeleteOptions.md) | The options for the delete that specify the revalidation deadline. |
|
|
67
|
-
|
|
68
|
-
##### Returns
|
|
69
|
-
|
|
70
|
-
[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
71
|
-
|
|
72
|
-
A promise that resolves when the delete is complete.
|
|
73
|
-
|
|
74
|
-
#### Defined in
|
|
75
|
-
|
|
76
|
-
[packages/functions/src/purge/types.ts:31](https://github.com/vercel/vercel/blob/main/packages/functions/src/purge/types.ts#L31)
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
### invalidateBySrcImage
|
|
81
|
-
|
|
82
|
-
• **invalidateBySrcImage**: (`src`: `string` \| `string`[]) => [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
83
|
-
|
|
84
|
-
#### Type declaration
|
|
85
|
-
|
|
86
|
-
▸ (`src`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
87
|
-
|
|
88
|
-
Given a source image, invalidate all of its transformed images by marking them as stale.
|
|
89
|
-
On the next access, the stale transformed image will be served and a background task will transform the source image.
|
|
90
|
-
|
|
91
|
-
##### Parameters
|
|
92
|
-
|
|
93
|
-
| Name | Type | Description |
|
|
94
|
-
| :---- | :--------------------- | :------------------------------ |
|
|
95
|
-
| `src` | `string` \| `string`[] | The source image to invalidate. |
|
|
96
|
-
|
|
97
|
-
##### Returns
|
|
98
|
-
|
|
99
|
-
[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
100
|
-
|
|
101
|
-
A promise that resolves when the invalidate is complete.
|
|
102
|
-
|
|
103
|
-
#### Defined in
|
|
104
|
-
|
|
105
|
-
[packages/functions/src/purge/types.ts:43](https://github.com/vercel/vercel/blob/main/packages/functions/src/purge/types.ts#L43)
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
### invalidateByTag
|
|
110
|
-
|
|
111
|
-
• **invalidateByTag**: (`tag`: `string` \| `string`[]) => [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
112
|
-
|
|
113
|
-
#### Type declaration
|
|
114
|
-
|
|
115
|
-
▸ (`tag`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
116
|
-
|
|
117
|
-
Invalidate all content associated with a tag or tags by marking them as stale.
|
|
118
|
-
On the next access to content associated with any of the tags, the stale content will be served and a background revalidation will be triggered.
|
|
119
|
-
|
|
120
|
-
##### Parameters
|
|
121
|
-
|
|
122
|
-
| Name | Type | Description |
|
|
123
|
-
| :---- | :--------------------- | :----------------------------- |
|
|
124
|
-
| `tag` | `string` \| `string`[] | The tag or tags to invalidate. |
|
|
125
|
-
|
|
126
|
-
##### Returns
|
|
127
|
-
|
|
128
|
-
[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
129
|
-
|
|
130
|
-
A promise that resolves when the invalidate is complete.
|
|
131
|
-
|
|
132
|
-
#### Defined in
|
|
133
|
-
|
|
134
|
-
[packages/functions/src/purge/types.ts:20](https://github.com/vercel/vercel/blob/main/packages/functions/src/purge/types.ts#L20)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Interface: Request
|
|
2
|
-
|
|
3
|
-
[index](../modules/index.md).Request
|
|
4
|
-
|
|
5
|
-
We define a new type so this function can be reused with the global `Request`, `node-fetch` and other types.
|
|
6
|
-
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
### Properties
|
|
10
|
-
|
|
11
|
-
- [headers](index.Request.md#headers)
|
|
12
|
-
|
|
13
|
-
## Properties
|
|
14
|
-
|
|
15
|
-
### headers
|
|
16
|
-
|
|
17
|
-
• **headers**: `Headers`
|
|
18
|
-
|
|
19
|
-
Represents the headers of a request.
|
|
20
|
-
|
|
21
|
-
#### Defined in
|
|
22
|
-
|
|
23
|
-
[packages/functions/src/headers.ts:52](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L52)
|