@conform-ed/contracts 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -2
- package/.turbo/turbo-format.log +5 -5
- package/.turbo/turbo-lint.log +3 -3
- package/.turbo/turbo-test.log +228 -223
- package/.turbo/turbo-typecheck.log +1 -1
- package/package.json +4 -4
- package/src/adapter.ts +1 -1
- package/src/caliper/v1_2/caliper_v1p2_bootcamp_schema.ts +6 -6
- package/src/caliper/v1_2/shared.ts +2 -2
- package/src/case/v1_1/case_v1p1_openapi3_restbinding_schema.ts +1 -0
- package/src/case/v1_1/index.ts +41 -41
- package/src/cat/v1_0/index.ts +39 -39
- package/src/cat/v1_0/shared.ts +1 -1
- package/src/clr/v2_0/shared.ts +19 -17
- package/src/cmi5/v1_0/index.ts +19 -19
- package/src/common-cartridge/v1_3/ccv1p3_imscp_v1p2_v1p0.ts +3 -3
- package/src/common-cartridge/v1_3/ccv1p3_lomccltilink_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_qtiasiv1p2p1_v1p0.ts +16 -13
- package/src/common-cartridge/v1_3/index.ts +3 -3
- package/src/common-cartridge/v1_3/lom-internal.ts +19 -19
- package/src/common-cartridge/v1_3/shared.ts +1 -1
- package/src/common-cartridge/v1_4/core/ccv1p4_imscp_v1p2_v1p0.ts +6 -6
- package/src/common-cartridge/v1_4/core/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/core/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/extension/ccv1p4_cpextensionv1p2_v1p0.ts +1 -0
- package/src/common-cartridge/v1_4/index.ts +5 -5
- package/src/common-cartridge/v1_4/k12/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/k12/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/lom-internal.ts +30 -27
- package/src/common-cartridge/v1_4/shared/ccv1p4_lomccltilink_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/shared/ccv1p4_qtiasiv1p2p1_v1p0.ts +16 -13
- package/src/common-cartridge/v1_4/shared.ts +1 -1
- package/src/common-cartridge/v1_4/thin/ccv1p4_imscp_v1p2_v1p0.ts +5 -5
- package/src/common-cartridge/v1_4/thin/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/thin/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/vdex/imsmd_loose_v1p3p2.ts +2 -1
- package/src/common-cartridge/v1_4/vdex/imsvdex_v1p0.ts +1 -1
- package/src/config.ts +3 -3
- package/src/h5p/v1/content.ts +1 -0
- package/src/h5p/v1/h5p-json.ts +4 -3
- package/src/h5p/v1/index.ts +21 -21
- package/src/h5p/v1/library-json.ts +2 -1
- package/src/lti/ags/v2_0/index.ts +12 -12
- package/src/lti/deep-linking/v2_0/index.ts +10 -10
- package/src/lti/index.ts +2 -2
- package/src/lti/nrps/v2_0/index.ts +10 -10
- package/src/lti/proctoring/v1_0/index.ts +11 -11
- package/src/lti/v1_3/index.ts +17 -17
- package/src/oneroster/v1_2/index.ts +45 -45
- package/src/oneroster/v1_2/or_v1p2_gradebook_restbinding_schema.ts +3 -3
- package/src/oneroster/v1_2/or_v1p2_resource_restbinding_schema.ts +1 -1
- package/src/oneroster/v1_2/or_v1p2_rostering_restbinding_schema.ts +1 -1
- package/src/oneroster/v1_2/or_v1p2_rostering_service_schema.ts +1 -1
- package/src/open-badges/v3_0/shared.ts +31 -29
- package/src/qti/v2-internal.ts +12 -11
- package/src/qti/v3_0_1/assessment-internal.ts +239 -197
- package/src/qti/v3_0_1/imsqti_asiv3p0p1_v1p0.ts +4 -4
- package/src/qti/v3_0_1/imsqti_itemv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_metadatav3p0_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_responseprocessingv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_resultv3p0_v1p0.ts +4 -3
- package/src/qti/v3_0_1/imsqti_sectionv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_stimulusv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_testv3p0p1_v1p0.ts +2 -2
- package/src/qti/v3_0_1/imsqti_usagedatav3p0_v1p0.ts +1 -1
- package/src/qti/v3_0_1/processing-internal.ts +44 -33
- package/src/qti/v3_0_1/shared.ts +2 -2
- package/src/vc-data-model/v2_0/shared.ts +4 -4
- package/src/xapi/shared.ts +11 -14
- package/src/xapi/v1_0_3/index.ts +54 -54
- package/src/xapi/v2_0/index.ts +56 -56
- package/test/caliper-v1_2.test.ts +1 -1
- package/test/cat-v1_0.test.ts +1 -0
- package/test/cmi5-v1_0.test.ts +33 -31
- package/test/contracts.test.ts +1 -0
- package/test/h5p-v1.test.ts +1 -0
- package/test/lti.test.ts +1 -0
- package/test/qti-v3_0_1.test.ts +109 -0
- package/test/schema-examples.test.ts +1 -0
- 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 {
|
|
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:
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
|
@@ -33,7 +33,6 @@ const binaryExpressionKinds = [
|
|
|
33
33
|
"divide",
|
|
34
34
|
"delete",
|
|
35
35
|
"match",
|
|
36
|
-
"equal",
|
|
37
36
|
"integerDivide",
|
|
38
37
|
"integerModulus",
|
|
39
38
|
"contains",
|
|
@@ -178,35 +177,35 @@ export const QtiMathConstantExpressionSchema = strictObject({
|
|
|
178
177
|
name: z.enum(["pi", "e"]),
|
|
179
178
|
});
|
|
180
179
|
|
|
181
|
-
export const QtiUnaryExpressionSchema: z.
|
|
180
|
+
export const QtiUnaryExpressionSchema: z.ZodType = z.lazy(() =>
|
|
182
181
|
strictObject({
|
|
183
182
|
kind: z.enum(unaryExpressionKinds),
|
|
184
183
|
children: z.tuple([QtiExpressionSchema]),
|
|
185
184
|
}),
|
|
186
185
|
);
|
|
187
186
|
|
|
188
|
-
export const QtiBinaryExpressionSchema: z.
|
|
187
|
+
export const QtiBinaryExpressionSchema: z.ZodType = z.lazy(() =>
|
|
189
188
|
strictObject({
|
|
190
189
|
kind: z.enum(binaryExpressionKinds),
|
|
191
190
|
children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
|
|
192
191
|
}),
|
|
193
192
|
);
|
|
194
193
|
|
|
195
|
-
export const QtiOneToManyExpressionSchema: z.
|
|
194
|
+
export const QtiOneToManyExpressionSchema: z.ZodType = z.lazy(() =>
|
|
196
195
|
strictObject({
|
|
197
196
|
kind: z.enum(oneToManyExpressionKinds),
|
|
198
197
|
children: z.array(QtiExpressionSchema).min(1),
|
|
199
198
|
}),
|
|
200
199
|
);
|
|
201
200
|
|
|
202
|
-
export const QtiContainerExpressionSchema: z.
|
|
201
|
+
export const QtiContainerExpressionSchema: z.ZodType = z.lazy(() =>
|
|
203
202
|
strictObject({
|
|
204
203
|
kind: z.enum(containerExpressionKinds),
|
|
205
204
|
children: z.array(QtiExpressionSchema),
|
|
206
205
|
}),
|
|
207
206
|
);
|
|
208
207
|
|
|
209
|
-
export const QtiCustomOperatorExpressionSchema: z.
|
|
208
|
+
export const QtiCustomOperatorExpressionSchema: z.ZodType = z.lazy(() =>
|
|
210
209
|
strictObject({
|
|
211
210
|
kind: z.literal("customOperator"),
|
|
212
211
|
children: z.array(QtiExpressionSchema).optional(),
|
|
@@ -216,7 +215,7 @@ export const QtiCustomOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
216
215
|
}),
|
|
217
216
|
);
|
|
218
217
|
|
|
219
|
-
export const QtiAnyNExpressionSchema: z.
|
|
218
|
+
export const QtiAnyNExpressionSchema: z.ZodType = z.lazy(() =>
|
|
220
219
|
strictObject({
|
|
221
220
|
kind: z.literal("anyN"),
|
|
222
221
|
children: z.array(QtiExpressionSchema).min(1),
|
|
@@ -237,7 +236,18 @@ export const QtiAnyNExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
237
236
|
}),
|
|
238
237
|
);
|
|
239
238
|
|
|
240
|
-
export const
|
|
239
|
+
export const QtiEqualExpressionSchema: z.ZodType = z.lazy(() =>
|
|
240
|
+
strictObject({
|
|
241
|
+
kind: z.literal("equal"),
|
|
242
|
+
children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
|
|
243
|
+
toleranceMode: z.enum(["exact", "absolute", "relative"]).optional(),
|
|
244
|
+
tolerance: z.array(QtiNumberOrVariableSchema).min(1).max(2).optional(),
|
|
245
|
+
includeLowerBound: z.boolean().optional(),
|
|
246
|
+
includeUpperBound: z.boolean().optional(),
|
|
247
|
+
}),
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
export const QtiEqualRoundedExpressionSchema: z.ZodType = z.lazy(() =>
|
|
241
251
|
strictObject({
|
|
242
252
|
kind: z.literal("equalRounded"),
|
|
243
253
|
children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
|
|
@@ -248,7 +258,7 @@ export const QtiEqualRoundedExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
248
258
|
}),
|
|
249
259
|
);
|
|
250
260
|
|
|
251
|
-
export const QtiFieldValueExpressionSchema: z.
|
|
261
|
+
export const QtiFieldValueExpressionSchema: z.ZodType = z.lazy(() =>
|
|
252
262
|
strictObject({
|
|
253
263
|
kind: z.literal("fieldValue"),
|
|
254
264
|
children: z.tuple([QtiExpressionSchema]),
|
|
@@ -256,7 +266,7 @@ export const QtiFieldValueExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
256
266
|
}),
|
|
257
267
|
);
|
|
258
268
|
|
|
259
|
-
export const QtiIndexExpressionSchema: z.
|
|
269
|
+
export const QtiIndexExpressionSchema: z.ZodType = z.lazy(() =>
|
|
260
270
|
strictObject({
|
|
261
271
|
kind: z.literal("index"),
|
|
262
272
|
children: z.tuple([QtiExpressionSchema]),
|
|
@@ -266,7 +276,7 @@ export const QtiIndexExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
266
276
|
}),
|
|
267
277
|
);
|
|
268
278
|
|
|
269
|
-
export const QtiInsideExpressionSchema: z.
|
|
279
|
+
export const QtiInsideExpressionSchema: z.ZodType = z.lazy(() =>
|
|
270
280
|
strictObject({
|
|
271
281
|
kind: z.literal("inside"),
|
|
272
282
|
children: z.tuple([QtiExpressionSchema]),
|
|
@@ -275,7 +285,7 @@ export const QtiInsideExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
275
285
|
}),
|
|
276
286
|
);
|
|
277
287
|
|
|
278
|
-
export const QtiMathOperatorExpressionSchema: z.
|
|
288
|
+
export const QtiMathOperatorExpressionSchema: z.ZodType = z.lazy(() =>
|
|
279
289
|
strictObject({
|
|
280
290
|
kind: z.literal("mathOperator"),
|
|
281
291
|
children: z.array(QtiExpressionSchema).min(1),
|
|
@@ -293,7 +303,7 @@ export const QtiMathOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
293
303
|
}),
|
|
294
304
|
);
|
|
295
305
|
|
|
296
|
-
export const QtiPatternMatchExpressionSchema: z.
|
|
306
|
+
export const QtiPatternMatchExpressionSchema: z.ZodType = z.lazy(() =>
|
|
297
307
|
strictObject({
|
|
298
308
|
kind: z.literal("patternMatch"),
|
|
299
309
|
children: z.tuple([QtiExpressionSchema]),
|
|
@@ -301,7 +311,7 @@ export const QtiPatternMatchExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
301
311
|
}),
|
|
302
312
|
);
|
|
303
313
|
|
|
304
|
-
export const QtiRepeatExpressionSchema: z.
|
|
314
|
+
export const QtiRepeatExpressionSchema: z.ZodType = z.lazy(() =>
|
|
305
315
|
strictObject({
|
|
306
316
|
kind: z.literal("repeat"),
|
|
307
317
|
children: z.array(QtiExpressionSchema).min(1),
|
|
@@ -311,7 +321,7 @@ export const QtiRepeatExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
311
321
|
}),
|
|
312
322
|
);
|
|
313
323
|
|
|
314
|
-
export const QtiRoundToExpressionSchema: z.
|
|
324
|
+
export const QtiRoundToExpressionSchema: z.ZodType = z.lazy(() =>
|
|
315
325
|
strictObject({
|
|
316
326
|
kind: z.literal("roundTo"),
|
|
317
327
|
children: z.tuple([QtiExpressionSchema]),
|
|
@@ -322,7 +332,7 @@ export const QtiRoundToExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
322
332
|
}),
|
|
323
333
|
);
|
|
324
334
|
|
|
325
|
-
export const QtiStatsOperatorExpressionSchema: z.
|
|
335
|
+
export const QtiStatsOperatorExpressionSchema: z.ZodType = z.lazy(() =>
|
|
326
336
|
strictObject({
|
|
327
337
|
kind: z.literal("statsOperator"),
|
|
328
338
|
children: z.tuple([QtiExpressionSchema]),
|
|
@@ -330,7 +340,7 @@ export const QtiStatsOperatorExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
330
340
|
}),
|
|
331
341
|
);
|
|
332
342
|
|
|
333
|
-
export const QtiStringMatchExpressionSchema: z.
|
|
343
|
+
export const QtiStringMatchExpressionSchema: z.ZodType = z.lazy(() =>
|
|
334
344
|
strictObject({
|
|
335
345
|
kind: z.literal("stringMatch"),
|
|
336
346
|
children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
|
|
@@ -339,7 +349,7 @@ export const QtiStringMatchExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
339
349
|
}),
|
|
340
350
|
);
|
|
341
351
|
|
|
342
|
-
export const QtiSubstringExpressionSchema: z.
|
|
352
|
+
export const QtiSubstringExpressionSchema: z.ZodType = z.lazy(() =>
|
|
343
353
|
strictObject({
|
|
344
354
|
kind: z.literal("substring"),
|
|
345
355
|
children: z.tuple([QtiExpressionSchema, QtiExpressionSchema]),
|
|
@@ -394,7 +404,7 @@ export const QtiTestVariablesExpressionSchema = strictObject({
|
|
|
394
404
|
baseType: QtiBaseTypeSchema.optional(),
|
|
395
405
|
});
|
|
396
406
|
|
|
397
|
-
export const QtiExpressionSchema: z.
|
|
407
|
+
export const QtiExpressionSchema: z.ZodType = z.lazy(() =>
|
|
398
408
|
z.union([
|
|
399
409
|
QtiNullExpressionSchema,
|
|
400
410
|
QtiBaseValueExpressionSchema,
|
|
@@ -412,6 +422,7 @@ export const QtiExpressionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
412
422
|
QtiContainerExpressionSchema,
|
|
413
423
|
QtiCustomOperatorExpressionSchema,
|
|
414
424
|
QtiAnyNExpressionSchema,
|
|
425
|
+
QtiEqualExpressionSchema,
|
|
415
426
|
QtiEqualRoundedExpressionSchema,
|
|
416
427
|
QtiFieldValueExpressionSchema,
|
|
417
428
|
QtiIndexExpressionSchema,
|
|
@@ -498,14 +509,14 @@ export const QtiExitTestSchema = strictObject({
|
|
|
498
509
|
kind: z.literal("exitTest"),
|
|
499
510
|
});
|
|
500
511
|
|
|
501
|
-
export const QtiResponseElseSchema: z.
|
|
512
|
+
export const QtiResponseElseSchema: z.ZodType = z.lazy(() =>
|
|
502
513
|
strictObject({
|
|
503
514
|
kind: z.literal("responseElse"),
|
|
504
515
|
actions: z.array(QtiResponseRuleSchema).optional(),
|
|
505
516
|
}),
|
|
506
517
|
);
|
|
507
518
|
|
|
508
|
-
export const QtiResponseIfSchema: z.
|
|
519
|
+
export const QtiResponseIfSchema: z.ZodType = z.lazy(() =>
|
|
509
520
|
strictObject({
|
|
510
521
|
kind: z.literal("responseIf"),
|
|
511
522
|
expression: QtiExpressionSchema,
|
|
@@ -513,7 +524,7 @@ export const QtiResponseIfSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
513
524
|
}),
|
|
514
525
|
);
|
|
515
526
|
|
|
516
|
-
export const QtiResponseConditionSchema: z.
|
|
527
|
+
export const QtiResponseConditionSchema: z.ZodType = z.lazy(() =>
|
|
517
528
|
strictObject({
|
|
518
529
|
kind: z.literal("responseCondition"),
|
|
519
530
|
responseIf: QtiResponseIfSchema,
|
|
@@ -522,14 +533,14 @@ export const QtiResponseConditionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
522
533
|
}),
|
|
523
534
|
);
|
|
524
535
|
|
|
525
|
-
export const QtiResponseProcessingFragmentSchema: z.
|
|
536
|
+
export const QtiResponseProcessingFragmentSchema: z.ZodType = z.lazy(() =>
|
|
526
537
|
strictObject({
|
|
527
538
|
kind: z.literal("responseProcessingFragment"),
|
|
528
539
|
rules: z.array(QtiResponseRuleSchema).optional(),
|
|
529
540
|
}),
|
|
530
541
|
);
|
|
531
542
|
|
|
532
|
-
export const QtiResponseRuleSchema: z.
|
|
543
|
+
export const QtiResponseRuleSchema: z.ZodType = z.lazy(() =>
|
|
533
544
|
z.union([
|
|
534
545
|
QtiIncludeSchema,
|
|
535
546
|
QtiResponseConditionSchema,
|
|
@@ -546,14 +557,14 @@ export const QtiResponseProcessingSchema = strictObject({
|
|
|
546
557
|
templateLocation: z.string().optional(),
|
|
547
558
|
});
|
|
548
559
|
|
|
549
|
-
export const QtiOutcomeElseSchema: z.
|
|
560
|
+
export const QtiOutcomeElseSchema: z.ZodType = z.lazy(() =>
|
|
550
561
|
strictObject({
|
|
551
562
|
kind: z.literal("outcomeElse"),
|
|
552
563
|
actions: z.array(QtiOutcomeRuleSchema).optional(),
|
|
553
564
|
}),
|
|
554
565
|
);
|
|
555
566
|
|
|
556
|
-
export const QtiOutcomeIfSchema: z.
|
|
567
|
+
export const QtiOutcomeIfSchema: z.ZodType = z.lazy(() =>
|
|
557
568
|
strictObject({
|
|
558
569
|
kind: z.literal("outcomeIf"),
|
|
559
570
|
expression: QtiExpressionSchema,
|
|
@@ -561,7 +572,7 @@ export const QtiOutcomeIfSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
561
572
|
}),
|
|
562
573
|
);
|
|
563
574
|
|
|
564
|
-
export const QtiOutcomeConditionSchema: z.
|
|
575
|
+
export const QtiOutcomeConditionSchema: z.ZodType = z.lazy(() =>
|
|
565
576
|
strictObject({
|
|
566
577
|
kind: z.literal("outcomeCondition"),
|
|
567
578
|
outcomeIf: QtiOutcomeIfSchema,
|
|
@@ -570,14 +581,14 @@ export const QtiOutcomeConditionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
570
581
|
}),
|
|
571
582
|
);
|
|
572
583
|
|
|
573
|
-
export const QtiOutcomeProcessingFragmentSchema: z.
|
|
584
|
+
export const QtiOutcomeProcessingFragmentSchema: z.ZodType = z.lazy(() =>
|
|
574
585
|
strictObject({
|
|
575
586
|
kind: z.literal("outcomeProcessingFragment"),
|
|
576
587
|
rules: z.array(QtiOutcomeRuleSchema).optional(),
|
|
577
588
|
}),
|
|
578
589
|
);
|
|
579
590
|
|
|
580
|
-
export const QtiOutcomeRuleSchema: z.
|
|
591
|
+
export const QtiOutcomeRuleSchema: z.ZodType = z.lazy(() =>
|
|
581
592
|
z.union([
|
|
582
593
|
QtiIncludeSchema,
|
|
583
594
|
QtiOutcomeConditionSchema,
|
|
@@ -592,14 +603,14 @@ export const QtiOutcomeProcessingSchema = strictObject({
|
|
|
592
603
|
rules: z.array(QtiOutcomeRuleSchema).optional(),
|
|
593
604
|
});
|
|
594
605
|
|
|
595
|
-
export const QtiTemplateElseSchema: z.
|
|
606
|
+
export const QtiTemplateElseSchema: z.ZodType = z.lazy(() =>
|
|
596
607
|
strictObject({
|
|
597
608
|
kind: z.literal("templateElse"),
|
|
598
609
|
actions: z.array(QtiTemplateRuleSchema).optional(),
|
|
599
610
|
}),
|
|
600
611
|
);
|
|
601
612
|
|
|
602
|
-
export const QtiTemplateIfSchema: z.
|
|
613
|
+
export const QtiTemplateIfSchema: z.ZodType = z.lazy(() =>
|
|
603
614
|
strictObject({
|
|
604
615
|
kind: z.literal("templateIf"),
|
|
605
616
|
expression: QtiExpressionSchema,
|
|
@@ -607,7 +618,7 @@ export const QtiTemplateIfSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
607
618
|
}),
|
|
608
619
|
);
|
|
609
620
|
|
|
610
|
-
export const QtiTemplateConditionSchema: z.
|
|
621
|
+
export const QtiTemplateConditionSchema: z.ZodType = z.lazy(() =>
|
|
611
622
|
strictObject({
|
|
612
623
|
kind: z.literal("templateCondition"),
|
|
613
624
|
templateIf: QtiTemplateIfSchema,
|
|
@@ -616,7 +627,7 @@ export const QtiTemplateConditionSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
616
627
|
}),
|
|
617
628
|
);
|
|
618
629
|
|
|
619
|
-
export const QtiTemplateRuleSchema: z.
|
|
630
|
+
export const QtiTemplateRuleSchema: z.ZodType = z.lazy(() =>
|
|
620
631
|
z.union([
|
|
621
632
|
QtiTemplateConditionSchema,
|
|
622
633
|
QtiSetTemplateValueSchema,
|
package/src/qti/v3_0_1/shared.ts
CHANGED
|
@@ -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.
|
|
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:
|
|
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.
|
|
26
|
+
return z.looseObject(shape);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function oneOrMany<T extends z.
|
|
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:
|
|
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.
|
|
101
|
+
export function contextArraySchema(label: string, requiredEntries: readonly z.ZodType[]) {
|
|
102
102
|
return z
|
|
103
103
|
.array(JsonLdContextEntrySchema)
|
|
104
104
|
.min(requiredEntries.length)
|
package/src/xapi/shared.ts
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
18
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
204
|
+
code: "custom",
|
|
208
205
|
message: "Score raw must be less than or equal to max",
|
|
209
206
|
path: ["raw"],
|
|
210
207
|
});
|
package/src/xapi/v1_0_3/index.ts
CHANGED
|
@@ -51,61 +51,61 @@ import {
|
|
|
51
51
|
XapiMultipartRequestSchema,
|
|
52
52
|
} from "../shared";
|
|
53
53
|
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|