@newrelic/video-core 5.0.0 → 5.0.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 +63 -0
- package/__mock__.js +8 -4
- package/dist/cjs/browser/index.js +1 -1
- package/dist/cjs/browser/index.js.LICENSE.txt +1 -1
- package/dist/cjs/browser/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.LICENSE.txt +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/vega/index.js +1 -1
- package/dist/cjs/vega/index.js.LICENSE.txt +1 -1
- package/dist/cjs/vega/index.js.map +1 -1
- package/dist/esm/browser/index.js +1 -1
- package/dist/esm/browser/index.js.LICENSE.txt +1 -1
- package/dist/esm/browser/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.LICENSE.txt +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/vega/index.js +1 -1
- package/dist/esm/vega/index.js.LICENSE.txt +1 -1
- package/dist/esm/vega/index.js.map +1 -1
- package/dist/umd/nrvideo.min.js +1 -1
- package/dist/umd/nrvideo.min.js.LICENSE.txt +1 -1
- package/dist/umd/nrvideo.min.js.map +1 -1
- package/package.json +2 -1
- package/src/connectedDevice/connectedDeviceConstants.js +10 -19
- package/src/connectedDevice/connectedDeviceHarvester.js +6 -14
- package/src/videoConfiguration.js +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/video-core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "New Relic video tracking core library",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@semantic-release/release-notes-generator": "^13.0.0",
|
|
57
57
|
"babel-jest": "^30.0.0",
|
|
58
58
|
"babel-loader": "^9.1.3",
|
|
59
|
+
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
59
60
|
"diff": "^5.0.0",
|
|
60
61
|
"jest": "^30.2.0",
|
|
61
62
|
"jest-environment-jsdom": "^30.2.0",
|
|
@@ -6,25 +6,16 @@
|
|
|
6
6
|
// Only `connectedDeviceHarvester.js` imports these — browser builds
|
|
7
7
|
// never reference this file, keeping the browser bundle lean.
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"https://
|
|
18
|
-
|
|
19
|
-
/** FedRAMP/GOV mobile collector base URL. Required for US government accounts. */
|
|
20
|
-
export const MOBILE_ENDPOINT_GOV = "https://gov-mobile-collector.newrelic.com/mobile";
|
|
21
|
-
|
|
22
|
-
/** Endpoint region selector. Each value routes to its regional collector. */
|
|
23
|
-
export const NR_ENDPOINT = {
|
|
24
|
-
US: "US",
|
|
25
|
-
EU: "EU",
|
|
26
|
-
STAGING: "staging",
|
|
27
|
-
GOV: "GOV",
|
|
9
|
+
/**
|
|
10
|
+
* Maps region key (lowercase) directly to the regional mobile collector base URL.
|
|
11
|
+
* Accepts global.region.key values: us, eu, gov, jp, staging.
|
|
12
|
+
*/
|
|
13
|
+
export const ENDPOINT_URL = {
|
|
14
|
+
us: "https://mobile-collector.newrelic.com/mobile",
|
|
15
|
+
eu: "https://mobile-collector.eu01.nr-data.net/mobile",
|
|
16
|
+
staging: "https://staging-mobile-collector.newrelic.com/mobile",
|
|
17
|
+
gov: "https://gov-mobile-collector.newrelic.com/mobile",
|
|
18
|
+
jp: "https://mobile-collector.jp.nr-data.net/mobile",
|
|
28
19
|
};
|
|
29
20
|
|
|
30
21
|
/** Default harvest cadence in ms. */
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { NrVideoEventAggregator } from "../eventAggregator";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
MOBILE_ENDPOINT_EU,
|
|
5
|
-
MOBILE_ENDPOINT_GOV,
|
|
6
|
-
STAGING_MOBILE_ENDPOINT,
|
|
7
|
-
NR_ENDPOINT,
|
|
3
|
+
ENDPOINT_URL,
|
|
8
4
|
DEFAULT_HARVEST_TIME,
|
|
9
5
|
DEFAULT_BUFFER_SIZE,
|
|
10
6
|
CD_DATA_TOKENS_PAYLOAD,
|
|
@@ -60,13 +56,14 @@ export default class ConnectedDeviceHarvester {
|
|
|
60
56
|
if (!applicationToken) {
|
|
61
57
|
throw new Error("applicationToken is required");
|
|
62
58
|
}
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
const normalizedEndpoint = endpoint?.toLowerCase();
|
|
60
|
+
if (!(normalizedEndpoint in ENDPOINT_URL)) {
|
|
61
|
+
throw new Error("Invalid endpoint");
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
this.accountId = accountId;
|
|
68
65
|
this.applicationToken = applicationToken;
|
|
69
|
-
this.endpoint =
|
|
66
|
+
this.endpoint = normalizedEndpoint;
|
|
70
67
|
this.harvestInterval = DEFAULT_HARVEST_TIME;
|
|
71
68
|
this.maxBufferSize = DEFAULT_BUFFER_SIZE;
|
|
72
69
|
|
|
@@ -136,12 +133,7 @@ export default class ConnectedDeviceHarvester {
|
|
|
136
133
|
* @returns {string}
|
|
137
134
|
*/
|
|
138
135
|
getEndpointBaseUrl() {
|
|
139
|
-
|
|
140
|
-
case NR_ENDPOINT.EU: return MOBILE_ENDPOINT_EU;
|
|
141
|
-
case NR_ENDPOINT.STAGING: return STAGING_MOBILE_ENDPOINT;
|
|
142
|
-
case NR_ENDPOINT.GOV: return MOBILE_ENDPOINT_GOV;
|
|
143
|
-
default: return MOBILE_ENDPOINT_US;
|
|
144
|
-
}
|
|
136
|
+
return ENDPOINT_URL[this.endpoint] ?? ENDPOINT_URL.us;
|
|
145
137
|
}
|
|
146
138
|
|
|
147
139
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Log from "./log";
|
|
2
2
|
import Constants from "./constants";
|
|
3
|
+
import { ENDPOINT_URL } from "./connectedDevice/connectedDeviceConstants";
|
|
3
4
|
|
|
4
5
|
const { COLLECTOR } = Constants;
|
|
5
6
|
|
|
@@ -44,8 +45,8 @@ class VideoConfiguration {
|
|
|
44
45
|
Log.error("applicationToken is required");
|
|
45
46
|
return false;
|
|
46
47
|
}
|
|
47
|
-
if (!
|
|
48
|
-
Log.error("Invalid endpoint (must be
|
|
48
|
+
if (!(info.endpoint?.toLowerCase() in ENDPOINT_URL)) {
|
|
49
|
+
Log.error("Invalid endpoint (must be us, eu, staging, gov, or jp)");
|
|
49
50
|
return false;
|
|
50
51
|
}
|
|
51
52
|
return true;
|
|
@@ -176,7 +177,7 @@ class VideoConfiguration {
|
|
|
176
177
|
info: {
|
|
177
178
|
accountId: userInfo.accountId,
|
|
178
179
|
applicationToken: userInfo.applicationToken,
|
|
179
|
-
endpoint: userInfo.endpoint,
|
|
180
|
+
endpoint: userInfo.endpoint?.toLowerCase(),
|
|
180
181
|
...(userInfo.appName ? { appName: userInfo.appName } : {}),
|
|
181
182
|
...(userInfo.applicationID ? { applicationID: userInfo.applicationID } : {}),
|
|
182
183
|
...(userInfo.deviceInfo ? { deviceInfo: userInfo.deviceInfo } : {}),
|