@vercel/functions 2.2.8 → 2.2.11

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,26 @@
1
1
  # @vercel/functions
2
2
 
3
+ ## 2.2.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix dependency ([#13726](https://github.com/vercel/vercel/pull/13726))
8
+
9
+ ## 2.2.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Update dependency ([#13722](https://github.com/vercel/vercel/pull/13722))
14
+
15
+ ## 2.2.9
16
+
17
+ ### Patch Changes
18
+
19
+ - Extract AWS dynamic import to async loader with error handling ([#13660](https://github.com/vercel/vercel/pull/13660))
20
+
21
+ - Updated dependencies [[`a133e534e7dfd785beeeb0dcafed8d2c991e9f11`](https://github.com/vercel/vercel/commit/a133e534e7dfd785beeeb0dcafed8d2c991e9f11)]:
22
+ - @vercel/oidc@2.1.0
23
+
3
24
  ## 2.2.8
4
25
 
5
26
  ### Patch Changes
@@ -18,46 +18,19 @@
18
18
 
19
19
  ▸ **awsCredentialsProvider**(`init`): `AwsCredentialIdentityProvider`
20
20
 
21
- Obtains the Vercel OIDC token and creates an AWS credential provider function
22
- that gets AWS credentials by calling STS AssumeRoleWithWebIdentity API.
23
-
24
- **`Example`**
25
-
26
- ```js
27
- import * as s3 from '@aws-sdk/client-s3';
28
- import { awsCredentialsProvider } from '@vercel/functions/oidc';
29
-
30
- const s3Client = new s3.S3Client({
31
- credentials: awsCredentialsProvider({
32
- roleArn: 'arn:aws:iam::1234567890:role/RoleA',
33
- clientConfig: { region: 'us-west-2' },
34
- clientPlugins: [addFooHeadersPlugin],
35
- roleAssumerWithWebIdentity: customRoleAssumer,
36
- roleSessionName: 'session_123',
37
- providerId: 'graph.facebook.com',
38
- policyArns: [{ arn: 'arn:aws:iam::1234567890:policy/SomePolicy' }],
39
- policy:
40
- '{"Statement": [{"Effect": "Allow", "Action": "s3:ListBucket", "Resource": "*"}]}',
41
- durationSeconds: 7200,
42
- }),
43
- });
44
- ```
45
-
46
21
  #### Parameters
47
22
 
48
- | Name | Type | Description |
49
- | :----- | :------------------------------------------------------------------------------- | :------------------------- |
50
- | `init` | [`AwsCredentialsProviderInit`](../interfaces/oidc.AwsCredentialsProviderInit.md) | The initialization object. |
23
+ | Name | Type |
24
+ | :----- | :------------------------------------------------------------------------------- |
25
+ | `init` | [`AwsCredentialsProviderInit`](../interfaces/oidc.AwsCredentialsProviderInit.md) |
51
26
 
52
27
  #### Returns
53
28
 
54
29
  `AwsCredentialIdentityProvider`
55
30
 
56
- A function that provides AWS credentials.
57
-
58
31
  #### Defined in
59
32
 
60
- [packages/functions/src/oidc/aws-credentials-provider.ts:60](https://github.com/vercel/vercel/blob/main/packages/functions/src/oidc/aws-credentials-provider.ts#L60)
33
+ [packages/functions/src/oidc/aws-credentials-provider.ts:70](https://github.com/vercel/vercel/blob/main/packages/functions/src/oidc/aws-credentials-provider.ts#L70)
61
34
 
62
35
  ---
63
36
 
@@ -97,7 +70,7 @@ A promise that resolves to the OIDC token.
97
70
 
98
71
  #### Defined in
99
72
 
100
- packages/oidc/dist/get-vercel-oidc-token.d.ts:23
73
+ node_modules/.pnpm/@vercel+oidc@2.0.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.d.ts:23
101
74
 
102
75
  ---
103
76
 
@@ -132,4 +105,4 @@ The OIDC token.
132
105
 
133
106
  #### Defined in
134
107
 
135
- packages/oidc/dist/get-vercel-oidc-token.d.ts:43
108
+ node_modules/.pnpm/@vercel+oidc@2.0.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.d.ts:43
@@ -17,41 +17,4 @@ import type { FromWebTokenInit } from '@aws-sdk/credential-provider-web-identity
17
17
  export interface AwsCredentialsProviderInit// eslint-disable-line @typescript-eslint/no-empty-interface
18
18
  extends Omit<FromWebTokenInit, 'webIdentityToken'> {
19
19
  }
20
- /**
21
- * Obtains the Vercel OIDC token and creates an AWS credential provider function
22
- * that gets AWS credentials by calling STS AssumeRoleWithWebIdentity API.
23
- *
24
- * @param {AwsCredentialsProviderInit} init - The initialization object.
25
- * @param {string} init.roleArn - ARN of the role that the caller is assuming.
26
- * @param {Object} [init.clientConfig] - Custom STS client configurations overriding the default ones.
27
- * @param {Array} [init.clientPlugins] - Custom STS client middleware plugin to modify the client default behavior.
28
- * @param {Function} [init.roleAssumerWithWebIdentity] - A function that assumes a role with web identity and returns a promise fulfilled with credentials for the assumed role.
29
- * @param {string} [init.roleSessionName] - An identifier for the assumed role session.
30
- * @param {string} [init.providerId] - The fully qualified host component of the domain name of the identity provider.
31
- * @param {Array} [init.policyArns] - ARNs of the IAM managed policies that you want to use as managed session policies.
32
- * @param {string} [init.policy] - An IAM policy in JSON format that you want to use as an inline session policy.
33
- * @param {number} [init.durationSeconds=3600] - The duration, in seconds, of the role session. Defaults to 3600 seconds.
34
- *
35
- * @returns {AwsCredentialIdentityProvider} A function that provides AWS credentials.
36
- *
37
- * @example
38
- * ```js
39
- * import * as s3 from '@aws-sdk/client-s3';
40
- * import { awsCredentialsProvider } from '@vercel/functions/oidc';
41
- *
42
- * const s3Client = new s3.S3Client({
43
- * credentials: awsCredentialsProvider({
44
- * roleArn: "arn:aws:iam::1234567890:role/RoleA",
45
- * clientConfig: { region: "us-west-2" },
46
- * clientPlugins: [addFooHeadersPlugin],
47
- * roleAssumerWithWebIdentity: customRoleAssumer,
48
- * roleSessionName: "session_123",
49
- * providerId: "graph.facebook.com",
50
- * policyArns: [{ arn: "arn:aws:iam::1234567890:policy/SomePolicy" }],
51
- * policy: "{\"Statement\": [{\"Effect\": \"Allow\", \"Action\": \"s3:ListBucket\", \"Resource\": \"*\"}]}",
52
- * durationSeconds: 7200
53
- * }),
54
- * });
55
- * ```
56
- */
57
20
  export declare function awsCredentialsProvider(init: AwsCredentialsProviderInit): AwsCredentialIdentityProvider;
@@ -32,9 +32,18 @@ __export(aws_credentials_provider_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(aws_credentials_provider_exports);
34
34
  var import_oidc = require("@vercel/oidc");
35
+ async function loadAwsCredentialProviderWebIdentity() {
36
+ try {
37
+ return await import("@aws-sdk/credential-provider-web-identity");
38
+ } catch (err) {
39
+ throw new Error(
40
+ "package '@aws-sdk/credential-provider-web-identity' not found"
41
+ );
42
+ }
43
+ }
35
44
  function awsCredentialsProvider(init) {
36
45
  return async () => {
37
- const { fromWebToken } = await import("@aws-sdk/credential-provider-web-identity");
46
+ const { fromWebToken } = await loadAwsCredentialProviderWebIdentity();
38
47
  return fromWebToken({
39
48
  ...init,
40
49
  webIdentityToken: (0, import_oidc.getVercelOidcTokenSync)()
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "require": "./middleware.js"
31
31
  }
32
32
  },
33
- "version": "2.2.8",
33
+ "version": "2.2.11",
34
34
  "repository": {
35
35
  "directory": "packages/functions",
36
36
  "type": "git",