@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
@@ -4,15 +4,15 @@ export * from "./assessment-internal";
4
4
  export * from "./variables-internal";
5
5
  export * from "./processing-internal";
6
6
 
7
- import { strictObject } from "./shared";
8
7
  import { QtiAssessmentItemSchema, QtiAssessmentStimulusSchema, QtiAssessmentTestSchema } from "./assessment-internal";
9
- import { QtiOutcomeDeclarationSchema } from "./variables-internal";
8
+ import { QtiAssessmentItemDocumentSchema } from "./imsqti_itemv3p0p1_v1p0";
9
+ import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
10
10
  import { QtiResponseProcessingDocumentSchema } from "./imsqti_responseprocessingv3p0p1_v1p0";
11
11
  import { QtiAssessmentSectionDocumentSchema, QtiAssessmentSectionSchema } from "./imsqti_sectionv3p0p1_v1p0";
12
12
  import { QtiAssessmentStimulusDocumentSchema } from "./imsqti_stimulusv3p0p1_v1p0";
13
- import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
14
- import { QtiAssessmentItemDocumentSchema } from "./imsqti_itemv3p0p1_v1p0";
15
13
  import { QtiAssessmentTestDocumentSchema, QtiOutcomeProcessingDocumentSchema } from "./imsqti_testv3p0p1_v1p0";
14
+ import { strictObject } from "./shared";
15
+ import { QtiOutcomeDeclarationSchema } from "./variables-internal";
16
16
 
17
17
  export const QtiAssessmentItemDocumentSchemaAlias = QtiAssessmentItemDocumentSchema;
18
18
  export const QtiAssessmentSectionDocumentSchemaAlias = QtiAssessmentSectionDocumentSchema;
@@ -42,9 +42,9 @@ export {
42
42
  } from "./processing-internal";
43
43
 
44
44
  import { QtiAssessmentItemSchema } from "./assessment-internal";
45
- import { strictObject } from "./shared";
46
45
  import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
47
46
  import { QtiResponseProcessingDocumentSchema } from "./imsqti_responseprocessingv3p0p1_v1p0";
47
+ import { strictObject } from "./shared";
48
48
 
49
49
  export const QtiAssessmentItemDocumentSchema = strictObject({
50
50
  assessmentItem: QtiAssessmentItemSchema,
@@ -53,7 +53,7 @@ export const QtiMetadataSchema = strictObject({
53
53
 
54
54
  if (value.portableCustomInteractionContext && !hasPortableCustomInteraction) {
55
55
  context.addIssue({
56
- code: z.ZodIssueCode.custom,
56
+ code: "custom",
57
57
  path: ["portableCustomInteractionContext"],
58
58
  message:
59
59
  "portableCustomInteractionContext is only valid when interactionType includes portableCustomInteraction.",
@@ -7,8 +7,8 @@ export {
7
7
  QtiResponseProcessingSchema,
8
8
  } from "./processing-internal";
9
9
 
10
- import { strictObject } from "./shared";
11
10
  import { QtiResponseProcessingSchema } from "./processing-internal";
11
+ import { strictObject } from "./shared";
12
12
 
13
13
  export const QtiResponseProcessingDocumentSchema = strictObject({
14
14
  responseProcessing: QtiResponseProcessingSchema,
@@ -128,9 +128,10 @@ function createVariableSuperRefine(valueKey: "values" | "candidateResponse", can
128
128
  return (
129
129
  value: {
130
130
  cardinality: z.infer<typeof QtiCardinalitySchema>;
131
- baseType?: z.infer<typeof QtiBaseTypeSchema>;
132
- values?: readonly z.infer<typeof QtiResultValueSchema>[];
133
- candidateResponse?: { values?: readonly z.infer<typeof QtiResultValueSchema>[] };
131
+ // Receives zod-parsed variables; zod's `.optional()` infers `| undefined`, so these must too.
132
+ baseType?: z.infer<typeof QtiBaseTypeSchema> | undefined;
133
+ values?: readonly z.infer<typeof QtiResultValueSchema>[] | undefined;
134
+ candidateResponse?: { values?: readonly z.infer<typeof QtiResultValueSchema>[] | undefined } | undefined;
134
135
  },
135
136
  context: z.RefinementCtx,
136
137
  ) => {
@@ -5,8 +5,8 @@ export {
5
5
  QtiAssessmentSectionSchema,
6
6
  } from "./assessment-internal";
7
7
 
8
- import { strictObject } from "./shared";
9
8
  import { QtiAssessmentSectionSchema } from "./assessment-internal";
9
+ import { strictObject } from "./shared";
10
10
 
11
11
  export const QtiAssessmentSectionDocumentSchema = strictObject({
12
12
  assessmentSection: QtiAssessmentSectionSchema,
@@ -5,8 +5,8 @@ export {
5
5
  QtiStimulusBodySchema,
6
6
  } from "./assessment-internal";
7
7
 
8
- import { strictObject } from "./shared";
9
8
  import { QtiAssessmentStimulusSchema } from "./assessment-internal";
9
+ import { strictObject } from "./shared";
10
10
 
11
11
  export const QtiAssessmentStimulusDocumentSchema = strictObject({
12
12
  assessmentStimulus: QtiAssessmentStimulusSchema,
@@ -24,10 +24,10 @@ export {
24
24
  } from "./processing-internal";
25
25
 
26
26
  import { QtiAssessmentTestSchema } from "./assessment-internal";
27
- import { QtiOutcomeProcessingSchema } from "./processing-internal";
28
- import { strictObject } from "./shared";
29
27
  import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
30
28
  import { QtiAssessmentSectionDocumentSchema } from "./imsqti_sectionv3p0p1_v1p0";
29
+ import { QtiOutcomeProcessingSchema } from "./processing-internal";
30
+ import { strictObject } from "./shared";
31
31
 
32
32
  export const QtiAssessmentTestDocumentSchema = strictObject({
33
33
  assessmentTest: QtiAssessmentTestSchema,
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
 
3
- import { QtiMapEntrySchema, QtiValueSchema } from "./variables-internal";
4
3
  import { QtiIdentifierSchema, UriReferenceSchema, addIssue, strictObject } from "./shared";
4
+ import { QtiMapEntrySchema, QtiValueSchema } from "./variables-internal";
5
5
 
6
6
  export const QtiUsageDateSchema = z.iso.date();
7
7
 
@@ -177,35 +177,35 @@ export const QtiMathConstantExpressionSchema = strictObject({
177
177
  name: z.enum(["pi", "e"]),
178
178
  });
179
179
 
180
- export const QtiUnaryExpressionSchema: z.ZodTypeAny = z.lazy(() =>
180
+ export const QtiUnaryExpressionSchema: z.ZodType = z.lazy(() =>
181
181
  strictObject({
182
182
  kind: z.enum(unaryExpressionKinds),
183
183
  children: z.tuple([QtiExpressionSchema]),
184
184
  }),
185
185
  );
186
186
 
187
- export const QtiBinaryExpressionSchema: z.ZodTypeAny = z.lazy(() =>
187
+ export const QtiBinaryExpressionSchema: z.ZodType = z.lazy(() =>
188
188
  strictObject({
189
189
  kind: z.enum(binaryExpressionKinds),
190
190
  children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
191
191
  }),
192
192
  );
193
193
 
194
- export const QtiOneToManyExpressionSchema: z.ZodTypeAny = z.lazy(() =>
194
+ export const QtiOneToManyExpressionSchema: z.ZodType = z.lazy(() =>
195
195
  strictObject({
196
196
  kind: z.enum(oneToManyExpressionKinds),
197
197
  children: z.array(QtiExpressionSchema).min(1),
198
198
  }),
199
199
  );
200
200
 
201
- export const QtiContainerExpressionSchema: z.ZodTypeAny = z.lazy(() =>
201
+ export const QtiContainerExpressionSchema: z.ZodType = z.lazy(() =>
202
202
  strictObject({
203
203
  kind: z.enum(containerExpressionKinds),
204
204
  children: z.array(QtiExpressionSchema),
205
205
  }),
206
206
  );
207
207
 
208
- export const QtiCustomOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
208
+ export const QtiCustomOperatorExpressionSchema: z.ZodType = z.lazy(() =>
209
209
  strictObject({
210
210
  kind: z.literal("customOperator"),
211
211
  children: z.array(QtiExpressionSchema).optional(),
@@ -215,7 +215,7 @@ export const QtiCustomOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
215
215
  }),
216
216
  );
217
217
 
218
- export const QtiAnyNExpressionSchema: z.ZodTypeAny = z.lazy(() =>
218
+ export const QtiAnyNExpressionSchema: z.ZodType = z.lazy(() =>
219
219
  strictObject({
220
220
  kind: z.literal("anyN"),
221
221
  children: z.array(QtiExpressionSchema).min(1),
@@ -236,7 +236,7 @@ export const QtiAnyNExpressionSchema: z.ZodTypeAny = z.lazy(() =>
236
236
  }),
237
237
  );
238
238
 
239
- export const QtiEqualExpressionSchema: z.ZodTypeAny = z.lazy(() =>
239
+ export const QtiEqualExpressionSchema: z.ZodType = z.lazy(() =>
240
240
  strictObject({
241
241
  kind: z.literal("equal"),
242
242
  children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
@@ -247,7 +247,7 @@ export const QtiEqualExpressionSchema: z.ZodTypeAny = z.lazy(() =>
247
247
  }),
248
248
  );
249
249
 
250
- export const QtiEqualRoundedExpressionSchema: z.ZodTypeAny = z.lazy(() =>
250
+ export const QtiEqualRoundedExpressionSchema: z.ZodType = z.lazy(() =>
251
251
  strictObject({
252
252
  kind: z.literal("equalRounded"),
253
253
  children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
@@ -258,7 +258,7 @@ export const QtiEqualRoundedExpressionSchema: z.ZodTypeAny = z.lazy(() =>
258
258
  }),
259
259
  );
260
260
 
261
- export const QtiFieldValueExpressionSchema: z.ZodTypeAny = z.lazy(() =>
261
+ export const QtiFieldValueExpressionSchema: z.ZodType = z.lazy(() =>
262
262
  strictObject({
263
263
  kind: z.literal("fieldValue"),
264
264
  children: z.tuple([QtiExpressionSchema]),
@@ -266,7 +266,7 @@ export const QtiFieldValueExpressionSchema: z.ZodTypeAny = z.lazy(() =>
266
266
  }),
267
267
  );
268
268
 
269
- export const QtiIndexExpressionSchema: z.ZodTypeAny = z.lazy(() =>
269
+ export const QtiIndexExpressionSchema: z.ZodType = z.lazy(() =>
270
270
  strictObject({
271
271
  kind: z.literal("index"),
272
272
  children: z.tuple([QtiExpressionSchema]),
@@ -276,7 +276,7 @@ export const QtiIndexExpressionSchema: z.ZodTypeAny = z.lazy(() =>
276
276
  }),
277
277
  );
278
278
 
279
- export const QtiInsideExpressionSchema: z.ZodTypeAny = z.lazy(() =>
279
+ export const QtiInsideExpressionSchema: z.ZodType = z.lazy(() =>
280
280
  strictObject({
281
281
  kind: z.literal("inside"),
282
282
  children: z.tuple([QtiExpressionSchema]),
@@ -285,7 +285,7 @@ export const QtiInsideExpressionSchema: z.ZodTypeAny = z.lazy(() =>
285
285
  }),
286
286
  );
287
287
 
288
- export const QtiMathOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
288
+ export const QtiMathOperatorExpressionSchema: z.ZodType = z.lazy(() =>
289
289
  strictObject({
290
290
  kind: z.literal("mathOperator"),
291
291
  children: z.array(QtiExpressionSchema).min(1),
@@ -303,7 +303,7 @@ export const QtiMathOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
303
303
  }),
304
304
  );
305
305
 
306
- export const QtiPatternMatchExpressionSchema: z.ZodTypeAny = z.lazy(() =>
306
+ export const QtiPatternMatchExpressionSchema: z.ZodType = z.lazy(() =>
307
307
  strictObject({
308
308
  kind: z.literal("patternMatch"),
309
309
  children: z.tuple([QtiExpressionSchema]),
@@ -311,7 +311,7 @@ export const QtiPatternMatchExpressionSchema: z.ZodTypeAny = z.lazy(() =>
311
311
  }),
312
312
  );
313
313
 
314
- export const QtiRepeatExpressionSchema: z.ZodTypeAny = z.lazy(() =>
314
+ export const QtiRepeatExpressionSchema: z.ZodType = z.lazy(() =>
315
315
  strictObject({
316
316
  kind: z.literal("repeat"),
317
317
  children: z.array(QtiExpressionSchema).min(1),
@@ -321,7 +321,7 @@ export const QtiRepeatExpressionSchema: z.ZodTypeAny = z.lazy(() =>
321
321
  }),
322
322
  );
323
323
 
324
- export const QtiRoundToExpressionSchema: z.ZodTypeAny = z.lazy(() =>
324
+ export const QtiRoundToExpressionSchema: z.ZodType = z.lazy(() =>
325
325
  strictObject({
326
326
  kind: z.literal("roundTo"),
327
327
  children: z.tuple([QtiExpressionSchema]),
@@ -332,7 +332,7 @@ export const QtiRoundToExpressionSchema: z.ZodTypeAny = z.lazy(() =>
332
332
  }),
333
333
  );
334
334
 
335
- export const QtiStatsOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
335
+ export const QtiStatsOperatorExpressionSchema: z.ZodType = z.lazy(() =>
336
336
  strictObject({
337
337
  kind: z.literal("statsOperator"),
338
338
  children: z.tuple([QtiExpressionSchema]),
@@ -340,7 +340,7 @@ export const QtiStatsOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
340
340
  }),
341
341
  );
342
342
 
343
- export const QtiStringMatchExpressionSchema: z.ZodTypeAny = z.lazy(() =>
343
+ export const QtiStringMatchExpressionSchema: z.ZodType = z.lazy(() =>
344
344
  strictObject({
345
345
  kind: z.literal("stringMatch"),
346
346
  children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
@@ -349,7 +349,7 @@ export const QtiStringMatchExpressionSchema: z.ZodTypeAny = z.lazy(() =>
349
349
  }),
350
350
  );
351
351
 
352
- export const QtiSubstringExpressionSchema: z.ZodTypeAny = z.lazy(() =>
352
+ export const QtiSubstringExpressionSchema: z.ZodType = z.lazy(() =>
353
353
  strictObject({
354
354
  kind: z.literal("substring"),
355
355
  children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
@@ -404,7 +404,7 @@ export const QtiTestVariablesExpressionSchema = strictObject({
404
404
  baseType: QtiBaseTypeSchema.optional(),
405
405
  });
406
406
 
407
- export const QtiExpressionSchema: z.ZodTypeAny = z.lazy(() =>
407
+ export const QtiExpressionSchema: z.ZodType = z.lazy(() =>
408
408
  z.union([
409
409
  QtiNullExpressionSchema,
410
410
  QtiBaseValueExpressionSchema,
@@ -509,14 +509,14 @@ export const QtiExitTestSchema = strictObject({
509
509
  kind: z.literal("exitTest"),
510
510
  });
511
511
 
512
- export const QtiResponseElseSchema: z.ZodTypeAny = z.lazy(() =>
512
+ export const QtiResponseElseSchema: z.ZodType = z.lazy(() =>
513
513
  strictObject({
514
514
  kind: z.literal("responseElse"),
515
515
  actions: z.array(QtiResponseRuleSchema).optional(),
516
516
  }),
517
517
  );
518
518
 
519
- export const QtiResponseIfSchema: z.ZodTypeAny = z.lazy(() =>
519
+ export const QtiResponseIfSchema: z.ZodType = z.lazy(() =>
520
520
  strictObject({
521
521
  kind: z.literal("responseIf"),
522
522
  expression: QtiExpressionSchema,
@@ -524,7 +524,7 @@ export const QtiResponseIfSchema: z.ZodTypeAny = z.lazy(() =>
524
524
  }),
525
525
  );
526
526
 
527
- export const QtiResponseConditionSchema: z.ZodTypeAny = z.lazy(() =>
527
+ export const QtiResponseConditionSchema: z.ZodType = z.lazy(() =>
528
528
  strictObject({
529
529
  kind: z.literal("responseCondition"),
530
530
  responseIf: QtiResponseIfSchema,
@@ -533,14 +533,14 @@ export const QtiResponseConditionSchema: z.ZodTypeAny = z.lazy(() =>
533
533
  }),
534
534
  );
535
535
 
536
- export const QtiResponseProcessingFragmentSchema: z.ZodTypeAny = z.lazy(() =>
536
+ export const QtiResponseProcessingFragmentSchema: z.ZodType = z.lazy(() =>
537
537
  strictObject({
538
538
  kind: z.literal("responseProcessingFragment"),
539
539
  rules: z.array(QtiResponseRuleSchema).optional(),
540
540
  }),
541
541
  );
542
542
 
543
- export const QtiResponseRuleSchema: z.ZodTypeAny = z.lazy(() =>
543
+ export const QtiResponseRuleSchema: z.ZodType = z.lazy(() =>
544
544
  z.union([
545
545
  QtiIncludeSchema,
546
546
  QtiResponseConditionSchema,
@@ -557,14 +557,14 @@ export const QtiResponseProcessingSchema = strictObject({
557
557
  templateLocation: z.string().optional(),
558
558
  });
559
559
 
560
- export const QtiOutcomeElseSchema: z.ZodTypeAny = z.lazy(() =>
560
+ export const QtiOutcomeElseSchema: z.ZodType = z.lazy(() =>
561
561
  strictObject({
562
562
  kind: z.literal("outcomeElse"),
563
563
  actions: z.array(QtiOutcomeRuleSchema).optional(),
564
564
  }),
565
565
  );
566
566
 
567
- export const QtiOutcomeIfSchema: z.ZodTypeAny = z.lazy(() =>
567
+ export const QtiOutcomeIfSchema: z.ZodType = z.lazy(() =>
568
568
  strictObject({
569
569
  kind: z.literal("outcomeIf"),
570
570
  expression: QtiExpressionSchema,
@@ -572,7 +572,7 @@ export const QtiOutcomeIfSchema: z.ZodTypeAny = z.lazy(() =>
572
572
  }),
573
573
  );
574
574
 
575
- export const QtiOutcomeConditionSchema: z.ZodTypeAny = z.lazy(() =>
575
+ export const QtiOutcomeConditionSchema: z.ZodType = z.lazy(() =>
576
576
  strictObject({
577
577
  kind: z.literal("outcomeCondition"),
578
578
  outcomeIf: QtiOutcomeIfSchema,
@@ -581,14 +581,14 @@ export const QtiOutcomeConditionSchema: z.ZodTypeAny = z.lazy(() =>
581
581
  }),
582
582
  );
583
583
 
584
- export const QtiOutcomeProcessingFragmentSchema: z.ZodTypeAny = z.lazy(() =>
584
+ export const QtiOutcomeProcessingFragmentSchema: z.ZodType = z.lazy(() =>
585
585
  strictObject({
586
586
  kind: z.literal("outcomeProcessingFragment"),
587
587
  rules: z.array(QtiOutcomeRuleSchema).optional(),
588
588
  }),
589
589
  );
590
590
 
591
- export const QtiOutcomeRuleSchema: z.ZodTypeAny = z.lazy(() =>
591
+ export const QtiOutcomeRuleSchema: z.ZodType = z.lazy(() =>
592
592
  z.union([
593
593
  QtiIncludeSchema,
594
594
  QtiOutcomeConditionSchema,
@@ -603,14 +603,14 @@ export const QtiOutcomeProcessingSchema = strictObject({
603
603
  rules: z.array(QtiOutcomeRuleSchema).optional(),
604
604
  });
605
605
 
606
- export const QtiTemplateElseSchema: z.ZodTypeAny = z.lazy(() =>
606
+ export const QtiTemplateElseSchema: z.ZodType = z.lazy(() =>
607
607
  strictObject({
608
608
  kind: z.literal("templateElse"),
609
609
  actions: z.array(QtiTemplateRuleSchema).optional(),
610
610
  }),
611
611
  );
612
612
 
613
- export const QtiTemplateIfSchema: z.ZodTypeAny = z.lazy(() =>
613
+ export const QtiTemplateIfSchema: z.ZodType = z.lazy(() =>
614
614
  strictObject({
615
615
  kind: z.literal("templateIf"),
616
616
  expression: QtiExpressionSchema,
@@ -618,7 +618,7 @@ export const QtiTemplateIfSchema: z.ZodTypeAny = z.lazy(() =>
618
618
  }),
619
619
  );
620
620
 
621
- export const QtiTemplateConditionSchema: z.ZodTypeAny = z.lazy(() =>
621
+ export const QtiTemplateConditionSchema: z.ZodType = z.lazy(() =>
622
622
  strictObject({
623
623
  kind: z.literal("templateCondition"),
624
624
  templateIf: QtiTemplateIfSchema,
@@ -627,7 +627,7 @@ export const QtiTemplateConditionSchema: z.ZodTypeAny = z.lazy(() =>
627
627
  }),
628
628
  );
629
629
 
630
- export const QtiTemplateRuleSchema: z.ZodTypeAny = z.lazy(() =>
630
+ export const QtiTemplateRuleSchema: z.ZodType = z.lazy(() =>
631
631
  z.union([
632
632
  QtiTemplateConditionSchema,
633
633
  QtiSetTemplateValueSchema,
@@ -76,7 +76,7 @@ export function looseObject<T extends z.ZodRawShape>(shape: T) {
76
76
  });
77
77
  }
78
78
 
79
- export function createXmlNodeSchema(childSchema: z.ZodTypeAny): z.ZodTypeAny {
79
+ export function createXmlNodeSchema(childSchema: z.ZodType): z.ZodType {
80
80
  return z.lazy(() =>
81
81
  strictObject({
82
82
  kind: z.literal("xml"),
@@ -91,7 +91,7 @@ export function createXmlNodeSchema(childSchema: z.ZodTypeAny): z.ZodTypeAny {
91
91
 
92
92
  export function addIssue(context: z.RefinementCtx, path: Array<string | number>, message: string) {
93
93
  context.addIssue({
94
- code: z.ZodIssueCode.custom,
94
+ code: "custom",
95
95
  path,
96
96
  message,
97
97
  });
@@ -23,16 +23,16 @@ export function strictObject<T extends z.ZodRawShape>(shape: T) {
23
23
  }
24
24
 
25
25
  export function passthroughObject<T extends z.ZodRawShape>(shape: T) {
26
- return z.object(shape).passthrough();
26
+ return z.looseObject(shape);
27
27
  }
28
28
 
29
- export function oneOrMany<T extends z.ZodTypeAny>(schema: T) {
29
+ export function oneOrMany<T extends z.ZodType>(schema: T) {
30
30
  return z.union([schema, z.array(schema).min(1)]);
31
31
  }
32
32
 
33
33
  export function addIssue(context: z.RefinementCtx, path: Array<string | number>, message: string) {
34
34
  context.addIssue({
35
- code: z.ZodIssueCode.custom,
35
+ code: "custom",
36
36
  path,
37
37
  message,
38
38
  });
@@ -98,7 +98,7 @@ export function credentialTypeSchema<T extends readonly [string, ...string[]]>(d
98
98
  });
99
99
  }
100
100
 
101
- export function contextArraySchema(label: string, requiredEntries: readonly z.ZodTypeAny[]) {
101
+ export function contextArraySchema(label: string, requiredEntries: readonly z.ZodType[]) {
102
102
  return z
103
103
  .array(JsonLdContextEntrySchema)
104
104
  .min(requiredEntries.length)
@@ -7,18 +7,15 @@ export function strictObject<T extends z.ZodRawShape>(shape: T) {
7
7
  const UriSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/u);
8
8
 
9
9
  export const NonEmptyStringSchema = z.string().min(1);
10
- export const UuidSchema = z.string().uuid();
10
+ export const UuidSchema = z.uuid();
11
11
  export const UriSchemaStrict = UriSchema;
12
12
  export const IriSchema = UriSchema;
13
13
  export const MediaTypeSchema = z.string().min(1);
14
14
  export const LanguageTagSchema = z.string().regex(/^[A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*$/u);
15
15
  export const XapiVersionSchema = z.string().regex(/^\d+\.\d+(?:\.\d+)?$/u);
16
- export const Iso8601TimestampSchema = z
17
- .string()
18
- .datetime({ offset: true })
19
- .refine((v) => !v.endsWith("-00:00"), {
20
- message: "Negative zero offset (-00:00) is not a valid xAPI timestamp",
21
- });
16
+ export const Iso8601TimestampSchema = z.iso.datetime({ offset: true }).refine((v) => !v.endsWith("-00:00"), {
17
+ message: "Negative zero offset (-00:00) is not a valid xAPI timestamp",
18
+ });
22
19
  export const Iso8601DurationSchema = z
23
20
  .string()
24
21
  .regex(/^P(?=.)(?:(\d+W)|(?:(\d+Y)?(\d+M)?(\d+D)?(?:T(?=\d)(\d+H)?(\d+M)?(\d+(?:\.\d+)?S)?)?))$/u);
@@ -57,7 +54,7 @@ export const AgentSchema = strictObject({
57
54
  const ifiCount = [value.mbox, value.mbox_sha1sum, value.openid, value.account].filter(hasDefined).length;
58
55
  if (ifiCount !== 1) {
59
56
  ctx.addIssue({
60
- code: z.ZodIssueCode.custom,
57
+ code: "custom",
61
58
  message:
62
59
  "An xAPI Agent requires exactly one Inverse Functional Identifier (mbox, mbox_sha1sum, openid, or account)",
63
60
  });
@@ -82,13 +79,13 @@ export const GroupSchema = strictObject({
82
79
  const ifiCount = [value.mbox, value.mbox_sha1sum, value.openid, value.account].filter(hasDefined).length;
83
80
  if (ifiCount > 1) {
84
81
  ctx.addIssue({
85
- code: z.ZodIssueCode.custom,
82
+ code: "custom",
86
83
  message: "An identified xAPI Group MUST have exactly one Inverse Functional Identifier",
87
84
  });
88
85
  }
89
86
  if (ifiCount === 0 && !hasDefined(value.member)) {
90
87
  ctx.addIssue({
91
- code: z.ZodIssueCode.custom,
88
+ code: "custom",
92
89
  message: "An anonymous xAPI Group requires a member list",
93
90
  });
94
91
  }
@@ -162,7 +159,7 @@ export const ActivityDefinitionSchema = strictObject({
162
159
  for (const prop of interactionSubProperties) {
163
160
  if (value[prop] !== undefined) {
164
161
  ctx.addIssue({
165
- code: z.ZodIssueCode.custom,
162
+ code: "custom",
166
163
  message: `Activity definition property '${prop}' requires interactionType to be set`,
167
164
  path: [prop],
168
165
  });
@@ -190,21 +187,21 @@ export const ScoreSchema = strictObject({
190
187
  const { min, max, raw } = value;
191
188
  if (min !== undefined && max !== undefined && min >= max) {
192
189
  ctx.addIssue({
193
- code: z.ZodIssueCode.custom,
190
+ code: "custom",
194
191
  message: "Score max must be greater than min",
195
192
  path: ["max"],
196
193
  });
197
194
  }
198
195
  if (raw !== undefined && min !== undefined && raw < min) {
199
196
  ctx.addIssue({
200
- code: z.ZodIssueCode.custom,
197
+ code: "custom",
201
198
  message: "Score raw must be greater than or equal to min",
202
199
  path: ["raw"],
203
200
  });
204
201
  }
205
202
  if (raw !== undefined && max !== undefined && raw > max) {
206
203
  ctx.addIssue({
207
- code: z.ZodIssueCode.custom,
204
+ code: "custom",
208
205
  message: "Score raw must be less than or equal to max",
209
206
  path: ["raw"],
210
207
  });
@@ -51,61 +51,61 @@ import {
51
51
  XapiMultipartRequestSchema,
52
52
  } from "../shared";
53
53
 
54
- export namespace XapiV1_0_3 {
55
- export namespace Schemas {
56
- export const AgentAccount = AgentAccountSchema;
57
- export const Agent = AgentSchema;
58
- export const Group = GroupSchema;
59
- export const Verb = VerbSchema;
60
- export const InteractionComponent = InteractionComponentSchema;
61
- export const Activity = ActivitySchema;
62
- export const StatementRef = StatementRefSchema;
63
- export const SubStatement = SubStatementSchema;
64
- export const Score = ScoreSchema;
65
- export const Result = ResultSchema;
66
- export const ContextActivities = ContextActivitiesSchema;
67
- export const Context = ContextSchema;
68
- export const Attachment = AttachmentSchema;
69
- export const StatementObject = StatementObjectSchema;
70
- export const Statement = StatementSchema;
71
- export const StatementSubmission = StatementSubmissionSchema;
72
- export const StatementResult = StatementResultSchema;
73
- export const Person = PersonSchema;
74
- export const AboutResource = AboutResourceSchema;
75
- export const StatementsQuery = StatementsQuerySchema;
76
- export const AgentsResourceQuery = AgentsResourceQuerySchema;
77
- export const ActivitiesResourceQuery = ActivitiesResourceQuerySchema;
78
- export const StateDocumentQuery = StateDocumentQuerySchema;
79
- export const StateDocumentListingQuery = StateDocumentListingQuerySchema;
80
- export const AgentProfileDocumentQuery = AgentProfileDocumentQuerySchema;
81
- export const AgentProfileDocumentListingQuery = AgentProfileDocumentListingQuerySchema;
82
- export const ActivityProfileDocumentQuery = ActivityProfileDocumentQuerySchema;
83
- export const ActivityProfileDocumentListingQuery = ActivityProfileDocumentListingQuerySchema;
84
- export const XapiDocument = XapiDocumentSchema;
85
- export const XapiDocumentIdList = XapiDocumentIdListSchema;
86
- export const HttpMethod = XapiHttpMethodSchema;
87
- export const Resource = XapiResourceSchema;
88
- export const RequestHeader = XapiRequestHeaderSchema;
89
- export const ResponseHeader = XapiResponseHeaderSchema;
90
- export const ErrorCode = XapiErrorCodeSchema;
91
- export const ErrorResponse = XapiErrorResponseSchema;
92
- export const Concurrency = XapiConcurrencySchema;
93
- export const MultipartAttachmentPart = XapiMultipartAttachmentPartSchema;
94
- export const MultipartRequest = XapiMultipartRequestSchema;
95
- }
54
+ export const XapiV1_0_3 = {
55
+ Schemas: {
56
+ AgentAccount: AgentAccountSchema,
57
+ Agent: AgentSchema,
58
+ Group: GroupSchema,
59
+ Verb: VerbSchema,
60
+ InteractionComponent: InteractionComponentSchema,
61
+ Activity: ActivitySchema,
62
+ StatementRef: StatementRefSchema,
63
+ SubStatement: SubStatementSchema,
64
+ Score: ScoreSchema,
65
+ Result: ResultSchema,
66
+ ContextActivities: ContextActivitiesSchema,
67
+ Context: ContextSchema,
68
+ Attachment: AttachmentSchema,
69
+ StatementObject: StatementObjectSchema,
70
+ Statement: StatementSchema,
71
+ StatementSubmission: StatementSubmissionSchema,
72
+ StatementResult: StatementResultSchema,
73
+ Person: PersonSchema,
74
+ AboutResource: AboutResourceSchema,
75
+ StatementsQuery: StatementsQuerySchema,
76
+ AgentsResourceQuery: AgentsResourceQuerySchema,
77
+ ActivitiesResourceQuery: ActivitiesResourceQuerySchema,
78
+ StateDocumentQuery: StateDocumentQuerySchema,
79
+ StateDocumentListingQuery: StateDocumentListingQuerySchema,
80
+ AgentProfileDocumentQuery: AgentProfileDocumentQuerySchema,
81
+ AgentProfileDocumentListingQuery: AgentProfileDocumentListingQuerySchema,
82
+ ActivityProfileDocumentQuery: ActivityProfileDocumentQuerySchema,
83
+ ActivityProfileDocumentListingQuery: ActivityProfileDocumentListingQuerySchema,
84
+ XapiDocument: XapiDocumentSchema,
85
+ XapiDocumentIdList: XapiDocumentIdListSchema,
86
+ HttpMethod: XapiHttpMethodSchema,
87
+ Resource: XapiResourceSchema,
88
+ RequestHeader: XapiRequestHeaderSchema,
89
+ ResponseHeader: XapiResponseHeaderSchema,
90
+ ErrorCode: XapiErrorCodeSchema,
91
+ ErrorResponse: XapiErrorResponseSchema,
92
+ Concurrency: XapiConcurrencySchema,
93
+ MultipartAttachmentPart: XapiMultipartAttachmentPartSchema,
94
+ MultipartRequest: XapiMultipartRequestSchema,
95
+ },
96
96
 
97
- export namespace Shared {
98
- export const Uuid = UuidSchema;
99
- export const Version = XapiVersionSchema;
100
- export const Iri = IriSchema;
101
- export const LanguageTag = LanguageTagSchema;
102
- export const LanguageMap = LanguageMapSchema;
103
- export const Timestamp = Iso8601TimestampSchema;
104
- export const Duration = Iso8601DurationSchema;
105
- export const NonEmptyString = NonEmptyStringSchema;
106
- export const InteractionType = InteractionTypeSchema;
107
- }
108
- }
97
+ Shared: {
98
+ Uuid: UuidSchema,
99
+ Version: XapiVersionSchema,
100
+ Iri: IriSchema,
101
+ LanguageTag: LanguageTagSchema,
102
+ LanguageMap: LanguageMapSchema,
103
+ Timestamp: Iso8601TimestampSchema,
104
+ Duration: Iso8601DurationSchema,
105
+ NonEmptyString: NonEmptyStringSchema,
106
+ InteractionType: InteractionTypeSchema,
107
+ },
108
+ } as const;
109
109
 
110
110
  export type XapiV1_0_3Schemas = typeof XapiV1_0_3.Schemas;
111
111