@conform-ed/contracts 0.0.13 → 0.0.15
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/.turbo/turbo-format.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +182 -182
- package/package.json +4 -4
- package/src/adapter.ts +1 -1
- package/src/caliper/v1_2/caliper_v1p2_bootcamp_schema.ts +6 -6
- package/src/caliper/v1_2/shared.ts +2 -2
- package/src/case/v1_1/case_v1p1_openapi3_restbinding_schema.ts +1 -0
- package/src/case/v1_1/index.ts +41 -41
- package/src/cat/v1_0/index.ts +39 -39
- package/src/cat/v1_0/shared.ts +1 -1
- package/src/clr/v2_0/shared.ts +19 -17
- package/src/cmi5/v1_0/index.ts +19 -19
- package/src/common-cartridge/v1_3/ccv1p3_imscp_v1p2_v1p0.ts +3 -3
- package/src/common-cartridge/v1_3/ccv1p3_lomccltilink_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_qtiasiv1p2p1_v1p0.ts +16 -13
- package/src/common-cartridge/v1_3/index.ts +3 -3
- package/src/common-cartridge/v1_3/lom-internal.ts +19 -19
- package/src/common-cartridge/v1_3/shared.ts +1 -1
- package/src/common-cartridge/v1_4/core/ccv1p4_imscp_v1p2_v1p0.ts +6 -6
- package/src/common-cartridge/v1_4/core/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/core/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/extension/ccv1p4_cpextensionv1p2_v1p0.ts +1 -0
- package/src/common-cartridge/v1_4/index.ts +5 -5
- package/src/common-cartridge/v1_4/k12/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/k12/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/lom-internal.ts +30 -27
- package/src/common-cartridge/v1_4/shared/ccv1p4_lomccltilink_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/shared/ccv1p4_qtiasiv1p2p1_v1p0.ts +16 -13
- package/src/common-cartridge/v1_4/shared.ts +1 -1
- package/src/common-cartridge/v1_4/thin/ccv1p4_imscp_v1p2_v1p0.ts +5 -5
- package/src/common-cartridge/v1_4/thin/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/thin/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/vdex/imsmd_loose_v1p3p2.ts +2 -1
- package/src/common-cartridge/v1_4/vdex/imsvdex_v1p0.ts +1 -1
- package/src/config.ts +3 -3
- package/src/h5p/v1/content.ts +1 -0
- package/src/h5p/v1/h5p-json.ts +4 -3
- package/src/h5p/v1/index.ts +21 -21
- package/src/h5p/v1/library-json.ts +2 -1
- package/src/lti/ags/v2_0/index.ts +12 -12
- package/src/lti/deep-linking/v2_0/index.ts +10 -10
- package/src/lti/index.ts +2 -2
- package/src/lti/nrps/v2_0/index.ts +10 -10
- package/src/lti/proctoring/v1_0/index.ts +11 -11
- package/src/lti/v1_3/index.ts +17 -17
- package/src/oneroster/v1_2/index.ts +45 -45
- package/src/oneroster/v1_2/or_v1p2_gradebook_restbinding_schema.ts +3 -3
- package/src/oneroster/v1_2/or_v1p2_resource_restbinding_schema.ts +1 -1
- package/src/oneroster/v1_2/or_v1p2_rostering_restbinding_schema.ts +1 -1
- package/src/oneroster/v1_2/or_v1p2_rostering_service_schema.ts +1 -1
- package/src/open-badges/v3_0/shared.ts +31 -29
- package/src/qti/v2-internal.ts +12 -11
- package/src/qti/v3_0_1/assessment-internal.ts +198 -178
- package/src/qti/v3_0_1/imsqti_asiv3p0p1_v1p0.ts +4 -4
- package/src/qti/v3_0_1/imsqti_itemv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_metadatav3p0_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_responseprocessingv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_resultv3p0_v1p0.ts +4 -3
- package/src/qti/v3_0_1/imsqti_sectionv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_stimulusv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_testv3p0p1_v1p0.ts +2 -2
- package/src/qti/v3_0_1/imsqti_usagedatav3p0_v1p0.ts +1 -1
- package/src/qti/v3_0_1/processing-internal.ts +33 -33
- package/src/qti/v3_0_1/shared.ts +2 -2
- package/src/vc-data-model/v2_0/shared.ts +4 -4
- package/src/xapi/shared.ts +11 -14
- package/src/xapi/v1_0_3/index.ts +54 -54
- package/src/xapi/v2_0/index.ts +56 -56
- package/test/caliper-v1_2.test.ts +1 -1
- package/test/cat-v1_0.test.ts +1 -0
- package/test/cmi5-v1_0.test.ts +33 -31
- package/test/contracts.test.ts +1 -0
- package/test/h5p-v1.test.ts +1 -0
- package/test/lti.test.ts +1 -0
- package/test/qti-v3_0_1.test.ts +1 -0
- package/test/schema-examples.test.ts +1 -0
- package/test/xapi.test.ts +1 -0
package/src/xapi/v2_0/index.ts
CHANGED
|
@@ -118,63 +118,63 @@ export const XapiMultipartRequestV2Schema = strictObject({
|
|
|
118
118
|
]),
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
export
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
121
|
+
export const XapiV2_0 = {
|
|
122
|
+
Schemas: {
|
|
123
|
+
AgentAccount: AgentAccountSchema,
|
|
124
|
+
Agent: AgentSchema,
|
|
125
|
+
Group: GroupSchema,
|
|
126
|
+
Person: PersonSchema,
|
|
127
|
+
Verb: VerbSchema,
|
|
128
|
+
InteractionComponent: InteractionComponentSchema,
|
|
129
|
+
Activity: ActivitySchema,
|
|
130
|
+
StatementRef: StatementRefSchema,
|
|
131
|
+
ContextAgent: ContextAgentSchema,
|
|
132
|
+
ContextGroup: ContextGroupSchema,
|
|
133
|
+
SubStatement: SubStatementV2Schema,
|
|
134
|
+
Score: ScoreSchema,
|
|
135
|
+
Result: ResultSchema,
|
|
136
|
+
ContextActivities: ContextActivitiesSchema,
|
|
137
|
+
Context: ContextV2Schema,
|
|
138
|
+
Attachment: AttachmentSchema,
|
|
139
|
+
StatementObject: StatementObjectV2Schema,
|
|
140
|
+
Statement: StatementV2Schema,
|
|
141
|
+
StatementSubmission: StatementSubmissionV2Schema,
|
|
142
|
+
StatementResult: StatementResultV2Schema,
|
|
143
|
+
AboutResource: AboutResourceSchema,
|
|
144
|
+
StatementsQuery: StatementsQuerySchema,
|
|
145
|
+
AgentsResourceQuery: AgentsResourceQuerySchema,
|
|
146
|
+
ActivitiesResourceQuery: ActivitiesResourceQuerySchema,
|
|
147
|
+
StateDocumentQuery: StateDocumentQuerySchema,
|
|
148
|
+
StateDocumentListingQuery: StateDocumentListingQuerySchema,
|
|
149
|
+
AgentProfileDocumentQuery: AgentProfileDocumentQuerySchema,
|
|
150
|
+
AgentProfileDocumentListingQuery: AgentProfileDocumentListingQuerySchema,
|
|
151
|
+
ActivityProfileDocumentQuery: ActivityProfileDocumentQuerySchema,
|
|
152
|
+
ActivityProfileDocumentListingQuery: ActivityProfileDocumentListingQuerySchema,
|
|
153
|
+
XapiDocument: XapiDocumentSchema,
|
|
154
|
+
XapiDocumentIdList: XapiDocumentIdListSchema,
|
|
155
|
+
HttpMethod: XapiHttpMethodSchema,
|
|
156
|
+
Resource: XapiResourceSchema,
|
|
157
|
+
RequestHeader: XapiRequestHeaderSchema,
|
|
158
|
+
ResponseHeader: XapiResponseHeaderSchema,
|
|
159
|
+
ErrorCode: XapiErrorCodeSchema,
|
|
160
|
+
ErrorResponse: XapiErrorResponseSchema,
|
|
161
|
+
Concurrency: XapiConcurrencySchema,
|
|
162
|
+
MultipartAttachmentPart: XapiMultipartAttachmentPartSchema,
|
|
163
|
+
MultipartRequest: XapiMultipartRequestV2Schema,
|
|
164
|
+
},
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
}
|
|
166
|
+
Shared: {
|
|
167
|
+
Uuid: UuidSchema,
|
|
168
|
+
Version: XapiVersionSchema,
|
|
169
|
+
Iri: IriSchema,
|
|
170
|
+
LanguageTag: LanguageTagSchema,
|
|
171
|
+
LanguageMap: LanguageMapSchema,
|
|
172
|
+
Timestamp: Iso8601TimestampSchema,
|
|
173
|
+
Duration: Iso8601DurationSchema,
|
|
174
|
+
NonEmptyString: NonEmptyStringSchema,
|
|
175
|
+
InteractionType: InteractionTypeSchema,
|
|
176
|
+
},
|
|
177
|
+
} as const;
|
|
178
178
|
|
|
179
179
|
export type XapiV2_0Schemas = typeof XapiV2_0.Schemas;
|
|
180
180
|
|
|
@@ -264,7 +264,7 @@ test("Caliper12DerivedZodTemplates exposes key Caliper entry points and conforma
|
|
|
264
264
|
expect(CaliperV1_2.Caliper12DerivedZodTemplates.systemIdentifier).toBe(CaliperV1_2.SystemIdentifierSchema);
|
|
265
265
|
expect(CaliperV1_2.Caliper12DerivedZodTemplates.jsonSchemaEntryPoints.Action).toBe(CaliperV1_2.ActionSchema);
|
|
266
266
|
const annotationRule =
|
|
267
|
-
CaliperV1_2.Caliper12DerivedZodTemplates.conformance.supportedTextualEventRules
|
|
267
|
+
CaliperV1_2.Caliper12DerivedZodTemplates.conformance.supportedTextualEventRules["AnnotationEvent"];
|
|
268
268
|
expect(annotationRule).toBeDefined();
|
|
269
269
|
expect(annotationRule?.profile).toBe("AnnotationProfile");
|
|
270
270
|
});
|
package/test/cat-v1_0.test.ts
CHANGED
package/test/cmi5-v1_0.test.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
1
2
|
import { readFileSync } from "node:fs";
|
|
2
3
|
import { resolve } from "node:path";
|
|
3
|
-
|
|
4
|
+
|
|
4
5
|
import { XMLParser } from "fast-xml-parser";
|
|
6
|
+
|
|
5
7
|
import { Cmi5V1_0 } from "@conform-ed/contracts";
|
|
6
8
|
|
|
7
9
|
const parser = new XMLParser({
|
|
@@ -31,18 +33,18 @@ function readString(record: Record<string, unknown>, key: string): string | unde
|
|
|
31
33
|
function normalizeTextBlock(block: unknown): { langstrings: Array<{ lang?: string; value: string }> } {
|
|
32
34
|
const record = (block ?? {}) as Record<string, unknown>;
|
|
33
35
|
return {
|
|
34
|
-
langstrings: asArray(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
),
|
|
36
|
+
langstrings: asArray(
|
|
37
|
+
record["langstring"] as Record<string, unknown> | Array<Record<string, unknown>> | undefined,
|
|
38
|
+
).map((langstring) => ({
|
|
39
|
+
...(typeof langstring["@_lang"] === "string" ? { lang: langstring["@_lang"] } : {}),
|
|
40
|
+
value: normalizeText(typeof langstring["#text"] === "string" ? langstring["#text"] : undefined),
|
|
41
|
+
})),
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
function normalizeObjectives(value: unknown): Array<{ idref: string }> {
|
|
44
46
|
const record = (value ?? {}) as Record<string, unknown>;
|
|
45
|
-
return asArray(record
|
|
47
|
+
return asArray(record["objective"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map(
|
|
46
48
|
(objective) => ({
|
|
47
49
|
idref: readString(objective, "@_idref") ?? "",
|
|
48
50
|
}),
|
|
@@ -56,15 +58,15 @@ function normalizeKeywordReferences(value: unknown): Array<{ idref: string }> {
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
function normalizeCourseItem(item: Record<string, unknown>): unknown {
|
|
59
|
-
if (typeof item
|
|
61
|
+
if (typeof item["url"] === "string") {
|
|
60
62
|
return {
|
|
61
63
|
id: readString(item, "@_id") ?? "",
|
|
62
|
-
title: normalizeTextBlock(item
|
|
63
|
-
description: normalizeTextBlock(item
|
|
64
|
-
objectives: item
|
|
65
|
-
url: item
|
|
66
|
-
launchParameters: typeof item
|
|
67
|
-
entitlementKey: typeof item
|
|
64
|
+
title: normalizeTextBlock(item["title"]),
|
|
65
|
+
description: normalizeTextBlock(item["description"]),
|
|
66
|
+
objectives: item["objectives"] ? normalizeObjectives(item["objectives"]) : undefined,
|
|
67
|
+
url: item["url"],
|
|
68
|
+
launchParameters: typeof item["launchParameters"] === "string" ? item["launchParameters"] : undefined,
|
|
69
|
+
entitlementKey: typeof item["entitlementKey"] === "string" ? item["entitlementKey"] : undefined,
|
|
68
70
|
moveOn: typeof item["@_moveOn"] === "string" ? item["@_moveOn"] : undefined,
|
|
69
71
|
masteryScore: typeof item["@_masteryScore"] === "string" ? Number(item["@_masteryScore"]) : undefined,
|
|
70
72
|
launchMethod: typeof item["@_launchMethod"] === "string" ? item["@_launchMethod"] : undefined,
|
|
@@ -75,14 +77,14 @@ function normalizeCourseItem(item: Record<string, unknown>): unknown {
|
|
|
75
77
|
|
|
76
78
|
return {
|
|
77
79
|
id: readString(item, "@_id") ?? "",
|
|
78
|
-
title: normalizeTextBlock(item
|
|
79
|
-
description: normalizeTextBlock(item
|
|
80
|
-
objectives: item
|
|
80
|
+
title: normalizeTextBlock(item["title"]),
|
|
81
|
+
description: normalizeTextBlock(item["description"]),
|
|
82
|
+
objectives: item["objectives"] ? normalizeObjectives(item["objectives"]) : undefined,
|
|
81
83
|
children: [
|
|
82
|
-
...asArray(item
|
|
84
|
+
...asArray(item["au"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((au) =>
|
|
83
85
|
normalizeCourseItem(au),
|
|
84
86
|
),
|
|
85
|
-
...asArray(item
|
|
87
|
+
...asArray(item["block"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((block) =>
|
|
86
88
|
normalizeCourseItem(block),
|
|
87
89
|
),
|
|
88
90
|
],
|
|
@@ -102,7 +104,7 @@ function normalizeKeywordSet(value: unknown): {
|
|
|
102
104
|
(keyword) => ({
|
|
103
105
|
id: readString(keyword, "@_id") ?? "",
|
|
104
106
|
title: normalizeTextBlock(keyword["kw:title"]),
|
|
105
|
-
|
|
107
|
+
...(keyword["kw:description"] ? { description: normalizeTextBlock(keyword["kw:description"]) } : {}),
|
|
106
108
|
}),
|
|
107
109
|
),
|
|
108
110
|
};
|
|
@@ -110,26 +112,26 @@ function normalizeKeywordSet(value: unknown): {
|
|
|
110
112
|
|
|
111
113
|
function normalizeDocument(xml: string): unknown {
|
|
112
114
|
const parsed = parser.parse(xml) as Record<string, unknown>;
|
|
113
|
-
const root = (parsed
|
|
115
|
+
const root = (parsed["courseStructure"] ?? {}) as Record<string, unknown>;
|
|
114
116
|
return {
|
|
115
117
|
courseStructure: {
|
|
116
118
|
course: {
|
|
117
|
-
id: readString((root
|
|
118
|
-
title: normalizeTextBlock(((root
|
|
119
|
-
description: normalizeTextBlock(((root
|
|
119
|
+
id: readString((root["course"] as Record<string, unknown>) ?? {}, "@_id") ?? "",
|
|
120
|
+
title: normalizeTextBlock(((root["course"] as Record<string, unknown>) ?? {})["title"]),
|
|
121
|
+
description: normalizeTextBlock(((root["course"] as Record<string, unknown>) ?? {})["description"]),
|
|
120
122
|
},
|
|
121
|
-
objectives: root
|
|
122
|
-
? asArray((root
|
|
123
|
+
objectives: root["objectives"]
|
|
124
|
+
? asArray((root["objectives"] as Record<string, unknown>)["objective"]).map((objective) => ({
|
|
123
125
|
id: readString(objective as Record<string, unknown>, "@_id") ?? "",
|
|
124
|
-
title: normalizeTextBlock((objective as Record<string, unknown>)
|
|
125
|
-
description: normalizeTextBlock((objective as Record<string, unknown>)
|
|
126
|
+
title: normalizeTextBlock((objective as Record<string, unknown>)["title"]),
|
|
127
|
+
description: normalizeTextBlock((objective as Record<string, unknown>)["description"]),
|
|
126
128
|
}))
|
|
127
129
|
: undefined,
|
|
128
130
|
children: [
|
|
129
|
-
...asArray(root
|
|
131
|
+
...asArray(root["au"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((au) =>
|
|
130
132
|
normalizeCourseItem(au),
|
|
131
133
|
),
|
|
132
|
-
...asArray(root
|
|
134
|
+
...asArray(root["block"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((block) =>
|
|
133
135
|
normalizeCourseItem(block),
|
|
134
136
|
),
|
|
135
137
|
],
|
package/test/contracts.test.ts
CHANGED
package/test/h5p-v1.test.ts
CHANGED
package/test/lti.test.ts
CHANGED
package/test/qti-v3_0_1.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expect, test } from "bun:test";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
+
|
|
4
5
|
import { AdapterProfileSchema } from "../src/adapter";
|
|
5
6
|
import { RunnerConfigSchema } from "../src/config";
|
|
6
7
|
import { RequirementTraceSchema, RunMetadataSchema, RunnerSummarySchema } from "../src/summary";
|