@aws-sdk/util-user-agent-browser 3.654.0 → 3.664.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/dist-cjs/index.js CHANGED
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultUserAgent = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bowser_1 = tslib_1.__importDefault(require("bowser"));
6
- const defaultUserAgent = ({ serviceId, clientVersion }) => async () => {
6
+ const defaultUserAgent = ({ serviceId, clientVersion }) => async (config) => {
7
7
  const parsedUA = typeof window !== "undefined" && window?.navigator?.userAgent
8
8
  ? bowser_1.default.parse(window.navigator.userAgent)
9
9
  : undefined;
10
10
  const sections = [
11
11
  ["aws-sdk-js", clientVersion],
12
- ["ua", "2.0"],
12
+ ["ua", "2.1"],
13
13
  [`os/${parsedUA?.os?.name || "other"}`, parsedUA?.os?.version],
14
14
  ["lang/js"],
15
15
  ["md/browser", `${parsedUA?.browser?.name ?? "unknown"}_${parsedUA?.browser?.version ?? "unknown"}`],
@@ -17,6 +17,10 @@ const defaultUserAgent = ({ serviceId, clientVersion }) => async () => {
17
17
  if (serviceId) {
18
18
  sections.push([`api/${serviceId}`, clientVersion]);
19
19
  }
20
+ const appId = await config?.userAgentAppId?.();
21
+ if (appId) {
22
+ sections.push([`app/${appId}`]);
23
+ }
20
24
  return sections;
21
25
  };
22
26
  exports.defaultUserAgent = defaultUserAgent;
@@ -4,7 +4,7 @@ exports.defaultUserAgent = void 0;
4
4
  const defaultUserAgent = ({ serviceId, clientVersion }) => async () => {
5
5
  const sections = [
6
6
  ["aws-sdk-js", clientVersion],
7
- ["ua", "2.0"],
7
+ ["ua", "2.1"],
8
8
  ["os/other"],
9
9
  ["lang/js"],
10
10
  ["md/rn"],
package/dist-es/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import bowser from "bowser";
2
- export const defaultUserAgent = ({ serviceId, clientVersion }) => async () => {
2
+ export const defaultUserAgent = ({ serviceId, clientVersion }) => async (config) => {
3
3
  const parsedUA = typeof window !== "undefined" && window?.navigator?.userAgent
4
4
  ? bowser.parse(window.navigator.userAgent)
5
5
  : undefined;
6
6
  const sections = [
7
7
  ["aws-sdk-js", clientVersion],
8
- ["ua", "2.0"],
8
+ ["ua", "2.1"],
9
9
  [`os/${parsedUA?.os?.name || "other"}`, parsedUA?.os?.version],
10
10
  ["lang/js"],
11
11
  ["md/browser", `${parsedUA?.browser?.name ?? "unknown"}_${parsedUA?.browser?.version ?? "unknown"}`],
@@ -13,5 +13,9 @@ export const defaultUserAgent = ({ serviceId, clientVersion }) => async () => {
13
13
  if (serviceId) {
14
14
  sections.push([`api/${serviceId}`, clientVersion]);
15
15
  }
16
+ const appId = await config?.userAgentAppId?.();
17
+ if (appId) {
18
+ sections.push([`app/${appId}`]);
19
+ }
16
20
  return sections;
17
21
  };
@@ -1,7 +1,7 @@
1
1
  export const defaultUserAgent = ({ serviceId, clientVersion }) => async () => {
2
2
  const sections = [
3
3
  ["aws-sdk-js", clientVersion],
4
- ["ua", "2.0"],
4
+ ["ua", "2.1"],
5
5
  ["os/other"],
6
6
  ["lang/js"],
7
7
  ["md/rn"],
@@ -1,9 +1,12 @@
1
1
  import { Provider, UserAgent } from "@smithy/types";
2
2
  import { DefaultUserAgentOptions } from "./configurations";
3
+ export interface PreviouslyResolved {
4
+ userAgentAppId: Provider<string | undefined>;
5
+ }
3
6
  /**
4
7
  * @internal
5
8
  *
6
9
  * Default provider to the user agent in browsers. It's a best effort to infer
7
10
  * the device information. It uses bowser library to detect the browser and version
8
11
  */
9
- export declare const defaultUserAgent: ({ serviceId, clientVersion }: DefaultUserAgentOptions) => Provider<UserAgent>;
12
+ export declare const defaultUserAgent: ({ serviceId, clientVersion }: DefaultUserAgentOptions) => (config: PreviouslyResolved) => Promise<UserAgent>;
@@ -1,6 +1,11 @@
1
1
  import { Provider, UserAgent } from "@smithy/types";
2
2
  import { DefaultUserAgentOptions } from "./configurations";
3
+ export interface PreviouslyResolved {
4
+ userAgentAppId: Provider<string | undefined>;
5
+ }
3
6
  export declare const defaultUserAgent: ({
4
7
  serviceId,
5
8
  clientVersion,
6
- }: DefaultUserAgentOptions) => Provider<UserAgent>;
9
+ }: DefaultUserAgentOptions) => (
10
+ config: PreviouslyResolved
11
+ ) => Promise<UserAgent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-user-agent-browser",
3
- "version": "3.654.0",
3
+ "version": "3.664.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline util-user-agent-browser",
@@ -22,8 +22,8 @@
22
22
  "license": "Apache-2.0",
23
23
  "react-native": "dist-es/index.native.js",
24
24
  "dependencies": {
25
- "@aws-sdk/types": "3.654.0",
26
- "@smithy/types": "^3.4.2",
25
+ "@aws-sdk/types": "3.664.0",
26
+ "@smithy/types": "^3.5.0",
27
27
  "bowser": "^2.11.0",
28
28
  "tslib": "^2.6.2"
29
29
  },