@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.
Files changed (80) hide show
  1. package/.turbo/turbo-format.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +182 -182
  4. package/package.json +4 -4
  5. package/src/adapter.ts +1 -1
  6. package/src/caliper/v1_2/caliper_v1p2_bootcamp_schema.ts +6 -6
  7. package/src/caliper/v1_2/shared.ts +2 -2
  8. package/src/case/v1_1/case_v1p1_openapi3_restbinding_schema.ts +1 -0
  9. package/src/case/v1_1/index.ts +41 -41
  10. package/src/cat/v1_0/index.ts +39 -39
  11. package/src/cat/v1_0/shared.ts +1 -1
  12. package/src/clr/v2_0/shared.ts +19 -17
  13. package/src/cmi5/v1_0/index.ts +19 -19
  14. package/src/common-cartridge/v1_3/ccv1p3_imscp_v1p2_v1p0.ts +3 -3
  15. package/src/common-cartridge/v1_3/ccv1p3_lomccltilink_v1p0.ts +2 -1
  16. package/src/common-cartridge/v1_3/ccv1p3_lommanifest_v1p0.ts +2 -1
  17. package/src/common-cartridge/v1_3/ccv1p3_lomresource_v1p0.ts +2 -1
  18. package/src/common-cartridge/v1_3/ccv1p3_qtiasiv1p2p1_v1p0.ts +16 -13
  19. package/src/common-cartridge/v1_3/index.ts +3 -3
  20. package/src/common-cartridge/v1_3/lom-internal.ts +19 -19
  21. package/src/common-cartridge/v1_3/shared.ts +1 -1
  22. package/src/common-cartridge/v1_4/core/ccv1p4_imscp_v1p2_v1p0.ts +6 -6
  23. package/src/common-cartridge/v1_4/core/ccv1p4_lommanifest_v1p0.ts +2 -1
  24. package/src/common-cartridge/v1_4/core/ccv1p4_lomresource_v1p0.ts +2 -1
  25. package/src/common-cartridge/v1_4/extension/ccv1p4_cpextensionv1p2_v1p0.ts +1 -0
  26. package/src/common-cartridge/v1_4/index.ts +5 -5
  27. package/src/common-cartridge/v1_4/k12/ccv1p4_lommanifest_v1p0.ts +2 -1
  28. package/src/common-cartridge/v1_4/k12/ccv1p4_lomresource_v1p0.ts +2 -1
  29. package/src/common-cartridge/v1_4/lom-internal.ts +30 -27
  30. package/src/common-cartridge/v1_4/shared/ccv1p4_lomccltilink_v1p0.ts +2 -1
  31. package/src/common-cartridge/v1_4/shared/ccv1p4_qtiasiv1p2p1_v1p0.ts +16 -13
  32. package/src/common-cartridge/v1_4/shared.ts +1 -1
  33. package/src/common-cartridge/v1_4/thin/ccv1p4_imscp_v1p2_v1p0.ts +5 -5
  34. package/src/common-cartridge/v1_4/thin/ccv1p4_lommanifest_v1p0.ts +2 -1
  35. package/src/common-cartridge/v1_4/thin/ccv1p4_lomresource_v1p0.ts +2 -1
  36. package/src/common-cartridge/v1_4/vdex/imsmd_loose_v1p3p2.ts +2 -1
  37. package/src/common-cartridge/v1_4/vdex/imsvdex_v1p0.ts +1 -1
  38. package/src/config.ts +3 -3
  39. package/src/h5p/v1/content.ts +1 -0
  40. package/src/h5p/v1/h5p-json.ts +4 -3
  41. package/src/h5p/v1/index.ts +21 -21
  42. package/src/h5p/v1/library-json.ts +2 -1
  43. package/src/lti/ags/v2_0/index.ts +12 -12
  44. package/src/lti/deep-linking/v2_0/index.ts +10 -10
  45. package/src/lti/index.ts +2 -2
  46. package/src/lti/nrps/v2_0/index.ts +10 -10
  47. package/src/lti/proctoring/v1_0/index.ts +11 -11
  48. package/src/lti/v1_3/index.ts +17 -17
  49. package/src/oneroster/v1_2/index.ts +45 -45
  50. package/src/oneroster/v1_2/or_v1p2_gradebook_restbinding_schema.ts +3 -3
  51. package/src/oneroster/v1_2/or_v1p2_resource_restbinding_schema.ts +1 -1
  52. package/src/oneroster/v1_2/or_v1p2_rostering_restbinding_schema.ts +1 -1
  53. package/src/oneroster/v1_2/or_v1p2_rostering_service_schema.ts +1 -1
  54. package/src/open-badges/v3_0/shared.ts +31 -29
  55. package/src/qti/v2-internal.ts +12 -11
  56. package/src/qti/v3_0_1/assessment-internal.ts +198 -178
  57. package/src/qti/v3_0_1/imsqti_asiv3p0p1_v1p0.ts +4 -4
  58. package/src/qti/v3_0_1/imsqti_itemv3p0p1_v1p0.ts +1 -1
  59. package/src/qti/v3_0_1/imsqti_metadatav3p0_v1p0.ts +1 -1
  60. package/src/qti/v3_0_1/imsqti_responseprocessingv3p0p1_v1p0.ts +1 -1
  61. package/src/qti/v3_0_1/imsqti_resultv3p0_v1p0.ts +4 -3
  62. package/src/qti/v3_0_1/imsqti_sectionv3p0p1_v1p0.ts +1 -1
  63. package/src/qti/v3_0_1/imsqti_stimulusv3p0p1_v1p0.ts +1 -1
  64. package/src/qti/v3_0_1/imsqti_testv3p0p1_v1p0.ts +2 -2
  65. package/src/qti/v3_0_1/imsqti_usagedatav3p0_v1p0.ts +1 -1
  66. package/src/qti/v3_0_1/processing-internal.ts +33 -33
  67. package/src/qti/v3_0_1/shared.ts +2 -2
  68. package/src/vc-data-model/v2_0/shared.ts +4 -4
  69. package/src/xapi/shared.ts +11 -14
  70. package/src/xapi/v1_0_3/index.ts +54 -54
  71. package/src/xapi/v2_0/index.ts +56 -56
  72. package/test/caliper-v1_2.test.ts +1 -1
  73. package/test/cat-v1_0.test.ts +1 -0
  74. package/test/cmi5-v1_0.test.ts +33 -31
  75. package/test/contracts.test.ts +1 -0
  76. package/test/h5p-v1.test.ts +1 -0
  77. package/test/lti.test.ts +1 -0
  78. package/test/qti-v3_0_1.test.ts +1 -0
  79. package/test/schema-examples.test.ts +1 -0
  80. package/test/xapi.test.ts +1 -0
@@ -118,63 +118,63 @@ export const XapiMultipartRequestV2Schema = strictObject({
118
118
  ]),
119
119
  });
120
120
 
121
- export namespace XapiV2_0 {
122
- export namespace Schemas {
123
- export const AgentAccount = AgentAccountSchema;
124
- export const Agent = AgentSchema;
125
- export const Group = GroupSchema;
126
- export const Person = PersonSchema;
127
- export const Verb = VerbSchema;
128
- export const InteractionComponent = InteractionComponentSchema;
129
- export const Activity = ActivitySchema;
130
- export const StatementRef = StatementRefSchema;
131
- export const ContextAgent = ContextAgentSchema;
132
- export const ContextGroup = ContextGroupSchema;
133
- export const SubStatement = SubStatementV2Schema;
134
- export const Score = ScoreSchema;
135
- export const Result = ResultSchema;
136
- export const ContextActivities = ContextActivitiesSchema;
137
- export const Context = ContextV2Schema;
138
- export const Attachment = AttachmentSchema;
139
- export const StatementObject = StatementObjectV2Schema;
140
- export const Statement = StatementV2Schema;
141
- export const StatementSubmission = StatementSubmissionV2Schema;
142
- export const StatementResult = StatementResultV2Schema;
143
- export const AboutResource = AboutResourceSchema;
144
- export const StatementsQuery = StatementsQuerySchema;
145
- export const AgentsResourceQuery = AgentsResourceQuerySchema;
146
- export const ActivitiesResourceQuery = ActivitiesResourceQuerySchema;
147
- export const StateDocumentQuery = StateDocumentQuerySchema;
148
- export const StateDocumentListingQuery = StateDocumentListingQuerySchema;
149
- export const AgentProfileDocumentQuery = AgentProfileDocumentQuerySchema;
150
- export const AgentProfileDocumentListingQuery = AgentProfileDocumentListingQuerySchema;
151
- export const ActivityProfileDocumentQuery = ActivityProfileDocumentQuerySchema;
152
- export const ActivityProfileDocumentListingQuery = ActivityProfileDocumentListingQuerySchema;
153
- export const XapiDocument = XapiDocumentSchema;
154
- export const XapiDocumentIdList = XapiDocumentIdListSchema;
155
- export const HttpMethod = XapiHttpMethodSchema;
156
- export const Resource = XapiResourceSchema;
157
- export const RequestHeader = XapiRequestHeaderSchema;
158
- export const ResponseHeader = XapiResponseHeaderSchema;
159
- export const ErrorCode = XapiErrorCodeSchema;
160
- export const ErrorResponse = XapiErrorResponseSchema;
161
- export const Concurrency = XapiConcurrencySchema;
162
- export const MultipartAttachmentPart = XapiMultipartAttachmentPartSchema;
163
- export const MultipartRequest = XapiMultipartRequestV2Schema;
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
- export namespace Shared {
167
- export const Uuid = UuidSchema;
168
- export const Version = XapiVersionSchema;
169
- export const Iri = IriSchema;
170
- export const LanguageTag = LanguageTagSchema;
171
- export const LanguageMap = LanguageMapSchema;
172
- export const Timestamp = Iso8601TimestampSchema;
173
- export const Duration = Iso8601DurationSchema;
174
- export const NonEmptyString = NonEmptyStringSchema;
175
- export const InteractionType = InteractionTypeSchema;
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.AnnotationEvent;
267
+ CaliperV1_2.Caliper12DerivedZodTemplates.conformance.supportedTextualEventRules["AnnotationEvent"];
268
268
  expect(annotationRule).toBeDefined();
269
269
  expect(annotationRule?.profile).toBe("AnnotationProfile");
270
270
  });
@@ -1,4 +1,5 @@
1
1
  import { describe, it, expect } from "bun:test";
2
+
2
3
  import { CatV1_0 } from "../src/cat/v1_0/index";
3
4
 
4
5
  describe("CAT v1.0 Zod Schemas", () => {
@@ -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
- import { expect, test } from "bun:test";
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(record.langstring as Record<string, unknown> | Array<Record<string, unknown>> | undefined).map(
35
- (langstring) => ({
36
- lang: typeof langstring["@_lang"] === "string" ? langstring["@_lang"] : undefined,
37
- value: normalizeText(typeof langstring["#text"] === "string" ? langstring["#text"] : undefined),
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.objective as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map(
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.url === "string") {
61
+ if (typeof item["url"] === "string") {
60
62
  return {
61
63
  id: readString(item, "@_id") ?? "",
62
- title: normalizeTextBlock(item.title),
63
- description: normalizeTextBlock(item.description),
64
- objectives: item.objectives ? normalizeObjectives(item.objectives) : undefined,
65
- url: item.url,
66
- launchParameters: typeof item.launchParameters === "string" ? item.launchParameters : undefined,
67
- entitlementKey: typeof item.entitlementKey === "string" ? item.entitlementKey : undefined,
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.title),
79
- description: normalizeTextBlock(item.description),
80
- objectives: item.objectives ? normalizeObjectives(item.objectives) : undefined,
80
+ title: normalizeTextBlock(item["title"]),
81
+ description: normalizeTextBlock(item["description"]),
82
+ objectives: item["objectives"] ? normalizeObjectives(item["objectives"]) : undefined,
81
83
  children: [
82
- ...asArray(item.au as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((au) =>
84
+ ...asArray(item["au"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((au) =>
83
85
  normalizeCourseItem(au),
84
86
  ),
85
- ...asArray(item.block as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((block) =>
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
- description: keyword["kw:description"] ? normalizeTextBlock(keyword["kw:description"]) : undefined,
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.courseStructure ?? {}) as Record<string, unknown>;
115
+ const root = (parsed["courseStructure"] ?? {}) as Record<string, unknown>;
114
116
  return {
115
117
  courseStructure: {
116
118
  course: {
117
- id: readString((root.course as Record<string, unknown>) ?? {}, "@_id") ?? "",
118
- title: normalizeTextBlock(((root.course as Record<string, unknown>) ?? {}).title),
119
- description: normalizeTextBlock(((root.course as Record<string, unknown>) ?? {}).description),
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.objectives
122
- ? asArray((root.objectives as Record<string, unknown>).objective).map((objective) => ({
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>).title),
125
- description: normalizeTextBlock((objective as Record<string, unknown>).description),
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.au as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((au) =>
131
+ ...asArray(root["au"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((au) =>
130
132
  normalizeCourseItem(au),
131
133
  ),
132
- ...asArray(root.block as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((block) =>
134
+ ...asArray(root["block"] as Array<Record<string, unknown>> | Record<string, unknown> | undefined).map((block) =>
133
135
  normalizeCourseItem(block),
134
136
  ),
135
137
  ],
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from "bun:test";
2
+
2
3
  import { AdapterCapabilitySchema, AdapterErrorSchema, AdapterProfileSchema } from "../src/adapter";
3
4
  import { RunnerConfigSchema } from "../src/config";
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from "bun:test";
2
+
2
3
  import { H5pV1 } from "@conform-ed/contracts";
3
4
 
4
5
  // --- PackageManifest (h5p.json) ---
package/test/lti.test.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from "bun:test";
2
+
2
3
  import { LtiAgsV2_0, LtiDeepLinkingV2_0, LtiNrpsV2_0, LtiProctoringV1_0, LtiV1_3 } from "@conform-ed/contracts";
3
4
 
4
5
  test("LTI core launch schema accepts a normalized resource link launch", () => {
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from "bun:test";
2
+
2
3
  import {
3
4
  Qti301DerivedZodTemplates,
4
5
  QtiAccessForAllPnpDocumentSchema,
@@ -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";
package/test/xapi.test.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from "bun:test";
2
+
2
3
  import { XapiV1_0_3, XapiV2_0 } from "@conform-ed/contracts";
3
4
 
4
5
  const attachmentSha2 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";