@vercel/oidc 3.4.1 → 3.5.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 +6 -0
- package/dist/get-vercel-oidc-token-sync.d.ts +22 -0
- package/dist/get-vercel-oidc-token-sync.js +37 -0
- package/dist/{get-vercel-oidc-token.d.ts → get-vercel-oidc-token-with-refresh.d.ts} +0 -22
- package/dist/{get-vercel-oidc-token.js → get-vercel-oidc-token-with-refresh.js} +8 -19
- package/dist/{get-vercel-oidc-token.test.js → get-vercel-oidc-token-with-refresh.test.js} +17 -17
- package/dist/index-edge-light.d.ts +11 -0
- package/dist/index-edge-light.js +47 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -3
- package/docs/functions/getVercelOidcToken.md +1 -1
- package/docs/functions/getVercelOidcTokenSync.md +1 -1
- package/package.json +2 -1
- /package/dist/{get-vercel-oidc-token.test.d.ts → get-vercel-oidc-token-with-refresh.test.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the current OIDC token from the request context or the environment variable.
|
|
3
|
+
*
|
|
4
|
+
* Do not cache this value, as it is subject to change in production!
|
|
5
|
+
*
|
|
6
|
+
* This function is used to retrieve the OIDC token from the request context or the environment variable.
|
|
7
|
+
* 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.
|
|
8
|
+
*
|
|
9
|
+
* This function will not refresh the token if it is expired. For refreshing the token, use the @{link getVercelOidcToken} function.
|
|
10
|
+
*
|
|
11
|
+
* @returns {string} The OIDC token.
|
|
12
|
+
* @throws {Error} If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* ```js
|
|
17
|
+
* // Using the OIDC token
|
|
18
|
+
* const token = getVercelOidcTokenSync();
|
|
19
|
+
* console.log('OIDC Token:', token);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function getVercelOidcTokenSync(): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_vercel_oidc_token_sync_exports = {};
|
|
20
|
+
__export(get_vercel_oidc_token_sync_exports, {
|
|
21
|
+
getVercelOidcTokenSync: () => getVercelOidcTokenSync
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(get_vercel_oidc_token_sync_exports);
|
|
24
|
+
var import_get_context = require("./get-context");
|
|
25
|
+
function getVercelOidcTokenSync() {
|
|
26
|
+
const token = (0, import_get_context.getContext)().headers?.["x-vercel-oidc-token"] ?? process.env.VERCEL_OIDC_TOKEN;
|
|
27
|
+
if (!token) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`The 'x-vercel-oidc-token' header is missing from the request.`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return token;
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
getVercelOidcTokenSync
|
|
37
|
+
});
|
|
@@ -58,25 +58,3 @@ export interface GetVercelOidcTokenOptions {
|
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
export declare function getVercelOidcToken(options?: GetVercelOidcTokenOptions): Promise<string>;
|
|
61
|
-
/**
|
|
62
|
-
* Gets the current OIDC token from the request context or the environment variable.
|
|
63
|
-
*
|
|
64
|
-
* Do not cache this value, as it is subject to change in production!
|
|
65
|
-
*
|
|
66
|
-
* This function is used to retrieve the OIDC token from the request context or the environment variable.
|
|
67
|
-
* 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.
|
|
68
|
-
*
|
|
69
|
-
* This function will not refresh the token if it is expired. For refreshing the token, use the @{link getVercelOidcToken} function.
|
|
70
|
-
*
|
|
71
|
-
* @returns {string} The OIDC token.
|
|
72
|
-
* @throws {Error} If the `x-vercel-oidc-token` header is missing from the request context and the environment variable `VERCEL_OIDC_TOKEN` is not set.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
*
|
|
76
|
-
* ```js
|
|
77
|
-
* // Using the OIDC token
|
|
78
|
-
* const token = getVercelOidcTokenSync();
|
|
79
|
-
* console.log('OIDC Token:', token);
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export declare function getVercelOidcTokenSync(): string;
|
|
@@ -26,19 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
getVercelOidcToken: () => getVercelOidcToken
|
|
32
|
-
getVercelOidcTokenSync: () => getVercelOidcTokenSync
|
|
29
|
+
var get_vercel_oidc_token_with_refresh_exports = {};
|
|
30
|
+
__export(get_vercel_oidc_token_with_refresh_exports, {
|
|
31
|
+
getVercelOidcToken: () => getVercelOidcToken
|
|
33
32
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(get_vercel_oidc_token_with_refresh_exports);
|
|
34
|
+
var import_get_vercel_oidc_token_sync = require("./get-vercel-oidc-token-sync");
|
|
36
35
|
var import_token_error = require("./token-error");
|
|
37
36
|
async function getVercelOidcToken(options) {
|
|
38
37
|
let token = "";
|
|
39
38
|
let err;
|
|
40
39
|
try {
|
|
41
|
-
token = getVercelOidcTokenSync();
|
|
40
|
+
token = (0, import_get_vercel_oidc_token_sync.getVercelOidcTokenSync)();
|
|
42
41
|
} catch (error) {
|
|
43
42
|
err = error;
|
|
44
43
|
}
|
|
@@ -49,7 +48,7 @@ async function getVercelOidcToken(options) {
|
|
|
49
48
|
]);
|
|
50
49
|
if (!token || isExpired(getTokenPayload(token), options?.expirationBufferMs)) {
|
|
51
50
|
await refreshToken(options);
|
|
52
|
-
token = getVercelOidcTokenSync();
|
|
51
|
+
token = (0, import_get_vercel_oidc_token_sync.getVercelOidcTokenSync)();
|
|
53
52
|
}
|
|
54
53
|
} catch (error) {
|
|
55
54
|
let message = err instanceof Error ? err.message : "";
|
|
@@ -64,17 +63,7 @@ ${error.message}`;
|
|
|
64
63
|
}
|
|
65
64
|
return token;
|
|
66
65
|
}
|
|
67
|
-
function getVercelOidcTokenSync() {
|
|
68
|
-
const token = (0, import_get_context.getContext)().headers?.["x-vercel-oidc-token"] ?? process.env.VERCEL_OIDC_TOKEN;
|
|
69
|
-
if (!token) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
`The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?`
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
return token;
|
|
75
|
-
}
|
|
76
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
77
67
|
0 && (module.exports = {
|
|
78
|
-
getVercelOidcToken
|
|
79
|
-
getVercelOidcTokenSync
|
|
68
|
+
getVercelOidcToken
|
|
80
69
|
});
|
|
@@ -27,7 +27,7 @@ var os = __toESM(require("os"));
|
|
|
27
27
|
var path = __toESM(require("path"));
|
|
28
28
|
var fs = __toESM(require("fs"));
|
|
29
29
|
var import_token_io = require("./token-io");
|
|
30
|
-
var
|
|
30
|
+
var import_get_vercel_oidc_token_with_refresh = require("./get-vercel-oidc-token-with-refresh");
|
|
31
31
|
var tokenUtil = __toESM(require("./token-util"));
|
|
32
32
|
import_vitest.vi.mock("./token-io");
|
|
33
33
|
import_vitest.vi.mock("./get-context", () => ({
|
|
@@ -69,7 +69,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
69
69
|
JSON.stringify({ projectId, orgId: teamId })
|
|
70
70
|
);
|
|
71
71
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
72
|
-
await (0, import_vitest.expect)((0,
|
|
72
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
73
73
|
/No authentication found/
|
|
74
74
|
);
|
|
75
75
|
});
|
|
@@ -79,14 +79,14 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
79
79
|
JSON.stringify({ token: "test-auth-token" })
|
|
80
80
|
);
|
|
81
81
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
82
|
-
await (0, import_vitest.expect)((0,
|
|
82
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
83
83
|
/project\.json not found, have you linked your project with `vc link\?`/
|
|
84
84
|
);
|
|
85
85
|
});
|
|
86
86
|
(0, import_vitest.test)("should throw helpful error when root directory cannot be found", async () => {
|
|
87
87
|
import_vitest.vi.mocked(import_token_io.findRootDir).mockReturnValue(null);
|
|
88
88
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
89
|
-
await (0, import_vitest.expect)((0,
|
|
89
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
90
90
|
/Unable to find project root directory\. Have you linked your project with `vc link\?`/
|
|
91
91
|
);
|
|
92
92
|
});
|
|
@@ -97,7 +97,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
97
97
|
);
|
|
98
98
|
import_vitest.vi.mocked(import_token_io.getUserDataDir).mockReturnValue(null);
|
|
99
99
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
100
|
-
await (0, import_vitest.expect)((0,
|
|
100
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
101
101
|
/Unable to find user data directory\. Please reach out to Vercel support\./
|
|
102
102
|
);
|
|
103
103
|
});
|
|
@@ -114,7 +114,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
114
114
|
new Error("Failed to refresh OIDC token: Unauthorized")
|
|
115
115
|
);
|
|
116
116
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
117
|
-
await (0, import_vitest.expect)((0,
|
|
117
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
118
118
|
/Failed to refresh OIDC token: Unauthorized/
|
|
119
119
|
);
|
|
120
120
|
});
|
|
@@ -133,7 +133,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
133
133
|
)
|
|
134
134
|
);
|
|
135
135
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
136
|
-
await (0, import_vitest.expect)((0,
|
|
136
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
137
137
|
/Vercel OIDC token is malformed\. Expected a string-valued token property\. Please run `vc env pull` and try again/
|
|
138
138
|
);
|
|
139
139
|
});
|
|
@@ -142,19 +142,19 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
142
142
|
import_vitest.vi.spyOn(tokenUtil, "getTokenPayload").mockImplementation(() => {
|
|
143
143
|
throw new Error("Invalid token. Please run `vc env pull` and try again");
|
|
144
144
|
});
|
|
145
|
-
await (0, import_vitest.expect)((0,
|
|
145
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
146
146
|
/Invalid token\. Please run `vc env pull` and try again/
|
|
147
147
|
);
|
|
148
148
|
});
|
|
149
149
|
(0, import_vitest.test)("should throw error when token expiry check fails", async () => {
|
|
150
150
|
process.env.VERCEL_OIDC_TOKEN = "not-a-jwt-token";
|
|
151
|
-
await (0, import_vitest.expect)((0,
|
|
151
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(
|
|
152
152
|
/Invalid token\. Please run `vc env pull` and try again/
|
|
153
153
|
);
|
|
154
154
|
});
|
|
155
155
|
(0, import_vitest.test)("should fail when no token exists and no CLI credentials available", async () => {
|
|
156
156
|
process.env.VERCEL_OIDC_TOKEN = void 0;
|
|
157
|
-
await (0, import_vitest.expect)((0,
|
|
157
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(/Invalid token/);
|
|
158
158
|
});
|
|
159
159
|
(0, import_vitest.test)("should propagate filesystem errors when saving token fails", async () => {
|
|
160
160
|
fs.writeFileSync(
|
|
@@ -177,7 +177,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
177
177
|
throw new Error("EACCES: permission denied");
|
|
178
178
|
});
|
|
179
179
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
180
|
-
await (0, import_vitest.expect)((0,
|
|
180
|
+
await (0, import_vitest.expect)((0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)()).rejects.toThrow(/EACCES|permission/i);
|
|
181
181
|
});
|
|
182
182
|
(0, import_vitest.test)("should succeed when valid token exists in env", async () => {
|
|
183
183
|
const validToken = createValidToken();
|
|
@@ -187,7 +187,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
187
187
|
name: "test-name",
|
|
188
188
|
exp: Date.now() / 1e3 + 43200
|
|
189
189
|
});
|
|
190
|
-
const token = await (0,
|
|
190
|
+
const token = await (0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)();
|
|
191
191
|
(0, import_vitest.expect)(token).toBe(validToken);
|
|
192
192
|
});
|
|
193
193
|
(0, import_vitest.test)("should refresh when token is expired but all configs are valid", async () => {
|
|
@@ -213,7 +213,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
213
213
|
exp: Date.now() / 1e3 + 43200
|
|
214
214
|
});
|
|
215
215
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
216
|
-
const token = await (0,
|
|
216
|
+
const token = await (0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)();
|
|
217
217
|
(0, import_vitest.expect)(token).toBe(newToken);
|
|
218
218
|
});
|
|
219
219
|
(0, import_vitest.test)("should use provided team and project for refresh instead of reading project.json", async () => {
|
|
@@ -237,7 +237,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
237
237
|
exp: Date.now() / 1e3 + 43200
|
|
238
238
|
});
|
|
239
239
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
240
|
-
const token = await (0,
|
|
240
|
+
const token = await (0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)({
|
|
241
241
|
team: customTeamId,
|
|
242
242
|
project: customProjectId
|
|
243
243
|
});
|
|
@@ -272,7 +272,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
272
272
|
exp: Date.now() / 1e3 + 43200
|
|
273
273
|
});
|
|
274
274
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
275
|
-
const token = await (0,
|
|
275
|
+
const token = await (0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)({
|
|
276
276
|
project: customProjectId
|
|
277
277
|
});
|
|
278
278
|
(0, import_vitest.expect)(token).toBe(newToken);
|
|
@@ -306,7 +306,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
306
306
|
exp: Date.now() / 1e3 + 43200
|
|
307
307
|
});
|
|
308
308
|
process.env.VERCEL_OIDC_TOKEN = createExpiredToken();
|
|
309
|
-
const token = await (0,
|
|
309
|
+
const token = await (0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)({
|
|
310
310
|
team: customTeamId
|
|
311
311
|
});
|
|
312
312
|
(0, import_vitest.expect)(token).toBe(newToken);
|
|
@@ -327,7 +327,7 @@ import_vitest.vi.mock("./get-context", () => ({
|
|
|
327
327
|
name: "test-name",
|
|
328
328
|
exp: Date.now() / 1e3 + 43200
|
|
329
329
|
});
|
|
330
|
-
const token = await (0,
|
|
330
|
+
const token = await (0, import_get_vercel_oidc_token_with_refresh.getVercelOidcToken)({
|
|
331
331
|
team: "custom-team",
|
|
332
332
|
project: "custom-project"
|
|
333
333
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { getContext } from './get-context';
|
|
2
|
+
export { AccessTokenMissingError, RefreshAccessTokenFailedError, } from './auth-errors';
|
|
3
|
+
export { getVercelOidcTokenSync } from './get-vercel-oidc-token-sync';
|
|
4
|
+
/**
|
|
5
|
+
* Gets the current OIDC token in Edge Runtime.
|
|
6
|
+
*
|
|
7
|
+
* Edge Runtime does not support automatic token refresh, so this returns the
|
|
8
|
+
* request-scoped token without checking expiration.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getVercelOidcToken(): Promise<string>;
|
|
11
|
+
export declare function getVercelToken(): Promise<string>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_edge_light_exports = {};
|
|
20
|
+
__export(index_edge_light_exports, {
|
|
21
|
+
AccessTokenMissingError: () => import_auth_errors.AccessTokenMissingError,
|
|
22
|
+
RefreshAccessTokenFailedError: () => import_auth_errors.RefreshAccessTokenFailedError,
|
|
23
|
+
getContext: () => import_get_context.getContext,
|
|
24
|
+
getVercelOidcToken: () => getVercelOidcToken,
|
|
25
|
+
getVercelOidcTokenSync: () => import_get_vercel_oidc_token_sync2.getVercelOidcTokenSync,
|
|
26
|
+
getVercelToken: () => getVercelToken
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_edge_light_exports);
|
|
29
|
+
var import_get_vercel_oidc_token_sync = require("./get-vercel-oidc-token-sync");
|
|
30
|
+
var import_get_context = require("./get-context");
|
|
31
|
+
var import_auth_errors = require("./auth-errors");
|
|
32
|
+
var import_get_vercel_oidc_token_sync2 = require("./get-vercel-oidc-token-sync");
|
|
33
|
+
async function getVercelOidcToken() {
|
|
34
|
+
return (0, import_get_vercel_oidc_token_sync.getVercelOidcTokenSync)();
|
|
35
|
+
}
|
|
36
|
+
async function getVercelToken() {
|
|
37
|
+
throw new Error("getVercelToken is not supported in Edge Runtime");
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
AccessTokenMissingError,
|
|
42
|
+
RefreshAccessTokenFailedError,
|
|
43
|
+
getContext,
|
|
44
|
+
getVercelOidcToken,
|
|
45
|
+
getVercelOidcTokenSync,
|
|
46
|
+
getVercelToken
|
|
47
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { getVercelOidcToken
|
|
1
|
+
export { getVercelOidcToken } from './get-vercel-oidc-token-with-refresh';
|
|
2
|
+
export { getVercelOidcTokenSync } from './get-vercel-oidc-token-sync';
|
|
2
3
|
export { getContext } from './get-context';
|
|
3
4
|
export { AccessTokenMissingError, RefreshAccessTokenFailedError, } from './auth-errors';
|
|
4
5
|
export { getVercelToken } from './token-util';
|
package/dist/index.js
CHANGED
|
@@ -21,12 +21,13 @@ __export(src_exports, {
|
|
|
21
21
|
AccessTokenMissingError: () => import_auth_errors.AccessTokenMissingError,
|
|
22
22
|
RefreshAccessTokenFailedError: () => import_auth_errors.RefreshAccessTokenFailedError,
|
|
23
23
|
getContext: () => import_get_context.getContext,
|
|
24
|
-
getVercelOidcToken: () =>
|
|
25
|
-
getVercelOidcTokenSync: () =>
|
|
24
|
+
getVercelOidcToken: () => import_get_vercel_oidc_token_with_refresh.getVercelOidcToken,
|
|
25
|
+
getVercelOidcTokenSync: () => import_get_vercel_oidc_token_sync.getVercelOidcTokenSync,
|
|
26
26
|
getVercelToken: () => import_token_util.getVercelToken
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(src_exports);
|
|
29
|
-
var
|
|
29
|
+
var import_get_vercel_oidc_token_with_refresh = require("./get-vercel-oidc-token-with-refresh");
|
|
30
|
+
var import_get_vercel_oidc_token_sync = require("./get-vercel-oidc-token-sync");
|
|
30
31
|
var import_get_context = require("./get-context");
|
|
31
32
|
var import_auth_errors = require("./auth-errors");
|
|
32
33
|
var import_token_util = require("./token-util");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **getVercelOidcToken**(`options?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\>
|
|
8
8
|
|
|
9
|
-
Defined in: [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)
|
|
9
|
+
Defined in: [packages/oidc/src/get-vercel-oidc-token-with-refresh.ts:64](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token-with-refresh.ts#L64)
|
|
10
10
|
|
|
11
11
|
Gets the current OIDC token from the request context or the environment variable.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **getVercelOidcTokenSync**(): `string`
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/oidc/src/get-vercel-oidc-token.ts:
|
|
9
|
+
Defined in: [packages/oidc/src/get-vercel-oidc-token-sync.ts:24](https://github.com/vercel/vercel/blob/main/packages/oidc/src/get-vercel-oidc-token-sync.ts#L24)
|
|
10
10
|
|
|
11
11
|
Gets the current OIDC token from the request context or the environment variable.
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"edge-light": "./dist/index-edge-light.js",
|
|
13
14
|
"browser": "./dist/index-browser.js",
|
|
14
15
|
"react-native": "./dist/index-browser.js",
|
|
15
16
|
"workflow": "./dist/index-browser.js",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"require": "./dist/index.js"
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
|
-
"version": "3.
|
|
21
|
+
"version": "3.5.0",
|
|
21
22
|
"repository": {
|
|
22
23
|
"directory": "packages/oidc",
|
|
23
24
|
"type": "git",
|
/package/dist/{get-vercel-oidc-token.test.d.ts → get-vercel-oidc-token-with-refresh.test.d.ts}
RENAMED
|
File without changes
|