@aws-sdk/ec2-metadata-service 3.1068.0 → 3.1070.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.
Files changed (2) hide show
  1. package/dist-cjs/index.js +12 -14
  2. package/package.json +6 -6
package/dist-cjs/index.js CHANGED
@@ -1,9 +1,7 @@
1
- 'use strict';
2
-
3
- var config = require('@smithy/core/config');
4
- var protocols = require('@smithy/core/protocols');
5
- var serde = require('@smithy/core/serde');
6
- var nodeHttpHandler = require('@smithy/node-http-handler');
1
+ const { loadConfig } = require("@smithy/core/config");
2
+ const { HttpRequest } = require("@smithy/core/protocols");
3
+ const { sdkStreamMixin } = require("@smithy/core/serde");
4
+ const { NodeHttpHandler } = require("@smithy/node-http-handler");
7
5
 
8
6
  var Endpoint;
9
7
  (function (Endpoint) {
@@ -48,11 +46,11 @@ class MetadataService {
48
46
  this.config = (async () => {
49
47
  const profile = options?.profile || process.env.AWS_PROFILE;
50
48
  return {
51
- endpoint: options.endpoint ?? (await config.loadConfig(ENDPOINT_SELECTORS, { profile })()),
49
+ endpoint: options.endpoint ?? (await loadConfig(ENDPOINT_SELECTORS, { profile })()),
52
50
  httpOptions: {
53
51
  timeout: options?.httpOptions?.timeout || 0,
54
52
  },
55
- ec2MetadataV1Disabled: options?.ec2MetadataV1Disabled ?? (await config.loadConfig(IMDSv1_DISABLED_SELECTORS, { profile })()),
53
+ ec2MetadataV1Disabled: options?.ec2MetadataV1Disabled ?? (await loadConfig(IMDSv1_DISABLED_SELECTORS, { profile })()),
56
54
  };
57
55
  })();
58
56
  this.disableFetchToken = options?.disableFetchToken || false;
@@ -120,7 +118,7 @@ class MetadataService {
120
118
  async request(path, options) {
121
119
  return this.retryWithBackoff(async () => {
122
120
  const { endpoint, ec2MetadataV1Disabled, httpOptions } = await this.config;
123
- const handler = new nodeHttpHandler.NodeHttpHandler({
121
+ const handler = new NodeHttpHandler({
124
122
  requestTimeout: httpOptions?.timeout,
125
123
  throwOnRequestTimeout: true,
126
124
  connectionTimeout: httpOptions?.timeout,
@@ -140,7 +138,7 @@ class MetadataService {
140
138
  }
141
139
  }
142
140
  }
143
- const request = new protocols.HttpRequest({
141
+ const request = new HttpRequest({
144
142
  method: options.method || "GET",
145
143
  headers: headers,
146
144
  hostname: endpointUrl.hostname,
@@ -151,7 +149,7 @@ class MetadataService {
151
149
  try {
152
150
  const { response } = await handler.handle(request, {});
153
151
  if (response.statusCode === 200 && response.body) {
154
- return serde.sdkStreamMixin(response.body).transformToString();
152
+ return sdkStreamMixin(response.body).transformToString();
155
153
  }
156
154
  else {
157
155
  throw Object.assign(new Error(`Request failed with status code ${response.statusCode}`), {
@@ -174,13 +172,13 @@ class MetadataService {
174
172
  }
175
173
  async fetchMetadataTokenInternal() {
176
174
  const { endpoint, httpOptions } = await this.config;
177
- const handler = new nodeHttpHandler.NodeHttpHandler({
175
+ const handler = new NodeHttpHandler({
178
176
  requestTimeout: httpOptions?.timeout,
179
177
  throwOnRequestTimeout: true,
180
178
  connectionTimeout: httpOptions?.timeout,
181
179
  });
182
180
  const endpointUrl = new URL(endpoint);
183
- const tokenRequest = new protocols.HttpRequest({
181
+ const tokenRequest = new HttpRequest({
184
182
  method: "PUT",
185
183
  headers: {
186
184
  "x-aws-ec2-metadata-token-ttl-seconds": String(this.tokenTtl),
@@ -194,7 +192,7 @@ class MetadataService {
194
192
  const { response } = await handler.handle(tokenRequest, {});
195
193
  let bodyString = "";
196
194
  if (response.body) {
197
- bodyString = await serde.sdkStreamMixin(response.body).transformToString();
195
+ bodyString = await sdkStreamMixin(response.body).transformToString();
198
196
  }
199
197
  if (response.statusCode === 200 && bodyString) {
200
198
  return bodyString;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aws-sdk/ec2-metadata-service",
3
- "version": "3.1068.0",
3
+ "version": "3.1070.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline",
7
- "build:es": "tsc -p tsconfig.es.json",
7
+ "build:es": "premove dist-es && tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
9
- "build:types": "tsc -p tsconfig.types.json",
9
+ "build:types": "premove dist-types && tsc -p tsconfig.types.json",
10
10
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
11
+ "clean": "premove dist-cjs dist-es dist-types",
12
12
  "test": "yarn g:vitest run --passWithNoTests",
13
13
  "test:watch": "yarn g:vitest watch --passWithNoTests",
14
14
  "test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts --mode development",
@@ -24,14 +24,14 @@
24
24
  "module": "./dist-es/index.js",
25
25
  "types": "./dist-types/index.d.ts",
26
26
  "dependencies": {
27
- "@aws-sdk/types": "^3.973.12",
27
+ "@aws-sdk/types": "^3.973.13",
28
28
  "@smithy/core": "^3.24.6",
29
29
  "@smithy/node-http-handler": "^4.7.6",
30
30
  "@smithy/types": "^4.14.3",
31
31
  "tslib": "^2.6.2"
32
32
  },
33
33
  "devDependencies": {
34
- "@aws-sdk/credential-providers": "3.1068.0",
34
+ "@aws-sdk/credential-providers": "3.1070.0",
35
35
  "@tsconfig/recommended": "1.0.1",
36
36
  "@types/node": "^20.14.8",
37
37
  "concurrently": "7.0.0",