@lessonkit/core 0.3.0 → 0.3.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/dist/index.cjs CHANGED
@@ -25,6 +25,8 @@ __export(index_exports, {
25
25
  nowIso: () => nowIso
26
26
  });
27
27
  module.exports = __toCommonJS(index_exports);
28
+
29
+ // src/trackingClient.ts
28
30
  function createTrackingClient(opts) {
29
31
  const sink = opts?.sink;
30
32
  const batchSink = opts?.batchSink;
@@ -75,6 +77,7 @@ function createTrackingClient(opts) {
75
77
  });
76
78
  };
77
79
  intervalId = flushIntervalMs > 0 ? globalThis.setInterval(flush, flushIntervalMs) : void 0;
80
+ intervalId?.unref?.();
78
81
  return {
79
82
  track: (event) => {
80
83
  if (disposed) return;
@@ -93,14 +96,18 @@ function createTrackingClient(opts) {
93
96
  }
94
97
  };
95
98
  }
96
- function nowIso() {
97
- return (/* @__PURE__ */ new Date()).toISOString();
98
- }
99
+
100
+ // src/ids.ts
99
101
  function createSessionId() {
100
102
  const g = globalThis;
101
103
  if (g.crypto?.randomUUID) return g.crypto.randomUUID();
102
104
  return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
103
105
  }
106
+
107
+ // src/time.ts
108
+ function nowIso() {
109
+ return (/* @__PURE__ */ new Date()).toISOString();
110
+ }
104
111
  // Annotate the CommonJS export names for ESM import in node:
105
112
  0 && (module.exports = {
106
113
  createSessionId,
package/dist/index.d.cts CHANGED
@@ -24,6 +24,7 @@ type TrackingClient = {
24
24
  flush?: () => void;
25
25
  dispose?: () => void;
26
26
  };
27
+
27
28
  declare function createTrackingClient(opts?: {
28
29
  sink?: TelemetrySink;
29
30
  batch?: {
@@ -33,7 +34,9 @@ declare function createTrackingClient(opts?: {
33
34
  };
34
35
  batchSink?: TelemetryBatchSink;
35
36
  }): TrackingClient;
36
- declare function nowIso(): string;
37
+
37
38
  declare function createSessionId(): string;
38
39
 
40
+ declare function nowIso(): string;
41
+
39
42
  export { type CourseId, type LessonId, type TelemetryBatchSink, type TelemetryEvent, type TelemetryEventName, type TelemetrySink, type TelemetryUser, type TrackingClient, createSessionId, createTrackingClient, nowIso };
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ type TrackingClient = {
24
24
  flush?: () => void;
25
25
  dispose?: () => void;
26
26
  };
27
+
27
28
  declare function createTrackingClient(opts?: {
28
29
  sink?: TelemetrySink;
29
30
  batch?: {
@@ -33,7 +34,9 @@ declare function createTrackingClient(opts?: {
33
34
  };
34
35
  batchSink?: TelemetryBatchSink;
35
36
  }): TrackingClient;
36
- declare function nowIso(): string;
37
+
37
38
  declare function createSessionId(): string;
38
39
 
40
+ declare function nowIso(): string;
41
+
39
42
  export { type CourseId, type LessonId, type TelemetryBatchSink, type TelemetryEvent, type TelemetryEventName, type TelemetrySink, type TelemetryUser, type TrackingClient, createSessionId, createTrackingClient, nowIso };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/index.ts
1
+ // src/trackingClient.ts
2
2
  function createTrackingClient(opts) {
3
3
  const sink = opts?.sink;
4
4
  const batchSink = opts?.batchSink;
@@ -49,6 +49,7 @@ function createTrackingClient(opts) {
49
49
  });
50
50
  };
51
51
  intervalId = flushIntervalMs > 0 ? globalThis.setInterval(flush, flushIntervalMs) : void 0;
52
+ intervalId?.unref?.();
52
53
  return {
53
54
  track: (event) => {
54
55
  if (disposed) return;
@@ -67,14 +68,18 @@ function createTrackingClient(opts) {
67
68
  }
68
69
  };
69
70
  }
70
- function nowIso() {
71
- return (/* @__PURE__ */ new Date()).toISOString();
72
- }
71
+
72
+ // src/ids.ts
73
73
  function createSessionId() {
74
74
  const g = globalThis;
75
75
  if (g.crypto?.randomUUID) return g.crypto.randomUUID();
76
76
  return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
77
77
  }
78
+
79
+ // src/time.ts
80
+ function nowIso() {
81
+ return (/* @__PURE__ */ new Date()).toISOString();
82
+ }
78
83
  export {
79
84
  createSessionId,
80
85
  createTrackingClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lessonkit/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "description": "Shared types and telemetry primitives for LessonKit.",
6
6
  "license": "Apache-2.0",