@vercel/aws 0.2.0 → 0.2.2

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,17 @@
1
1
  # @vercel/aws
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - @vercel/oidc-aws-credentials-provider@3.1.3
8
+
9
+ ## 0.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - cb11ee2: Update `createOpenSearch` to read `OPENSEARCH_ENDPOINT` and `AWS_REGION` (replacing `OPENSEARCH_DASHBOARD_ENDPOINT` and `OPENSEARCH_REGION`).
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ### Minor Changes
@@ -11,12 +11,12 @@ import { Client, type ClientOptions } from '@opensearch-project/opensearch';
11
11
  export interface CreateOpenSearchOptions extends Partial<ClientOptions> {
12
12
  /**
13
13
  * The OpenSearch collection endpoint. Defaults to
14
- * `process.env.OPENSEARCH_DASHBOARD_ENDPOINT`.
14
+ * `process.env.OPENSEARCH_ENDPOINT`.
15
15
  */
16
16
  endpoint?: string;
17
17
  /**
18
18
  * The AWS region the collection lives in. Defaults to
19
- * `process.env.OPENSEARCH_REGION`.
19
+ * `process.env.AWS_REGION`.
20
20
  */
21
21
  region?: string;
22
22
  /**
@@ -25,14 +25,14 @@ var import_opensearch = require("@opensearch-project/opensearch");
25
25
  var import_aws = require("@opensearch-project/opensearch/aws");
26
26
  var import_oidc_aws_credentials_provider = require("@vercel/oidc-aws-credentials-provider");
27
27
  function createOpenSearch(opts = {}) {
28
- const endpoint = opts.endpoint ?? process.env.OPENSEARCH_DASHBOARD_ENDPOINT;
29
- const region = opts.region ?? process.env.OPENSEARCH_REGION;
28
+ const endpoint = opts.endpoint ?? process.env.OPENSEARCH_ENDPOINT;
29
+ const region = opts.region ?? process.env.AWS_REGION;
30
30
  const roleArn = opts.roleArn ?? process.env.AWS_ROLE_ARN;
31
31
  const missing = [];
32
32
  if (!endpoint)
33
- missing.push("OPENSEARCH_DASHBOARD_ENDPOINT");
33
+ missing.push("OPENSEARCH_ENDPOINT");
34
34
  if (!region)
35
- missing.push("OPENSEARCH_REGION");
35
+ missing.push("AWS_REGION");
36
36
  if (!roleArn)
37
37
  missing.push("AWS_ROLE_ARN");
38
38
  if (missing.length > 0) {
@@ -20,11 +20,7 @@ import_vitest.vi.mock("@vercel/oidc-aws-credentials-provider", () => ({
20
20
  secretAccessKey: "SECRET_TEST"
21
21
  }))
22
22
  }));
23
- const ENV_KEYS = [
24
- "OPENSEARCH_DASHBOARD_ENDPOINT",
25
- "OPENSEARCH_REGION",
26
- "AWS_ROLE_ARN"
27
- ];
23
+ const ENV_KEYS = ["OPENSEARCH_ENDPOINT", "AWS_REGION", "AWS_ROLE_ARN"];
28
24
  (0, import_vitest.describe)("createOpenSearch", () => {
29
25
  const originalEnv = {};
30
26
  (0, import_vitest.beforeEach)(() => {
@@ -44,8 +40,8 @@ const ENV_KEYS = [
44
40
  }
45
41
  });
46
42
  (0, import_vitest.test)("uses Vercel-injected env vars when no options are provided", async () => {
47
- process.env.OPENSEARCH_DASHBOARD_ENDPOINT = "https://example.aoss.amazonaws.com";
48
- process.env.OPENSEARCH_REGION = "us-east-2";
43
+ process.env.OPENSEARCH_ENDPOINT = "https://example.aoss.amazonaws.com";
44
+ process.env.AWS_REGION = "us-east-2";
49
45
  process.env.AWS_ROLE_ARN = "arn:aws:iam::1234567890:role/vercel-opensearch";
50
46
  const client = (0, import_opensearch.createOpenSearch)();
51
47
  (0, import_vitest.expect)(import_aws.AwsSigv4Signer).toHaveBeenCalledTimes(1);
@@ -61,8 +57,8 @@ const ENV_KEYS = [
61
57
  ).toBe("https://example.aoss.amazonaws.com");
62
58
  });
63
59
  (0, import_vitest.test)("explicit options override env", () => {
64
- process.env.OPENSEARCH_DASHBOARD_ENDPOINT = "https://env-endpoint.example";
65
- process.env.OPENSEARCH_REGION = "us-east-2";
60
+ process.env.OPENSEARCH_ENDPOINT = "https://env-endpoint.example";
61
+ process.env.AWS_REGION = "us-east-2";
66
62
  process.env.AWS_ROLE_ARN = "arn:aws:iam::1:role/env";
67
63
  (0, import_opensearch.createOpenSearch)({
68
64
  endpoint: "https://override-endpoint.example",
@@ -75,15 +71,13 @@ const ENV_KEYS = [
75
71
  });
76
72
  (0, import_vitest.test)("throws a helpful error when env vars are missing", () => {
77
73
  (0, import_vitest.expect)(() => (0, import_opensearch.createOpenSearch)()).toThrow(
78
- /OPENSEARCH_DASHBOARD_ENDPOINT.*OPENSEARCH_REGION.*AWS_ROLE_ARN/
74
+ /OPENSEARCH_ENDPOINT.*AWS_REGION.*AWS_ROLE_ARN/
79
75
  );
80
76
  });
81
77
  (0, import_vitest.test)("lists only the missing env vars in the error", () => {
82
- process.env.OPENSEARCH_DASHBOARD_ENDPOINT = "https://example";
83
- process.env.OPENSEARCH_REGION = "us-east-2";
78
+ process.env.OPENSEARCH_ENDPOINT = "https://example";
79
+ process.env.AWS_REGION = "us-east-2";
84
80
  (0, import_vitest.expect)(() => (0, import_opensearch.createOpenSearch)()).toThrow(/AWS_ROLE_ARN/);
85
- (0, import_vitest.expect)(() => (0, import_opensearch.createOpenSearch)()).not.toThrow(
86
- /OPENSEARCH_DASHBOARD_ENDPOINT/
87
- );
81
+ (0, import_vitest.expect)(() => (0, import_opensearch.createOpenSearch)()).not.toThrow(/OPENSEARCH_ENDPOINT/);
88
82
  });
89
83
  });
@@ -159,7 +159,7 @@ Defined in: node_modules/.pnpm/@opensearch-project+opensearch@3.3.0/node_modules
159
159
  Defined in: [packages/aws/src/opensearch.ts:19](https://github.com/vercel/vercel/blob/main/packages/aws/src/opensearch.ts#L19)
160
160
 
161
161
  The OpenSearch collection endpoint. Defaults to
162
- `process.env.OPENSEARCH_DASHBOARD_ENDPOINT`.
162
+ `process.env.OPENSEARCH_ENDPOINT`.
163
163
 
164
164
  ---
165
165
 
@@ -314,7 +314,7 @@ Defined in: node_modules/.pnpm/@opensearch-project+opensearch@3.3.0/node_modules
314
314
  Defined in: [packages/aws/src/opensearch.ts:24](https://github.com/vercel/vercel/blob/main/packages/aws/src/opensearch.ts#L24)
315
315
 
316
316
  The AWS region the collection lives in. Defaults to
317
- `process.env.OPENSEARCH_REGION`.
317
+ `process.env.AWS_REGION`.
318
318
 
319
319
  ---
320
320
 
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "require": "./dist/opensearch.js"
19
19
  }
20
20
  },
21
- "version": "0.2.0",
21
+ "version": "0.2.2",
22
22
  "repository": {
23
23
  "directory": "packages/aws",
24
24
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@vercel/oidc-aws-credentials-provider": "3.1.2"
55
+ "@vercel/oidc-aws-credentials-provider": "3.1.3"
56
56
  },
57
57
  "scripts": {
58
58
  "pretest": "pnpm run build:code",