@aws-sdk/util-user-agent-node 3.186.0 → 3.190.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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.190.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.189.0...v3.190.0) (2022-10-17)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/util-user-agent-node
9
+
10
+
11
+
12
+
13
+
14
+ # [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
15
+
16
+ **Note:** Version bump only for package @aws-sdk/util-user-agent-node
17
+
18
+
19
+
20
+
21
+
6
22
  # [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
7
23
 
8
24
  **Note:** Version bump only for package @aws-sdk/util-user-agent-node
package/dist-es/index.js CHANGED
@@ -1,47 +1,37 @@
1
- import { __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { loadConfig } from "@aws-sdk/node-config-provider";
3
2
  import { platform, release } from "os";
4
3
  import { env, versions } from "process";
5
4
  import { isCrtAvailable } from "./is-crt-available";
6
- export var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
7
- export var UA_APP_ID_INI_NAME = "sdk-ua-app-id";
8
- export var defaultUserAgent = function (_a) {
9
- var serviceId = _a.serviceId, clientVersion = _a.clientVersion;
10
- var sections = [
5
+ export const UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
6
+ export const UA_APP_ID_INI_NAME = "sdk-ua-app-id";
7
+ export const defaultUserAgent = ({ serviceId, clientVersion }) => {
8
+ const sections = [
11
9
  ["aws-sdk-js", clientVersion],
12
- ["os/".concat(platform()), release()],
10
+ [`os/${platform()}`, release()],
13
11
  ["lang/js"],
14
- ["md/nodejs", "".concat(versions.node)],
12
+ ["md/nodejs", `${versions.node}`],
15
13
  ];
16
- var crtAvailable = isCrtAvailable();
14
+ const crtAvailable = isCrtAvailable();
17
15
  if (crtAvailable) {
18
16
  sections.push(crtAvailable);
19
17
  }
20
18
  if (serviceId) {
21
- sections.push(["api/".concat(serviceId), clientVersion]);
19
+ sections.push([`api/${serviceId}`, clientVersion]);
22
20
  }
23
21
  if (env.AWS_EXECUTION_ENV) {
24
- sections.push(["exec-env/".concat(env.AWS_EXECUTION_ENV)]);
22
+ sections.push([`exec-env/${env.AWS_EXECUTION_ENV}`]);
25
23
  }
26
- var appIdPromise = loadConfig({
27
- environmentVariableSelector: function (env) { return env[UA_APP_ID_ENV_NAME]; },
28
- configFileSelector: function (profile) { return profile[UA_APP_ID_INI_NAME]; },
24
+ const appIdPromise = loadConfig({
25
+ environmentVariableSelector: (env) => env[UA_APP_ID_ENV_NAME],
26
+ configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME],
29
27
  default: undefined,
30
28
  })();
31
- var resolvedUserAgent = undefined;
32
- return function () { return __awaiter(void 0, void 0, void 0, function () {
33
- var appId;
34
- return __generator(this, function (_a) {
35
- switch (_a.label) {
36
- case 0:
37
- if (!!resolvedUserAgent) return [3, 2];
38
- return [4, appIdPromise];
39
- case 1:
40
- appId = _a.sent();
41
- resolvedUserAgent = appId ? __spreadArray(__spreadArray([], __read(sections), false), [["app/".concat(appId)]], false) : __spreadArray([], __read(sections), false);
42
- _a.label = 2;
43
- case 2: return [2, resolvedUserAgent];
44
- }
45
- });
46
- }); };
29
+ let resolvedUserAgent = undefined;
30
+ return async () => {
31
+ if (!resolvedUserAgent) {
32
+ const appId = await appIdPromise;
33
+ resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
34
+ }
35
+ return resolvedUserAgent;
36
+ };
47
37
  };
@@ -1,4 +1,4 @@
1
- export var isCrtAvailable = function () {
1
+ export const isCrtAvailable = () => {
2
2
  try {
3
3
  if (typeof require === "function" && typeof module !== "undefined" && module.require && require("aws-crt")) {
4
4
  return ["md/crt-avail"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-user-agent-node",
3
- "version": "3.186.0",
3
+ "version": "3.190.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,12 +20,12 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/node-config-provider": "3.186.0",
24
- "@aws-sdk/types": "3.186.0",
23
+ "@aws-sdk/node-config-provider": "3.190.0",
24
+ "@aws-sdk/types": "3.190.0",
25
25
  "tslib": "^2.3.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@aws-sdk/protocol-http": "3.186.0",
28
+ "@aws-sdk/protocol-http": "3.190.0",
29
29
  "@tsconfig/recommended": "1.0.1",
30
30
  "@types/node": "^10.0.0",
31
31
  "concurrently": "7.0.0",