@vercel/oidc 3.0.5 → 3.2.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/docs/README.md CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  ## Table of contents
4
4
 
5
+ ### Classes
6
+
7
+ - [AccessTokenMissingError](classes/AccessTokenMissingError.md)
8
+ - [RefreshAccessTokenFailedError](classes/RefreshAccessTokenFailedError.md)
9
+
5
10
  ### Functions
6
11
 
7
12
  - [getContext](README.md#getcontext)
8
13
  - [getVercelOidcToken](README.md#getverceloidctoken)
9
14
  - [getVercelOidcTokenSync](README.md#getverceloidctokensync)
15
+ - [getVercelToken](README.md#getverceltoken)
10
16
 
11
17
  ## Functions
12
18
 
@@ -20,13 +26,13 @@
20
26
 
21
27
  #### Defined in
22
28
 
23
- [get-context.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-context.ts#L7)
29
+ [packages/oidc/src/get-context.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-context.ts#L7)
24
30
 
25
31
  ---
26
32
 
27
33
  ### getVercelOidcToken
28
34
 
29
- ▸ **getVercelOidcToken**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
35
+ ▸ **getVercelOidcToken**(`options?`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
30
36
 
31
37
  Gets the current OIDC token from the request context or the environment variable.
32
38
 
@@ -56,6 +62,25 @@ getVercelOidcToken()
56
62
  });
57
63
  ```
58
64
 
65
+ **`Example`**
66
+
67
+ ```js
68
+ // Using the OIDC token with explicit team and project (supports IDs and slugs)
69
+ getVercelOidcToken({ team: 'my-team', project: 'my-project' })
70
+ .then(token => {
71
+ console.log('OIDC Token:', token);
72
+ })
73
+ .catch(error => {
74
+ console.error('Error:', error.message);
75
+ });
76
+ ```
77
+
78
+ #### Parameters
79
+
80
+ | Name | Type | Description |
81
+ | :--------- | :-------------------------- | :------------------------------------------ |
82
+ | `options?` | `GetVercelOidcTokenOptions` | Optional configuration for token retrieval. |
83
+
59
84
  #### Returns
60
85
 
61
86
  [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
@@ -64,7 +89,7 @@ A promise that resolves to the OIDC token.
64
89
 
65
90
  #### Defined in
66
91
 
67
- [get-vercel-oidc-token.ts:30](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L30)
92
+ [packages/oidc/src/get-vercel-oidc-token.ts:64](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L64)
68
93
 
69
94
  ---
70
95
 
@@ -101,4 +126,24 @@ The OIDC token.
101
126
 
102
127
  #### Defined in
103
128
 
104
- [get-vercel-oidc-token.ts:81](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L81)
129
+ [packages/oidc/src/get-vercel-oidc-token.ts:124](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token.ts#L124)
130
+
131
+ ---
132
+
133
+ ### getVercelToken
134
+
135
+ ▸ **getVercelToken**(`options?`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
136
+
137
+ #### Parameters
138
+
139
+ | Name | Type |
140
+ | :--------- | :---------------------- |
141
+ | `options?` | `GetVercelTokenOptions` |
142
+
143
+ #### Returns
144
+
145
+ [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`string`\>
146
+
147
+ #### Defined in
148
+
149
+ [packages/oidc/src/token-util.ts:35](https://github.com/vercel/vercel/blob/main/packages/oidc/src/token-util.ts#L35)
@@ -0,0 +1,160 @@
1
+ # Class: AccessTokenMissingError
2
+
3
+ Error thrown when no authentication configuration is found.
4
+ This typically means the user needs to log in.
5
+
6
+ ## Hierarchy
7
+
8
+ - [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
9
+
10
+ ↳ **`AccessTokenMissingError`**
11
+
12
+ ## Table of contents
13
+
14
+ ### Constructors
15
+
16
+ - [constructor](AccessTokenMissingError.md#constructor)
17
+
18
+ ### Properties
19
+
20
+ - [message](AccessTokenMissingError.md#message)
21
+ - [name](AccessTokenMissingError.md#name)
22
+ - [stack](AccessTokenMissingError.md#stack)
23
+ - [prepareStackTrace](AccessTokenMissingError.md#preparestacktrace)
24
+ - [stackTraceLimit](AccessTokenMissingError.md#stacktracelimit)
25
+
26
+ ### Methods
27
+
28
+ - [captureStackTrace](AccessTokenMissingError.md#capturestacktrace)
29
+
30
+ ## Constructors
31
+
32
+ ### constructor
33
+
34
+ • **new AccessTokenMissingError**()
35
+
36
+ #### Overrides
37
+
38
+ Error.constructor
39
+
40
+ #### Defined in
41
+
42
+ [packages/oidc/src/auth-errors.ts:7](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L7)
43
+
44
+ ## Properties
45
+
46
+ ### message
47
+
48
+ • **message**: `string`
49
+
50
+ #### Inherited from
51
+
52
+ Error.message
53
+
54
+ #### Defined in
55
+
56
+ node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/lib.es5.d.ts:1054
57
+
58
+ ---
59
+
60
+ ### name
61
+
62
+ • **name**: `string` = `'AccessTokenMissingError'`
63
+
64
+ #### Overrides
65
+
66
+ Error.name
67
+
68
+ #### Defined in
69
+
70
+ [packages/oidc/src/auth-errors.ts:6](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L6)
71
+
72
+ ---
73
+
74
+ ### stack
75
+
76
+ • `Optional` **stack**: `string`
77
+
78
+ #### Inherited from
79
+
80
+ Error.stack
81
+
82
+ #### Defined in
83
+
84
+ node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/lib.es5.d.ts:1055
85
+
86
+ ---
87
+
88
+ ### prepareStackTrace
89
+
90
+ ▪ `Static` `Optional` **prepareStackTrace**: (`err`: [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), `stackTraces`: `CallSite`[]) => `any`
91
+
92
+ #### Type declaration
93
+
94
+ ▸ (`err`, `stackTraces`): `any`
95
+
96
+ Optional override for formatting stack traces
97
+
98
+ **`See`**
99
+
100
+ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
101
+
102
+ ##### Parameters
103
+
104
+ | Name | Type |
105
+ | :------------ | :------------------------------------------------------------------------------------------------ |
106
+ | `err` | [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) |
107
+ | `stackTraces` | `CallSite`[] |
108
+
109
+ ##### Returns
110
+
111
+ `any`
112
+
113
+ #### Inherited from
114
+
115
+ Error.prepareStackTrace
116
+
117
+ #### Defined in
118
+
119
+ node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:28
120
+
121
+ ---
122
+
123
+ ### stackTraceLimit
124
+
125
+ ▪ `Static` **stackTraceLimit**: `number`
126
+
127
+ #### Inherited from
128
+
129
+ Error.stackTraceLimit
130
+
131
+ #### Defined in
132
+
133
+ node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:30
134
+
135
+ ## Methods
136
+
137
+ ### captureStackTrace
138
+
139
+ ▸ `Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
140
+
141
+ Create .stack property on a target object
142
+
143
+ #### Parameters
144
+
145
+ | Name | Type |
146
+ | :---------------- | :------------------------------------------------------------------------------------------------------ |
147
+ | `targetObject` | `object` |
148
+ | `constructorOpt?` | [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
149
+
150
+ #### Returns
151
+
152
+ `void`
153
+
154
+ #### Inherited from
155
+
156
+ Error.captureStackTrace
157
+
158
+ #### Defined in
159
+
160
+ node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:21
@@ -0,0 +1,166 @@
1
+ # Class: RefreshAccessTokenFailedError
2
+
3
+ Error thrown when attempting to refresh the authentication token fails.
4
+ This includes cases where no refresh token is available.
5
+
6
+ ## Hierarchy
7
+
8
+ - [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
9
+
10
+ ↳ **`RefreshAccessTokenFailedError`**
11
+
12
+ ## Table of contents
13
+
14
+ ### Constructors
15
+
16
+ - [constructor](RefreshAccessTokenFailedError.md#constructor)
17
+
18
+ ### Properties
19
+
20
+ - [message](RefreshAccessTokenFailedError.md#message)
21
+ - [name](RefreshAccessTokenFailedError.md#name)
22
+ - [stack](RefreshAccessTokenFailedError.md#stack)
23
+ - [prepareStackTrace](RefreshAccessTokenFailedError.md#preparestacktrace)
24
+ - [stackTraceLimit](RefreshAccessTokenFailedError.md#stacktracelimit)
25
+
26
+ ### Methods
27
+
28
+ - [captureStackTrace](RefreshAccessTokenFailedError.md#capturestacktrace)
29
+
30
+ ## Constructors
31
+
32
+ ### constructor
33
+
34
+ • **new RefreshAccessTokenFailedError**(`cause?`)
35
+
36
+ #### Parameters
37
+
38
+ | Name | Type |
39
+ | :------- | :-------- |
40
+ | `cause?` | `unknown` |
41
+
42
+ #### Overrides
43
+
44
+ Error.constructor
45
+
46
+ #### Defined in
47
+
48
+ [packages/oidc/src/auth-errors.ts:20](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L20)
49
+
50
+ ## Properties
51
+
52
+ ### message
53
+
54
+ • **message**: `string`
55
+
56
+ #### Inherited from
57
+
58
+ Error.message
59
+
60
+ #### Defined in
61
+
62
+ node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/lib.es5.d.ts:1054
63
+
64
+ ---
65
+
66
+ ### name
67
+
68
+ • **name**: `string` = `'RefreshAccessTokenFailedError'`
69
+
70
+ #### Overrides
71
+
72
+ Error.name
73
+
74
+ #### Defined in
75
+
76
+ [packages/oidc/src/auth-errors.ts:19](https://github.com/vercel/vercel/blob/main/packages/oidc/src/auth-errors.ts#L19)
77
+
78
+ ---
79
+
80
+ ### stack
81
+
82
+ • `Optional` **stack**: `string`
83
+
84
+ #### Inherited from
85
+
86
+ Error.stack
87
+
88
+ #### Defined in
89
+
90
+ node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/lib.es5.d.ts:1055
91
+
92
+ ---
93
+
94
+ ### prepareStackTrace
95
+
96
+ ▪ `Static` `Optional` **prepareStackTrace**: (`err`: [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), `stackTraces`: `CallSite`[]) => `any`
97
+
98
+ #### Type declaration
99
+
100
+ ▸ (`err`, `stackTraces`): `any`
101
+
102
+ Optional override for formatting stack traces
103
+
104
+ **`See`**
105
+
106
+ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
107
+
108
+ ##### Parameters
109
+
110
+ | Name | Type |
111
+ | :------------ | :------------------------------------------------------------------------------------------------ |
112
+ | `err` | [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) |
113
+ | `stackTraces` | `CallSite`[] |
114
+
115
+ ##### Returns
116
+
117
+ `any`
118
+
119
+ #### Inherited from
120
+
121
+ Error.prepareStackTrace
122
+
123
+ #### Defined in
124
+
125
+ node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:28
126
+
127
+ ---
128
+
129
+ ### stackTraceLimit
130
+
131
+ ▪ `Static` **stackTraceLimit**: `number`
132
+
133
+ #### Inherited from
134
+
135
+ Error.stackTraceLimit
136
+
137
+ #### Defined in
138
+
139
+ node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:30
140
+
141
+ ## Methods
142
+
143
+ ### captureStackTrace
144
+
145
+ ▸ `Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
146
+
147
+ Create .stack property on a target object
148
+
149
+ #### Parameters
150
+
151
+ | Name | Type |
152
+ | :---------------- | :------------------------------------------------------------------------------------------------------ |
153
+ | `targetObject` | `object` |
154
+ | `constructorOpt?` | [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
155
+
156
+ #### Returns
157
+
158
+ `void`
159
+
160
+ #### Inherited from
161
+
162
+ Error.captureStackTrace
163
+
164
+ #### Defined in
165
+
166
+ node_modules/.pnpm/@types+node@20.11.0/node_modules/@types/node/globals.d.ts:21
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "require": "./dist/index.js"
18
18
  }
19
19
  },
20
- "version": "3.0.5",
20
+ "version": "3.2.0",
21
21
  "repository": {
22
22
  "directory": "packages/oidc",
23
23
  "type": "git",