@conform-ed/contracts 0.0.3
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 +2 -0
- package/.turbo/turbo-format.log +6 -0
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +196 -0
- package/.turbo/turbo-typecheck.log +2 -0
- package/README.md +52 -0
- package/caliper-v1_2-zod-templates.md +123 -0
- package/case-v1_1-zod-templates.md +290 -0
- package/cat-v1_0-zod-templates.md +73 -0
- package/cc-v1_3-zod-templates.md +531 -0
- package/cc-v1_4-zod-templates.md +247 -0
- package/clr-v2_0-zod-templates.md +117 -0
- package/cmi5-v1_0-zod-templates.md +9 -0
- package/lti-zod-templates.md +11 -0
- package/oneroster-v1_2-zod-templates.md +76 -0
- package/open-badges-v3_0-zod-templates.md +66 -0
- package/package.json +42 -0
- package/qti-v2_1-zod-templates.md +45 -0
- package/qti-v2_2-zod-templates.md +32 -0
- package/qti-v3_0_1-zod-templates.md +421 -0
- package/src/adapter.ts +83 -0
- package/src/caliper/v1_2/caliper_v1p2_bootcamp_schema.ts +781 -0
- package/src/caliper/v1_2/index.ts +37 -0
- package/src/caliper/v1_2/shared.ts +122 -0
- package/src/caliper/v1_2/textual_requirements.ts +219 -0
- package/src/case/v1_1/case_v1p1_cfassociation_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfassociationgrouping_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfassociationset_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfconceptset_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfdocument_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfdocumentset_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfitem_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfitemtypeset_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cflicense_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfpackage_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfrubric_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_cfsubjectset_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_imsx_statusinfo_jsonschema1.ts +1 -0
- package/src/case/v1_1/case_v1p1_openapi3_restbinding_schema.ts +113 -0
- package/src/case/v1_1/index.ts +95 -0
- package/src/case/v1_1/shared.ts +384 -0
- package/src/cat/v1_0/cat_v1p0_restbinding_operations_schema.ts +75 -0
- package/src/cat/v1_0/index.ts +124 -0
- package/src/cat/v1_0/shared.ts +345 -0
- package/src/clr/v2_0/clr_v2p0_achievementcredential_schema.ts +16 -0
- package/src/clr/v2_0/clr_v2p0_clrcredential_schema.ts +9 -0
- package/src/clr/v2_0/clr_v2p0_endorsementcredential_schema.ts +11 -0
- package/src/clr/v2_0/clr_v2p0_getclrcredentialsresponse_schema.ts +1 -0
- package/src/clr/v2_0/clr_v2p0_imsx_statusinfo_schema.ts +8 -0
- package/src/clr/v2_0/clr_v2p0_profile_schema.ts +9 -0
- package/src/clr/v2_0/index.ts +22 -0
- package/src/clr/v2_0/shared.ts +206 -0
- package/src/cmi5/index.ts +3 -0
- package/src/cmi5/v1_0/index.ts +134 -0
- package/src/common-cartridge/v1_3/ccv1p3_imsccauth_v1p3.ts +26 -0
- package/src/common-cartridge/v1_3/ccv1p3_imscp_v1p2_v1p0.ts +352 -0
- package/src/common-cartridge/v1_3/ccv1p3_imscsmd_v1p0.ts +35 -0
- package/src/common-cartridge/v1_3/ccv1p3_imsdt_v1p3.ts +33 -0
- package/src/common-cartridge/v1_3/ccv1p3_imswl_v1p3.ts +23 -0
- package/src/common-cartridge/v1_3/ccv1p3_lomccltilink_v1p0.ts +14 -0
- package/src/common-cartridge/v1_3/ccv1p3_lommanifest_v1p0.ts +14 -0
- package/src/common-cartridge/v1_3/ccv1p3_lomresource_v1p0.ts +14 -0
- package/src/common-cartridge/v1_3/ccv1p3_qtiasiv1p2p1_v1p0.ts +964 -0
- package/src/common-cartridge/v1_3/index.ts +41 -0
- package/src/common-cartridge/v1_3/lom-internal.ts +396 -0
- package/src/common-cartridge/v1_3/shared.ts +68 -0
- package/src/common-cartridge/v1_4/core/ccv1p4_imscp_v1p2_v1p0.ts +360 -0
- package/src/common-cartridge/v1_4/core/ccv1p4_lommanifest_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/core/ccv1p4_lomresource_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/extension/cc_extresource_assignmentv1p0_v1p0.ts +61 -0
- package/src/common-cartridge/v1_4/extension/ccv1p4_cpextensionv1p2_v1p0.ts +20 -0
- package/src/common-cartridge/v1_4/extension/ims_openvideov1p0_v1p0.ts +325 -0
- package/src/common-cartridge/v1_4/index.ts +104 -0
- package/src/common-cartridge/v1_4/k12/ccv1p4_imscp_v1p2_v1p0.ts +19 -0
- package/src/common-cartridge/v1_4/k12/ccv1p4_imscp_v1p2_v1p0_thin.ts +17 -0
- package/src/common-cartridge/v1_4/k12/ccv1p4_lommanifest_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/k12/ccv1p4_lomresource_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/lom-internal.ts +476 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_imsccauth_v1p4.ts +26 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_imscsmd_v1p1.ts +36 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_imsdt_v1p4.ts +33 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_imslticc_v1p4.ts +45 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_imswl_v1p4.ts +23 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_lomccltilink_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/shared/ccv1p4_qtiasiv1p2p1_v1p0.ts +964 -0
- package/src/common-cartridge/v1_4/shared/imsbasiclti_v1p0p1.ts +24 -0
- package/src/common-cartridge/v1_4/shared/imslticm_v1p0.ts +23 -0
- package/src/common-cartridge/v1_4/shared/imslticp_v1p0.ts +57 -0
- package/src/common-cartridge/v1_4/shared/lineitem_v1p0.ts +35 -0
- package/src/common-cartridge/v1_4/shared/resourcea11ymetadata-20210915.ts +110 -0
- package/src/common-cartridge/v1_4/shared.ts +68 -0
- package/src/common-cartridge/v1_4/thin/ccv1p4_imscp_v1p2_v1p0.ts +243 -0
- package/src/common-cartridge/v1_4/thin/ccv1p4_lommanifest_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/thin/ccv1p4_lomresource_v1p0.ts +14 -0
- package/src/common-cartridge/v1_4/vdex/imsmd_loose_v1p3p2.ts +13 -0
- package/src/common-cartridge/v1_4/vdex/imsvdex_v1p0.ts +124 -0
- package/src/config.ts +121 -0
- package/src/index.ts +32 -0
- package/src/lti/ags/v2_0/index.ts +97 -0
- package/src/lti/deep-linking/v2_0/index.ts +100 -0
- package/src/lti/index.ts +26 -0
- package/src/lti/nrps/v2_0/index.ts +69 -0
- package/src/lti/proctoring/v1_0/index.ts +131 -0
- package/src/lti/shared.ts +66 -0
- package/src/lti/v1_3/index.ts +84 -0
- package/src/oneroster/v1_2/index.ts +156 -0
- package/src/oneroster/v1_2/or_v1p2_csv_binding_schema.ts +427 -0
- package/src/oneroster/v1_2/or_v1p2_gradebook_restbinding_schema.ts +120 -0
- package/src/oneroster/v1_2/or_v1p2_gradebook_service_schema.ts +243 -0
- package/src/oneroster/v1_2/or_v1p2_resource_restbinding_schema.ts +24 -0
- package/src/oneroster/v1_2/or_v1p2_resource_service_schema.ts +47 -0
- package/src/oneroster/v1_2/or_v1p2_rostering_restbinding_schema.ts +84 -0
- package/src/oneroster/v1_2/or_v1p2_rostering_service_schema.ts +288 -0
- package/src/oneroster/v1_2/shared.ts +90 -0
- package/src/open-badges/v3_0/index.ts +20 -0
- package/src/open-badges/v3_0/ob_v3p0_achievementcredential_schema.ts +17 -0
- package/src/open-badges/v3_0/ob_v3p0_endorsementcredential_schema.ts +11 -0
- package/src/open-badges/v3_0/ob_v3p0_getopenbadgecredentialsresponse_schema.ts +1 -0
- package/src/open-badges/v3_0/ob_v3p0_imsx_statusinfo_schema.ts +8 -0
- package/src/open-badges/v3_0/ob_v3p0_profile_schema.ts +9 -0
- package/src/open-badges/v3_0/shared.ts +458 -0
- package/src/qti/v2-internal.ts +1683 -0
- package/src/qti/v2_1/apipv1p0_qtiextv2p1_v1p0.ts +3 -0
- package/src/qti/v2_1/imsqti_metadata_v2p1.ts +3 -0
- package/src/qti/v2_1/imsqti_result_v2p1.ts +3 -0
- package/src/qti/v2_1/imsqti_usagedata_v2p1.ts +3 -0
- package/src/qti/v2_1/imsqti_v2p1p2.ts +71 -0
- package/src/qti/v2_1/index.ts +53 -0
- package/src/qti/v2_1/qtiv2p1_imscpv1p2_v1p0.ts +3 -0
- package/src/qti/v2_1/schemas.ts +15 -0
- package/src/qti/v2_1/shared.ts +3 -0
- package/src/qti/v2_2/apipv1p0_qtiextv2p2_v1p0p1.ts +3 -0
- package/src/qti/v2_2/imsqti_metadata_v2p2.ts +3 -0
- package/src/qti/v2_2/imsqti_result_v2p2.ts +3 -0
- package/src/qti/v2_2/imsqti_usagedata_v2p2.ts +3 -0
- package/src/qti/v2_2/imsqti_v2p2p4.ts +76 -0
- package/src/qti/v2_2/imsqtiv2p2p4_html5_v1p0.ts +8 -0
- package/src/qti/v2_2/index.ts +59 -0
- package/src/qti/v2_2/qtiv2p2_csm_v2p2.ts +4 -0
- package/src/qti/v2_2/qtiv2p2_imscpv1p2_v1p0.ts +3 -0
- package/src/qti/v2_2/schemas.ts +19 -0
- package/src/qti/v2_2/shared.ts +3 -0
- package/src/qti/v3_0_1/assessment-internal.ts +1509 -0
- package/src/qti/v3_0_1/imsqti_asiv3p0p1_v1p0.ts +57 -0
- package/src/qti/v3_0_1/imsqti_itemv3p0p1_v1p0.ts +60 -0
- package/src/qti/v3_0_1/imsqti_metadatav3p0_v1p0.ts +73 -0
- package/src/qti/v3_0_1/imsqti_outcomev3p0p1_v1p0.ts +11 -0
- package/src/qti/v3_0_1/imsqti_responseprocessingv3p0p1_v1p0.ts +17 -0
- package/src/qti/v3_0_1/imsqti_resultv3p0_v1p0.ts +222 -0
- package/src/qti/v3_0_1/imsqti_sectionv3p0p1_v1p0.ts +15 -0
- package/src/qti/v3_0_1/imsqti_stimulusv3p0p1_v1p0.ts +15 -0
- package/src/qti/v3_0_1/imsqti_testv3p0p1_v1p0.ts +49 -0
- package/src/qti/v3_0_1/imsqti_usagedatav3p0_v1p0.ts +77 -0
- package/src/qti/v3_0_1/imsqtiv3p0_afa3p0pnp_v1p0.ts +269 -0
- package/src/qti/v3_0_1/index.ts +50 -0
- package/src/qti/v3_0_1/processing-internal.ts +667 -0
- package/src/qti/v3_0_1/shared.ts +146 -0
- package/src/qti/v3_0_1/variables-internal.ts +274 -0
- package/src/shared/imsx-status.ts +49 -0
- package/src/summary.ts +70 -0
- package/src/vc-data-model/v2_0/index.ts +27 -0
- package/src/vc-data-model/v2_0/shared.ts +206 -0
- package/src/xapi/index.ts +12 -0
- package/src/xapi/shared.ts +444 -0
- package/src/xapi/v1_0_3/index.ts +169 -0
- package/src/xapi/v2_0/index.ts +256 -0
- package/test/caliper-v1_2.test.ts +270 -0
- package/test/case-v1_1.test.ts +147 -0
- package/test/cat-v1_0.test.ts +338 -0
- package/test/cc-v1_4.test.ts +239 -0
- package/test/clr-v2_0.test.ts +225 -0
- package/test/cmi5-v1_0.test.ts +196 -0
- package/test/contracts.test.ts +125 -0
- package/test/fixtures/cmi5/extended-cmi5.xml +72 -0
- package/test/fixtures/cmi5/simple-cmi5.xml +26 -0
- package/test/lti.test.ts +146 -0
- package/test/oneroster-v1_2.test.ts +234 -0
- package/test/open-badges-v3_0.test.ts +144 -0
- package/test/qti-v2_1.test.ts +146 -0
- package/test/qti-v2_2.test.ts +154 -0
- package/test/qti-v3_0_1.test.ts +576 -0
- package/test/schema-examples.test.ts +101 -0
- package/test/vc-data-model-v2_0.test.ts +63 -0
- package/test/xapi.test.ts +384 -0
- package/tsconfig.json +7 -0
- package/vc-data-model-v2_0-zod-templates.md +43 -0
- package/xapi-zod-templates.md +95 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export * from "./assessment-internal";
|
|
4
|
+
export * from "./variables-internal";
|
|
5
|
+
export * from "./processing-internal";
|
|
6
|
+
|
|
7
|
+
import { strictObject } from "./shared";
|
|
8
|
+
import { QtiAssessmentItemSchema, QtiAssessmentStimulusSchema, QtiAssessmentTestSchema } from "./assessment-internal";
|
|
9
|
+
import { QtiOutcomeDeclarationSchema } from "./variables-internal";
|
|
10
|
+
import { QtiResponseProcessingDocumentSchema } from "./imsqti_responseprocessingv3p0p1_v1p0";
|
|
11
|
+
import { QtiAssessmentSectionDocumentSchema, QtiAssessmentSectionSchema } from "./imsqti_sectionv3p0p1_v1p0";
|
|
12
|
+
import { QtiAssessmentStimulusDocumentSchema } from "./imsqti_stimulusv3p0p1_v1p0";
|
|
13
|
+
import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
|
|
14
|
+
import { QtiAssessmentItemDocumentSchema } from "./imsqti_itemv3p0p1_v1p0";
|
|
15
|
+
import { QtiAssessmentTestDocumentSchema, QtiOutcomeProcessingDocumentSchema } from "./imsqti_testv3p0p1_v1p0";
|
|
16
|
+
|
|
17
|
+
export const QtiAssessmentItemDocumentSchemaAlias = QtiAssessmentItemDocumentSchema;
|
|
18
|
+
export const QtiAssessmentSectionDocumentSchemaAlias = QtiAssessmentSectionDocumentSchema;
|
|
19
|
+
export const QtiAssessmentStimulusDocumentSchemaAlias = QtiAssessmentStimulusDocumentSchema;
|
|
20
|
+
export const QtiAssessmentTestDocumentSchemaAlias = QtiAssessmentTestDocumentSchema;
|
|
21
|
+
|
|
22
|
+
export const QtiAssessmentItemStandaloneDocumentSchema = strictObject({
|
|
23
|
+
assessmentItem: QtiAssessmentItemSchema,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const QtiAssessmentSectionStandaloneDocumentSchema = strictObject({
|
|
27
|
+
assessmentSection: QtiAssessmentSectionSchema,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const QtiAssessmentStimulusStandaloneDocumentSchema = strictObject({
|
|
31
|
+
assessmentStimulus: QtiAssessmentStimulusSchema,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const QtiAssessmentTestStandaloneDocumentSchema = strictObject({
|
|
35
|
+
assessmentTest: QtiAssessmentTestSchema,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const QtiOutcomeDeclarationStandaloneDocumentSchema = strictObject({
|
|
39
|
+
outcomeDeclaration: QtiOutcomeDeclarationSchema,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const QtiAsiProfileDocumentSchema = z.union([
|
|
43
|
+
QtiAssessmentItemDocumentSchema,
|
|
44
|
+
QtiAssessmentSectionDocumentSchema,
|
|
45
|
+
QtiAssessmentStimulusDocumentSchema,
|
|
46
|
+
QtiAssessmentTestDocumentSchema,
|
|
47
|
+
QtiOutcomeDeclarationDocumentSchema,
|
|
48
|
+
QtiOutcomeProcessingDocumentSchema,
|
|
49
|
+
QtiResponseProcessingDocumentSchema,
|
|
50
|
+
]);
|
|
51
|
+
// Inferred types from exported Zod validators.
|
|
52
|
+
export type QtiAssessmentItemStandaloneDocument = z.infer<typeof QtiAssessmentItemStandaloneDocumentSchema>;
|
|
53
|
+
export type QtiAssessmentSectionStandaloneDocument = z.infer<typeof QtiAssessmentSectionStandaloneDocumentSchema>;
|
|
54
|
+
export type QtiAssessmentStimulusStandaloneDocument = z.infer<typeof QtiAssessmentStimulusStandaloneDocumentSchema>;
|
|
55
|
+
export type QtiAssessmentTestStandaloneDocument = z.infer<typeof QtiAssessmentTestStandaloneDocumentSchema>;
|
|
56
|
+
export type QtiOutcomeDeclarationStandaloneDocument = z.infer<typeof QtiOutcomeDeclarationStandaloneDocumentSchema>;
|
|
57
|
+
export type QtiAsiProfileDocument = z.infer<typeof QtiAsiProfileDocumentSchema>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
QtiAssessmentItemRawSchema,
|
|
5
|
+
QtiAssessmentItemRefSchema,
|
|
6
|
+
QtiAssessmentItemSchema,
|
|
7
|
+
QtiAssessmentStimulusRefSchema,
|
|
8
|
+
QtiChoiceInteractionSchema,
|
|
9
|
+
QtiCompanionMaterialsInfoSchema,
|
|
10
|
+
QtiExtendedTextInteractionSchema,
|
|
11
|
+
QtiGapMatchInteractionSchema,
|
|
12
|
+
QtiHotTextInteractionSchema,
|
|
13
|
+
QtiHotspotInteractionSchema,
|
|
14
|
+
QtiInlineChoiceInteractionSchema,
|
|
15
|
+
QtiItemBodySchema,
|
|
16
|
+
QtiMatchInteractionSchema,
|
|
17
|
+
QtiMediaInteractionSchema,
|
|
18
|
+
QtiModalFeedbackSchema,
|
|
19
|
+
QtiOrderInteractionSchema,
|
|
20
|
+
QtiTextEntryInteractionSchema,
|
|
21
|
+
QtiUploadInteractionSchema,
|
|
22
|
+
} from "./assessment-internal";
|
|
23
|
+
export {
|
|
24
|
+
QtiOutcomeDeclarationRawSchema,
|
|
25
|
+
QtiOutcomeDeclarationSchema,
|
|
26
|
+
QtiResponseDeclarationRawSchema,
|
|
27
|
+
QtiResponseDeclarationSchema,
|
|
28
|
+
QtiTemplateDeclarationSchema,
|
|
29
|
+
} from "./variables-internal";
|
|
30
|
+
export {
|
|
31
|
+
QtiResponseConditionSchema,
|
|
32
|
+
QtiResponseElseSchema,
|
|
33
|
+
QtiResponseIfSchema,
|
|
34
|
+
QtiResponseProcessingFragmentSchema,
|
|
35
|
+
QtiResponseProcessingSchema,
|
|
36
|
+
QtiTemplateConditionSchema,
|
|
37
|
+
QtiTemplateConstraintSchema,
|
|
38
|
+
QtiTemplateDefaultSchema,
|
|
39
|
+
QtiTemplateElseSchema,
|
|
40
|
+
QtiTemplateIfSchema,
|
|
41
|
+
QtiTemplateProcessingSchema,
|
|
42
|
+
} from "./processing-internal";
|
|
43
|
+
|
|
44
|
+
import { QtiAssessmentItemSchema } from "./assessment-internal";
|
|
45
|
+
import { strictObject } from "./shared";
|
|
46
|
+
import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
|
|
47
|
+
import { QtiResponseProcessingDocumentSchema } from "./imsqti_responseprocessingv3p0p1_v1p0";
|
|
48
|
+
|
|
49
|
+
export const QtiAssessmentItemDocumentSchema = strictObject({
|
|
50
|
+
assessmentItem: QtiAssessmentItemSchema,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const QtiItemProfileDocumentSchema = z.union([
|
|
54
|
+
QtiAssessmentItemDocumentSchema,
|
|
55
|
+
QtiOutcomeDeclarationDocumentSchema,
|
|
56
|
+
QtiResponseProcessingDocumentSchema,
|
|
57
|
+
]);
|
|
58
|
+
// Inferred types from exported Zod validators.
|
|
59
|
+
export type QtiAssessmentItemDocument = z.infer<typeof QtiAssessmentItemDocumentSchema>;
|
|
60
|
+
export type QtiItemProfileDocument = z.infer<typeof QtiItemProfileDocumentSchema>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { strictObject } from "./shared";
|
|
4
|
+
|
|
5
|
+
export const QtiMetadataInteractionTypeSchema = z.enum([
|
|
6
|
+
"associateInteraction",
|
|
7
|
+
"choiceInteraction",
|
|
8
|
+
"customInteraction",
|
|
9
|
+
"drawingInteraction",
|
|
10
|
+
"endAttemptInteraction",
|
|
11
|
+
"extendedTextInteraction",
|
|
12
|
+
"gapMatchInteraction",
|
|
13
|
+
"graphicAssociateInteraction",
|
|
14
|
+
"graphicGapMatchInteraction",
|
|
15
|
+
"graphicOrderInteraction",
|
|
16
|
+
"hotspotInteraction",
|
|
17
|
+
"hottextInteraction",
|
|
18
|
+
"inlineChoiceInteraction",
|
|
19
|
+
"matchInteraction",
|
|
20
|
+
"mediaInteraction",
|
|
21
|
+
"orderInteraction",
|
|
22
|
+
"portableCustomInteraction",
|
|
23
|
+
"positionObjectInteraction",
|
|
24
|
+
"selectPointInteraction",
|
|
25
|
+
"sliderInteraction",
|
|
26
|
+
"textEntryInteraction",
|
|
27
|
+
"uploadInteraction",
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export const QtiMetadataFeedbackTypeSchema = z.enum(["adaptive", "nonadaptive", "none"]);
|
|
31
|
+
|
|
32
|
+
export const QtiMetadataScoringModeSchema = z.enum(["human", "externalmachine", "responseprocessing"]);
|
|
33
|
+
|
|
34
|
+
export const QtiPortableCustomInteractionContextSchema = strictObject({
|
|
35
|
+
customTypeIdentifier: z.string().optional(),
|
|
36
|
+
interactionKind: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const QtiMetadataSchema = strictObject({
|
|
40
|
+
itemTemplate: z.boolean().optional(),
|
|
41
|
+
timeDependent: z.boolean().optional(),
|
|
42
|
+
composite: z.boolean().optional(),
|
|
43
|
+
interactionType: z.array(QtiMetadataInteractionTypeSchema).optional(),
|
|
44
|
+
portableCustomInteractionContext: QtiPortableCustomInteractionContextSchema.optional(),
|
|
45
|
+
feedbackType: QtiMetadataFeedbackTypeSchema.optional(),
|
|
46
|
+
solutionAvailable: z.boolean().optional(),
|
|
47
|
+
scoringMode: z.array(QtiMetadataScoringModeSchema).optional(),
|
|
48
|
+
toolName: z.string().max(256).optional(),
|
|
49
|
+
toolVersion: z.string().max(256).optional(),
|
|
50
|
+
toolVendor: z.string().max(256).optional(),
|
|
51
|
+
}).superRefine((value, context) => {
|
|
52
|
+
const hasPortableCustomInteraction = value.interactionType?.includes("portableCustomInteraction") ?? false;
|
|
53
|
+
|
|
54
|
+
if (value.portableCustomInteractionContext && !hasPortableCustomInteraction) {
|
|
55
|
+
context.addIssue({
|
|
56
|
+
code: z.ZodIssueCode.custom,
|
|
57
|
+
path: ["portableCustomInteractionContext"],
|
|
58
|
+
message:
|
|
59
|
+
"portableCustomInteractionContext is only valid when interactionType includes portableCustomInteraction.",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const QtiMetadataDocumentSchema = strictObject({
|
|
65
|
+
qtiMetadata: QtiMetadataSchema,
|
|
66
|
+
});
|
|
67
|
+
// Inferred types from exported Zod validators.
|
|
68
|
+
export type QtiMetadataInteractionType = z.infer<typeof QtiMetadataInteractionTypeSchema>;
|
|
69
|
+
export type QtiMetadataFeedbackType = z.infer<typeof QtiMetadataFeedbackTypeSchema>;
|
|
70
|
+
export type QtiMetadataScoringMode = z.infer<typeof QtiMetadataScoringModeSchema>;
|
|
71
|
+
export type QtiPortableCustomInteractionContext = z.infer<typeof QtiPortableCustomInteractionContextSchema>;
|
|
72
|
+
export type QtiMetadata = z.infer<typeof QtiMetadataSchema>;
|
|
73
|
+
export type QtiMetadataDocument = z.infer<typeof QtiMetadataDocumentSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export { QtiOutcomeDeclarationRawSchema, QtiOutcomeDeclarationSchema } from "./variables-internal";
|
|
3
|
+
|
|
4
|
+
import { strictObject } from "./shared";
|
|
5
|
+
import { QtiOutcomeDeclarationSchema } from "./variables-internal";
|
|
6
|
+
|
|
7
|
+
export const QtiOutcomeDeclarationDocumentSchema = strictObject({
|
|
8
|
+
outcomeDeclaration: QtiOutcomeDeclarationSchema,
|
|
9
|
+
});
|
|
10
|
+
// Inferred types from exported Zod validators.
|
|
11
|
+
export type QtiOutcomeDeclarationDocument = z.infer<typeof QtiOutcomeDeclarationDocumentSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export {
|
|
3
|
+
QtiResponseConditionSchema,
|
|
4
|
+
QtiResponseElseSchema,
|
|
5
|
+
QtiResponseIfSchema,
|
|
6
|
+
QtiResponseProcessingFragmentSchema,
|
|
7
|
+
QtiResponseProcessingSchema,
|
|
8
|
+
} from "./processing-internal";
|
|
9
|
+
|
|
10
|
+
import { strictObject } from "./shared";
|
|
11
|
+
import { QtiResponseProcessingSchema } from "./processing-internal";
|
|
12
|
+
|
|
13
|
+
export const QtiResponseProcessingDocumentSchema = strictObject({
|
|
14
|
+
responseProcessing: QtiResponseProcessingSchema,
|
|
15
|
+
});
|
|
16
|
+
// Inferred types from exported Zod validators.
|
|
17
|
+
export type QtiResponseProcessingDocument = z.infer<typeof QtiResponseProcessingDocumentSchema>;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
QtiAnsweredStatusSchema,
|
|
5
|
+
QtiBaseTypeSchema,
|
|
6
|
+
QtiCardinalitySchema,
|
|
7
|
+
QtiExternalScoredSchema,
|
|
8
|
+
QtiIdentifierListSchema,
|
|
9
|
+
QtiIdentifierSchema,
|
|
10
|
+
QtiScoreStatusSchema,
|
|
11
|
+
QtiSessionStatusSchema,
|
|
12
|
+
QtiSupportAssignmentSchema,
|
|
13
|
+
QtiViewSchema,
|
|
14
|
+
XmlExtensionNodeListSchema,
|
|
15
|
+
addIssue,
|
|
16
|
+
strictObject,
|
|
17
|
+
} from "./shared";
|
|
18
|
+
|
|
19
|
+
export const QtiResultValueSchema = strictObject({
|
|
20
|
+
value: z.string(),
|
|
21
|
+
fieldIdentifier: QtiIdentifierSchema.optional(),
|
|
22
|
+
baseType: QtiBaseTypeSchema.optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const QtiResultCandidateResponseSchema = strictObject({
|
|
26
|
+
values: z.array(QtiResultValueSchema).optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const QtiResultCorrectResponseSchema = strictObject({
|
|
30
|
+
values: z.array(QtiResultValueSchema).min(1),
|
|
31
|
+
interpretation: z.string().optional(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const QtiResultSessionIdentifierSchema = strictObject({
|
|
35
|
+
sourceId: z.string(),
|
|
36
|
+
identifier: QtiIdentifierSchema,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const QtiResultContextSchema = strictObject({
|
|
40
|
+
sourcedId: QtiIdentifierSchema.optional(),
|
|
41
|
+
sessionIdentifiers: z.array(QtiResultSessionIdentifierSchema).optional(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const QtiResultSupportSchema = strictObject({
|
|
45
|
+
name: z.string().min(1),
|
|
46
|
+
assignment: QtiSupportAssignmentSchema,
|
|
47
|
+
value: z.string().optional(),
|
|
48
|
+
xmlLang: z.string().optional(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const QtiResultVariableBaseShape = {
|
|
52
|
+
identifier: QtiIdentifierSchema,
|
|
53
|
+
cardinality: QtiCardinalitySchema,
|
|
54
|
+
baseType: QtiBaseTypeSchema.optional(),
|
|
55
|
+
values: z.array(QtiResultValueSchema).optional(),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const QtiResultContextVariableSchema = strictObject({
|
|
59
|
+
...QtiResultVariableBaseShape,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const QtiResultTemplateVariableSchema = strictObject({
|
|
63
|
+
...QtiResultVariableBaseShape,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const QtiResultOutcomeInformationSchema = strictObject({
|
|
67
|
+
extensions: XmlExtensionNodeListSchema.optional(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export const QtiResultOutcomeVariableSchema = strictObject({
|
|
71
|
+
...QtiResultVariableBaseShape,
|
|
72
|
+
outcomeInformation: QtiResultOutcomeInformationSchema.optional(),
|
|
73
|
+
view: z.array(QtiViewSchema).optional(),
|
|
74
|
+
interpretation: z.string().optional(),
|
|
75
|
+
longInterpretation: z.string().optional(),
|
|
76
|
+
normalMaximum: z.number().optional(),
|
|
77
|
+
normalMinimum: z.number().optional(),
|
|
78
|
+
masteryValue: z.number().optional(),
|
|
79
|
+
externalScored: QtiExternalScoredSchema.optional(),
|
|
80
|
+
variableIdentifierRef: QtiIdentifierSchema.optional(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const QtiResultResponseVariableSchema = strictObject({
|
|
84
|
+
...QtiResultVariableBaseShape,
|
|
85
|
+
correctResponse: QtiResultCorrectResponseSchema.optional(),
|
|
86
|
+
candidateResponse: QtiResultCandidateResponseSchema,
|
|
87
|
+
extensions: XmlExtensionNodeListSchema.optional(),
|
|
88
|
+
choiceSequence: QtiIdentifierListSchema.optional(),
|
|
89
|
+
scoreStatus: QtiScoreStatusSchema.optional(),
|
|
90
|
+
answeredStatus: QtiAnsweredStatusSchema.optional(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
function validateValuesForCardinality(
|
|
94
|
+
values: readonly z.infer<typeof QtiResultValueSchema>[] | undefined,
|
|
95
|
+
cardinality: z.infer<typeof QtiCardinalitySchema>,
|
|
96
|
+
context: z.RefinementCtx,
|
|
97
|
+
path: Array<string | number>,
|
|
98
|
+
) {
|
|
99
|
+
if (!values?.length) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (cardinality === "record") {
|
|
104
|
+
for (const [index, value] of values.entries()) {
|
|
105
|
+
if (!value.fieldIdentifier) {
|
|
106
|
+
addIssue(
|
|
107
|
+
context,
|
|
108
|
+
[...path, index, "fieldIdentifier"],
|
|
109
|
+
"Record-valued result entries must define fieldIdentifier.",
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (const [index, value] of values.entries()) {
|
|
117
|
+
if (value.fieldIdentifier) {
|
|
118
|
+
addIssue(
|
|
119
|
+
context,
|
|
120
|
+
[...path, index, "fieldIdentifier"],
|
|
121
|
+
"fieldIdentifier is only valid for record-valued results.",
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function createVariableSuperRefine(valueKey: "values" | "candidateResponse", candidateResponseKey?: "values") {
|
|
128
|
+
return (
|
|
129
|
+
value: {
|
|
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>[] };
|
|
134
|
+
},
|
|
135
|
+
context: z.RefinementCtx,
|
|
136
|
+
) => {
|
|
137
|
+
if (value.cardinality === "record" && value.baseType) {
|
|
138
|
+
addIssue(context, ["baseType"], "baseType must be omitted when cardinality is record.");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (valueKey === "values") {
|
|
142
|
+
validateValuesForCardinality(value.values, value.cardinality, context, ["values"]);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
validateValuesForCardinality(
|
|
147
|
+
value.candidateResponse?.[candidateResponseKey ?? "values"],
|
|
148
|
+
value.cardinality,
|
|
149
|
+
context,
|
|
150
|
+
["candidateResponse", candidateResponseKey ?? "values"],
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const QtiResultOutcomeVariableValidatedSchema = QtiResultOutcomeVariableSchema.superRefine(
|
|
156
|
+
createVariableSuperRefine("values"),
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
export const QtiResultContextVariableValidatedSchema = QtiResultContextVariableSchema.superRefine(
|
|
160
|
+
createVariableSuperRefine("values"),
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
export const QtiResultTemplateVariableValidatedSchema = QtiResultTemplateVariableSchema.superRefine(
|
|
164
|
+
createVariableSuperRefine("values"),
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
export const QtiResultResponseVariableValidatedSchema = QtiResultResponseVariableSchema.superRefine(
|
|
168
|
+
createVariableSuperRefine("candidateResponse", "values"),
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
export const QtiResultTestResultSchema = strictObject({
|
|
172
|
+
identifier: QtiIdentifierSchema,
|
|
173
|
+
datestamp: z.string(),
|
|
174
|
+
responseVariables: z.array(QtiResultResponseVariableValidatedSchema).optional(),
|
|
175
|
+
templateVariables: z.array(QtiResultTemplateVariableValidatedSchema).optional(),
|
|
176
|
+
outcomeVariables: z.array(QtiResultOutcomeVariableValidatedSchema).optional(),
|
|
177
|
+
contextVariables: z.array(QtiResultContextVariableValidatedSchema).optional(),
|
|
178
|
+
supports: z.array(QtiResultSupportSchema).optional(),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export const QtiResultItemResultSchema = strictObject({
|
|
182
|
+
identifier: QtiIdentifierSchema,
|
|
183
|
+
sequenceIndex: z.number().int().optional(),
|
|
184
|
+
datestamp: z.string(),
|
|
185
|
+
sessionStatus: QtiSessionStatusSchema,
|
|
186
|
+
responseVariables: z.array(QtiResultResponseVariableValidatedSchema).optional(),
|
|
187
|
+
templateVariables: z.array(QtiResultTemplateVariableValidatedSchema).optional(),
|
|
188
|
+
outcomeVariables: z.array(QtiResultOutcomeVariableValidatedSchema).optional(),
|
|
189
|
+
contextVariables: z.array(QtiResultContextVariableValidatedSchema).optional(),
|
|
190
|
+
candidateComment: z.string().optional(),
|
|
191
|
+
supports: z.array(QtiResultSupportSchema).optional(),
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
export const QtiAssessmentResultSchema = strictObject({
|
|
195
|
+
context: QtiResultContextSchema,
|
|
196
|
+
testResult: QtiResultTestResultSchema.optional(),
|
|
197
|
+
itemResults: z.array(QtiResultItemResultSchema).optional(),
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
export const QtiAssessmentResultDocumentSchema = strictObject({
|
|
201
|
+
assessmentResult: QtiAssessmentResultSchema,
|
|
202
|
+
});
|
|
203
|
+
// Inferred types from exported Zod validators.
|
|
204
|
+
export type QtiResultValue = z.infer<typeof QtiResultValueSchema>;
|
|
205
|
+
export type QtiResultCandidateResponse = z.infer<typeof QtiResultCandidateResponseSchema>;
|
|
206
|
+
export type QtiResultCorrectResponse = z.infer<typeof QtiResultCorrectResponseSchema>;
|
|
207
|
+
export type QtiResultSessionIdentifier = z.infer<typeof QtiResultSessionIdentifierSchema>;
|
|
208
|
+
export type QtiResultContext = z.infer<typeof QtiResultContextSchema>;
|
|
209
|
+
export type QtiResultSupport = z.infer<typeof QtiResultSupportSchema>;
|
|
210
|
+
export type QtiResultContextVariable = z.infer<typeof QtiResultContextVariableSchema>;
|
|
211
|
+
export type QtiResultTemplateVariable = z.infer<typeof QtiResultTemplateVariableSchema>;
|
|
212
|
+
export type QtiResultOutcomeInformation = z.infer<typeof QtiResultOutcomeInformationSchema>;
|
|
213
|
+
export type QtiResultOutcomeVariable = z.infer<typeof QtiResultOutcomeVariableSchema>;
|
|
214
|
+
export type QtiResultResponseVariable = z.infer<typeof QtiResultResponseVariableSchema>;
|
|
215
|
+
export type QtiResultOutcomeVariableValidated = z.infer<typeof QtiResultOutcomeVariableValidatedSchema>;
|
|
216
|
+
export type QtiResultContextVariableValidated = z.infer<typeof QtiResultContextVariableValidatedSchema>;
|
|
217
|
+
export type QtiResultTemplateVariableValidated = z.infer<typeof QtiResultTemplateVariableValidatedSchema>;
|
|
218
|
+
export type QtiResultResponseVariableValidated = z.infer<typeof QtiResultResponseVariableValidatedSchema>;
|
|
219
|
+
export type QtiResultTestResult = z.infer<typeof QtiResultTestResultSchema>;
|
|
220
|
+
export type QtiResultItemResult = z.infer<typeof QtiResultItemResultSchema>;
|
|
221
|
+
export type QtiAssessmentResult = z.infer<typeof QtiAssessmentResultSchema>;
|
|
222
|
+
export type QtiAssessmentResultDocument = z.infer<typeof QtiAssessmentResultDocumentSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export {
|
|
3
|
+
QtiAssessmentSectionRawSchema,
|
|
4
|
+
QtiAssessmentSectionRefSchema,
|
|
5
|
+
QtiAssessmentSectionSchema,
|
|
6
|
+
} from "./assessment-internal";
|
|
7
|
+
|
|
8
|
+
import { strictObject } from "./shared";
|
|
9
|
+
import { QtiAssessmentSectionSchema } from "./assessment-internal";
|
|
10
|
+
|
|
11
|
+
export const QtiAssessmentSectionDocumentSchema = strictObject({
|
|
12
|
+
assessmentSection: QtiAssessmentSectionSchema,
|
|
13
|
+
});
|
|
14
|
+
// Inferred types from exported Zod validators.
|
|
15
|
+
export type QtiAssessmentSectionDocument = z.infer<typeof QtiAssessmentSectionDocumentSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export {
|
|
3
|
+
QtiAssessmentStimulusRefSchema,
|
|
4
|
+
QtiAssessmentStimulusSchema,
|
|
5
|
+
QtiStimulusBodySchema,
|
|
6
|
+
} from "./assessment-internal";
|
|
7
|
+
|
|
8
|
+
import { strictObject } from "./shared";
|
|
9
|
+
import { QtiAssessmentStimulusSchema } from "./assessment-internal";
|
|
10
|
+
|
|
11
|
+
export const QtiAssessmentStimulusDocumentSchema = strictObject({
|
|
12
|
+
assessmentStimulus: QtiAssessmentStimulusSchema,
|
|
13
|
+
});
|
|
14
|
+
// Inferred types from exported Zod validators.
|
|
15
|
+
export type QtiAssessmentStimulusDocument = z.infer<typeof QtiAssessmentStimulusDocumentSchema>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
QtiAdaptiveSelectionSchema,
|
|
5
|
+
QtiAssessmentItemRefSchema,
|
|
6
|
+
QtiAssessmentSectionRawSchema,
|
|
7
|
+
QtiAssessmentSectionRefSchema,
|
|
8
|
+
QtiAssessmentSectionSchema,
|
|
9
|
+
QtiAssessmentTestRawSchema,
|
|
10
|
+
QtiAssessmentTestSchema,
|
|
11
|
+
QtiOrderingSchema,
|
|
12
|
+
QtiSelectionSchema,
|
|
13
|
+
QtiTestFeedbackSchema,
|
|
14
|
+
QtiTestPartSchema,
|
|
15
|
+
QtiTestRubricBlockSchema,
|
|
16
|
+
} from "./assessment-internal";
|
|
17
|
+
export { QtiOutcomeDeclarationRawSchema, QtiOutcomeDeclarationSchema } from "./variables-internal";
|
|
18
|
+
export {
|
|
19
|
+
QtiOutcomeConditionSchema,
|
|
20
|
+
QtiOutcomeElseSchema,
|
|
21
|
+
QtiOutcomeIfSchema,
|
|
22
|
+
QtiOutcomeProcessingFragmentSchema,
|
|
23
|
+
QtiOutcomeProcessingSchema,
|
|
24
|
+
} from "./processing-internal";
|
|
25
|
+
|
|
26
|
+
import { QtiAssessmentTestSchema } from "./assessment-internal";
|
|
27
|
+
import { QtiOutcomeProcessingSchema } from "./processing-internal";
|
|
28
|
+
import { strictObject } from "./shared";
|
|
29
|
+
import { QtiOutcomeDeclarationDocumentSchema } from "./imsqti_outcomev3p0p1_v1p0";
|
|
30
|
+
import { QtiAssessmentSectionDocumentSchema } from "./imsqti_sectionv3p0p1_v1p0";
|
|
31
|
+
|
|
32
|
+
export const QtiAssessmentTestDocumentSchema = strictObject({
|
|
33
|
+
assessmentTest: QtiAssessmentTestSchema,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const QtiOutcomeProcessingDocumentSchema = strictObject({
|
|
37
|
+
outcomeProcessing: QtiOutcomeProcessingSchema,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const QtiTestProfileDocumentSchema = z.union([
|
|
41
|
+
QtiAssessmentTestDocumentSchema,
|
|
42
|
+
QtiAssessmentSectionDocumentSchema,
|
|
43
|
+
QtiOutcomeDeclarationDocumentSchema,
|
|
44
|
+
QtiOutcomeProcessingDocumentSchema,
|
|
45
|
+
]);
|
|
46
|
+
// Inferred types from exported Zod validators.
|
|
47
|
+
export type QtiAssessmentTestDocument = z.infer<typeof QtiAssessmentTestDocumentSchema>;
|
|
48
|
+
export type QtiOutcomeProcessingDocument = z.infer<typeof QtiOutcomeProcessingDocumentSchema>;
|
|
49
|
+
export type QtiTestProfileDocument = z.infer<typeof QtiTestProfileDocumentSchema>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { QtiMapEntrySchema, QtiValueSchema } from "./variables-internal";
|
|
4
|
+
import { QtiIdentifierSchema, UriReferenceSchema, addIssue, strictObject } from "./shared";
|
|
5
|
+
|
|
6
|
+
export const QtiUsageDateSchema = z.iso.date();
|
|
7
|
+
|
|
8
|
+
export const QtiUsageObjectTypeSchema = z.enum([
|
|
9
|
+
"test",
|
|
10
|
+
"testpart",
|
|
11
|
+
"section",
|
|
12
|
+
"item",
|
|
13
|
+
"outcome",
|
|
14
|
+
"interaction",
|
|
15
|
+
"choice",
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
export const QtiUsageTargetObjectSchema = strictObject({
|
|
19
|
+
identifier: z.string().min(1),
|
|
20
|
+
partIdentifier: QtiIdentifierSchema.optional(),
|
|
21
|
+
objectType: QtiUsageObjectTypeSchema.optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const QtiUsageMappingSchema = strictObject({
|
|
25
|
+
lowerBound: z.number().optional(),
|
|
26
|
+
upperBound: z.number().optional(),
|
|
27
|
+
defaultValue: z.number().optional(),
|
|
28
|
+
mapEntries: z.array(QtiMapEntrySchema).min(1),
|
|
29
|
+
}).superRefine((value, context) => {
|
|
30
|
+
if (value.lowerBound !== undefined && value.upperBound !== undefined && value.lowerBound > value.upperBound) {
|
|
31
|
+
addIssue(context, ["upperBound"], "upperBound must be greater than or equal to lowerBound.");
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const QtiUsageStatisticBaseShape = {
|
|
36
|
+
name: QtiIdentifierSchema,
|
|
37
|
+
glossary: UriReferenceSchema.optional(),
|
|
38
|
+
context: UriReferenceSchema,
|
|
39
|
+
caseCount: z.number().int().nonnegative().optional(),
|
|
40
|
+
stdError: z.number().optional(),
|
|
41
|
+
stdDeviation: z.number().optional(),
|
|
42
|
+
lastUpdated: QtiUsageDateSchema.optional(),
|
|
43
|
+
targetObjects: z.array(QtiUsageTargetObjectSchema).min(1),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const QtiOrdinaryStatisticSchema = strictObject({
|
|
47
|
+
kind: z.literal("ordinaryStatistic"),
|
|
48
|
+
...QtiUsageStatisticBaseShape,
|
|
49
|
+
value: QtiValueSchema,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const QtiCategorizedStatisticSchema = strictObject({
|
|
53
|
+
kind: z.literal("categorizedStatistic"),
|
|
54
|
+
...QtiUsageStatisticBaseShape,
|
|
55
|
+
mapping: QtiUsageMappingSchema,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const QtiUsageStatisticSchema = z.union([QtiOrdinaryStatisticSchema, QtiCategorizedStatisticSchema]);
|
|
59
|
+
|
|
60
|
+
export const QtiUsageDataSchema = strictObject({
|
|
61
|
+
glossary: UriReferenceSchema.optional(),
|
|
62
|
+
statistics: z.array(QtiUsageStatisticSchema).default([]),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const QtiUsageDataDocumentSchema = strictObject({
|
|
66
|
+
usageData: QtiUsageDataSchema,
|
|
67
|
+
});
|
|
68
|
+
// Inferred types from exported Zod validators.
|
|
69
|
+
export type QtiUsageDate = z.infer<typeof QtiUsageDateSchema>;
|
|
70
|
+
export type QtiUsageObjectType = z.infer<typeof QtiUsageObjectTypeSchema>;
|
|
71
|
+
export type QtiUsageTargetObject = z.infer<typeof QtiUsageTargetObjectSchema>;
|
|
72
|
+
export type QtiUsageMapping = z.infer<typeof QtiUsageMappingSchema>;
|
|
73
|
+
export type QtiOrdinaryStatistic = z.infer<typeof QtiOrdinaryStatisticSchema>;
|
|
74
|
+
export type QtiCategorizedStatistic = z.infer<typeof QtiCategorizedStatisticSchema>;
|
|
75
|
+
export type QtiUsageStatistic = z.infer<typeof QtiUsageStatisticSchema>;
|
|
76
|
+
export type QtiUsageData = z.infer<typeof QtiUsageDataSchema>;
|
|
77
|
+
export type QtiUsageDataDocument = z.infer<typeof QtiUsageDataDocumentSchema>;
|