@lessonkit/core 0.1.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/README.md +15 -0
- package/dist/index.cjs +42 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +16 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `@lessonkit/core`
|
|
2
|
+
|
|
3
|
+
Core types and runtime primitives shared across LessonKit packages.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lessonkit/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What’s inside (0.1.x)
|
|
12
|
+
|
|
13
|
+
- Telemetry event types (`TelemetryEvent`)
|
|
14
|
+
- A minimal tracking client (`createTrackingClient`)
|
|
15
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
createTrackingClient: () => createTrackingClient,
|
|
24
|
+
nowIso: () => nowIso
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
function createTrackingClient(opts) {
|
|
28
|
+
const sink = opts?.sink;
|
|
29
|
+
return {
|
|
30
|
+
track: (event) => {
|
|
31
|
+
void sink?.(event);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function nowIso() {
|
|
36
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
createTrackingClient,
|
|
41
|
+
nowIso
|
|
42
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type CourseId = string;
|
|
2
|
+
type LessonId = string;
|
|
3
|
+
type TelemetryEventName = "course_started" | "course_completed" | "lesson_started" | "lesson_completed" | "quiz_answered" | "quiz_completed" | "interaction";
|
|
4
|
+
type TelemetryEvent = {
|
|
5
|
+
name: TelemetryEventName;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
courseId?: CourseId;
|
|
8
|
+
lessonId?: LessonId;
|
|
9
|
+
data?: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
type TelemetrySink = (event: TelemetryEvent) => void | Promise<void>;
|
|
12
|
+
type TrackingClient = {
|
|
13
|
+
track: (event: TelemetryEvent) => void;
|
|
14
|
+
};
|
|
15
|
+
declare function createTrackingClient(opts?: {
|
|
16
|
+
sink?: TelemetrySink;
|
|
17
|
+
}): TrackingClient;
|
|
18
|
+
declare function nowIso(): string;
|
|
19
|
+
|
|
20
|
+
export { type CourseId, type LessonId, type TelemetryEvent, type TelemetryEventName, type TelemetrySink, type TrackingClient, createTrackingClient, nowIso };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type CourseId = string;
|
|
2
|
+
type LessonId = string;
|
|
3
|
+
type TelemetryEventName = "course_started" | "course_completed" | "lesson_started" | "lesson_completed" | "quiz_answered" | "quiz_completed" | "interaction";
|
|
4
|
+
type TelemetryEvent = {
|
|
5
|
+
name: TelemetryEventName;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
courseId?: CourseId;
|
|
8
|
+
lessonId?: LessonId;
|
|
9
|
+
data?: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
type TelemetrySink = (event: TelemetryEvent) => void | Promise<void>;
|
|
12
|
+
type TrackingClient = {
|
|
13
|
+
track: (event: TelemetryEvent) => void;
|
|
14
|
+
};
|
|
15
|
+
declare function createTrackingClient(opts?: {
|
|
16
|
+
sink?: TelemetrySink;
|
|
17
|
+
}): TrackingClient;
|
|
18
|
+
declare function nowIso(): string;
|
|
19
|
+
|
|
20
|
+
export { type CourseId, type LessonId, type TelemetryEvent, type TelemetryEventName, type TelemetrySink, type TrackingClient, createTrackingClient, nowIso };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
function createTrackingClient(opts) {
|
|
3
|
+
const sink = opts?.sink;
|
|
4
|
+
return {
|
|
5
|
+
track: (event) => {
|
|
6
|
+
void sink?.(event);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function nowIso() {
|
|
11
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
createTrackingClient,
|
|
15
|
+
nowIso
|
|
16
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lessonkit/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Shared types and telemetry primitives for LessonKit.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/eddiethedean/lessonkit.git",
|
|
10
|
+
"directory": "packages/core"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/eddiethedean/lessonkit",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/eddiethedean/lessonkit/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"lessonkit",
|
|
18
|
+
"telemetry",
|
|
19
|
+
"analytics",
|
|
20
|
+
"learning",
|
|
21
|
+
"training"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
39
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
40
|
+
"prepublishOnly": "npm run build",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
42
|
+
"test": "vitest run --passWithNoTests",
|
|
43
|
+
"lint": "echo \"(no lint configured yet)\""
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"tsup": "^8.5.0",
|
|
47
|
+
"typescript": "^5.8.3",
|
|
48
|
+
"vitest": "^3.2.4"
|
|
49
|
+
}
|
|
50
|
+
}
|