@intellectif/lk-core 0.2.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/LICENSE +21 -0
- package/dist/activity-D5tqgx8A.d.cts +330 -0
- package/dist/activity-D5tqgx8A.d.ts +330 -0
- package/dist/chunk-2T3IL7VL.js +147 -0
- package/dist/chunk-2T3IL7VL.js.map +1 -0
- package/dist/chunk-3JMLUUFS.cjs +124 -0
- package/dist/chunk-3JMLUUFS.cjs.map +1 -0
- package/dist/chunk-6VOCV4EX.js +25 -0
- package/dist/chunk-6VOCV4EX.js.map +1 -0
- package/dist/chunk-DCDOTQNH.cjs +147 -0
- package/dist/chunk-DCDOTQNH.cjs.map +1 -0
- package/dist/chunk-DV466SBJ.cjs +25 -0
- package/dist/chunk-DV466SBJ.cjs.map +1 -0
- package/dist/chunk-GZ73G2TS.js +124 -0
- package/dist/chunk-GZ73G2TS.js.map +1 -0
- package/dist/chunk-PJFDAP54.cjs +188 -0
- package/dist/chunk-PJFDAP54.cjs.map +1 -0
- package/dist/chunk-ZHOX6TO4.js +188 -0
- package/dist/chunk-ZHOX6TO4.js.map +1 -0
- package/dist/index.cjs +45 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.cjs +23 -0
- package/dist/schemas.cjs.map +1 -0
- package/dist/schemas.d.cts +179 -0
- package/dist/schemas.d.ts +179 -0
- package/dist/schemas.js +23 -0
- package/dist/schemas.js.map +1 -0
- package/dist/scoring.cjs +10 -0
- package/dist/scoring.cjs.map +1 -0
- package/dist/scoring.d.cts +20 -0
- package/dist/scoring.d.ts +20 -0
- package/dist/scoring.js +10 -0
- package/dist/scoring.js.map +1 -0
- package/dist/xapi.cjs +14 -0
- package/dist/xapi.cjs.map +1 -0
- package/dist/xapi.d.cts +88 -0
- package/dist/xapi.d.ts +88 -0
- package/dist/xapi.js +14 -0
- package/dist/xapi.js.map +1 -0
- package/package.json +50 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computePassThreshold,
|
|
3
|
+
score
|
|
4
|
+
} from "./chunk-GZ73G2TS.js";
|
|
5
|
+
import {
|
|
6
|
+
XAPIVerb,
|
|
7
|
+
XAPI_VERB_DISPLAY,
|
|
8
|
+
validateXAPIStatement,
|
|
9
|
+
xAPIBuilder
|
|
10
|
+
} from "./chunk-ZHOX6TO4.js";
|
|
11
|
+
import {
|
|
12
|
+
ActivitySchemaError,
|
|
13
|
+
UnknownActivityTypeError
|
|
14
|
+
} from "./chunk-6VOCV4EX.js";
|
|
15
|
+
import {
|
|
16
|
+
BlankConfigSchema,
|
|
17
|
+
FeedbackSchema,
|
|
18
|
+
FillInTheBlanksDataSchema,
|
|
19
|
+
MediaSchema,
|
|
20
|
+
MultipleChoiceDataSchema,
|
|
21
|
+
MultipleChoiceOptionSchema,
|
|
22
|
+
fillInTheBlanksJsonSchema,
|
|
23
|
+
multipleChoiceJsonSchema,
|
|
24
|
+
validateActivity
|
|
25
|
+
} from "./chunk-2T3IL7VL.js";
|
|
26
|
+
export {
|
|
27
|
+
ActivitySchemaError,
|
|
28
|
+
BlankConfigSchema,
|
|
29
|
+
FeedbackSchema,
|
|
30
|
+
FillInTheBlanksDataSchema,
|
|
31
|
+
MediaSchema,
|
|
32
|
+
MultipleChoiceDataSchema,
|
|
33
|
+
MultipleChoiceOptionSchema,
|
|
34
|
+
UnknownActivityTypeError,
|
|
35
|
+
XAPIVerb,
|
|
36
|
+
XAPI_VERB_DISPLAY,
|
|
37
|
+
computePassThreshold,
|
|
38
|
+
fillInTheBlanksJsonSchema,
|
|
39
|
+
multipleChoiceJsonSchema,
|
|
40
|
+
score,
|
|
41
|
+
validateActivity,
|
|
42
|
+
validateXAPIStatement,
|
|
43
|
+
xAPIBuilder
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/schemas.cjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkDCDOTQNHcjs = require('./chunk-DCDOTQNH.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.BlankConfigSchema = _chunkDCDOTQNHcjs.BlankConfigSchema; exports.FeedbackSchema = _chunkDCDOTQNHcjs.FeedbackSchema; exports.FillInTheBlanksDataSchema = _chunkDCDOTQNHcjs.FillInTheBlanksDataSchema; exports.MediaSchema = _chunkDCDOTQNHcjs.MediaSchema; exports.MultipleChoiceDataSchema = _chunkDCDOTQNHcjs.MultipleChoiceDataSchema; exports.MultipleChoiceOptionSchema = _chunkDCDOTQNHcjs.MultipleChoiceOptionSchema; exports.fillInTheBlanksJsonSchema = _chunkDCDOTQNHcjs.fillInTheBlanksJsonSchema; exports.multipleChoiceJsonSchema = _chunkDCDOTQNHcjs.multipleChoiceJsonSchema; exports.validateActivity = _chunkDCDOTQNHcjs.validateActivity;
|
|
23
|
+
//# sourceMappingURL=schemas.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["c:\\Users\\onecu\\Documents\\Intellectif\\IT-for-Intellectif\\learning-kit\\packages\\lk-core\\dist\\schemas.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,koBAAC","file":"C:\\Users\\onecu\\Documents\\Intellectif\\IT-for-Intellectif\\learning-kit\\packages\\lk-core\\dist\\schemas.cjs"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { e as ActivityType, j as ValidationResult, a as ActivityDataMap } from './activity-D5tqgx8A.cjs';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Optional authored "overall feedback" shown after submission, selected by
|
|
6
|
+
* whether the learner passed (h5p-style overall feedback). Both fields are
|
|
7
|
+
* optional; non-empty when present.
|
|
8
|
+
*/
|
|
9
|
+
declare const FeedbackSchema: z.ZodObject<{
|
|
10
|
+
correct: z.ZodOptional<z.ZodString>;
|
|
11
|
+
incorrect: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
|
|
14
|
+
/** Zod schema for a single fill-in-the-blank slot configuration. */
|
|
15
|
+
declare const BlankConfigSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
acceptedAnswers: z.ZodArray<z.ZodString>;
|
|
18
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
trimWhitespace: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
21
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
/**
|
|
24
|
+
* Zod schema validating the full Fill-in-the-Blanks activity data contract.
|
|
25
|
+
*
|
|
26
|
+
* The refinement enforces a bijection between `{{id}}` placeholders in the
|
|
27
|
+
* passage and `blanks[].id`; otherwise a blank could never be rendered, or a
|
|
28
|
+
* placeholder could have no scoring config, yielding undefined behaviour.
|
|
29
|
+
*/
|
|
30
|
+
declare const FillInTheBlanksDataSchema: z.ZodObject<{
|
|
31
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
32
|
+
type: z.ZodLiteral<"fill-in-the-blanks">;
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
title: z.ZodString;
|
|
35
|
+
passage: z.ZodString;
|
|
36
|
+
blanks: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
acceptedAnswers: z.ZodArray<z.ZodString>;
|
|
39
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
trimWhitespace: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
42
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
scoringStrategy: z.ZodEnum<{
|
|
45
|
+
"all-or-nothing": "all-or-nothing";
|
|
46
|
+
partial: "partial";
|
|
47
|
+
}>;
|
|
48
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
type: z.ZodEnum<{
|
|
50
|
+
image: "image";
|
|
51
|
+
audio: "audio";
|
|
52
|
+
video: "video";
|
|
53
|
+
embed: "embed";
|
|
54
|
+
}>;
|
|
55
|
+
url: z.ZodURL;
|
|
56
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
57
|
+
captionsUrl: z.ZodOptional<z.ZodURL>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
correct: z.ZodOptional<z.ZodString>;
|
|
61
|
+
incorrect: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
passThreshold: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
65
|
+
learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* JSON Schema (Draft 7) representation of the Multiple Choice activity data
|
|
71
|
+
* contract, generated natively by Zod 4. Draft 7 is mandated by Requirement
|
|
72
|
+
* 2.2 for the widest AI-prompt / OpenAPI tooling compatibility. The semantic
|
|
73
|
+
* `.refine()` guards are not representable in JSON Schema and are
|
|
74
|
+
* intentionally omitted — the export captures the *structural* contract only.
|
|
75
|
+
*/
|
|
76
|
+
declare const multipleChoiceJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
77
|
+
/**
|
|
78
|
+
* JSON Schema (Draft 7) representation of the Fill-in-the-Blanks activity data
|
|
79
|
+
* contract, generated natively by Zod 4. Structural contract only (semantic
|
|
80
|
+
* `.refine()` guards are Zod-only and not representable in JSON Schema).
|
|
81
|
+
*/
|
|
82
|
+
declare const fillInTheBlanksJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Optional media attached to an activity, rendered above the question or
|
|
86
|
+
* passage — e.g. a recording to listen to, or an embedded video to watch
|
|
87
|
+
* before answering. URL-only by design: hosting/delivery (S3/CDN, or the
|
|
88
|
+
* provider's own embed for `embed`) is the consuming app's responsibility
|
|
89
|
+
* (see requirements "Non-Goals and Shared Responsibility").
|
|
90
|
+
*
|
|
91
|
+
* - `image`: rendered as `<img>` — `alt` is REQUIRED (WCAG 1.1.1 / Req 14.5).
|
|
92
|
+
* - `audio` / `video`: rendered with native controls; `alt` is an optional
|
|
93
|
+
* accessible label; `captionsUrl` points at a WebVTT `<track>`. `url` must
|
|
94
|
+
* be a direct media file (NOT a YouTube/Vimeo page — use `embed` for those).
|
|
95
|
+
* - `embed`: rendered as a sandboxed `<iframe>` for provider players
|
|
96
|
+
* (YouTube/Vimeo/etc.). `url` MUST be the provider's *embeddable* URL
|
|
97
|
+
* (e.g. `https://www.youtube.com/embed/<id>`). `alt` is REQUIRED and used
|
|
98
|
+
* as the iframe's accessible `title` (WCAG 4.1.2 / 2.4.1).
|
|
99
|
+
*/
|
|
100
|
+
declare const MediaSchema: z.ZodObject<{
|
|
101
|
+
type: z.ZodEnum<{
|
|
102
|
+
image: "image";
|
|
103
|
+
audio: "audio";
|
|
104
|
+
video: "video";
|
|
105
|
+
embed: "embed";
|
|
106
|
+
}>;
|
|
107
|
+
url: z.ZodURL;
|
|
108
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
109
|
+
captionsUrl: z.ZodOptional<z.ZodURL>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
|
|
112
|
+
/** Zod schema for a single Multiple Choice option. */
|
|
113
|
+
declare const MultipleChoiceOptionSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
text: z.ZodString;
|
|
116
|
+
isCorrect: z.ZodBoolean;
|
|
117
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
/**
|
|
120
|
+
* Zod schema validating the full Multiple Choice activity data contract.
|
|
121
|
+
*
|
|
122
|
+
* Two semantic guards: (1) at least one option must be correct, otherwise the
|
|
123
|
+
* activity can never be answered correctly; (2) `mode: 'single'` must have
|
|
124
|
+
* exactly one correct option — multiple correct options under single-select
|
|
125
|
+
* make `showCorrectAnswers` and the xAPI correct-response ambiguous and mask
|
|
126
|
+
* authoring errors. Both are unrepresentable in JSON Schema and are dropped
|
|
127
|
+
* from `toJSONSchema` output by design.
|
|
128
|
+
*/
|
|
129
|
+
declare const MultipleChoiceDataSchema: z.ZodObject<{
|
|
130
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
131
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
title: z.ZodString;
|
|
134
|
+
question: z.ZodString;
|
|
135
|
+
mode: z.ZodEnum<{
|
|
136
|
+
single: "single";
|
|
137
|
+
multi: "multi";
|
|
138
|
+
}>;
|
|
139
|
+
options: z.ZodArray<z.ZodObject<{
|
|
140
|
+
id: z.ZodString;
|
|
141
|
+
text: z.ZodString;
|
|
142
|
+
isCorrect: z.ZodBoolean;
|
|
143
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
scoringStrategy: z.ZodEnum<{
|
|
146
|
+
"all-or-nothing": "all-or-nothing";
|
|
147
|
+
partial: "partial";
|
|
148
|
+
}>;
|
|
149
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
type: z.ZodEnum<{
|
|
151
|
+
image: "image";
|
|
152
|
+
audio: "audio";
|
|
153
|
+
video: "video";
|
|
154
|
+
embed: "embed";
|
|
155
|
+
}>;
|
|
156
|
+
url: z.ZodURL;
|
|
157
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
158
|
+
captionsUrl: z.ZodOptional<z.ZodURL>;
|
|
159
|
+
}, z.core.$strip>>;
|
|
160
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
correct: z.ZodOptional<z.ZodString>;
|
|
162
|
+
incorrect: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
passThreshold: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
shuffle: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
167
|
+
learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Validates raw activity data against the schema for the given activity type.
|
|
173
|
+
*
|
|
174
|
+
* @returns `{ success: true, data }` with the typed, validated data, or
|
|
175
|
+
* `{ success: false, errors }` with one entry per failed constraint.
|
|
176
|
+
*/
|
|
177
|
+
declare function validateActivity<T extends ActivityType>(type: T, data: unknown): ValidationResult<ActivityDataMap[T]>;
|
|
178
|
+
|
|
179
|
+
export { BlankConfigSchema, FeedbackSchema, FillInTheBlanksDataSchema, MediaSchema, MultipleChoiceDataSchema, MultipleChoiceOptionSchema, fillInTheBlanksJsonSchema, multipleChoiceJsonSchema, validateActivity };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { e as ActivityType, j as ValidationResult, a as ActivityDataMap } from './activity-D5tqgx8A.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Optional authored "overall feedback" shown after submission, selected by
|
|
6
|
+
* whether the learner passed (h5p-style overall feedback). Both fields are
|
|
7
|
+
* optional; non-empty when present.
|
|
8
|
+
*/
|
|
9
|
+
declare const FeedbackSchema: z.ZodObject<{
|
|
10
|
+
correct: z.ZodOptional<z.ZodString>;
|
|
11
|
+
incorrect: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
|
|
14
|
+
/** Zod schema for a single fill-in-the-blank slot configuration. */
|
|
15
|
+
declare const BlankConfigSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
acceptedAnswers: z.ZodArray<z.ZodString>;
|
|
18
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
trimWhitespace: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
21
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
/**
|
|
24
|
+
* Zod schema validating the full Fill-in-the-Blanks activity data contract.
|
|
25
|
+
*
|
|
26
|
+
* The refinement enforces a bijection between `{{id}}` placeholders in the
|
|
27
|
+
* passage and `blanks[].id`; otherwise a blank could never be rendered, or a
|
|
28
|
+
* placeholder could have no scoring config, yielding undefined behaviour.
|
|
29
|
+
*/
|
|
30
|
+
declare const FillInTheBlanksDataSchema: z.ZodObject<{
|
|
31
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
32
|
+
type: z.ZodLiteral<"fill-in-the-blanks">;
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
title: z.ZodString;
|
|
35
|
+
passage: z.ZodString;
|
|
36
|
+
blanks: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
acceptedAnswers: z.ZodArray<z.ZodString>;
|
|
39
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
trimWhitespace: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
42
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
scoringStrategy: z.ZodEnum<{
|
|
45
|
+
"all-or-nothing": "all-or-nothing";
|
|
46
|
+
partial: "partial";
|
|
47
|
+
}>;
|
|
48
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
type: z.ZodEnum<{
|
|
50
|
+
image: "image";
|
|
51
|
+
audio: "audio";
|
|
52
|
+
video: "video";
|
|
53
|
+
embed: "embed";
|
|
54
|
+
}>;
|
|
55
|
+
url: z.ZodURL;
|
|
56
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
57
|
+
captionsUrl: z.ZodOptional<z.ZodURL>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
correct: z.ZodOptional<z.ZodString>;
|
|
61
|
+
incorrect: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
passThreshold: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
65
|
+
learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* JSON Schema (Draft 7) representation of the Multiple Choice activity data
|
|
71
|
+
* contract, generated natively by Zod 4. Draft 7 is mandated by Requirement
|
|
72
|
+
* 2.2 for the widest AI-prompt / OpenAPI tooling compatibility. The semantic
|
|
73
|
+
* `.refine()` guards are not representable in JSON Schema and are
|
|
74
|
+
* intentionally omitted — the export captures the *structural* contract only.
|
|
75
|
+
*/
|
|
76
|
+
declare const multipleChoiceJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
77
|
+
/**
|
|
78
|
+
* JSON Schema (Draft 7) representation of the Fill-in-the-Blanks activity data
|
|
79
|
+
* contract, generated natively by Zod 4. Structural contract only (semantic
|
|
80
|
+
* `.refine()` guards are Zod-only and not representable in JSON Schema).
|
|
81
|
+
*/
|
|
82
|
+
declare const fillInTheBlanksJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Optional media attached to an activity, rendered above the question or
|
|
86
|
+
* passage — e.g. a recording to listen to, or an embedded video to watch
|
|
87
|
+
* before answering. URL-only by design: hosting/delivery (S3/CDN, or the
|
|
88
|
+
* provider's own embed for `embed`) is the consuming app's responsibility
|
|
89
|
+
* (see requirements "Non-Goals and Shared Responsibility").
|
|
90
|
+
*
|
|
91
|
+
* - `image`: rendered as `<img>` — `alt` is REQUIRED (WCAG 1.1.1 / Req 14.5).
|
|
92
|
+
* - `audio` / `video`: rendered with native controls; `alt` is an optional
|
|
93
|
+
* accessible label; `captionsUrl` points at a WebVTT `<track>`. `url` must
|
|
94
|
+
* be a direct media file (NOT a YouTube/Vimeo page — use `embed` for those).
|
|
95
|
+
* - `embed`: rendered as a sandboxed `<iframe>` for provider players
|
|
96
|
+
* (YouTube/Vimeo/etc.). `url` MUST be the provider's *embeddable* URL
|
|
97
|
+
* (e.g. `https://www.youtube.com/embed/<id>`). `alt` is REQUIRED and used
|
|
98
|
+
* as the iframe's accessible `title` (WCAG 4.1.2 / 2.4.1).
|
|
99
|
+
*/
|
|
100
|
+
declare const MediaSchema: z.ZodObject<{
|
|
101
|
+
type: z.ZodEnum<{
|
|
102
|
+
image: "image";
|
|
103
|
+
audio: "audio";
|
|
104
|
+
video: "video";
|
|
105
|
+
embed: "embed";
|
|
106
|
+
}>;
|
|
107
|
+
url: z.ZodURL;
|
|
108
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
109
|
+
captionsUrl: z.ZodOptional<z.ZodURL>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
|
|
112
|
+
/** Zod schema for a single Multiple Choice option. */
|
|
113
|
+
declare const MultipleChoiceOptionSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
text: z.ZodString;
|
|
116
|
+
isCorrect: z.ZodBoolean;
|
|
117
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
/**
|
|
120
|
+
* Zod schema validating the full Multiple Choice activity data contract.
|
|
121
|
+
*
|
|
122
|
+
* Two semantic guards: (1) at least one option must be correct, otherwise the
|
|
123
|
+
* activity can never be answered correctly; (2) `mode: 'single'` must have
|
|
124
|
+
* exactly one correct option — multiple correct options under single-select
|
|
125
|
+
* make `showCorrectAnswers` and the xAPI correct-response ambiguous and mask
|
|
126
|
+
* authoring errors. Both are unrepresentable in JSON Schema and are dropped
|
|
127
|
+
* from `toJSONSchema` output by design.
|
|
128
|
+
*/
|
|
129
|
+
declare const MultipleChoiceDataSchema: z.ZodObject<{
|
|
130
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
131
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
title: z.ZodString;
|
|
134
|
+
question: z.ZodString;
|
|
135
|
+
mode: z.ZodEnum<{
|
|
136
|
+
single: "single";
|
|
137
|
+
multi: "multi";
|
|
138
|
+
}>;
|
|
139
|
+
options: z.ZodArray<z.ZodObject<{
|
|
140
|
+
id: z.ZodString;
|
|
141
|
+
text: z.ZodString;
|
|
142
|
+
isCorrect: z.ZodBoolean;
|
|
143
|
+
feedback: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
scoringStrategy: z.ZodEnum<{
|
|
146
|
+
"all-or-nothing": "all-or-nothing";
|
|
147
|
+
partial: "partial";
|
|
148
|
+
}>;
|
|
149
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
type: z.ZodEnum<{
|
|
151
|
+
image: "image";
|
|
152
|
+
audio: "audio";
|
|
153
|
+
video: "video";
|
|
154
|
+
embed: "embed";
|
|
155
|
+
}>;
|
|
156
|
+
url: z.ZodURL;
|
|
157
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
158
|
+
captionsUrl: z.ZodOptional<z.ZodURL>;
|
|
159
|
+
}, z.core.$strip>>;
|
|
160
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
correct: z.ZodOptional<z.ZodString>;
|
|
162
|
+
incorrect: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
passThreshold: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
shuffle: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
167
|
+
learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Validates raw activity data against the schema for the given activity type.
|
|
173
|
+
*
|
|
174
|
+
* @returns `{ success: true, data }` with the typed, validated data, or
|
|
175
|
+
* `{ success: false, errors }` with one entry per failed constraint.
|
|
176
|
+
*/
|
|
177
|
+
declare function validateActivity<T extends ActivityType>(type: T, data: unknown): ValidationResult<ActivityDataMap[T]>;
|
|
178
|
+
|
|
179
|
+
export { BlankConfigSchema, FeedbackSchema, FillInTheBlanksDataSchema, MediaSchema, MultipleChoiceDataSchema, MultipleChoiceOptionSchema, fillInTheBlanksJsonSchema, multipleChoiceJsonSchema, validateActivity };
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BlankConfigSchema,
|
|
3
|
+
FeedbackSchema,
|
|
4
|
+
FillInTheBlanksDataSchema,
|
|
5
|
+
MediaSchema,
|
|
6
|
+
MultipleChoiceDataSchema,
|
|
7
|
+
MultipleChoiceOptionSchema,
|
|
8
|
+
fillInTheBlanksJsonSchema,
|
|
9
|
+
multipleChoiceJsonSchema,
|
|
10
|
+
validateActivity
|
|
11
|
+
} from "./chunk-2T3IL7VL.js";
|
|
12
|
+
export {
|
|
13
|
+
BlankConfigSchema,
|
|
14
|
+
FeedbackSchema,
|
|
15
|
+
FillInTheBlanksDataSchema,
|
|
16
|
+
MediaSchema,
|
|
17
|
+
MultipleChoiceDataSchema,
|
|
18
|
+
MultipleChoiceOptionSchema,
|
|
19
|
+
fillInTheBlanksJsonSchema,
|
|
20
|
+
multipleChoiceJsonSchema,
|
|
21
|
+
validateActivity
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/scoring.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk3JMLUUFScjs = require('./chunk-3JMLUUFS.cjs');
|
|
5
|
+
require('./chunk-DV466SBJ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.computePassThreshold = _chunk3JMLUUFScjs.computePassThreshold; exports.score = _chunk3JMLUUFScjs.score;
|
|
10
|
+
//# sourceMappingURL=scoring.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["c:\\Users\\onecu\\Documents\\Intellectif\\IT-for-Intellectif\\learning-kit\\packages\\lk-core\\dist\\scoring.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,+GAAC","file":"C:\\Users\\onecu\\Documents\\Intellectif\\IT-for-Intellectif\\learning-kit\\packages\\lk-core\\dist\\scoring.cjs"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { A as ActivityData, e as ActivityType, L as LearnerResponse, i as ScoringResult } from './activity-D5tqgx8A.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` iff `score` meets or exceeds the activity's `passThreshold`,
|
|
5
|
+
* defaulting to {@link DEFAULT_PASS_THRESHOLD} when the field is absent.
|
|
6
|
+
*/
|
|
7
|
+
declare function computePassThreshold(activityData: ActivityData, score: number): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Scores a learner response against activity data and returns a full
|
|
10
|
+
* {@link ScoringResult}.
|
|
11
|
+
*
|
|
12
|
+
* Pure and deterministic with no side effects. It does **not** re-validate
|
|
13
|
+
* `activityData` — schema validation is the component boundary's
|
|
14
|
+
* responsibility; this is a low-level scoring primitive that trusts its typed
|
|
15
|
+
* inputs. Dispatches on `activityType`; an unrecognised type throws
|
|
16
|
+
* {@link UnknownActivityTypeError}.
|
|
17
|
+
*/
|
|
18
|
+
declare function score(activityType: ActivityType, activityData: ActivityData, learnerResponse: LearnerResponse): ScoringResult;
|
|
19
|
+
|
|
20
|
+
export { computePassThreshold, score };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { A as ActivityData, e as ActivityType, L as LearnerResponse, i as ScoringResult } from './activity-D5tqgx8A.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` iff `score` meets or exceeds the activity's `passThreshold`,
|
|
5
|
+
* defaulting to {@link DEFAULT_PASS_THRESHOLD} when the field is absent.
|
|
6
|
+
*/
|
|
7
|
+
declare function computePassThreshold(activityData: ActivityData, score: number): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Scores a learner response against activity data and returns a full
|
|
10
|
+
* {@link ScoringResult}.
|
|
11
|
+
*
|
|
12
|
+
* Pure and deterministic with no side effects. It does **not** re-validate
|
|
13
|
+
* `activityData` — schema validation is the component boundary's
|
|
14
|
+
* responsibility; this is a low-level scoring primitive that trusts its typed
|
|
15
|
+
* inputs. Dispatches on `activityType`; an unrecognised type throws
|
|
16
|
+
* {@link UnknownActivityTypeError}.
|
|
17
|
+
*/
|
|
18
|
+
declare function score(activityType: ActivityType, activityData: ActivityData, learnerResponse: LearnerResponse): ScoringResult;
|
|
19
|
+
|
|
20
|
+
export { computePassThreshold, score };
|
package/dist/scoring.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/xapi.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkPJFDAP54cjs = require('./chunk-PJFDAP54.cjs');
|
|
7
|
+
require('./chunk-DV466SBJ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.XAPIVerb = _chunkPJFDAP54cjs.XAPIVerb; exports.XAPI_VERB_DISPLAY = _chunkPJFDAP54cjs.XAPI_VERB_DISPLAY; exports.validateXAPIStatement = _chunkPJFDAP54cjs.validateXAPIStatement; exports.xAPIBuilder = _chunkPJFDAP54cjs.xAPIBuilder;
|
|
14
|
+
//# sourceMappingURL=xapi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["c:\\Users\\onecu\\Documents\\Intellectif\\IT-for-Intellectif\\learning-kit\\packages\\lk-core\\dist\\xapi.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,6OAAC","file":"C:\\Users\\onecu\\Documents\\Intellectif\\IT-for-Intellectif\\learning-kit\\packages\\lk-core\\dist\\xapi.cjs"}
|
package/dist/xapi.d.cts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { X as XAPIActor, i as ScoringResult, l as XAPIContext, o as XAPIResult, q as XAPIStatement } from './activity-D5tqgx8A.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The set of xAPI verbs emitted by SDK activities, keyed by a stable
|
|
5
|
+
* identifier mapped to its canonical xAPI verb IRI (xAPI 1.0.3 / ADL registry).
|
|
6
|
+
*/
|
|
7
|
+
declare const XAPIVerb: {
|
|
8
|
+
readonly ANSWERED: "http://adlnet.gov/expapi/verbs/answered";
|
|
9
|
+
readonly COMPLETED: "http://adlnet.gov/expapi/verbs/completed";
|
|
10
|
+
readonly EXPERIENCED: "http://adlnet.gov/expapi/verbs/experienced";
|
|
11
|
+
readonly INTERACTED: "http://adlnet.gov/expapi/verbs/interacted";
|
|
12
|
+
readonly ATTEMPTED: "http://adlnet.gov/expapi/verbs/attempted";
|
|
13
|
+
readonly PASSED: "http://adlnet.gov/expapi/verbs/passed";
|
|
14
|
+
readonly FAILED: "http://adlnet.gov/expapi/verbs/failed";
|
|
15
|
+
readonly WATCHED: "https://w3id.org/xapi/video/verbs/watched";
|
|
16
|
+
};
|
|
17
|
+
/** Union of the valid `XAPIVerb` keys. */
|
|
18
|
+
type XAPIVerbKey = keyof typeof XAPIVerb;
|
|
19
|
+
/**
|
|
20
|
+
* Default `en-US` display label for each verb, used to populate
|
|
21
|
+
* `XAPIVerbObject.display` when the builder resolves a verb key.
|
|
22
|
+
*/
|
|
23
|
+
declare const XAPI_VERB_DISPLAY: Record<XAPIVerbKey, Record<string, string>>;
|
|
24
|
+
|
|
25
|
+
/** Caller-supplied activity object descriptor (mapped to an xAPI Activity). */
|
|
26
|
+
interface XAPIObjectParams {
|
|
27
|
+
/** Activity IRI. */
|
|
28
|
+
id: string;
|
|
29
|
+
name?: Record<string, string>;
|
|
30
|
+
description?: Record<string, string>;
|
|
31
|
+
/** Activity type IRI. */
|
|
32
|
+
type?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Parameters for the generic {@link xAPIBuilder.buildStatement}. */
|
|
35
|
+
interface XAPIStatementParams {
|
|
36
|
+
actor: XAPIActor;
|
|
37
|
+
verb: XAPIVerbKey;
|
|
38
|
+
object: XAPIObjectParams;
|
|
39
|
+
result?: XAPIResult;
|
|
40
|
+
context?: XAPIContext;
|
|
41
|
+
}
|
|
42
|
+
/** Parameters for {@link xAPIBuilder.buildAnsweredStatement} (verb = ANSWERED). */
|
|
43
|
+
interface AnsweredStatementParams {
|
|
44
|
+
actor: XAPIActor;
|
|
45
|
+
object: XAPIObjectParams;
|
|
46
|
+
scoringResult: ScoringResult;
|
|
47
|
+
timeSpentMs: number;
|
|
48
|
+
/** Serialized learner response string. */
|
|
49
|
+
response?: string;
|
|
50
|
+
context?: XAPIContext;
|
|
51
|
+
resultExtensions?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
/** Parameters for {@link xAPIBuilder.buildCompletedStatement} (verb = COMPLETED). */
|
|
54
|
+
interface CompletedStatementParams {
|
|
55
|
+
actor: XAPIActor;
|
|
56
|
+
object: XAPIObjectParams;
|
|
57
|
+
scoringResult?: ScoringResult;
|
|
58
|
+
timeSpentMs: number;
|
|
59
|
+
context?: XAPIContext;
|
|
60
|
+
resultExtensions?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Constructs xAPI 1.0.3 Statements. Every call stamps a fresh UUID v4 `id`,
|
|
64
|
+
* an ISO 8601 `timestamp`, and `version: '1.0.3'`. Not pure by design —
|
|
65
|
+
* statements are unique events.
|
|
66
|
+
*/
|
|
67
|
+
declare const xAPIBuilder: {
|
|
68
|
+
buildStatement(params: XAPIStatementParams): XAPIStatement;
|
|
69
|
+
buildAnsweredStatement(params: AnsweredStatementParams): XAPIStatement;
|
|
70
|
+
buildCompletedStatement(params: CompletedStatementParams): XAPIStatement;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Validates a constructed {@link XAPIStatement} against the xAPI 1.0.3
|
|
75
|
+
* structural contract.
|
|
76
|
+
*
|
|
77
|
+
* In development a structural failure throws (caught early); in production it
|
|
78
|
+
* logs a warning and returns (the statement is still sent — see the design's
|
|
79
|
+
* Error Handling table). Uses a `zod/v4` schema rather than `ajv` + an
|
|
80
|
+
* external JSON Schema to keep `lk-core` dependency-free.
|
|
81
|
+
*
|
|
82
|
+
* NOTE: `ActivitySchemaError` is reused here per the task spec; its
|
|
83
|
+
* `activityType` field carries the sentinel `'xAPIStatement'`. A dedicated
|
|
84
|
+
* `XAPIValidationError` would be semantically cleaner — flagged for review.
|
|
85
|
+
*/
|
|
86
|
+
declare function validateXAPIStatement(statement: XAPIStatement): void;
|
|
87
|
+
|
|
88
|
+
export { type AnsweredStatementParams, type CompletedStatementParams, type XAPIObjectParams, type XAPIStatementParams, XAPIVerb, type XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder };
|