@conform-ed/contracts 0.0.14 → 0.0.16

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.
@@ -2,4 +2,4 @@ $ oxfmt --config ../../.oxfmtrc.jsonc --check .
2
2
  Checking formatting...
3
3
 
4
4
  All matched files use the correct format.
5
- Finished in 614ms on 188 files using 8 threads.
5
+ Finished in 626ms on 189 files using 8 threads.
@@ -1,3 +1,3 @@
1
1
  $ oxlint --config ../../.oxlintrc.jsonc .
2
2
  Found 0 warnings and 0 errors.
3
- Finished in 1.3s on 169 files with 123 rules using 8 threads.
3
+ Finished in 1.3s on 170 files with 123 rules using 8 threads.
@@ -2,227 +2,232 @@ $ bun test
2
2
  bun test v1.3.14 (0d9b296a)
3
3
 
4
4
  test/xapi.test.ts:
5
- (pass) xAPI 1.0.3 statement schema accepts the core data model [21.30ms]
6
- (pass) xAPI 2.0 statement schema accepts the same core data model [3.60ms]
7
- (pass) xAPI 2.0 statement schema accepts IEEE 2.0 contextAgent/contextGroup objects [8.00ms]
8
- (pass) xAPI statement submission schema accepts batches [0.45ms]
9
- (pass) xAPI document, listing, and about schemas validate LRS metadata [14.35ms]
10
- (pass) xAPI validation rejects statements missing required fields [0.69ms]
11
- (pass) xAPI statement result, person object, and resource queries validate missing spec objects [4.06ms]
12
- (pass) xAPI Agent schema enforces exactly one Inverse Functional Identifier [0.65ms]
13
- (pass) xAPI HTTP method enum validates LRS operations [0.18ms]
14
- (pass) xAPI error response schema validates LRS error payloads [0.93ms]
15
- (pass) xAPI error codes validate standard HTTP status responses [0.43ms]
16
- (pass) xAPI concurrency schema validates ETags and conditional headers [0.72ms]
17
- (pass) xAPI multipart attachment part schema validates attachment data structure [0.26ms]
18
- (pass) xAPI multipart request schema validates statement with attachments [3.02ms]
19
- (pass) xAPI resource schema models LRS endpoint definitions [0.69ms]
20
- (pass) xAPI request and response headers are properly enumerated [0.30ms]
5
+ (pass) xAPI 1.0.3 statement schema accepts the core data model [12.48ms]
6
+ (pass) xAPI 2.0 statement schema accepts the same core data model [2.06ms]
7
+ (pass) xAPI 2.0 statement schema accepts IEEE 2.0 contextAgent/contextGroup objects [7.76ms]
8
+ (pass) xAPI statement submission schema accepts batches [0.41ms]
9
+ (pass) xAPI document, listing, and about schemas validate LRS metadata [3.01ms]
10
+ (pass) xAPI validation rejects statements missing required fields [0.41ms]
11
+ (pass) xAPI statement result, person object, and resource queries validate missing spec objects [2.07ms]
12
+ (pass) xAPI Agent schema enforces exactly one Inverse Functional Identifier [0.45ms]
13
+ (pass) xAPI HTTP method enum validates LRS operations [0.13ms]
14
+ (pass) xAPI error response schema validates LRS error payloads [0.49ms]
15
+ (pass) xAPI error codes validate standard HTTP status responses [0.11ms]
16
+ (pass) xAPI concurrency schema validates ETags and conditional headers [0.40ms]
17
+ (pass) xAPI multipart attachment part schema validates attachment data structure [0.17ms]
18
+ (pass) xAPI multipart request schema validates statement with attachments [0.96ms]
19
+ (pass) xAPI resource schema models LRS endpoint definitions [0.55ms]
20
+ (pass) xAPI request and response headers are properly enumerated [0.16ms]
21
21
 
22
22
  test/cmi5-v1_0.test.ts:
23
- (pass) cmi5 course structure schema parses the simple XML example [7.24ms]
24
- (pass) cmi5 keyword extension schema parses the extended XML example [4.96ms]
25
- (pass) cmi5 recursive course structure schema accepts nested blocks and AUs [1.30ms]
23
+ (pass) cmi5 course structure schema parses the simple XML example [12.71ms]
24
+ (pass) cmi5 keyword extension schema parses the extended XML example [3.36ms]
25
+ (pass) cmi5 recursive course structure schema accepts nested blocks and AUs [0.86ms]
26
26
 
27
27
  test/oneroster-v1_2.test.ts:
28
- (pass) UserSchema parses a minimal OneRoster user [4.29ms]
29
- (pass) LineItemSchema parses a minimal gradebook line item [2.44ms]
30
- (pass) ResourceSchema parses a minimal resource entry [1.37ms]
31
- (pass) ImsxStatusInfoSchema parses a OneRoster status envelope [1.08ms]
32
- (pass) EnrollmentRoleSchema accepts extension values and rejects unknown built-ins [0.23ms]
33
- (pass) ClassSchema requires at least one term reference [1.56ms]
28
+ (pass) UserSchema parses a minimal OneRoster user [2.98ms]
29
+ (pass) LineItemSchema parses a minimal gradebook line item [1.23ms]
30
+ (pass) ResourceSchema parses a minimal resource entry [0.73ms]
31
+ (pass) ImsxStatusInfoSchema parses a OneRoster status envelope [0.88ms]
32
+ (pass) EnrollmentRoleSchema accepts extension values and rejects unknown built-ins [0.19ms]
33
+ (pass) ClassSchema requires at least one term reference [1.28ms]
34
34
  (pass) OneRoster12DerivedZodTemplates exposes core published entry points [0.06ms]
35
35
  (pass) OneRoster REST binding operation catalogs expose all endpoint schemas [0.06ms]
36
36
  (pass) Gradebook operation bindings expose request/response payload schemas [0.04ms]
37
- (pass) ManifestCsvRowSchema accepts either starred or unstarred optional file keys [1.71ms]
38
- (pass) UsersCsvRowSchema validates required OneRoster 1.2 user CSV columns [1.09ms]
39
- (pass) OneRosterCsvBindingPackageSchema validates package-level CSV document sets [1.76ms]
37
+ (pass) ManifestCsvRowSchema accepts either starred or unstarred optional file keys [1.66ms]
38
+ (pass) UsersCsvRowSchema validates required OneRoster 1.2 user CSV columns [1.05ms]
39
+ (pass) OneRosterCsvBindingPackageSchema validates package-level CSV document sets [1.50ms]
40
40
 
41
41
  test/qti-v2_1.test.ts:
42
- (pass) QtiV2_1 metadata document parses a minimal metadata payload [0.85ms]
43
- (pass) QtiV2_1 assessment item document parses a minimal choice item [14.43ms]
44
- (pass) QtiV2_1 result document rejects record responses without field identifiers [1.75ms]
45
- (pass) QtiV2_1 manifest document parses a minimal package [2.87ms]
46
- (pass) QtiV2_1 APIP accessibility document parses a minimal payload [1.87ms]
42
+ (pass) QtiV2_1 metadata document parses a minimal metadata payload [0.76ms]
43
+ (pass) QtiV2_1 assessment item document parses a minimal choice item [10.66ms]
44
+ (pass) QtiV2_1 result document rejects record responses without field identifiers [2.08ms]
45
+ (pass) QtiV2_1 manifest document parses a minimal package [1.38ms]
46
+ (pass) QtiV2_1 APIP accessibility document parses a minimal payload [1.47ms]
47
47
 
48
48
  test/qti-v3_0_1.test.ts:
49
- (pass) QtiMetadataDocumentSchema parses a minimal metadata document [1.50ms]
50
- (pass) QtiAccessForAllPnpDocumentSchema parses a minimal preferences document [5.64ms]
51
- (pass) QtiAssessmentResultDocumentSchema parses a minimal result report [3.17ms]
52
- (pass) QtiAssessmentResultDocumentSchema rejects record response values without field identifiers [0.27ms]
53
- (pass) QtiAssessmentResultDocumentSchema rejects record outcomes with baseType [0.92ms]
54
- (pass) QtiUsageDataDocumentSchema parses ordinary and categorized statistics [4.88ms]
55
- (pass) QtiUsageDataDocumentSchema rejects invalid objectType and mapping bounds [0.83ms]
56
- (pass) QtiResponseProcessingDocumentSchema parses typed processing operators [15.79ms]
57
- (pass) QtiOutcomeProcessingDocumentSchema parses typed aggregate operators [22.86ms]
58
- (pass) QtiResponseProcessingDocumentSchema rejects invalid operator parameters [5.40ms]
59
- (pass) QtiOutcomeProcessingDocumentSchema rejects invalid operator arity and ranges [2.87ms]
60
- (pass) QtiAssessmentSectionDocumentSchema parses a minimal standalone section [3.35ms]
61
- (pass) QtiAssessmentStimulusDocumentSchema parses a minimal stimulus [2.25ms]
62
- (pass) QtiOutcomeDeclarationDocumentSchema parses a minimal outcome declaration [1.09ms]
63
- (pass) QtiAsiProfileDocumentSchema accepts resource-specific QTI documents [1.71ms]
64
- (pass) QtiAssessmentItemDocumentSchema parses a minimal choice item [52.00ms]
65
- (pass) QtiAssessmentItemDocumentSchema rejects incompatible response declarations [4.98ms]
66
- (pass) QtiAssessmentTestDocumentSchema parses a minimal test document [5.04ms]
67
- (pass) Qti301DerivedZodTemplates exposes expected document templates [0.11ms]
68
- (pass) QTI barrel exports prefixed XML extension node helpers [0.77ms]
69
- (pass) built-in outcome completionStatus needs no declaration in processing rules [0.48ms]
70
- (pass) an integer SCORE is accepted — the official corpus ships it [0.22ms]
71
- (pass) a non-numeric or multiple SCORE is still rejected [0.43ms]
72
- (pass) snake_case completion_status is accepted as the built-in's corpus alias [0.58ms]
73
- (pass) maxChoices 0 means unbounded and never conflicts with minChoices [0.79ms]
49
+ (pass) QtiMetadataDocumentSchema parses a minimal metadata document [2.27ms]
50
+ (pass) QtiAccessForAllPnpDocumentSchema parses a minimal preferences document [2.56ms]
51
+ (pass) QtiAssessmentResultDocumentSchema parses a minimal result report [2.56ms]
52
+ (pass) QtiAssessmentResultDocumentSchema rejects record response values without field identifiers [0.23ms]
53
+ (pass) QtiAssessmentResultDocumentSchema rejects record outcomes with baseType [0.56ms]
54
+ (pass) QtiUsageDataDocumentSchema parses ordinary and categorized statistics [2.61ms]
55
+ (pass) QtiUsageDataDocumentSchema rejects invalid objectType and mapping bounds [0.41ms]
56
+ (pass) QtiResponseProcessingDocumentSchema parses typed processing operators [12.29ms]
57
+ (pass) QtiOutcomeProcessingDocumentSchema parses typed aggregate operators [7.14ms]
58
+ (pass) QtiResponseProcessingDocumentSchema rejects invalid operator parameters [2.60ms]
59
+ (pass) QtiOutcomeProcessingDocumentSchema rejects invalid operator arity and ranges [1.83ms]
60
+ (pass) QtiAssessmentSectionDocumentSchema parses a minimal standalone section [2.78ms]
61
+ (pass) QtiAssessmentStimulusDocumentSchema parses a minimal stimulus [1.75ms]
62
+ (pass) QtiOutcomeDeclarationDocumentSchema parses a minimal outcome declaration [0.91ms]
63
+ (pass) QtiAsiProfileDocumentSchema accepts resource-specific QTI documents [1.18ms]
64
+ (pass) QtiAssessmentItemDocumentSchema parses a minimal choice item [19.61ms]
65
+ (pass) QtiAssessmentItemDocumentSchema rejects incompatible response declarations [0.66ms]
66
+ (pass) QtiAssessmentTestDocumentSchema parses a minimal test document [1.96ms]
67
+ (pass) Qti301DerivedZodTemplates exposes expected document templates [0.04ms]
68
+ (pass) QTI barrel exports prefixed XML extension node helpers [0.36ms]
69
+ (pass) built-in outcome completionStatus needs no declaration in processing rules [0.25ms]
70
+ (pass) an integer SCORE is accepted — the official corpus ships it [0.14ms]
71
+ (pass) a non-numeric or multiple SCORE is still rejected [0.15ms]
72
+ (pass) snake_case completion_status is accepted as the built-in's corpus alias [0.18ms]
73
+ (pass) maxChoices 0 means unbounded and never conflicts with minChoices [0.42ms]
74
+ (pass) QtiCatalogInfoSchema parses cards with language-keyed entries and direct content [1.29ms]
75
+ (pass) QtiCatalogInfoSchema accepts data-* discriminators, defaults, and file references [0.32ms]
76
+ (pass) a card is either entries or direct content, never both (XSD choice) [0.21ms]
77
+ (pass) only one card entry may carry the default designation (§5.27.2) [0.11ms]
78
+ (pass) card supports are the SupportEnum tokens or ext: extension strings [0.25ms]
74
79
 
75
80
  test/contracts.test.ts:
76
- (pass) RunnerConfigSchema parses minimal config [2.07ms]
77
- (pass) RunnerConfigSchema requires adapter for cmi5 suite [0.19ms]
78
- (pass) RunnerConfigSchema enforces bearer adapter token source [0.72ms]
79
- (pass) AdapterCapabilitySchema validates profile payload [0.57ms]
80
- (pass) AdapterProfileSchema validates cmi5 interoperability contract [3.75ms]
81
- (pass) AdapterProfileSchema requires cmi5 packageUpload [0.19ms]
82
- (pass) AdapterErrorSchema validates uniform error envelope [0.81ms]
81
+ (pass) RunnerConfigSchema parses minimal config [3.56ms]
82
+ (pass) RunnerConfigSchema requires adapter for cmi5 suite [0.36ms]
83
+ (pass) RunnerConfigSchema enforces bearer adapter token source [1.27ms]
84
+ (pass) AdapterCapabilitySchema validates profile payload [0.49ms]
85
+ (pass) AdapterProfileSchema validates cmi5 interoperability contract [1.34ms]
86
+ (pass) AdapterProfileSchema requires cmi5 packageUpload [0.09ms]
87
+ (pass) AdapterErrorSchema validates uniform error envelope [0.49ms]
83
88
 
84
89
  test/qti-v2_2.test.ts:
85
- (pass) QtiV2_2 metadata document parses a minimal metadata payload with scoring modes [1.30ms]
86
- (pass) QtiV2_2 assessment stimulus and assessment item documents parse together [5.54ms]
87
- (pass) QtiV2_2 processing rejects invalid numeric operator parameters [13.66ms]
88
- (pass) QtiV2_2 curriculum standards metadata and manifest documents parse [2.30ms]
89
- (pass) QtiV2_2 APIP accessibility document parses external supplemental accessibility [2.29ms]
90
+ (pass) QtiV2_2 metadata document parses a minimal metadata payload with scoring modes [0.73ms]
91
+ (pass) QtiV2_2 assessment stimulus and assessment item documents parse together [3.50ms]
92
+ (pass) QtiV2_2 processing rejects invalid numeric operator parameters [10.43ms]
93
+ (pass) QtiV2_2 curriculum standards metadata and manifest documents parse [4.06ms]
94
+ (pass) QtiV2_2 APIP accessibility document parses external supplemental accessibility [1.39ms]
90
95
 
91
96
  test/cat-v1_0.test.ts:
92
- (pass) CAT v1.0 Zod Schemas > Shared validators > UuidSchema validates RFC4122 compliant UUIDs [3.02ms]
93
- (pass) CAT v1.0 Zod Schemas > Shared validators > DateTimeSchema validates ISO8601 datetimes [0.39ms]
94
- (pass) CAT v1.0 Zod Schemas > Shared validators > ExtensionEnum supports standard values and ext:* vendor extensions [0.33ms]
95
- (pass) CAT v1.0 Zod Schemas > Shared validators > OutcomeVariableType supports outcome types and vendor extensions [0.06ms]
96
- (pass) CAT v1.0 Zod Schemas > Core data types > OutcomeVariable validates outcome variable structure [0.70ms]
97
- (pass) CAT v1.0 Zod Schemas > Core data types > OutcomeVariable rejects additional properties [0.15ms]
98
- (pass) CAT v1.0 Zod Schemas > Core data types > ResponseVariable validates candidate responses [0.23ms]
99
- (pass) CAT v1.0 Zod Schemas > Core data types > ItemRef validates item references [0.32ms]
100
- (pass) CAT v1.0 Zod Schemas > Core data types > ItemPool validates item pool with multiple items [0.27ms]
101
- (pass) CAT v1.0 Zod Schemas > Core data types > SectionData validates complete section configuration [1.10ms]
102
- (pass) CAT v1.0 Zod Schemas > Core data types > ItemStage validates items to present to candidate [0.76ms]
103
- (pass) CAT v1.0 Zod Schemas > Core data types > AssessmentResult validates candidate responses and outcomes [1.15ms]
104
- (pass) CAT v1.0 Zod Schemas > Core data types > CatEngineResultReport validates CAT engine response [0.93ms]
105
- (pass) CAT v1.0 Zod Schemas > Core data types > SessionInfo validates session state [0.87ms]
106
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSectionRequest validates section creation [0.31ms]
107
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSectionResponse validates section creation response [0.30ms]
108
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSessionRequest validates session creation [0.40ms]
109
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSessionResponse validates session creation response [0.30ms]
110
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > SubmitResultsRequest validates result submission [0.37ms]
111
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > SubmitResultsResponse validates CAT engine result report [0.08ms]
112
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSessionRequest validates session termination [0.34ms]
113
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSessionResponse validates session termination response [0.38ms]
114
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSectionRequest validates section closure [0.27ms]
115
- (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSectionResponse validates section closure response [0.16ms]
97
+ (pass) CAT v1.0 Zod Schemas > Shared validators > UuidSchema validates RFC4122 compliant UUIDs [0.35ms]
98
+ (pass) CAT v1.0 Zod Schemas > Shared validators > DateTimeSchema validates ISO8601 datetimes [0.26ms]
99
+ (pass) CAT v1.0 Zod Schemas > Shared validators > ExtensionEnum supports standard values and ext:* vendor extensions [0.26ms]
100
+ (pass) CAT v1.0 Zod Schemas > Shared validators > OutcomeVariableType supports outcome types and vendor extensions [0.04ms]
101
+ (pass) CAT v1.0 Zod Schemas > Core data types > OutcomeVariable validates outcome variable structure [2.01ms]
102
+ (pass) CAT v1.0 Zod Schemas > Core data types > OutcomeVariable rejects additional properties [0.28ms]
103
+ (pass) CAT v1.0 Zod Schemas > Core data types > ResponseVariable validates candidate responses [0.20ms]
104
+ (pass) CAT v1.0 Zod Schemas > Core data types > ItemRef validates item references [0.25ms]
105
+ (pass) CAT v1.0 Zod Schemas > Core data types > ItemPool validates item pool with multiple items [0.20ms]
106
+ (pass) CAT v1.0 Zod Schemas > Core data types > SectionData validates complete section configuration [0.64ms]
107
+ (pass) CAT v1.0 Zod Schemas > Core data types > ItemStage validates items to present to candidate [0.53ms]
108
+ (pass) CAT v1.0 Zod Schemas > Core data types > AssessmentResult validates candidate responses and outcomes [0.75ms]
109
+ (pass) CAT v1.0 Zod Schemas > Core data types > CatEngineResultReport validates CAT engine response [0.62ms]
110
+ (pass) CAT v1.0 Zod Schemas > Core data types > SessionInfo validates session state [0.58ms]
111
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSectionRequest validates section creation [0.28ms]
112
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSectionResponse validates section creation response [0.26ms]
113
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSessionRequest validates session creation [0.29ms]
114
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > CreateSessionResponse validates session creation response [0.21ms]
115
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > SubmitResultsRequest validates result submission [0.26ms]
116
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > SubmitResultsResponse validates CAT engine result report [0.05ms]
117
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSessionRequest validates session termination [0.19ms]
118
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSessionResponse validates session termination response [0.23ms]
119
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSectionRequest validates section closure [0.14ms]
120
+ (pass) CAT v1.0 Zod Schemas > REST operation payloads > EndSectionResponse validates section closure response [0.10ms]
116
121
  (pass) CAT v1.0 Zod Schemas > REST operation bindings > REST operation catalog exposes all 6 CAT operations [0.05ms]
117
- (pass) CAT v1.0 Zod Schemas > REST operation bindings > CreateSection operation has correct structure [0.04ms]
118
- (pass) CAT v1.0 Zod Schemas > REST operation bindings > SubmitResults operation has correct path template [0.03ms]
119
- (pass) CAT v1.0 Zod Schemas > Derived templates > Cat10DerivedZodTemplates exposes specification metadata [0.36ms]
120
- (pass) CAT v1.0 Zod Schemas > Derived templates > Specification links point to official CAT v1.0 resources [0.08ms]
121
- (pass) CAT v1.0 Zod Schemas > Error handling > ErrorResponse validates error payloads [0.59ms]
122
+ (pass) CAT v1.0 Zod Schemas > REST operation bindings > CreateSection operation has correct structure [0.03ms]
123
+ (pass) CAT v1.0 Zod Schemas > REST operation bindings > SubmitResults operation has correct path template [0.02ms]
124
+ (pass) CAT v1.0 Zod Schemas > Derived templates > Cat10DerivedZodTemplates exposes specification metadata [0.26ms]
125
+ (pass) CAT v1.0 Zod Schemas > Derived templates > Specification links point to official CAT v1.0 resources [0.06ms]
126
+ (pass) CAT v1.0 Zod Schemas > Error handling > ErrorResponse validates error payloads [0.34ms]
122
127
 
123
128
  test/schema-examples.test.ts:
124
- (pass) example configs parse with RunnerConfigSchema [0.49ms]
125
- (pass) summary sample shape validates [1.72ms]
126
- (pass) requirement trace sample shape validates [0.54ms]
127
- (pass) run metadata sample shape validates [1.38ms]
128
- (pass) adapter profile sample shape validates [0.18ms]
129
+ (pass) example configs parse with RunnerConfigSchema [0.46ms]
130
+ (pass) summary sample shape validates [1.63ms]
131
+ (pass) requirement trace sample shape validates [0.52ms]
132
+ (pass) run metadata sample shape validates [1.08ms]
133
+ (pass) adapter profile sample shape validates [0.16ms]
129
134
 
130
135
  test/clr-v2_0.test.ts:
131
- (pass) ClrCredentialSchema parses a realistic CLR 2.0 credential [8.73ms]
132
- (pass) AchievementCredentialSchema parses a minimal achievement credential [2.21ms]
133
- (pass) ProfileSchema parses a minimal issuer profile [0.08ms]
134
- (pass) GetClrCredentialsResponseSchema parses credential and JWS collections [0.44ms]
135
- (pass) ImsxStatusInfoSchema enforces known status vocabularies [0.43ms]
136
- (pass) ClrCredentialSchema rejects credentials without the CLR context set [0.41ms]
137
- (pass) Clr20DerivedZodTemplates exposes the published entry points [0.08ms]
136
+ (pass) ClrCredentialSchema parses a realistic CLR 2.0 credential [7.02ms]
137
+ (pass) AchievementCredentialSchema parses a minimal achievement credential [1.84ms]
138
+ (pass) ProfileSchema parses a minimal issuer profile [0.09ms]
139
+ (pass) GetClrCredentialsResponseSchema parses credential and JWS collections [0.43ms]
140
+ (pass) ImsxStatusInfoSchema enforces known status vocabularies [0.53ms]
141
+ (pass) ClrCredentialSchema rejects credentials without the CLR context set [0.38ms]
142
+ (pass) Clr20DerivedZodTemplates exposes the published entry points [0.05ms]
138
143
 
139
144
  test/cc-v1_4.test.ts:
140
- (pass) CommonCartridgeV1_4 parses a minimal core manifest [6.07ms]
141
- (pass) CommonCartridgeV1_4 rejects question-bank references from organization items [1.39ms]
142
- (pass) CommonCartridgeV1_4 parses a minimal thin manifest with embedded webLink XML [3.97ms]
143
- (pass) CommonCartridgeV1_4 thin profile rejects mismatched embedded resource XML [2.36ms]
144
- (pass) CommonCartridgeV1_4 K-12 LOM resource profile enforces required educational metadata [3.82ms]
145
- (pass) CommonCartridgeV1_4 parses assignment, line item, accessibility, and open video documents [6.17ms]
146
- (pass) CommonCartridgeV1_4 exposes expected derived templates [0.07ms]
145
+ (pass) CommonCartridgeV1_4 parses a minimal core manifest [3.65ms]
146
+ (pass) CommonCartridgeV1_4 rejects question-bank references from organization items [0.92ms]
147
+ (pass) CommonCartridgeV1_4 parses a minimal thin manifest with embedded webLink XML [2.38ms]
148
+ (pass) CommonCartridgeV1_4 thin profile rejects mismatched embedded resource XML [1.30ms]
149
+ (pass) CommonCartridgeV1_4 K-12 LOM resource profile enforces required educational metadata [2.58ms]
150
+ (pass) CommonCartridgeV1_4 parses assignment, line item, accessibility, and open video documents [5.43ms]
151
+ (pass) CommonCartridgeV1_4 exposes expected derived templates [0.06ms]
147
152
 
148
153
  test/open-badges-v3_0.test.ts:
149
- (pass) AchievementCredentialSchema parses a realistic Open Badge credential [0.81ms]
150
- (pass) EndorsementCredentialSchema parses a valid endorsement credential [2.42ms]
151
- (pass) GetOpenBadgeCredentialsResponseSchema parses credential and JWS collections [0.46ms]
152
- (pass) AchievementCredentialSchema rejects missing OB context [0.47ms]
153
- (pass) OpenBadges30DerivedZodTemplates exposes expected entry points [0.07ms]
154
+ (pass) AchievementCredentialSchema parses a realistic Open Badge credential [0.51ms]
155
+ (pass) EndorsementCredentialSchema parses a valid endorsement credential [1.43ms]
156
+ (pass) GetOpenBadgeCredentialsResponseSchema parses credential and JWS collections [0.36ms]
157
+ (pass) AchievementCredentialSchema rejects missing OB context [0.33ms]
158
+ (pass) OpenBadges30DerivedZodTemplates exposes expected entry points [0.05ms]
154
159
 
155
160
  test/vc-data-model-v2_0.test.ts:
156
- (pass) VerifiableCredentialSchema parses a minimal VC Data Model 2.0 credential [1.69ms]
157
- (pass) VerifiablePresentationSchema parses a presentation carrying VC and JWS credentials [0.89ms]
158
- (pass) VerifiableCredentialSchema rejects wrong core context [0.29ms]
159
- (pass) VcDataModel20DerivedZodTemplates exposes expected entry points [0.06ms]
161
+ (pass) VerifiableCredentialSchema parses a minimal VC Data Model 2.0 credential [1.04ms]
162
+ (pass) VerifiablePresentationSchema parses a presentation carrying VC and JWS credentials [0.54ms]
163
+ (pass) VerifiableCredentialSchema rejects wrong core context [0.18ms]
164
+ (pass) VcDataModel20DerivedZodTemplates exposes expected entry points [0.04ms]
160
165
 
161
166
  test/h5p-v1.test.ts:
162
- (pass) H5P PackageManifest accepts a minimal valid h5p.json [3.04ms]
163
- (pass) H5P PackageManifest accepts all optional fields [0.98ms]
164
- (pass) H5P PackageManifest rejects missing required title [0.27ms]
165
- (pass) H5P PackageManifest rejects invalid machine name [0.23ms]
166
- (pass) H5P PackageManifest rejects invalid embed type [0.20ms]
167
- (pass) H5P PackageManifest rejects yearTo < yearFrom [0.19ms]
168
- (pass) H5P PackageManifest rejects duplicate embed types [0.16ms]
169
- (pass) H5P LibraryManifest accepts a minimal valid library.json [1.99ms]
170
- (pass) H5P LibraryManifest accepts a runnable library with full fields [1.08ms]
171
- (pass) H5P LibraryManifest rejects invalid machineName [0.23ms]
172
- (pass) H5P VersionRef rejects patch version (not part of the schema) [0.13ms]
173
- (pass) H5P LibraryFolderName validates correct folder name [0.11ms]
174
- (pass) H5P LibraryFolderName rejects folder names with patch version [0.08ms]
175
- (pass) H5P Semantics accepts a simple text field [1.58ms]
176
- (pass) H5P Semantics accepts a boolean field [3.66ms]
177
- (pass) H5P Semantics accepts a select field with options [5.15ms]
178
- (pass) H5P Semantics accepts a group with nested fields [2.88ms]
179
- (pass) H5P Semantics accepts a list field containing a group [2.25ms]
180
- (pass) H5P Semantics accepts deeply nested groups (3 levels) [0.37ms]
181
- (pass) H5P Semantics accepts library field with options [0.19ms]
182
- (pass) H5P Semantics accepts an image field [0.12ms]
183
- (pass) H5P Semantics rejects unknown field type [1.96ms]
184
- (pass) H5P Semantics rejects field without name [0.79ms]
185
- (pass) H5P MediaFile accepts a valid image file reference [1.21ms]
186
- (pass) H5P LibraryEmbed accepts a valid embedded library reference [0.51ms]
167
+ (pass) H5P PackageManifest accepts a minimal valid h5p.json [1.96ms]
168
+ (pass) H5P PackageManifest accepts all optional fields [0.57ms]
169
+ (pass) H5P PackageManifest rejects missing required title [0.15ms]
170
+ (pass) H5P PackageManifest rejects invalid machine name [0.14ms]
171
+ (pass) H5P PackageManifest rejects invalid embed type [0.11ms]
172
+ (pass) H5P PackageManifest rejects yearTo < yearFrom [0.12ms]
173
+ (pass) H5P PackageManifest rejects duplicate embed types [0.09ms]
174
+ (pass) H5P LibraryManifest accepts a minimal valid library.json [1.10ms]
175
+ (pass) H5P LibraryManifest accepts a runnable library with full fields [0.60ms]
176
+ (pass) H5P LibraryManifest rejects invalid machineName [0.14ms]
177
+ (pass) H5P VersionRef rejects patch version (not part of the schema) [0.06ms]
178
+ (pass) H5P LibraryFolderName validates correct folder name [0.06ms]
179
+ (pass) H5P LibraryFolderName rejects folder names with patch version [0.06ms]
180
+ (pass) H5P Semantics accepts a simple text field [0.87ms]
181
+ (pass) H5P Semantics accepts a boolean field [2.11ms]
182
+ (pass) H5P Semantics accepts a select field with options [2.95ms]
183
+ (pass) H5P Semantics accepts a group with nested fields [1.70ms]
184
+ (pass) H5P Semantics accepts a list field containing a group [1.12ms]
185
+ (pass) H5P Semantics accepts deeply nested groups (3 levels) [0.20ms]
186
+ (pass) H5P Semantics accepts library field with options [0.11ms]
187
+ (pass) H5P Semantics accepts an image field [0.07ms]
188
+ (pass) H5P Semantics rejects unknown field type [1.04ms]
189
+ (pass) H5P Semantics rejects field without name [0.42ms]
190
+ (pass) H5P MediaFile accepts a valid image file reference [0.70ms]
191
+ (pass) H5P LibraryEmbed accepts a valid embedded library reference [0.31ms]
187
192
 
188
193
  test/lti.test.ts:
189
- (pass) LTI core launch schema accepts a normalized resource link launch [7.33ms]
190
- (pass) LTI deep linking schema accepts request settings and response items [3.84ms]
191
- (pass) LTI AGS schema accepts endpoint, line item, score, and result shapes [2.78ms]
192
- (pass) LTI NRPS schema accepts names/roles service and membership container shapes [2.18ms]
193
- (pass) LTI proctoring schema accepts start and end assessment messages [2.80ms]
194
+ (pass) LTI core launch schema accepts a normalized resource link launch [2.00ms]
195
+ (pass) LTI deep linking schema accepts request settings and response items [1.93ms]
196
+ (pass) LTI AGS schema accepts endpoint, line item, score, and result shapes [1.94ms]
197
+ (pass) LTI NRPS schema accepts names/roles service and membership container shapes [1.46ms]
198
+ (pass) LTI proctoring schema accepts start and end assessment messages [1.59ms]
194
199
 
195
200
  test/case-v1_1.test.ts:
196
- (pass) CASE v1.1 Schemas > Core entity schemas > should validate a valid CFAssociation [1.81ms]
197
- (pass) CASE v1.1 Schemas > Core entity schemas > should reject CFAssociation with invalid UUID [0.32ms]
198
- (pass) CASE v1.1 Schemas > REST binding operations > should expose getCFAssociation operation [0.05ms]
199
- (pass) CASE v1.1 Schemas > REST binding operations > should expose listCFAssociations operation [0.03ms]
200
- (pass) CASE v1.1 Schemas > REST binding operations > should expose getCFPackage operation [0.03ms]
201
+ (pass) CASE v1.1 Schemas > Core entity schemas > should validate a valid CFAssociation [3.95ms]
202
+ (pass) CASE v1.1 Schemas > Core entity schemas > should reject CFAssociation with invalid UUID [0.20ms]
203
+ (pass) CASE v1.1 Schemas > REST binding operations > should expose getCFAssociation operation [0.03ms]
204
+ (pass) CASE v1.1 Schemas > REST binding operations > should expose listCFAssociations operation [0.02ms]
205
+ (pass) CASE v1.1 Schemas > REST binding operations > should expose getCFPackage operation [0.02ms]
201
206
  (pass) CASE v1.1 Schemas > REST binding operations > should expose listCFItems operation [0.02ms]
202
- (pass) CASE v1.1 Schemas > REST binding operations > should expose getCFRubric operation [0.03ms]
203
- (pass) CASE v1.1 Schemas > Shared validators > should validate RFC4122 UUID [0.04ms]
204
- (pass) CASE v1.1 Schemas > Shared validators > should reject invalid UUID format [3.11ms]
205
- (pass) CASE v1.1 Schemas > Shared validators > should validate ISO8601 datetime [0.15ms]
206
- (pass) CASE v1.1 Schemas > Shared validators > should validate link URI [0.61ms]
207
- (pass) CASE v1.1 Schemas > Extensible vocabularies > should allow standard association types [0.20ms]
208
- (pass) CASE v1.1 Schemas > Extensible vocabularies > should allow ext:* custom extensions [0.09ms]
209
- (pass) CASE v1.1 Schemas > Extensible vocabularies > should reject invalid ext: format [0.15ms]
210
- (pass) CASE v1.1 Schemas > Derived templates > should expose spec links [0.06ms]
211
- (pass) CASE v1.1 Schemas > Derived templates > should document scope coverage [0.04ms]
207
+ (pass) CASE v1.1 Schemas > REST binding operations > should expose getCFRubric operation [0.01ms]
208
+ (pass) CASE v1.1 Schemas > Shared validators > should validate RFC4122 UUID [0.02ms]
209
+ (pass) CASE v1.1 Schemas > Shared validators > should reject invalid UUID format [0.06ms]
210
+ (pass) CASE v1.1 Schemas > Shared validators > should validate ISO8601 datetime [0.02ms]
211
+ (pass) CASE v1.1 Schemas > Shared validators > should validate link URI [0.36ms]
212
+ (pass) CASE v1.1 Schemas > Extensible vocabularies > should allow standard association types [0.13ms]
213
+ (pass) CASE v1.1 Schemas > Extensible vocabularies > should allow ext:* custom extensions [0.06ms]
214
+ (pass) CASE v1.1 Schemas > Extensible vocabularies > should reject invalid ext: format [0.08ms]
215
+ (pass) CASE v1.1 Schemas > Derived templates > should expose spec links [0.04ms]
216
+ (pass) CASE v1.1 Schemas > Derived templates > should document scope coverage [0.02ms]
212
217
 
213
218
  test/caliper-v1_2.test.ts:
214
- (pass) ActionSchema validates Caliper action vocabulary [0.34ms]
215
- (pass) PersonSchema requires top-level @context for described entity documents [1.40ms]
216
- (pass) EventSchema enforces URN UUID ids and UTC-millisecond eventTime [2.09ms]
217
- (pass) AnnotationEventSchema enforces textual actor/action/object constraints [1.70ms]
218
- (pass) MessageEventSchema accepts MarkedAsUnRead textual alias [0.66ms]
219
- (pass) ViewEventSchema restricts target entity type to Frame [0.71ms]
220
- (pass) EnvelopeSchema enforces required fields and disallows custom top-level properties [9.82ms]
221
- (pass) TextPositionSelectorSchema requires type/start/end [0.85ms]
222
- (pass) SystemIdentifierSchema validates required identifier fields [0.75ms]
223
- (pass) Caliper12DerivedZodTemplates exposes key Caliper entry points and conformance metadata [0.11ms]
224
-
225
- 187 pass
219
+ (pass) ActionSchema validates Caliper action vocabulary [0.17ms]
220
+ (pass) PersonSchema requires top-level @context for described entity documents [1.11ms]
221
+ (pass) EventSchema enforces URN UUID ids and UTC-millisecond eventTime [1.24ms]
222
+ (pass) AnnotationEventSchema enforces textual actor/action/object constraints [0.99ms]
223
+ (pass) MessageEventSchema accepts MarkedAsUnRead textual alias [0.40ms]
224
+ (pass) ViewEventSchema restricts target entity type to Frame [0.41ms]
225
+ (pass) EnvelopeSchema enforces required fields and disallows custom top-level properties [6.46ms]
226
+ (pass) TextPositionSelectorSchema requires type/start/end [0.49ms]
227
+ (pass) SystemIdentifierSchema validates required identifier fields [0.56ms]
228
+ (pass) Caliper12DerivedZodTemplates exposes key Caliper entry points and conformance metadata [0.07ms]
229
+
230
+ 192 pass
226
231
  0 fail
227
- 318 expect() calls
228
- Ran 187 tests across 17 files. [826.00ms]
232
+ 325 expect() calls
233
+ Ran 192 tests across 17 files. [518.00ms]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conform-ed/contracts",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "module": "src/index.ts",
6
6
  "exports": {
@@ -18,6 +18,7 @@ import {
18
18
  QtiShapeSchema,
19
19
  QtiShowHideSchema,
20
20
  QtiStringListSchema,
21
+ QtiMimeTypeSchema,
21
22
  QtiSuppressTtsSchema,
22
23
  QtiSubmissionModeSchema,
23
24
  QtiViewSchema,
@@ -766,11 +767,69 @@ export const QtiStimulusBodySchema: z.ZodType = z.lazy(() =>
766
767
  }),
767
768
  );
768
769
 
770
+ // ---------- Companion materials (§2.13.1: "content props that provide key information") ----------
771
+
772
+ /** ItemFileInfo: a content-file reference with its optional icon (digital materials, calculator info). */
773
+ export const QtiItemFileInfoSchema = strictObject({
774
+ mimeType: QtiMimeTypeSchema.optional(),
775
+ label: z.string().optional(),
776
+ fileHref: z.string().min(1),
777
+ resourceIcon: z.string().optional(),
778
+ });
779
+
780
+ /** A measured increment: decimal value plus its required unit (linear or radial). */
781
+ export const QtiMeasurementValueSchema = strictObject({
782
+ value: z.number(),
783
+ unit: z.enum([
784
+ "Millimeter",
785
+ "Centimeter",
786
+ "Meter",
787
+ "Kilometer",
788
+ "Inch",
789
+ "Foot",
790
+ "Yard",
791
+ "Mile",
792
+ "Radian",
793
+ "Degree",
794
+ "Minute",
795
+ "Second",
796
+ ]),
797
+ });
798
+
799
+ export const QtiCompanionCalculatorSchema = strictObject({
800
+ calculatorType: z.enum(["basic", "standard", "scientific", "graphing"]),
801
+ description: z.string(),
802
+ calculatorInfo: QtiItemFileInfoSchema.optional(),
803
+ });
804
+
805
+ export const QtiCompanionRuleSystemSchema = strictObject({
806
+ minimumLength: z.number().int(),
807
+ minorIncrement: QtiMeasurementValueSchema.optional(),
808
+ majorIncrement: QtiMeasurementValueSchema,
809
+ });
810
+
811
+ export const QtiCompanionRuleSchema = strictObject({
812
+ description: z.string(),
813
+ ruleSystemSi: QtiCompanionRuleSystemSchema.optional(),
814
+ ruleSystemUs: QtiCompanionRuleSystemSchema.optional(),
815
+ });
816
+
817
+ export const QtiCompanionProtractorIncrementSchema = strictObject({
818
+ minorIncrement: QtiMeasurementValueSchema.optional(),
819
+ majorIncrement: QtiMeasurementValueSchema,
820
+ });
821
+
822
+ export const QtiCompanionProtractorSchema = strictObject({
823
+ description: z.string(),
824
+ incrementSi: QtiCompanionProtractorIncrementSchema.optional(),
825
+ incrementUs: QtiCompanionProtractorIncrementSchema.optional(),
826
+ });
827
+
769
828
  export const QtiCompanionMaterialsInfoSchema = strictObject({
770
- calculators: z.array(z.unknown()).optional(),
771
- rules: z.array(z.unknown()).optional(),
772
- protractors: z.array(z.unknown()).optional(),
773
- digitalMaterials: z.array(z.unknown()).optional(),
829
+ calculators: z.array(QtiCompanionCalculatorSchema).optional(),
830
+ rules: z.array(QtiCompanionRuleSchema).optional(),
831
+ protractors: z.array(QtiCompanionProtractorSchema).optional(),
832
+ digitalMaterials: z.array(QtiItemFileInfoSchema).optional(),
774
833
  physicalMaterials: z.array(z.string()).optional(),
775
834
  extensions: z.array(z.unknown()).optional(),
776
835
  });
@@ -1544,6 +1603,13 @@ export type QtiGapChoice = z.infer<typeof QtiGapChoiceSchema>;
1544
1603
  export type QtiCompanionMaterialsInfo = z.infer<typeof QtiCompanionMaterialsInfoSchema>;
1545
1604
  export type QtiAdaptiveHref = z.infer<typeof QtiAdaptiveHrefSchema>;
1546
1605
  export type QtiAdaptiveSelection = z.infer<typeof QtiAdaptiveSelectionSchema>;
1606
+ export type QtiItemFileInfo = z.infer<typeof QtiItemFileInfoSchema>;
1607
+ export type QtiMeasurementValue = z.infer<typeof QtiMeasurementValueSchema>;
1608
+ export type QtiCompanionCalculator = z.infer<typeof QtiCompanionCalculatorSchema>;
1609
+ export type QtiCompanionRuleSystem = z.infer<typeof QtiCompanionRuleSystemSchema>;
1610
+ export type QtiCompanionRule = z.infer<typeof QtiCompanionRuleSchema>;
1611
+ export type QtiCompanionProtractorIncrement = z.infer<typeof QtiCompanionProtractorIncrementSchema>;
1612
+ export type QtiCompanionProtractor = z.infer<typeof QtiCompanionProtractorSchema>;
1547
1613
  export type QtiSelection = z.infer<typeof QtiSelectionSchema>;
1548
1614
  export type QtiOrdering = z.infer<typeof QtiOrderingSchema>;
1549
1615
  export type QtiAssessmentItemRef = z.infer<typeof QtiAssessmentItemRefSchema>;
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+
3
+ import { QtiMetadataSchema } from "./imsqti_metadatav3p0_v1p0";
4
+ import { strictObject } from "./shared";
5
+
6
+ /**
7
+ * The QTI 3.0 content-package manifest (imsqtiv3p0_imscpv1p2_v1p0.xsd, namespace
8
+ * …/qti/qtiv3p0/imscp_v1p1). Resource types are an open vocabulary by design — the
9
+ * official corpus itself mixes the imsqti_*_xmlv3p0 tokens with mime-style values
10
+ * (qtiusagedata/xml, resourcemetadata/xml) and LTI link types (imslti_xmlv1p1).
11
+ */
12
+
13
+ const NonEmptyStringSchema = z.string().min(1);
14
+
15
+ export const QtiV3ManifestResourceMetadataSchema = strictObject({
16
+ qtiMetadata: QtiMetadataSchema.optional(),
17
+ /** IEEE LOM subtree, preserved structurally (its own specification). */
18
+ lom: z.unknown().optional(),
19
+ });
20
+
21
+ export const QtiV3ManifestMetadataSchema = strictObject({
22
+ schema: NonEmptyStringSchema,
23
+ schemaVersion: NonEmptyStringSchema,
24
+ qtiMetadata: QtiMetadataSchema.optional(),
25
+ lom: z.unknown().optional(),
26
+ });
27
+
28
+ export const QtiV3ManifestFileSchema = strictObject({
29
+ href: NonEmptyStringSchema,
30
+ metadata: QtiV3ManifestResourceMetadataSchema.optional(),
31
+ });
32
+
33
+ export const QtiV3ManifestDependencySchema = strictObject({
34
+ identifierRef: NonEmptyStringSchema,
35
+ });
36
+
37
+ export const QtiV3ManifestResourceSchema = strictObject({
38
+ identifier: NonEmptyStringSchema,
39
+ type: NonEmptyStringSchema,
40
+ href: NonEmptyStringSchema.optional(),
41
+ metadata: QtiV3ManifestResourceMetadataSchema.optional(),
42
+ files: z.array(QtiV3ManifestFileSchema).optional(),
43
+ dependencies: z.array(QtiV3ManifestDependencySchema).optional(),
44
+ });
45
+
46
+ export const QtiV3ManifestSchema = strictObject({
47
+ identifier: NonEmptyStringSchema,
48
+ metadata: QtiV3ManifestMetadataSchema,
49
+ organizations: strictObject({}),
50
+ resources: z.array(QtiV3ManifestResourceSchema).default([]),
51
+ }).superRefine((value, context) => {
52
+ const seen = new Set<string>();
53
+
54
+ for (const [index, resource] of value.resources.entries()) {
55
+ if (seen.has(resource.identifier)) {
56
+ context.addIssue({
57
+ code: "custom",
58
+ path: ["resources", index, "identifier"],
59
+ message: `Duplicate manifest resource identifier: ${resource.identifier}`,
60
+ });
61
+ }
62
+ seen.add(resource.identifier);
63
+ }
64
+ });
65
+
66
+ export const QtiManifestDocumentSchema = strictObject({
67
+ manifest: QtiV3ManifestSchema,
68
+ });
69
+ // Inferred types from exported Zod validators.
70
+ export type QtiV3ManifestResourceMetadata = z.infer<typeof QtiV3ManifestResourceMetadataSchema>;
71
+ export type QtiV3ManifestMetadata = z.infer<typeof QtiV3ManifestMetadataSchema>;
72
+ export type QtiV3ManifestFile = z.infer<typeof QtiV3ManifestFileSchema>;
73
+ export type QtiV3ManifestDependency = z.infer<typeof QtiV3ManifestDependencySchema>;
74
+ export type QtiV3ManifestResource = z.infer<typeof QtiV3ManifestResourceSchema>;
75
+ export type QtiV3Manifest = z.infer<typeof QtiV3ManifestSchema>;
76
+ export type QtiManifestDocument = z.infer<typeof QtiManifestDocumentSchema>;
@@ -13,6 +13,7 @@ export * from "./imsqti_sectionv3p0p1_v1p0";
13
13
  export * from "./imsqti_stimulusv3p0p1_v1p0";
14
14
  export * from "./imsqti_testv3p0p1_v1p0";
15
15
  export * from "./imsqti_usagedatav3p0_v1p0";
16
+ export * from "./imsqtiv3p0_imscpv1p2_v1p0";
16
17
  export * from "./imsqtiv3p0_afa3p0pnp_v1p0";
17
18
 
18
19
  import { QtiAsiProfileDocumentSchema } from "./imsqti_asiv3p0p1_v1p0";
@@ -30,6 +31,7 @@ import {
30
31
  } from "./imsqti_testv3p0p1_v1p0";
31
32
  import { QtiUsageDataDocumentSchema } from "./imsqti_usagedatav3p0_v1p0";
32
33
  import { QtiAccessForAllPnpDocumentSchema, QtiAccessForAllPnpRecordsDocumentSchema } from "./imsqtiv3p0_afa3p0pnp_v1p0";
34
+ import { QtiManifestDocumentSchema } from "./imsqtiv3p0_imscpv1p2_v1p0";
33
35
 
34
36
  export const Qti301DerivedZodTemplates = {
35
37
  qtiAsiProfileDocument: QtiAsiProfileDocumentSchema,
@@ -45,6 +47,7 @@ export const Qti301DerivedZodTemplates = {
45
47
  qtiMetadataDocument: QtiMetadataDocumentSchema,
46
48
  qtiAssessmentResultDocument: QtiAssessmentResultDocumentSchema,
47
49
  qtiUsageDataDocument: QtiUsageDataDocumentSchema,
50
+ qtiManifestDocument: QtiManifestDocumentSchema,
48
51
  qtiAccessForAllPnpDocument: QtiAccessForAllPnpDocumentSchema,
49
52
  qtiAccessForAllPnpRecordsDocument: QtiAccessForAllPnpRecordsDocumentSchema,
50
53
  } as const;
@@ -10,7 +10,7 @@ import {
10
10
  QtiShapeSchema,
11
11
  QtiViewSchema,
12
12
  addIssue,
13
- looseObject,
13
+ createXmlNodeSchema,
14
14
  strictObject,
15
15
  } from "./shared";
16
16
 
@@ -84,9 +84,93 @@ export const QtiStyleSheetSchema = strictObject({
84
84
  title: z.string().optional(),
85
85
  });
86
86
 
87
- export const QtiCatalogSchema = looseObject({
88
- kind: z.literal("catalog"),
89
- content: z.array(z.unknown()).optional(),
87
+ // ---------- Catalog (CatalogInfo/Catalog/Card/CardEntry, §5.26–5.29) ----------
88
+
89
+ /**
90
+ * Card support names: "This attribute names either pre-defined supports or a
91
+ * custom-named support" (§5.26.1) — the SupportEnum tokens (§8.38) or the XSD's
92
+ * SupportExtString pattern `(ext:)[a-zA-Z0-9_.\-]+`.
93
+ */
94
+ export const QtiSupportNameSchema = z.union([
95
+ z.enum([
96
+ "additional-directions",
97
+ "audio-description",
98
+ "braille",
99
+ "glossary-on-screen",
100
+ "high-contrast",
101
+ "keyboard-directions",
102
+ "keyword-translation",
103
+ "linguistic-guidance",
104
+ "long-description",
105
+ "sign-language",
106
+ "simplified-language-portions",
107
+ "simplified-graphics",
108
+ "spoken",
109
+ "tactile",
110
+ "transcript",
111
+ ]),
112
+ z.string().regex(/^ext:[a-zA-Z0-9_.-]+$/u),
113
+ ]);
114
+
115
+ /** Generic mixed HTML flow inside catalog content (HTMLContentFlow has no QTI elements). */
116
+ const QtiHtmlContentFragmentSchema: z.ZodType = z.lazy(() =>
117
+ z.union([z.string(), createXmlNodeSchema(QtiHtmlContentFragmentSchema)]),
118
+ );
119
+
120
+ /** FileHrefCard (§7.15): a content-file URI with its required mime-type. */
121
+ export const QtiFileHrefCardSchema = strictObject({
122
+ href: z.string(),
123
+ mimeType: QtiMimeTypeSchema,
124
+ });
125
+
126
+ /** HTMLContent (§5.63): the dormant alternative content in HTML format. */
127
+ export const QtiCatalogHtmlContentSchema = strictObject({
128
+ xmlLang: z.string().optional(),
129
+ /** data-* extension characteristics, keyed without the "data-" prefix. */
130
+ dataAttributes: z.record(z.string(), z.string()).optional(),
131
+ content: z.array(QtiHtmlContentFragmentSchema).optional(),
132
+ });
133
+
134
+ /**
135
+ * CardEntry (§5.27): "an attribute (often custom attributes) on the CardEntry element
136
+ * declares the difference between the resources, and where the attribute value aligns
137
+ * with a specific preference/need from the candidate's PNP".
138
+ */
139
+ export const QtiCardEntrySchema = strictObject({
140
+ xmlLang: z.string().optional(),
141
+ default: z.boolean().optional(),
142
+ /** data-* discriminators (e.g. data-reading-type), keyed without the "data-" prefix. */
143
+ dataAttributes: z.record(z.string(), z.string()).optional(),
144
+ htmlContent: QtiCatalogHtmlContentSchema.optional(),
145
+ fileHrefs: z.array(QtiFileHrefCardSchema).optional(),
146
+ });
147
+
148
+ /**
149
+ * Card (§5.26): dormant content for one named support. The XSD is a choice — either
150
+ * direct content (qti-html-content/qti-file-href) or card entries, never both.
151
+ */
152
+ export const QtiCardSchema = strictObject({
153
+ support: QtiSupportNameSchema,
154
+ xmlLang: z.string().optional(),
155
+ htmlContent: QtiCatalogHtmlContentSchema.optional(),
156
+ fileHrefs: z.array(QtiFileHrefCardSchema).optional(),
157
+ cardEntries: z.array(QtiCardEntrySchema).min(1).optional(),
158
+ }).superRefine((value, context) => {
159
+ if (value.cardEntries && (value.htmlContent || value.fileHrefs)) {
160
+ addIssue(context, ["cardEntries"], "A card holds either card entries or direct content, not both.");
161
+ }
162
+
163
+ // "Only one of the CardEntry instances can have a default designation." (§5.27.2)
164
+ const defaults = (value.cardEntries ?? []).filter((entry) => entry.default === true).length;
165
+ if (defaults > 1) {
166
+ addIssue(context, ["cardEntries"], "Only one card entry may be designated as the default.");
167
+ }
168
+ });
169
+
170
+ /** Catalog (§5.28): "located … from a data-catalog-idref" via its unique id. */
171
+ export const QtiCatalogSchema = strictObject({
172
+ id: z.string().min(1),
173
+ cards: z.array(QtiCardSchema).min(1),
90
174
  });
91
175
 
92
176
  export const QtiCatalogInfoSchema = strictObject({
@@ -260,6 +344,11 @@ export type QtiInterpolationTable = z.infer<typeof QtiInterpolationTableSchema>;
260
344
  export type QtiMatchTableEntry = z.infer<typeof QtiMatchTableEntrySchema>;
261
345
  export type QtiMatchTable = z.infer<typeof QtiMatchTableSchema>;
262
346
  export type QtiStyleSheet = z.infer<typeof QtiStyleSheetSchema>;
347
+ export type QtiSupportName = z.infer<typeof QtiSupportNameSchema>;
348
+ export type QtiFileHrefCard = z.infer<typeof QtiFileHrefCardSchema>;
349
+ export type QtiCatalogHtmlContent = z.infer<typeof QtiCatalogHtmlContentSchema>;
350
+ export type QtiCardEntry = z.infer<typeof QtiCardEntrySchema>;
351
+ export type QtiCard = z.infer<typeof QtiCardSchema>;
263
352
  export type QtiCatalog = z.infer<typeof QtiCatalogSchema>;
264
353
  export type QtiCatalogInfo = z.infer<typeof QtiCatalogInfoSchema>;
265
354
  export type QtiItemSessionControl = z.infer<typeof QtiItemSessionControlSchema>;
@@ -9,6 +9,7 @@ import {
9
9
  QtiAssessmentSectionDocumentSchema,
10
10
  QtiAssessmentStimulusDocumentSchema,
11
11
  QtiAssessmentTestDocumentSchema,
12
+ QtiCatalogInfoSchema,
12
13
  QtiMetadataDocumentSchema,
13
14
  QtiOutcomeDeclarationDocumentSchema,
14
15
  QtiOutcomeProcessingDocumentSchema,
@@ -683,3 +684,111 @@ test("maxChoices 0 means unbounded and never conflicts with minChoices", () => {
683
684
 
684
685
  expect(parsed.success).toBe(true);
685
686
  });
687
+
688
+ // ---------- Catalog (CatalogInfo/Catalog/Card/CardEntry, §5.26–5.29) ----------
689
+
690
+ test("QtiCatalogInfoSchema parses cards with language-keyed entries and direct content", () => {
691
+ // Mirrors the official CatalogWithMultipleSupports.xml: a keyword-translation card
692
+ // with per-language entries plus a linguistic-guidance card carrying direct content.
693
+ const parsed = QtiCatalogInfoSchema.safeParse({
694
+ catalogs: [
695
+ {
696
+ id: "catalog1",
697
+ cards: [
698
+ {
699
+ support: "keyword-translation",
700
+ cardEntries: [
701
+ { xmlLang: "es", htmlContent: { content: ["preciso"] } },
702
+ { xmlLang: "de", htmlContent: { content: ["genau"] } },
703
+ ],
704
+ },
705
+ {
706
+ support: "linguistic-guidance",
707
+ htmlContent: { content: ["Accurate means correct."] },
708
+ },
709
+ ],
710
+ },
711
+ ],
712
+ });
713
+
714
+ expect(parsed.success).toBe(true);
715
+ });
716
+
717
+ test("QtiCatalogInfoSchema accepts data-* discriminators, defaults, and file references", () => {
718
+ // The sharedStimulus exemplars discriminate spoken entries by data-reading-type; the
719
+ // XSD allows file references with a required mime-type (FileHrefCard, §7.15).
720
+ const parsed = QtiCatalogInfoSchema.safeParse({
721
+ catalogs: [
722
+ {
723
+ id: "cat123_1",
724
+ cards: [
725
+ {
726
+ support: "spoken",
727
+ cardEntries: [
728
+ {
729
+ dataAttributes: { "reading-type": "computer-read-aloud" },
730
+ htmlContent: { content: ["Anina saw the crocodile."] },
731
+ },
732
+ {
733
+ default: true,
734
+ fileHrefs: [{ href: "audio/item123.mp3", mimeType: "audio/mpeg" }],
735
+ },
736
+ ],
737
+ },
738
+ ],
739
+ },
740
+ ],
741
+ });
742
+
743
+ expect(parsed.success).toBe(true);
744
+ });
745
+
746
+ test("a card is either entries or direct content, never both (XSD choice)", () => {
747
+ const parsed = QtiCatalogInfoSchema.safeParse({
748
+ catalogs: [
749
+ {
750
+ id: "c1",
751
+ cards: [
752
+ {
753
+ support: "braille",
754
+ htmlContent: { content: ["text"] },
755
+ cardEntries: [{ htmlContent: { content: ["entry"] } }],
756
+ },
757
+ ],
758
+ },
759
+ ],
760
+ });
761
+
762
+ expect(parsed.success).toBe(false);
763
+ });
764
+
765
+ test("only one card entry may carry the default designation (§5.27.2)", () => {
766
+ const parsed = QtiCatalogInfoSchema.safeParse({
767
+ catalogs: [
768
+ {
769
+ id: "c1",
770
+ cards: [
771
+ {
772
+ support: "sign-language",
773
+ cardEntries: [
774
+ { xmlLang: "ase", default: true, htmlContent: { content: ["a"] } },
775
+ { xmlLang: "fsl", default: true, htmlContent: { content: ["b"] } },
776
+ ],
777
+ },
778
+ ],
779
+ },
780
+ ],
781
+ });
782
+
783
+ expect(parsed.success).toBe(false);
784
+ });
785
+
786
+ test("card supports are the SupportEnum tokens or ext: extension strings", () => {
787
+ const card = (support: string) => ({
788
+ catalogs: [{ id: "c1", cards: [{ support, htmlContent: { content: ["x"] } }] }],
789
+ });
790
+
791
+ expect(QtiCatalogInfoSchema.safeParse(card("glossary-on-screen")).success).toBe(true);
792
+ expect(QtiCatalogInfoSchema.safeParse(card("ext:my-program-support")).success).toBe(true);
793
+ expect(QtiCatalogInfoSchema.safeParse(card("not-a-support")).success).toBe(false);
794
+ });