@vercel/functions 2.2.4 → 2.2.5

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @vercel/functions
2
2
 
3
+ ## 2.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - extract oidc and aws oidc credential helpers from @vercel/functions into @vercel/oidc and @vercel/oidc-aws-credentials-provider. @vercel/functions re-exports the new functions as deprecated to maintain backwards compatibility. ([#13548](https://github.com/vercel/vercel/pull/13548))
8
+
9
+ - Updated dependencies [[`fa8d4c76ea50c4844031f56209b21845818212fc`](https://github.com/vercel/vercel/commit/fa8d4c76ea50c4844031f56209b21845818212fc)]:
10
+ - @vercel/oidc@2.0.0
11
+
12
+ ## 2.2.5
13
+
14
+ ### Patch Changes
15
+
16
+ - Extract oidc behavior into separate packages ([#13548](https://github.com/vercel/vercel/pull/13548))
17
+
3
18
  ## 2.2.4
4
19
 
5
20
  ### Patch Changes
@@ -97,7 +97,7 @@ A promise that resolves to the OIDC token.
97
97
 
98
98
  #### Defined in
99
99
 
100
- [packages/functions/src/oidc/get-vercel-oidc-token.ts:25](https://github.com/vercel/vercel/blob/main/packages/functions/src/oidc/get-vercel-oidc-token.ts#L25)
100
+ packages/oidc/dist/get-vercel-oidc-token.d.ts:23
101
101
 
102
102
  ---
103
103
 
@@ -132,4 +132,4 @@ The OIDC token.
132
132
 
133
133
  #### Defined in
134
134
 
135
- [packages/functions/src/oidc/get-vercel-oidc-token.ts:48](https://github.com/vercel/vercel/blob/main/packages/functions/src/oidc/get-vercel-oidc-token.ts#L48)
135
+ packages/oidc/dist/get-vercel-oidc-token.d.ts:43
@@ -31,13 +31,13 @@ __export(aws_credentials_provider_exports, {
31
31
  awsCredentialsProvider: () => awsCredentialsProvider
32
32
  });
33
33
  module.exports = __toCommonJS(aws_credentials_provider_exports);
34
- var import_get_vercel_oidc_token = require("./get-vercel-oidc-token");
34
+ var import_oidc = require("@vercel/oidc");
35
35
  function awsCredentialsProvider(init) {
36
36
  return async () => {
37
37
  const { fromWebToken } = await import("@aws-sdk/credential-provider-web-identity");
38
38
  return fromWebToken({
39
39
  ...init,
40
- webIdentityToken: (0, import_get_vercel_oidc_token.getVercelOidcTokenSync)()
40
+ webIdentityToken: (0, import_oidc.getVercelOidcTokenSync)()
41
41
  })();
42
42
  };
43
43
  }
package/oidc/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ /**
2
+ * @deprecated Use @vercel/oidc-aws-credentials-provider instead
3
+ * AWS authentication for Vercel Functions
4
+ */
1
5
  export type { AwsCredentialsProviderInit } from './aws-credentials-provider';
6
+ /**
7
+ * @deprecated Use @vercel/oidc-aws-credentials-provider instead
8
+ * AWS authentication for Vercel Functions
9
+ */
2
10
  export { awsCredentialsProvider } from './aws-credentials-provider';
3
- export { getVercelOidcToken, getVercelOidcTokenSync, } from './get-vercel-oidc-token';
11
+ /**
12
+ * @deprecated Use @vercel/oidc instead
13
+ * OIDC authentication for Vercel Functions
14
+ */
15
+ export { getVercelOidcToken, getVercelOidcTokenSync } from '@vercel/oidc';
package/oidc/index.js CHANGED
@@ -19,12 +19,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var oidc_exports = {};
20
20
  __export(oidc_exports, {
21
21
  awsCredentialsProvider: () => import_aws_credentials_provider.awsCredentialsProvider,
22
- getVercelOidcToken: () => import_get_vercel_oidc_token.getVercelOidcToken,
23
- getVercelOidcTokenSync: () => import_get_vercel_oidc_token.getVercelOidcTokenSync
22
+ getVercelOidcToken: () => import_oidc.getVercelOidcToken,
23
+ getVercelOidcTokenSync: () => import_oidc.getVercelOidcTokenSync
24
24
  });
25
25
  module.exports = __toCommonJS(oidc_exports);
26
26
  var import_aws_credentials_provider = require("./aws-credentials-provider");
27
- var import_get_vercel_oidc_token = require("./get-vercel-oidc-token");
27
+ var import_oidc = require("@vercel/oidc");
28
28
  // Annotate the CommonJS export names for ESM import in node:
29
29
  0 && (module.exports = {
30
30
  awsCredentialsProvider,
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "require": "./middleware.js"
27
27
  }
28
28
  },
29
- "version": "2.2.4",
29
+ "version": "2.2.5",
30
30
  "repository": {
31
31
  "directory": "packages/functions",
32
32
  "type": "git",
@@ -61,6 +61,9 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
+ "dependencies": {
65
+ "@vercel/oidc": "2.0.0"
66
+ },
64
67
  "scripts": {
65
68
  "pretest": "pnpm run build:code",
66
69
  "test": "vitest",
@@ -1,43 +0,0 @@
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
- * @returns {Promise<string>} A promise that resolves to the OIDC token.
10
- * @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.
11
- *
12
- * @example
13
- *
14
- * ```js
15
- * // Using the OIDC token
16
- * getVercelOidcToken().then((token) => {
17
- * console.log('OIDC Token:', token);
18
- * }).catch((error) => {
19
- * console.error('Error:', error.message);
20
- * });
21
- * ```
22
- */
23
- export declare function getVercelOidcToken(): Promise<string>;
24
- /**
25
- * Gets the current OIDC token from the request context or the environment variable.
26
- *
27
- * Do not cache this value, as it is subject to change in production!
28
- *
29
- * This function is used to retrieve the OIDC token from the request context or the environment variable.
30
- * 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.
31
- *
32
- * @returns {string} The OIDC token.
33
- * @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.
34
- *
35
- * @example
36
- *
37
- * ```js
38
- * // Using the OIDC token
39
- * const token = getVercelOidcTokenSync();
40
- * console.log('OIDC Token:', token);
41
- * ```
42
- */
43
- export declare function getVercelOidcTokenSync(): string;
@@ -1,42 +0,0 @@
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_exports = {};
20
- __export(get_vercel_oidc_token_exports, {
21
- getVercelOidcToken: () => getVercelOidcToken,
22
- getVercelOidcTokenSync: () => getVercelOidcTokenSync
23
- });
24
- module.exports = __toCommonJS(get_vercel_oidc_token_exports);
25
- var import_get_context = require("../get-context");
26
- async function getVercelOidcToken() {
27
- return getVercelOidcTokenSync();
28
- }
29
- function getVercelOidcTokenSync() {
30
- const token = (0, import_get_context.getContext)().headers?.["x-vercel-oidc-token"] ?? process.env.VERCEL_OIDC_TOKEN;
31
- if (!token) {
32
- throw new Error(
33
- `The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?`
34
- );
35
- }
36
- return token;
37
- }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- getVercelOidcToken,
41
- getVercelOidcTokenSync
42
- });