@conform-ed/contracts 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-format.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +182 -182
- 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 +198 -178
- 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 +33 -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 +1 -0
- package/test/schema-examples.test.ts +1 -0
- package/test/xapi.test.ts +1 -0
package/src/case/v1_1/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as CaseV1P1AssociationGrouping from "./case_v1p1_cfassociationgrouping_jsonschema1";
|
|
2
1
|
import * as CaseV1P1Association from "./case_v1p1_cfassociation_jsonschema1";
|
|
2
|
+
import * as CaseV1P1AssociationGrouping from "./case_v1p1_cfassociationgrouping_jsonschema1";
|
|
3
3
|
import * as CaseV1P1AssociationSet from "./case_v1p1_cfassociationset_jsonschema1";
|
|
4
4
|
import * as CaseV1P1ConceptSet from "./case_v1p1_cfconceptset_jsonschema1";
|
|
5
5
|
import * as CaseV1P1Document from "./case_v1p1_cfdocument_jsonschema1";
|
|
@@ -11,6 +11,7 @@ import * as CaseV1P1Package from "./case_v1p1_cfpackage_jsonschema1";
|
|
|
11
11
|
import * as CaseV1P1Rubric from "./case_v1p1_cfrubric_jsonschema1";
|
|
12
12
|
import * as CaseV1P1SubjectSet from "./case_v1p1_cfsubjectset_jsonschema1";
|
|
13
13
|
import * as CaseV1P1Status from "./case_v1p1_imsx_statusinfo_jsonschema1";
|
|
14
|
+
import { CaseV1P1RestBindingOperations } from "./case_v1p1_openapi3_restbinding_schema";
|
|
14
15
|
import {
|
|
15
16
|
CFAssociationSchema,
|
|
16
17
|
CFAssociationSetSchema,
|
|
@@ -28,50 +29,49 @@ import {
|
|
|
28
29
|
DateTimeSchema,
|
|
29
30
|
ExtensionEnumSchema,
|
|
30
31
|
} from "./shared";
|
|
31
|
-
import { CaseV1P1RestBindingOperations } from "./case_v1p1_openapi3_restbinding_schema";
|
|
32
32
|
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
33
|
+
export const CaseV1_1 = {
|
|
34
|
+
JsonSchema: {
|
|
35
|
+
AssociationGrouping: CaseV1P1AssociationGrouping,
|
|
36
|
+
Association: CaseV1P1Association,
|
|
37
|
+
AssociationSet: CaseV1P1AssociationSet,
|
|
38
|
+
ConceptSet: CaseV1P1ConceptSet,
|
|
39
|
+
Document: CaseV1P1Document,
|
|
40
|
+
DocumentSet: CaseV1P1DocumentSet,
|
|
41
|
+
Item: CaseV1P1Item,
|
|
42
|
+
ItemTypeSet: CaseV1P1ItemTypeSet,
|
|
43
|
+
License: CaseV1P1License,
|
|
44
|
+
Package: CaseV1P1Package,
|
|
45
|
+
Rubric: CaseV1P1Rubric,
|
|
46
|
+
SubjectSet: CaseV1P1SubjectSet,
|
|
47
|
+
Status: CaseV1P1Status,
|
|
48
|
+
},
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
50
|
+
Schemas: {
|
|
51
|
+
CFAssociation: CFAssociationSchema,
|
|
52
|
+
CFAssociationSet: CFAssociationSetSchema,
|
|
53
|
+
CFConceptSet: CFConceptSetSchema,
|
|
54
|
+
CFItem: CFItemSchema,
|
|
55
|
+
CFItemTypeSet: CFItemTypeSetSchema,
|
|
56
|
+
CFLicense: CFLicenseSchema,
|
|
57
|
+
CFPackage: CFPackageSchema,
|
|
58
|
+
CFRubric: CFRubricSchema,
|
|
59
|
+
CFSubjectSet: CFSubjectSetSchema,
|
|
60
|
+
ImsxStatusInfo: ImsxStatusInfoSchema,
|
|
61
|
+
},
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
63
|
+
Shared: {
|
|
64
|
+
LinkUri: LinkUriSchema,
|
|
65
|
+
LinkGenUri: LinkGenUriSchema,
|
|
66
|
+
Uuid: UuidSchema,
|
|
67
|
+
DateTime: DateTimeSchema,
|
|
68
|
+
ExtensionEnum: ExtensionEnumSchema,
|
|
69
|
+
},
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
71
|
+
RestBinding: {
|
|
72
|
+
Operations: CaseV1P1RestBindingOperations,
|
|
73
|
+
},
|
|
74
|
+
} as const;
|
|
75
75
|
|
|
76
76
|
export type CaseV1_1Schemas = typeof CaseV1_1.Schemas;
|
|
77
77
|
|
package/src/cat/v1_0/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CatV1P0RestBindingOperations } from "./cat_v1p0_restbinding_operations_schema";
|
|
1
2
|
import {
|
|
2
3
|
UuidSchema,
|
|
3
4
|
DateTimeSchema,
|
|
@@ -29,53 +30,52 @@ import {
|
|
|
29
30
|
OutcomeCardinalitySchema,
|
|
30
31
|
AssessmentResultTypeSchema,
|
|
31
32
|
} from "./shared";
|
|
32
|
-
import { CatV1P0RestBindingOperations } from "./cat_v1p0_restbinding_operations_schema";
|
|
33
33
|
|
|
34
|
-
export
|
|
35
|
-
|
|
34
|
+
export const CatV1_0 = {
|
|
35
|
+
Schemas: {
|
|
36
36
|
// Request schemas
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
CreateSectionRequest: CreateSectionRequestSchema,
|
|
38
|
+
GetSectionRequest: GetSectionRequestSchema,
|
|
39
|
+
CreateSessionRequest: CreateSessionRequestSchema,
|
|
40
|
+
SubmitResultsRequest: SubmitResultsRequestSchema,
|
|
41
|
+
EndSessionRequest: EndSessionRequestSchema,
|
|
42
|
+
EndSectionRequest: EndSectionRequestSchema,
|
|
43
43
|
|
|
44
44
|
// Response schemas
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
CreateSectionResponse: CreateSectionResponseSchema,
|
|
46
|
+
GetSectionResponse: GetSectionResponseSchema,
|
|
47
|
+
CreateSessionResponse: CreateSessionResponseSchema,
|
|
48
|
+
SubmitResultsResponse: SubmitResultsResponseSchema,
|
|
49
|
+
EndSessionResponse: EndSessionResponseSchema,
|
|
50
|
+
EndSectionResponse: EndSectionResponseSchema,
|
|
51
51
|
|
|
52
52
|
// Data type schemas
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
53
|
+
OutcomeVariable: OutcomeVariableSchema,
|
|
54
|
+
ResponseVariable: ResponseVariableSchema,
|
|
55
|
+
ItemRef: ItemRefSchema,
|
|
56
|
+
CatConstraint: CatConstraintSchema,
|
|
57
|
+
ItemPool: ItemPoolSchema,
|
|
58
|
+
SectionData: SectionDataSchema,
|
|
59
|
+
ItemStage: ItemStageSchema,
|
|
60
|
+
AssessmentResult: AssessmentResultSchema,
|
|
61
|
+
CatEngineResultReport: CatEngineResultReportSchema,
|
|
62
|
+
SessionInfo: SessionInfoSchema,
|
|
63
|
+
ErrorResponse: ErrorResponseSchema,
|
|
64
|
+
},
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
66
|
+
Shared: {
|
|
67
|
+
Uuid: UuidSchema,
|
|
68
|
+
DateTime: DateTimeSchema,
|
|
69
|
+
ExtensionEnum: ExtensionEnumSchema,
|
|
70
|
+
OutcomeVariableType: OutcomeVariableTypeSchema,
|
|
71
|
+
OutcomeCardinality: OutcomeCardinalitySchema,
|
|
72
|
+
AssessmentResultType: AssessmentResultTypeSchema,
|
|
73
|
+
},
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
75
|
+
RestBinding: {
|
|
76
|
+
Operations: CatV1P0RestBindingOperations,
|
|
77
|
+
},
|
|
78
|
+
} as const;
|
|
79
79
|
|
|
80
80
|
export type CatV1_0Schemas = typeof CatV1_0.Schemas;
|
|
81
81
|
|
package/src/cat/v1_0/shared.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const UuidSchema = z
|
|
|
13
13
|
.string()
|
|
14
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
15
|
const UriSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/u);
|
|
16
|
-
export const DateTimeSchema = z.
|
|
16
|
+
export const DateTimeSchema = z.iso.datetime({ offset: true });
|
|
17
17
|
|
|
18
18
|
const ExtensibleVocabularyValueSchema = z.string().regex(/^(ext:)[a-zA-Z0-9.\-_]+$/u);
|
|
19
19
|
|
package/src/clr/v2_0/shared.ts
CHANGED
|
@@ -48,37 +48,39 @@ import {
|
|
|
48
48
|
W3cCredentialsV2ContextSchema,
|
|
49
49
|
} from "../../vc-data-model/v2_0/shared";
|
|
50
50
|
|
|
51
|
+
// Declared output of a zod schema (z.ZodType<...>): zod's `.optional()` infers `| undefined`, so this must too.
|
|
51
52
|
type ClrSubject = {
|
|
52
|
-
id?: UriValue;
|
|
53
|
+
id?: UriValue | undefined;
|
|
53
54
|
type: unknown;
|
|
54
|
-
identifier?: OneOrManyValue<Record<string, unknown
|
|
55
|
-
achievement?: OneOrManyValue<Record<string, unknown
|
|
55
|
+
identifier?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
56
|
+
achievement?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
56
57
|
verifiableCredential: OneOrManyValue<Record<string, unknown>>;
|
|
57
|
-
association?: OneOrManyValue<Record<string, unknown
|
|
58
|
+
association?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
58
59
|
[key: string]: unknown;
|
|
59
60
|
};
|
|
60
61
|
|
|
62
|
+
// Declared output of a zod schema (z.ZodType<...>): zod's `.optional()` infers `| undefined`, so this must too.
|
|
61
63
|
type ClrCredential = {
|
|
62
64
|
"@context": Array<Record<string, unknown> | UriValue>;
|
|
63
65
|
type: unknown;
|
|
64
66
|
id: UriValue;
|
|
65
67
|
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;
|
|
68
|
+
description?: TextValue | undefined;
|
|
69
|
+
endorsement?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
70
|
+
endorsementJwt?: OneOrManyValue<string | Record<string, string>> | undefined;
|
|
71
|
+
image?: Record<string, unknown> | undefined;
|
|
72
|
+
partial?: boolean | undefined;
|
|
71
73
|
credentialSubject: ClrSubject;
|
|
72
|
-
awardedDate?: string;
|
|
74
|
+
awardedDate?: string | undefined;
|
|
73
75
|
issuer: UriValue | Record<string, unknown>;
|
|
74
76
|
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
|
|
77
|
+
validUntil?: string | undefined;
|
|
78
|
+
proof?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
79
|
+
credentialSchema?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
80
|
+
credentialStatus?: Record<string, unknown> | undefined;
|
|
81
|
+
refreshService?: Record<string, unknown> | undefined;
|
|
82
|
+
termsOfUse?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
83
|
+
evidence?: OneOrManyValue<Record<string, unknown>> | undefined;
|
|
82
84
|
[key: string]: unknown;
|
|
83
85
|
};
|
|
84
86
|
|
package/src/cmi5/v1_0/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ export const Cmi5KeywordExtensionSchema = strictObject({
|
|
|
39
39
|
keywords: z.array(Cmi5KeywordDefinitionSchema).min(1),
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
let Cmi5BlockSchema: z.
|
|
42
|
+
let Cmi5BlockSchema: z.ZodType;
|
|
43
43
|
|
|
44
44
|
export const Cmi5MoveOnSchema = z.enum([
|
|
45
45
|
"NotApplicable",
|
|
@@ -93,24 +93,24 @@ export const Cmi5CourseStructureDocumentSchema = strictObject({
|
|
|
93
93
|
keywords: Cmi5KeywordExtensionSchema.optional(),
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
}
|
|
96
|
+
export const Cmi5V1_0 = {
|
|
97
|
+
Schemas: {
|
|
98
|
+
LanguageString: Cmi5LanguageStringSchema,
|
|
99
|
+
Text: Cmi5TextSchema,
|
|
100
|
+
Objective: Cmi5ObjectiveSchema,
|
|
101
|
+
ObjectiveReference: Cmi5ObjectiveReferenceSchema,
|
|
102
|
+
KeywordReference: Cmi5KeywordReferenceSchema,
|
|
103
|
+
KeywordDefinition: Cmi5KeywordDefinitionSchema,
|
|
104
|
+
KeywordExtension: Cmi5KeywordExtensionSchema,
|
|
105
|
+
Course: Cmi5CourseSchema,
|
|
106
|
+
Au: Cmi5AuSchema,
|
|
107
|
+
Block: Cmi5BlockSchema,
|
|
108
|
+
CourseStructure: Cmi5CourseStructureSchema,
|
|
109
|
+
CourseStructureDocument: Cmi5CourseStructureDocumentSchema,
|
|
110
|
+
MoveOn: Cmi5MoveOnSchema,
|
|
111
|
+
LaunchMethod: Cmi5LaunchMethodSchema,
|
|
112
|
+
},
|
|
113
|
+
} as const;
|
|
114
114
|
|
|
115
115
|
export const Schemas = Cmi5V1_0.Schemas;
|
|
116
116
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import { CurriculumStandardsMetadataSetSchema } from "./ccv1p3_imscsmd_v1p0";
|
|
4
3
|
import { CommonCartridgeAuthorizationsSchema } from "./ccv1p3_imsccauth_v1p3";
|
|
4
|
+
import { CurriculumStandardsMetadataSetSchema } from "./ccv1p3_imscsmd_v1p0";
|
|
5
5
|
import { LomManifestSchema } from "./ccv1p3_lommanifest_v1p0";
|
|
6
6
|
import { LomResourceSchema } from "./ccv1p3_lomresource_v1p0";
|
|
7
7
|
import {
|
|
@@ -43,7 +43,7 @@ export const CommonCartridgeFileSchema = strictObject({
|
|
|
43
43
|
metadata: CommonCartridgeGenericMetadataSchema.optional(),
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
export const CommonCartridgeItemSchema: z.
|
|
46
|
+
export const CommonCartridgeItemSchema: z.ZodType = z.lazy(() =>
|
|
47
47
|
strictObject({
|
|
48
48
|
identifier: NonEmptyStringSchema,
|
|
49
49
|
identifierref: NonEmptyStringSchema.optional(),
|
|
@@ -53,7 +53,7 @@ export const CommonCartridgeItemSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
53
53
|
}),
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
export const CommonCartridgeItemOrgSchema: z.
|
|
56
|
+
export const CommonCartridgeItemOrgSchema: z.ZodType = z.lazy(() =>
|
|
57
57
|
strictObject({
|
|
58
58
|
identifier: NonEmptyStringSchema,
|
|
59
59
|
item: z.array(CommonCartridgeItemSchema).optional(),
|
|
@@ -55,7 +55,7 @@ export const QtiMaterialSchema = strictObject({
|
|
|
55
55
|
altmaterial: z.array(QtiAltMaterialSchema).optional(),
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
export const QtiFlowMatSchema: z.
|
|
58
|
+
export const QtiFlowMatSchema: z.ZodType = z.lazy(() =>
|
|
59
59
|
strictObject({
|
|
60
60
|
kind: z.literal("flow_mat"),
|
|
61
61
|
class: z.string().optional(),
|
|
@@ -73,7 +73,7 @@ export const QtiResponseLabelSchema = strictObject({
|
|
|
73
73
|
children: z.array(z.union([QtiMaterialSchema, QtiMaterialRefSchema, QtiFlowMatSchema])).optional(),
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
export const QtiFlowLabelSchema: z.
|
|
76
|
+
export const QtiFlowLabelSchema: z.ZodType = z.lazy(() =>
|
|
77
77
|
strictObject({
|
|
78
78
|
kind: z.literal("flow_label"),
|
|
79
79
|
class: z.string().optional(),
|
|
@@ -130,7 +130,7 @@ export const QtiResponseStrSchema = strictObject({
|
|
|
130
130
|
trailing: QtiLeadingOrTrailingMaterialSchema.optional(),
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
export const QtiFlowSchema: z.
|
|
133
|
+
export const QtiFlowSchema: z.ZodType = z.lazy(() =>
|
|
134
134
|
strictObject({
|
|
135
135
|
kind: z.literal("flow"),
|
|
136
136
|
class: z.string().optional(),
|
|
@@ -259,28 +259,28 @@ export const QtiOtherConditionSchema = strictObject({
|
|
|
259
259
|
kind: z.literal("other"),
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
export const QtiNotSchema: z.
|
|
262
|
+
export const QtiNotSchema: z.ZodType = z.lazy(() =>
|
|
263
263
|
strictObject({
|
|
264
264
|
kind: z.literal("not"),
|
|
265
265
|
tests: z.array(z.union([QtiAndSchema, QtiOrSchema, QtiVarEqualSchema])).min(1),
|
|
266
266
|
}),
|
|
267
267
|
);
|
|
268
268
|
|
|
269
|
-
export const QtiAndSchema: z.
|
|
269
|
+
export const QtiAndSchema: z.ZodType = z.lazy(() =>
|
|
270
270
|
strictObject({
|
|
271
271
|
kind: z.literal("and"),
|
|
272
272
|
tests: z.array(z.union([QtiNotSchema, QtiVarEqualSchema])).min(1),
|
|
273
273
|
}),
|
|
274
274
|
);
|
|
275
275
|
|
|
276
|
-
export const QtiOrSchema: z.
|
|
276
|
+
export const QtiOrSchema: z.ZodType = z.lazy(() =>
|
|
277
277
|
strictObject({
|
|
278
278
|
kind: z.literal("or"),
|
|
279
279
|
tests: z.array(z.union([QtiNotSchema, QtiVarEqualSchema])).min(1),
|
|
280
280
|
}),
|
|
281
281
|
);
|
|
282
282
|
|
|
283
|
-
export const QtiConditionNodeSchema: z.
|
|
283
|
+
export const QtiConditionNodeSchema: z.ZodType = z.lazy(() =>
|
|
284
284
|
z.union([QtiAndSchema, QtiOrSchema, QtiNotSchema, QtiOtherConditionSchema, QtiVarEqualSchema, QtiVarSubstringSchema]),
|
|
285
285
|
);
|
|
286
286
|
|
|
@@ -347,7 +347,7 @@ export const QtiQuestestinteropRawSchema = z.union([
|
|
|
347
347
|
}),
|
|
348
348
|
]);
|
|
349
349
|
|
|
350
|
-
const qtiAssessmentFieldRules: Record<string, z.
|
|
350
|
+
const qtiAssessmentFieldRules: Record<string, z.ZodType> = {
|
|
351
351
|
cc_profile: z.literal("cc.exam.v0p1"),
|
|
352
352
|
qmd_assessmenttype: z.literal("Examination"),
|
|
353
353
|
qmd_scoretype: z.literal("Percentage"),
|
|
@@ -359,7 +359,7 @@ const qtiAssessmentFieldRules: Record<string, z.ZodTypeAny> = {
|
|
|
359
359
|
cc_maxattempts: z.enum(["Examination", "1", "2", "3", "4", "5", "unlimited"]),
|
|
360
360
|
};
|
|
361
361
|
|
|
362
|
-
const qtiItemFieldRules: Record<string, z.
|
|
362
|
+
const qtiItemFieldRules: Record<string, z.ZodType> = {
|
|
363
363
|
cc_profile: z.enum([
|
|
364
364
|
"cc.multiple_choice.v0p1",
|
|
365
365
|
"cc.multiple_response.v0p1",
|
|
@@ -383,10 +383,13 @@ type QtiMetadataLike = {
|
|
|
383
383
|
qtimetadatafield?: QtiMetadataFieldEntry[];
|
|
384
384
|
};
|
|
385
385
|
|
|
386
|
+
// Receives zod-parsed items; zod's `.optional()` infers `| undefined`, so this must too.
|
|
386
387
|
type QtiItemMetadataLike = {
|
|
387
|
-
itemmetadata?:
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
itemmetadata?:
|
|
389
|
+
| {
|
|
390
|
+
qtimetadata?: QtiMetadataLike[] | undefined;
|
|
391
|
+
}
|
|
392
|
+
| undefined;
|
|
390
393
|
};
|
|
391
394
|
|
|
392
395
|
type QtiRenderLike = {
|
|
@@ -455,7 +458,7 @@ function getQtiMetadataValues(fields: Array<{ fieldlabel: string; fieldentry: st
|
|
|
455
458
|
|
|
456
459
|
function validateControlledMetadata(
|
|
457
460
|
fields: Array<{ fieldlabel: string; fieldentry: string }>,
|
|
458
|
-
rules: Record<string, z.
|
|
461
|
+
rules: Record<string, z.ZodType>,
|
|
459
462
|
requiredExactlyOnceLabels: string[],
|
|
460
463
|
context: z.RefinementCtx,
|
|
461
464
|
path: Array<string | number>,
|
|
@@ -10,14 +10,14 @@ export * from "./ccv1p3_imsccauth_v1p3";
|
|
|
10
10
|
export * from "./ccv1p3_imscp_v1p2_v1p0";
|
|
11
11
|
export * from "./ccv1p3_qtiasiv1p2p1_v1p0";
|
|
12
12
|
|
|
13
|
-
import { CurriculumStandardsMetadataSetDocumentSchema } from "./ccv1p3_imscsmd_v1p0";
|
|
14
|
-
import { DiscussionTopicDocumentSchema } from "./ccv1p3_imsdt_v1p3";
|
|
15
|
-
import { WebLinkDocumentSchema } from "./ccv1p3_imswl_v1p3";
|
|
16
13
|
import { CommonCartridgeAuthorizationsDocumentSchema } from "./ccv1p3_imsccauth_v1p3";
|
|
17
14
|
import {
|
|
18
15
|
CommonCartridgeManifestProfileDocumentSchema,
|
|
19
16
|
CommonCartridgeManifestRawDocumentSchema,
|
|
20
17
|
} from "./ccv1p3_imscp_v1p2_v1p0";
|
|
18
|
+
import { CurriculumStandardsMetadataSetDocumentSchema } from "./ccv1p3_imscsmd_v1p0";
|
|
19
|
+
import { DiscussionTopicDocumentSchema } from "./ccv1p3_imsdt_v1p3";
|
|
20
|
+
import { WebLinkDocumentSchema } from "./ccv1p3_imswl_v1p3";
|
|
21
21
|
import { LomCcLtiLinkDocumentSchema } from "./ccv1p3_lomccltilink_v1p0";
|
|
22
22
|
import { LomManifestDocumentSchema } from "./ccv1p3_lommanifest_v1p0";
|
|
23
23
|
import { LomResourceDocumentSchema } from "./ccv1p3_lomresource_v1p0";
|
|
@@ -86,24 +86,24 @@ const LomStructureValueSchema = z.enum(["atomic", "collection", "networked", "hi
|
|
|
86
86
|
const LomTypeValueSchema = z.enum(["operating system", "browser"]);
|
|
87
87
|
|
|
88
88
|
type LomVocabularySchemaConfig = {
|
|
89
|
-
aggregationLevel: z.
|
|
90
|
-
context: z.
|
|
91
|
-
copyrightAndOtherRestrictions: z.
|
|
92
|
-
cost: z.
|
|
93
|
-
difficulty: z.
|
|
94
|
-
intendedEndUserRole: z.
|
|
95
|
-
interactivityLevel: z.
|
|
96
|
-
interactivityType: z.
|
|
97
|
-
kind: z.
|
|
98
|
-
learningResourceType: z.
|
|
99
|
-
name: z.
|
|
100
|
-
purpose: z.
|
|
101
|
-
roleLifeCycle: z.
|
|
102
|
-
roleMetaMetadata: z.
|
|
103
|
-
semanticDensity: z.
|
|
104
|
-
status: z.
|
|
105
|
-
structure: z.
|
|
106
|
-
type: z.
|
|
89
|
+
aggregationLevel: z.ZodType;
|
|
90
|
+
context: z.ZodType;
|
|
91
|
+
copyrightAndOtherRestrictions: z.ZodType;
|
|
92
|
+
cost: z.ZodType;
|
|
93
|
+
difficulty: z.ZodType;
|
|
94
|
+
intendedEndUserRole: z.ZodType;
|
|
95
|
+
interactivityLevel: z.ZodType;
|
|
96
|
+
interactivityType: z.ZodType;
|
|
97
|
+
kind: z.ZodType;
|
|
98
|
+
learningResourceType: z.ZodType;
|
|
99
|
+
name: z.ZodType;
|
|
100
|
+
purpose: z.ZodType;
|
|
101
|
+
roleLifeCycle: z.ZodType;
|
|
102
|
+
roleMetaMetadata: z.ZodType;
|
|
103
|
+
semanticDensity: z.ZodType;
|
|
104
|
+
status: z.ZodType;
|
|
105
|
+
structure: z.ZodType;
|
|
106
|
+
type: z.ZodType;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
function createLomProfileSchemas(config: { allowExtensions: boolean; values: LomVocabularySchemaConfig }) {
|
|
@@ -118,7 +118,7 @@ function createLomProfileSchemas(config: { allowExtensions: boolean; values: Lom
|
|
|
118
118
|
string: z.array(LanguageStringSchema),
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
const vocabulary = (valueSchema: z.
|
|
121
|
+
const vocabulary = (valueSchema: z.ZodType) =>
|
|
122
122
|
object({
|
|
123
123
|
source: z.string().optional(),
|
|
124
124
|
value: valueSchema.optional(),
|
|
@@ -33,7 +33,7 @@ export function looseObject<T extends z.ZodRawShape>(shape: T) {
|
|
|
33
33
|
|
|
34
34
|
export function addIssue(context: z.RefinementCtx, path: Array<string | number>, message: string) {
|
|
35
35
|
context.addIssue({
|
|
36
|
-
code:
|
|
36
|
+
code: "custom",
|
|
37
37
|
path,
|
|
38
38
|
message,
|
|
39
39
|
});
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import { CurriculumStandardsMetadataSetSchema } from "../shared/ccv1p4_imscsmd_v1p1";
|
|
4
|
-
import { CommonCartridgeAuthorizationsSchema } from "../shared/ccv1p4_imsccauth_v1p4";
|
|
5
|
-
import { LomManifestSchema } from "./ccv1p4_lommanifest_v1p0";
|
|
6
|
-
import { LomResourceSchema } from "./ccv1p4_lomresource_v1p0";
|
|
7
3
|
import {
|
|
8
4
|
NonEmptyStringSchema,
|
|
9
5
|
UriReferenceSchema,
|
|
@@ -13,6 +9,10 @@ import {
|
|
|
13
9
|
collectDuplicates,
|
|
14
10
|
strictObject,
|
|
15
11
|
} from "../shared";
|
|
12
|
+
import { CommonCartridgeAuthorizationsSchema } from "../shared/ccv1p4_imsccauth_v1p4";
|
|
13
|
+
import { CurriculumStandardsMetadataSetSchema } from "../shared/ccv1p4_imscsmd_v1p1";
|
|
14
|
+
import { LomManifestSchema } from "./ccv1p4_lommanifest_v1p0";
|
|
15
|
+
import { LomResourceSchema } from "./ccv1p4_lomresource_v1p0";
|
|
16
16
|
|
|
17
17
|
export const CommonCartridgeResourceTypeSchema = z.enum([
|
|
18
18
|
"webcontent",
|
|
@@ -46,7 +46,7 @@ export const CommonCartridgeFileSchema = strictObject({
|
|
|
46
46
|
metadata: CommonCartridgeGenericMetadataSchema.optional(),
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
export const CommonCartridgeItemSchema: z.
|
|
49
|
+
export const CommonCartridgeItemSchema: z.ZodType = z.lazy(() =>
|
|
50
50
|
strictObject({
|
|
51
51
|
identifier: NonEmptyStringSchema,
|
|
52
52
|
identifierref: NonEmptyStringSchema.optional(),
|
|
@@ -56,7 +56,7 @@ export const CommonCartridgeItemSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
56
56
|
}),
|
|
57
57
|
);
|
|
58
58
|
|
|
59
|
-
export const CommonCartridgeItemOrgSchema: z.
|
|
59
|
+
export const CommonCartridgeItemOrgSchema: z.ZodType = z.lazy(() =>
|
|
60
60
|
strictObject({
|
|
61
61
|
identifier: NonEmptyStringSchema,
|
|
62
62
|
item: z.array(CommonCartridgeItemSchema).optional(),
|