@oxy.so/telemetry 0.1.0 → 0.1.1
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/README.md +3 -4
- package/dist/cjs/browser.js +3 -2
- package/dist/esm/browser.js +3 -2
- package/package.json +7 -1
- package/src/browser.ts +3 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Framework-agnostic primitives for anonymous, real-time Oxy activity telemetry.
|
|
|
4
4
|
The package has no runtime dependencies and does not import Express, Socket.IO,
|
|
5
5
|
Redis, React, React Native or Expo.
|
|
6
6
|
|
|
7
|
-
Version: `0.1.
|
|
7
|
+
Version: `0.1.1`.
|
|
8
8
|
|
|
9
9
|
## Entry points
|
|
10
10
|
|
|
@@ -90,9 +90,8 @@ replace their local validation and bucketing logic with
|
|
|
90
90
|
re-export: consumers move imports directly to the new owner, then the old
|
|
91
91
|
private implementations are deleted in the same integration change.
|
|
92
92
|
|
|
93
|
-
The central API uses the server entry point
|
|
94
|
-
|
|
95
|
-
can migrate without a broken registry dependency.
|
|
93
|
+
The central API uses the server entry point. Core retains deprecated compatibility
|
|
94
|
+
exports while applications migrate their direct imports.
|
|
96
95
|
|
|
97
96
|
## Collector, realtime and reconnect
|
|
98
97
|
|
package/dist/cjs/browser.js
CHANGED
|
@@ -28,8 +28,9 @@ function createBrowserTelemetry(options = {}) {
|
|
|
28
28
|
let activityIdCreatedAt = 0;
|
|
29
29
|
let edgePopPromise = null;
|
|
30
30
|
const getActivityIdHeader = () => {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const hasInjectedBrowser = Boolean(options.location);
|
|
32
|
+
const hasBrowserRuntime = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
33
|
+
if (!hasInjectedBrowser && !hasBrowserRuntime)
|
|
33
34
|
return {};
|
|
34
35
|
const now = (options.now ?? Date.now)();
|
|
35
36
|
if (!activityId || now < activityIdCreatedAt || now - activityIdCreatedAt >= (options.activityIdRotationMs ?? exports.DEFAULT_ACTIVITY_ID_ROTATION_MS)) {
|
package/dist/esm/browser.js
CHANGED
|
@@ -24,8 +24,9 @@ export function createBrowserTelemetry(options = {}) {
|
|
|
24
24
|
let activityIdCreatedAt = 0;
|
|
25
25
|
let edgePopPromise = null;
|
|
26
26
|
const getActivityIdHeader = () => {
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const hasInjectedBrowser = Boolean(options.location);
|
|
28
|
+
const hasBrowserRuntime = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
29
|
+
if (!hasInjectedBrowser && !hasBrowserRuntime)
|
|
29
30
|
return {};
|
|
30
31
|
const now = (options.now ?? Date.now)();
|
|
31
32
|
if (!activityId || now < activityIdCreatedAt || now - activityIdCreatedAt >= (options.activityIdRotationMs ?? DEFAULT_ACTIVITY_ID_ROTATION_MS)) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/telemetry",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Framework-agnostic anonymous activity telemetry primitives for Oxy services.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
9
|
+
"typesVersions": {
|
|
10
|
+
"*": {
|
|
11
|
+
"browser": ["dist/types/browser.d.ts"],
|
|
12
|
+
"server": ["dist/types/server.d.ts"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
9
15
|
"sideEffects": false,
|
|
10
16
|
"publishConfig": {
|
|
11
17
|
"access": "public"
|
package/src/browser.ts
CHANGED
|
@@ -47,8 +47,9 @@ export function createBrowserTelemetry(options: BrowserTelemetryOptions = {}): B
|
|
|
47
47
|
let edgePopPromise: Promise<string | null> | null = null;
|
|
48
48
|
|
|
49
49
|
const getActivityIdHeader = (): Record<string, string> => {
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const hasInjectedBrowser = Boolean(options.location);
|
|
51
|
+
const hasBrowserRuntime = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
52
|
+
if (!hasInjectedBrowser && !hasBrowserRuntime) return {};
|
|
52
53
|
const now = (options.now ?? Date.now)();
|
|
53
54
|
if (!activityId || now < activityIdCreatedAt || now - activityIdCreatedAt >= (options.activityIdRotationMs ?? DEFAULT_ACTIVITY_ID_ROTATION_MS)) {
|
|
54
55
|
activityId = createUuid(options.crypto ?? globalThis.crypto);
|