@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,345 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
function strictObject<T extends z.ZodRawShape>(shape: T) {
|
|
4
|
+
return z.object(shape).strict();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function extensibleEnum<Values extends readonly [string, ...string[]]>(values: Values) {
|
|
8
|
+
return z.union([z.enum(values), ExtensibleVocabularyValueSchema]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Shared validators
|
|
12
|
+
export const UuidSchema = z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[8-9a-b][0-9a-f]{3}-[0-9a-f]{12}$/u);
|
|
15
|
+
const UriSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/u);
|
|
16
|
+
export const DateTimeSchema = z.string().datetime({ offset: true });
|
|
17
|
+
|
|
18
|
+
const ExtensibleVocabularyValueSchema = z.string().regex(/^(ext:)[a-zA-Z0-9.\-_]+$/u);
|
|
19
|
+
|
|
20
|
+
export const ExtensionEnumSchema = extensibleEnum;
|
|
21
|
+
|
|
22
|
+
// Assessment Result status values
|
|
23
|
+
const ASSESSMENT_RESULT_TYPES = ["active", "complete", "incomplete", "paused", "terminated", "pending"] as const;
|
|
24
|
+
|
|
25
|
+
// Outcome variable types in CAT
|
|
26
|
+
const OUTCOME_VARIABLE_TYPES = [
|
|
27
|
+
"float",
|
|
28
|
+
"integer",
|
|
29
|
+
"boolean",
|
|
30
|
+
"string",
|
|
31
|
+
"point",
|
|
32
|
+
"duration",
|
|
33
|
+
"pair",
|
|
34
|
+
"directedPair",
|
|
35
|
+
"ordered",
|
|
36
|
+
"multiple",
|
|
37
|
+
"record",
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
// Cardinality types for outcome variables
|
|
41
|
+
const OUTCOME_CARDINALITY_TYPES = ["single", "multiple", "ordered", "record"] as const;
|
|
42
|
+
|
|
43
|
+
export const OutcomeVariableTypeSchema = extensibleEnum(OUTCOME_VARIABLE_TYPES);
|
|
44
|
+
export const OutcomeCardinalitySchema = extensibleEnum(OUTCOME_CARDINALITY_TYPES);
|
|
45
|
+
export const AssessmentResultTypeSchema = extensibleEnum(ASSESSMENT_RESULT_TYPES);
|
|
46
|
+
|
|
47
|
+
// Outcome variable value (can be various types)
|
|
48
|
+
const OutcomeValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Outcome variable - represents a QTI outcome variable from assessment results
|
|
52
|
+
*/
|
|
53
|
+
export const OutcomeVariableSchema = strictObject({
|
|
54
|
+
identifier: z.string(),
|
|
55
|
+
cardinality: OutcomeCardinalitySchema,
|
|
56
|
+
baseType: OutcomeVariableTypeSchema,
|
|
57
|
+
value: z.union([OutcomeValueSchema, z.array(OutcomeValueSchema)]).optional(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Response variable - represents a candidate response to an item
|
|
62
|
+
*/
|
|
63
|
+
export const ResponseVariableSchema = strictObject({
|
|
64
|
+
identifier: z.string(),
|
|
65
|
+
cardinality: OutcomeCardinalitySchema,
|
|
66
|
+
baseType: z.string(),
|
|
67
|
+
value: z.union([OutcomeValueSchema, z.array(OutcomeValueSchema)]).optional(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Item reference in the item pool
|
|
72
|
+
*/
|
|
73
|
+
export const ItemRefSchema = strictObject({
|
|
74
|
+
identifier: z.string(),
|
|
75
|
+
href: UriSchema,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* CAT constraint - defines rules for item selection
|
|
80
|
+
*/
|
|
81
|
+
export const CatConstraintSchema = strictObject({
|
|
82
|
+
type: z.string(),
|
|
83
|
+
parameters: z.record(z.string(), z.unknown()).optional(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Item pool - references to available items for adaptive selection
|
|
88
|
+
*/
|
|
89
|
+
export const ItemPoolSchema = strictObject({
|
|
90
|
+
itemRefs: z.array(ItemRefSchema),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Adaptive section configuration - contains all parameters needed by CAT engine
|
|
95
|
+
*/
|
|
96
|
+
export const SectionDataSchema = strictObject({
|
|
97
|
+
// Unique identifier for the section in the assessment
|
|
98
|
+
sectionIdentifier: z.string(),
|
|
99
|
+
|
|
100
|
+
// Unique identifier for this particular adaptive section instance
|
|
101
|
+
assessmentSectionId: UuidSchema,
|
|
102
|
+
|
|
103
|
+
// URI pointing to the section resource (QTI or content package)
|
|
104
|
+
sectionHref: UriSchema,
|
|
105
|
+
|
|
106
|
+
// Item pool with available items
|
|
107
|
+
itemPool: ItemPoolSchema,
|
|
108
|
+
|
|
109
|
+
// CAT constraints (e.g., maximum items, target ability, etc.)
|
|
110
|
+
constraints: z.array(CatConstraintSchema).optional(),
|
|
111
|
+
|
|
112
|
+
// Optional item metadata (e.g., IRT parameters, CSM mappings)
|
|
113
|
+
itemMetadata: z.record(z.string(), z.unknown()).optional(),
|
|
114
|
+
|
|
115
|
+
// Optional user demographics for personalization
|
|
116
|
+
demographics: z.record(z.string(), z.unknown()).optional(),
|
|
117
|
+
|
|
118
|
+
// Custom CAT engine parameters (engine-specific)
|
|
119
|
+
customParameters: z.record(z.string(), z.unknown()).optional(),
|
|
120
|
+
|
|
121
|
+
// Creation timestamp
|
|
122
|
+
createdAt: DateTimeSchema,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Item stage - one or more items to present to the candidate
|
|
127
|
+
*/
|
|
128
|
+
export const ItemStageSchema = strictObject({
|
|
129
|
+
// Unique identifier for this item stage
|
|
130
|
+
stageId: UuidSchema,
|
|
131
|
+
|
|
132
|
+
// The items to present in this stage
|
|
133
|
+
items: z.array(ItemRefSchema),
|
|
134
|
+
|
|
135
|
+
// Whether the candidate must complete all items in this stage before proceeding
|
|
136
|
+
mustCompleteAll: z.boolean().optional().default(false),
|
|
137
|
+
|
|
138
|
+
// Position of this stage in the test sequence
|
|
139
|
+
stagePosition: z.number().int().positive().optional(),
|
|
140
|
+
|
|
141
|
+
// Total number of stages expected (null if unknown)
|
|
142
|
+
stagesTotal: z.number().int().positive().nullable().optional(),
|
|
143
|
+
|
|
144
|
+
// Adaptive section ID this stage belongs to
|
|
145
|
+
assessmentSectionId: UuidSchema,
|
|
146
|
+
|
|
147
|
+
// Custom properties for the CAT engine
|
|
148
|
+
customProperties: z.record(z.string(), z.unknown()).optional(),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Assessment result from platform - candidate responses to items
|
|
153
|
+
*/
|
|
154
|
+
export const AssessmentResultSchema = strictObject({
|
|
155
|
+
// Unique identifier for this result
|
|
156
|
+
resultId: UuidSchema,
|
|
157
|
+
|
|
158
|
+
// The assessment section this result is for
|
|
159
|
+
assessmentSectionId: UuidSchema,
|
|
160
|
+
|
|
161
|
+
// The items being responded to
|
|
162
|
+
itemsAttempted: z.array(
|
|
163
|
+
strictObject({
|
|
164
|
+
itemRef: ItemRefSchema,
|
|
165
|
+
attemptNumber: z.number().int().positive(),
|
|
166
|
+
}),
|
|
167
|
+
),
|
|
168
|
+
|
|
169
|
+
// Candidate responses to items
|
|
170
|
+
responseVariables: z.array(ResponseVariableSchema).optional(),
|
|
171
|
+
|
|
172
|
+
// Outcome variables generated by item processing (e.g., item scores)
|
|
173
|
+
outcomeVariables: z.array(OutcomeVariableSchema).optional(),
|
|
174
|
+
|
|
175
|
+
// Whether the candidate is continuing (true) or finishing (false)
|
|
176
|
+
continuationRequired: z.boolean(),
|
|
177
|
+
|
|
178
|
+
// Timestamp of this result submission
|
|
179
|
+
submittedAt: DateTimeSchema,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Result report from CAT engine - recommendations and scoring
|
|
184
|
+
*/
|
|
185
|
+
export const CatEngineResultReportSchema = strictObject({
|
|
186
|
+
// Unique identifier for this report
|
|
187
|
+
reportId: UuidSchema,
|
|
188
|
+
|
|
189
|
+
// Assessment section ID
|
|
190
|
+
assessmentSectionId: UuidSchema,
|
|
191
|
+
|
|
192
|
+
// Estimated ability of the candidate (IRT theta estimate)
|
|
193
|
+
estimatedAbility: z.number().optional(),
|
|
194
|
+
|
|
195
|
+
// Standard error of ability estimate
|
|
196
|
+
abilityStandardError: z.number().optional(),
|
|
197
|
+
|
|
198
|
+
// Overall score/outcome for the section
|
|
199
|
+
sectionScore: z.number().optional(),
|
|
200
|
+
|
|
201
|
+
// Outcome variables to be delivered to the platform
|
|
202
|
+
outcomeVariables: z.array(OutcomeVariableSchema).optional(),
|
|
203
|
+
|
|
204
|
+
// Recommendation (e.g., "continue", "finish")
|
|
205
|
+
recommendation: z.enum(["continue", "finish", "suspend", "abandon"]),
|
|
206
|
+
|
|
207
|
+
// Optional next item stage to present
|
|
208
|
+
nextStage: ItemStageSchema.optional(),
|
|
209
|
+
|
|
210
|
+
// Optional diagnostic information
|
|
211
|
+
diagnosticData: z.record(z.string(), z.unknown()).optional(),
|
|
212
|
+
|
|
213
|
+
// Timestamp of report generation
|
|
214
|
+
generatedAt: DateTimeSchema,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Session information for CAT delivery
|
|
219
|
+
*/
|
|
220
|
+
export const SessionInfoSchema = strictObject({
|
|
221
|
+
// Unique session identifier
|
|
222
|
+
sessionId: UuidSchema,
|
|
223
|
+
|
|
224
|
+
// Assessment section ID for this session
|
|
225
|
+
assessmentSectionId: UuidSchema,
|
|
226
|
+
|
|
227
|
+
// Candidate/user identifier
|
|
228
|
+
candidateId: z.string(),
|
|
229
|
+
|
|
230
|
+
// Current session status
|
|
231
|
+
status: AssessmentResultTypeSchema,
|
|
232
|
+
|
|
233
|
+
// Number of items completed so far
|
|
234
|
+
itemsCompleted: z.number().int().nonnegative(),
|
|
235
|
+
|
|
236
|
+
// When session started
|
|
237
|
+
startedAt: DateTimeSchema,
|
|
238
|
+
|
|
239
|
+
// When session ended (null if still active)
|
|
240
|
+
endedAt: DateTimeSchema.nullable().optional(),
|
|
241
|
+
|
|
242
|
+
// Custom session data
|
|
243
|
+
customData: z.record(z.string(), z.unknown()).optional(),
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Request payloads for CAT operations
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
export const CreateSectionRequestSchema = strictObject({
|
|
251
|
+
sectionData: SectionDataSchema,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export const GetSectionRequestSchema = strictObject({
|
|
255
|
+
sectionId: UuidSchema,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
export const CreateSessionRequestSchema = strictObject({
|
|
259
|
+
assessmentSectionId: UuidSchema,
|
|
260
|
+
candidateId: z.string(),
|
|
261
|
+
demographics: z.record(z.string(), z.unknown()).optional(),
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export const SubmitResultsRequestSchema = strictObject({
|
|
265
|
+
sessionId: UuidSchema,
|
|
266
|
+
result: AssessmentResultSchema,
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
export const EndSessionRequestSchema = strictObject({
|
|
270
|
+
sessionId: UuidSchema,
|
|
271
|
+
status: AssessmentResultTypeSchema.optional(),
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
export const EndSectionRequestSchema = strictObject({
|
|
275
|
+
sectionId: UuidSchema,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Response payloads for CAT operations
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
export const CreateSectionResponseSchema = strictObject({
|
|
283
|
+
sectionId: UuidSchema,
|
|
284
|
+
status: z.literal("created"),
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
export const GetSectionResponseSchema = SectionDataSchema;
|
|
288
|
+
|
|
289
|
+
export const CreateSessionResponseSchema = strictObject({
|
|
290
|
+
sessionId: UuidSchema,
|
|
291
|
+
status: z.literal("active"),
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
export const SubmitResultsResponseSchema = CatEngineResultReportSchema;
|
|
295
|
+
|
|
296
|
+
export const EndSessionResponseSchema = strictObject({
|
|
297
|
+
sessionId: UuidSchema,
|
|
298
|
+
status: z.literal("ended"),
|
|
299
|
+
finalReport: CatEngineResultReportSchema.optional(),
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
export const EndSectionResponseSchema = strictObject({
|
|
303
|
+
sectionId: UuidSchema,
|
|
304
|
+
status: z.literal("ended"),
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Error response
|
|
309
|
+
*/
|
|
310
|
+
export const ErrorResponseSchema = strictObject({
|
|
311
|
+
error: z.string(),
|
|
312
|
+
message: z.string(),
|
|
313
|
+
statusCode: z.number().int(),
|
|
314
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
315
|
+
});
|
|
316
|
+
// Inferred types from exported Zod validators.
|
|
317
|
+
export type Uuid = z.infer<typeof UuidSchema>;
|
|
318
|
+
export type DateTime = z.infer<typeof DateTimeSchema>;
|
|
319
|
+
export type ExtensionEnum = z.infer<typeof ExtensionEnumSchema>;
|
|
320
|
+
export type OutcomeVariableType = z.infer<typeof OutcomeVariableTypeSchema>;
|
|
321
|
+
export type OutcomeCardinality = z.infer<typeof OutcomeCardinalitySchema>;
|
|
322
|
+
export type AssessmentResultType = z.infer<typeof AssessmentResultTypeSchema>;
|
|
323
|
+
export type OutcomeVariable = z.infer<typeof OutcomeVariableSchema>;
|
|
324
|
+
export type ResponseVariable = z.infer<typeof ResponseVariableSchema>;
|
|
325
|
+
export type ItemRef = z.infer<typeof ItemRefSchema>;
|
|
326
|
+
export type CatConstraint = z.infer<typeof CatConstraintSchema>;
|
|
327
|
+
export type ItemPool = z.infer<typeof ItemPoolSchema>;
|
|
328
|
+
export type SectionData = z.infer<typeof SectionDataSchema>;
|
|
329
|
+
export type ItemStage = z.infer<typeof ItemStageSchema>;
|
|
330
|
+
export type AssessmentResult = z.infer<typeof AssessmentResultSchema>;
|
|
331
|
+
export type CatEngineResultReport = z.infer<typeof CatEngineResultReportSchema>;
|
|
332
|
+
export type SessionInfo = z.infer<typeof SessionInfoSchema>;
|
|
333
|
+
export type CreateSectionRequest = z.infer<typeof CreateSectionRequestSchema>;
|
|
334
|
+
export type GetSectionRequest = z.infer<typeof GetSectionRequestSchema>;
|
|
335
|
+
export type CreateSessionRequest = z.infer<typeof CreateSessionRequestSchema>;
|
|
336
|
+
export type SubmitResultsRequest = z.infer<typeof SubmitResultsRequestSchema>;
|
|
337
|
+
export type EndSessionRequest = z.infer<typeof EndSessionRequestSchema>;
|
|
338
|
+
export type EndSectionRequest = z.infer<typeof EndSectionRequestSchema>;
|
|
339
|
+
export type CreateSectionResponse = z.infer<typeof CreateSectionResponseSchema>;
|
|
340
|
+
export type GetSectionResponse = z.infer<typeof GetSectionResponseSchema>;
|
|
341
|
+
export type CreateSessionResponse = z.infer<typeof CreateSessionResponseSchema>;
|
|
342
|
+
export type SubmitResultsResponse = z.infer<typeof SubmitResultsResponseSchema>;
|
|
343
|
+
export type EndSessionResponse = z.infer<typeof EndSessionResponseSchema>;
|
|
344
|
+
export type EndSectionResponse = z.infer<typeof EndSectionResponseSchema>;
|
|
345
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
AchievementCredentialSchema,
|
|
3
|
+
AchievementSchema,
|
|
4
|
+
AchievementSubjectSchema,
|
|
5
|
+
AchievementTypeSchema,
|
|
6
|
+
AlignmentSchema,
|
|
7
|
+
AlignmentTargetTypeSchema,
|
|
8
|
+
CriteriaSchema,
|
|
9
|
+
IdentityObjectSchema,
|
|
10
|
+
RelatedSchema,
|
|
11
|
+
ResultDescriptionSchema,
|
|
12
|
+
ResultSchema,
|
|
13
|
+
ResultStatusTypeSchema,
|
|
14
|
+
ResultTypeSchema,
|
|
15
|
+
RubricCriterionLevelSchema,
|
|
16
|
+
} from "./shared";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetClrCredentialsResponseSchema } from "./shared";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from "./clr_v2p0_clrcredential_schema";
|
|
2
|
+
export * from "./clr_v2p0_achievementcredential_schema";
|
|
3
|
+
export * from "./clr_v2p0_endorsementcredential_schema";
|
|
4
|
+
export * from "./clr_v2p0_profile_schema";
|
|
5
|
+
export * from "./clr_v2p0_getclrcredentialsresponse_schema";
|
|
6
|
+
export * from "./clr_v2p0_imsx_statusinfo_schema";
|
|
7
|
+
|
|
8
|
+
import { AchievementCredentialSchema } from "./clr_v2p0_achievementcredential_schema";
|
|
9
|
+
import { ClrCredentialSchema } from "./clr_v2p0_clrcredential_schema";
|
|
10
|
+
import { EndorsementCredentialSchema } from "./clr_v2p0_endorsementcredential_schema";
|
|
11
|
+
import { GetClrCredentialsResponseSchema } from "./clr_v2p0_getclrcredentialsresponse_schema";
|
|
12
|
+
import { ImsxStatusInfoSchema } from "./clr_v2p0_imsx_statusinfo_schema";
|
|
13
|
+
import { ProfileSchema } from "./clr_v2p0_profile_schema";
|
|
14
|
+
|
|
15
|
+
export const Clr20DerivedZodTemplates = {
|
|
16
|
+
clrCredential: ClrCredentialSchema,
|
|
17
|
+
achievementCredential: AchievementCredentialSchema,
|
|
18
|
+
endorsementCredential: EndorsementCredentialSchema,
|
|
19
|
+
getClrCredentialsResponse: GetClrCredentialsResponseSchema,
|
|
20
|
+
profile: ProfileSchema,
|
|
21
|
+
imsxStatusInfo: ImsxStatusInfoSchema,
|
|
22
|
+
} as const;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AchievementCredentialSchema,
|
|
5
|
+
AchievementSchema,
|
|
6
|
+
AchievementSubjectSchema,
|
|
7
|
+
AchievementTypeSchema,
|
|
8
|
+
AddressSchema,
|
|
9
|
+
AlignmentSchema,
|
|
10
|
+
AlignmentTargetTypeSchema,
|
|
11
|
+
CriteriaSchema,
|
|
12
|
+
CredentialSubjectSchema,
|
|
13
|
+
CredentialSchemaSchema,
|
|
14
|
+
CredentialStatusSchema,
|
|
15
|
+
EndorsementCredentialSchema,
|
|
16
|
+
EndorsementSubjectSchema,
|
|
17
|
+
EvidenceSchema,
|
|
18
|
+
GeoCoordinatesSchema,
|
|
19
|
+
IdentifierEntrySchema,
|
|
20
|
+
IdentifierTypeEnumSchema,
|
|
21
|
+
IdentityObjectSchema,
|
|
22
|
+
ImageSchema,
|
|
23
|
+
OpenBadgesV30ContextUrlSchema,
|
|
24
|
+
ProfileRefSchema,
|
|
25
|
+
ProfileSchema,
|
|
26
|
+
ProofSchema,
|
|
27
|
+
RefreshServiceSchema,
|
|
28
|
+
RelatedSchema,
|
|
29
|
+
ResultDescriptionSchema,
|
|
30
|
+
ResultSchema,
|
|
31
|
+
ResultStatusTypeSchema,
|
|
32
|
+
ResultTypeSchema,
|
|
33
|
+
RubricCriterionLevelSchema,
|
|
34
|
+
TermsOfUseSchema,
|
|
35
|
+
} from "../../open-badges/v3_0/shared";
|
|
36
|
+
import {
|
|
37
|
+
CompactJwsValueSchema,
|
|
38
|
+
contextArraySchema,
|
|
39
|
+
credentialTypeSchema,
|
|
40
|
+
oneOrMany,
|
|
41
|
+
type OneOrManyValue,
|
|
42
|
+
passthroughObject,
|
|
43
|
+
singleTypeSchema,
|
|
44
|
+
TextValueSchema,
|
|
45
|
+
type TextValue,
|
|
46
|
+
UriValueSchema,
|
|
47
|
+
type UriValue,
|
|
48
|
+
W3cCredentialsV2ContextSchema,
|
|
49
|
+
} from "../../vc-data-model/v2_0/shared";
|
|
50
|
+
|
|
51
|
+
type ClrSubject = {
|
|
52
|
+
id?: UriValue;
|
|
53
|
+
type: unknown;
|
|
54
|
+
identifier?: OneOrManyValue<Record<string, unknown>>;
|
|
55
|
+
achievement?: OneOrManyValue<Record<string, unknown>>;
|
|
56
|
+
verifiableCredential: OneOrManyValue<Record<string, unknown>>;
|
|
57
|
+
association?: OneOrManyValue<Record<string, unknown>>;
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type ClrCredential = {
|
|
62
|
+
"@context": Array<Record<string, unknown> | UriValue>;
|
|
63
|
+
type: unknown;
|
|
64
|
+
id: UriValue;
|
|
65
|
+
name: TextValue;
|
|
66
|
+
description?: TextValue;
|
|
67
|
+
endorsement?: OneOrManyValue<Record<string, unknown>>;
|
|
68
|
+
endorsementJwt?: OneOrManyValue<string | Record<string, string>>;
|
|
69
|
+
image?: Record<string, unknown>;
|
|
70
|
+
partial?: boolean;
|
|
71
|
+
credentialSubject: ClrSubject;
|
|
72
|
+
awardedDate?: string;
|
|
73
|
+
issuer: UriValue | Record<string, unknown>;
|
|
74
|
+
validFrom: string;
|
|
75
|
+
validUntil?: string;
|
|
76
|
+
proof?: OneOrManyValue<Record<string, unknown>>;
|
|
77
|
+
credentialSchema?: OneOrManyValue<Record<string, unknown>>;
|
|
78
|
+
credentialStatus?: Record<string, unknown>;
|
|
79
|
+
refreshService?: Record<string, unknown>;
|
|
80
|
+
termsOfUse?: OneOrManyValue<Record<string, unknown>>;
|
|
81
|
+
evidence?: OneOrManyValue<Record<string, unknown>>;
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const ClrV20ContextUrlSchema = z
|
|
86
|
+
.string()
|
|
87
|
+
.regex(/^https:\/\/purl\.imsglobal\.org\/spec\/clr\/v2p0\/context(-2\.\d\.\d)*\.json$/u);
|
|
88
|
+
|
|
89
|
+
const ClrCredentialContextSchema = contextArraySchema("CLR 2.0", [
|
|
90
|
+
W3cCredentialsV2ContextSchema,
|
|
91
|
+
ClrV20ContextUrlSchema,
|
|
92
|
+
OpenBadgesV30ContextUrlSchema,
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
export const AssociationTypeSchema = z.enum([
|
|
96
|
+
"exactMatchOf",
|
|
97
|
+
"isChildOf",
|
|
98
|
+
"isParentOf",
|
|
99
|
+
"isPartOf",
|
|
100
|
+
"isPeerOf",
|
|
101
|
+
"isRelatedTo",
|
|
102
|
+
"precedes",
|
|
103
|
+
"replacedBy",
|
|
104
|
+
]);
|
|
105
|
+
|
|
106
|
+
export const AssociationSchema = passthroughObject({
|
|
107
|
+
type: singleTypeSchema("Association"),
|
|
108
|
+
associationType: AssociationTypeSchema,
|
|
109
|
+
sourceId: UriValueSchema,
|
|
110
|
+
targetId: UriValueSchema,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export const VerifiableCredentialSchema = passthroughObject({
|
|
114
|
+
"@context": contextArraySchema("CLR 2.0", [W3cCredentialsV2ContextSchema]),
|
|
115
|
+
id: UriValueSchema.optional(),
|
|
116
|
+
type: singleTypeSchema("VerifiableCredential"),
|
|
117
|
+
issuer: ProfileRefSchema,
|
|
118
|
+
validFrom: z.iso.datetime(),
|
|
119
|
+
validUntil: z.iso.datetime().optional(),
|
|
120
|
+
credentialSubject: passthroughObject({
|
|
121
|
+
id: UriValueSchema.optional(),
|
|
122
|
+
}),
|
|
123
|
+
proof: oneOrMany(ProofSchema).optional(),
|
|
124
|
+
credentialSchema: oneOrMany(CredentialSchemaSchema).optional(),
|
|
125
|
+
credentialStatus: CredentialStatusSchema.optional(),
|
|
126
|
+
refreshService: RefreshServiceSchema.optional(),
|
|
127
|
+
termsOfUse: oneOrMany(TermsOfUseSchema).optional(),
|
|
128
|
+
evidence: oneOrMany(EvidenceSchema).optional(),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const ClrSubjectSchema: z.ZodType<ClrSubject> = passthroughObject({
|
|
132
|
+
id: UriValueSchema.optional(),
|
|
133
|
+
type: singleTypeSchema("ClrSubject"),
|
|
134
|
+
identifier: oneOrMany(IdentityObjectSchema).optional(),
|
|
135
|
+
achievement: oneOrMany(AchievementSchema).optional(),
|
|
136
|
+
verifiableCredential: oneOrMany(VerifiableCredentialSchema),
|
|
137
|
+
association: oneOrMany(AssociationSchema).optional(),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const ClrCredentialSchema: z.ZodType<ClrCredential> = passthroughObject({
|
|
141
|
+
"@context": ClrCredentialContextSchema,
|
|
142
|
+
type: credentialTypeSchema(["ClrCredential"]),
|
|
143
|
+
id: UriValueSchema,
|
|
144
|
+
name: TextValueSchema,
|
|
145
|
+
description: TextValueSchema.optional(),
|
|
146
|
+
endorsement: oneOrMany(EndorsementCredentialSchema).optional(),
|
|
147
|
+
endorsementJwt: oneOrMany(CompactJwsValueSchema).optional(),
|
|
148
|
+
image: ImageSchema.optional(),
|
|
149
|
+
partial: z.boolean().optional(),
|
|
150
|
+
credentialSubject: ClrSubjectSchema,
|
|
151
|
+
awardedDate: z.iso.datetime().optional(),
|
|
152
|
+
issuer: ProfileRefSchema,
|
|
153
|
+
validFrom: z.iso.datetime(),
|
|
154
|
+
validUntil: z.iso.datetime().optional(),
|
|
155
|
+
proof: oneOrMany(ProofSchema).optional(),
|
|
156
|
+
credentialSchema: oneOrMany(CredentialSchemaSchema).optional(),
|
|
157
|
+
credentialStatus: CredentialStatusSchema.optional(),
|
|
158
|
+
refreshService: RefreshServiceSchema.optional(),
|
|
159
|
+
termsOfUse: oneOrMany(TermsOfUseSchema).optional(),
|
|
160
|
+
evidence: oneOrMany(EvidenceSchema).optional(),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export const GetClrCredentialsResponseSchema = z
|
|
164
|
+
.object({
|
|
165
|
+
credential: oneOrMany(ClrCredentialSchema).optional(),
|
|
166
|
+
compactJwsString: oneOrMany(CompactJwsValueSchema).optional(),
|
|
167
|
+
})
|
|
168
|
+
.strict();
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
AchievementCredentialSchema,
|
|
172
|
+
AchievementSchema,
|
|
173
|
+
AchievementSubjectSchema,
|
|
174
|
+
AchievementTypeSchema,
|
|
175
|
+
AddressSchema,
|
|
176
|
+
AlignmentSchema,
|
|
177
|
+
AlignmentTargetTypeSchema,
|
|
178
|
+
CriteriaSchema,
|
|
179
|
+
CredentialSubjectSchema,
|
|
180
|
+
CredentialSchemaSchema,
|
|
181
|
+
CredentialStatusSchema,
|
|
182
|
+
EndorsementCredentialSchema,
|
|
183
|
+
EndorsementSubjectSchema,
|
|
184
|
+
EvidenceSchema,
|
|
185
|
+
GeoCoordinatesSchema,
|
|
186
|
+
IdentifierEntrySchema,
|
|
187
|
+
IdentifierTypeEnumSchema,
|
|
188
|
+
IdentityObjectSchema,
|
|
189
|
+
ImageSchema,
|
|
190
|
+
ProfileRefSchema,
|
|
191
|
+
ProfileSchema,
|
|
192
|
+
ProofSchema,
|
|
193
|
+
RefreshServiceSchema,
|
|
194
|
+
RelatedSchema,
|
|
195
|
+
ResultDescriptionSchema,
|
|
196
|
+
ResultSchema,
|
|
197
|
+
ResultStatusTypeSchema,
|
|
198
|
+
ResultTypeSchema,
|
|
199
|
+
RubricCriterionLevelSchema,
|
|
200
|
+
TermsOfUseSchema,
|
|
201
|
+
};
|
|
202
|
+
// Inferred types from exported Zod validators.
|
|
203
|
+
export type AssociationType = z.infer<typeof AssociationTypeSchema>;
|
|
204
|
+
export type Association = z.infer<typeof AssociationSchema>;
|
|
205
|
+
export type VerifiableCredential = z.infer<typeof VerifiableCredentialSchema>;
|
|
206
|
+
export type GetClrCredentialsResponse = z.infer<typeof GetClrCredentialsResponseSchema>;
|