@conform-ed/contracts 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -2
- package/.turbo/turbo-format.log +5 -5
- package/.turbo/turbo-lint.log +3 -3
- package/.turbo/turbo-test.log +228 -223
- package/.turbo/turbo-typecheck.log +1 -1
- package/package.json +4 -4
- package/src/adapter.ts +1 -1
- package/src/caliper/v1_2/caliper_v1p2_bootcamp_schema.ts +6 -6
- package/src/caliper/v1_2/shared.ts +2 -2
- package/src/case/v1_1/case_v1p1_openapi3_restbinding_schema.ts +1 -0
- package/src/case/v1_1/index.ts +41 -41
- package/src/cat/v1_0/index.ts +39 -39
- package/src/cat/v1_0/shared.ts +1 -1
- package/src/clr/v2_0/shared.ts +19 -17
- package/src/cmi5/v1_0/index.ts +19 -19
- package/src/common-cartridge/v1_3/ccv1p3_imscp_v1p2_v1p0.ts +3 -3
- package/src/common-cartridge/v1_3/ccv1p3_lomccltilink_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_3/ccv1p3_qtiasiv1p2p1_v1p0.ts +16 -13
- package/src/common-cartridge/v1_3/index.ts +3 -3
- package/src/common-cartridge/v1_3/lom-internal.ts +19 -19
- package/src/common-cartridge/v1_3/shared.ts +1 -1
- package/src/common-cartridge/v1_4/core/ccv1p4_imscp_v1p2_v1p0.ts +6 -6
- package/src/common-cartridge/v1_4/core/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/core/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/extension/ccv1p4_cpextensionv1p2_v1p0.ts +1 -0
- package/src/common-cartridge/v1_4/index.ts +5 -5
- package/src/common-cartridge/v1_4/k12/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/k12/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/lom-internal.ts +30 -27
- package/src/common-cartridge/v1_4/shared/ccv1p4_lomccltilink_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/shared/ccv1p4_qtiasiv1p2p1_v1p0.ts +16 -13
- package/src/common-cartridge/v1_4/shared.ts +1 -1
- package/src/common-cartridge/v1_4/thin/ccv1p4_imscp_v1p2_v1p0.ts +5 -5
- package/src/common-cartridge/v1_4/thin/ccv1p4_lommanifest_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/thin/ccv1p4_lomresource_v1p0.ts +2 -1
- package/src/common-cartridge/v1_4/vdex/imsmd_loose_v1p3p2.ts +2 -1
- package/src/common-cartridge/v1_4/vdex/imsvdex_v1p0.ts +1 -1
- package/src/config.ts +3 -3
- package/src/h5p/v1/content.ts +1 -0
- package/src/h5p/v1/h5p-json.ts +4 -3
- package/src/h5p/v1/index.ts +21 -21
- package/src/h5p/v1/library-json.ts +2 -1
- package/src/lti/ags/v2_0/index.ts +12 -12
- package/src/lti/deep-linking/v2_0/index.ts +10 -10
- package/src/lti/index.ts +2 -2
- package/src/lti/nrps/v2_0/index.ts +10 -10
- package/src/lti/proctoring/v1_0/index.ts +11 -11
- package/src/lti/v1_3/index.ts +17 -17
- package/src/oneroster/v1_2/index.ts +45 -45
- package/src/oneroster/v1_2/or_v1p2_gradebook_restbinding_schema.ts +3 -3
- package/src/oneroster/v1_2/or_v1p2_resource_restbinding_schema.ts +1 -1
- package/src/oneroster/v1_2/or_v1p2_rostering_restbinding_schema.ts +1 -1
- package/src/oneroster/v1_2/or_v1p2_rostering_service_schema.ts +1 -1
- package/src/open-badges/v3_0/shared.ts +31 -29
- package/src/qti/v2-internal.ts +12 -11
- package/src/qti/v3_0_1/assessment-internal.ts +239 -197
- package/src/qti/v3_0_1/imsqti_asiv3p0p1_v1p0.ts +4 -4
- package/src/qti/v3_0_1/imsqti_itemv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_metadatav3p0_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_responseprocessingv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_resultv3p0_v1p0.ts +4 -3
- package/src/qti/v3_0_1/imsqti_sectionv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_stimulusv3p0p1_v1p0.ts +1 -1
- package/src/qti/v3_0_1/imsqti_testv3p0p1_v1p0.ts +2 -2
- package/src/qti/v3_0_1/imsqti_usagedatav3p0_v1p0.ts +1 -1
- package/src/qti/v3_0_1/processing-internal.ts +44 -33
- package/src/qti/v3_0_1/shared.ts +2 -2
- package/src/vc-data-model/v2_0/shared.ts +4 -4
- package/src/xapi/shared.ts +11 -14
- package/src/xapi/v1_0_3/index.ts +54 -54
- package/src/xapi/v2_0/index.ts +56 -56
- package/test/caliper-v1_2.test.ts +1 -1
- package/test/cat-v1_0.test.ts +1 -0
- package/test/cmi5-v1_0.test.ts +33 -31
- package/test/contracts.test.ts +1 -0
- package/test/h5p-v1.test.ts +1 -0
- package/test/lti.test.ts +1 -0
- package/test/qti-v3_0_1.test.ts +109 -0
- package/test/schema-examples.test.ts +1 -0
- package/test/xapi.test.ts +1 -0
|
@@ -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(),
|
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
} from "./core/ccv1p4_imscp_v1p2_v1p0";
|
|
35
35
|
import { LomManifestDocumentSchema } from "./core/ccv1p4_lommanifest_v1p0";
|
|
36
36
|
import { LomResourceDocumentSchema } from "./core/ccv1p4_lomresource_v1p0";
|
|
37
|
+
import { AssignmentDocumentSchema } from "./extension/cc_extresource_assignmentv1p0_v1p0";
|
|
38
|
+
import { CpxVariantDocumentSchema } from "./extension/ccv1p4_cpextensionv1p2_v1p0";
|
|
39
|
+
import { OpenVideoSessionDocumentSchema } from "./extension/ims_openvideov1p0_v1p0";
|
|
37
40
|
import {
|
|
38
41
|
K12CommonCartridgeManifestProfileDocumentSchema,
|
|
39
42
|
K12CommonCartridgeManifestRawDocumentSchema,
|
|
@@ -57,17 +60,14 @@ import {
|
|
|
57
60
|
import { BasicLTILinkDocumentSchema } from "./shared/imsbasiclti_v1p0p1";
|
|
58
61
|
import { LineItemDocumentSchema } from "./shared/lineitem_v1p0";
|
|
59
62
|
import { ResourceAccessibilityMetadataDocumentSchema } from "./shared/resourcea11ymetadata-20210915";
|
|
60
|
-
import { AssignmentDocumentSchema } from "./extension/cc_extresource_assignmentv1p0_v1p0";
|
|
61
|
-
import { CpxVariantDocumentSchema } from "./extension/ccv1p4_cpextensionv1p2_v1p0";
|
|
62
|
-
import { OpenVideoSessionDocumentSchema } from "./extension/ims_openvideov1p0_v1p0";
|
|
63
|
-
import { ImsMdLooseLomDocumentSchema } from "./vdex/imsmd_loose_v1p3p2";
|
|
64
|
-
import { VdexDocumentSchema } from "./vdex/imsvdex_v1p0";
|
|
65
63
|
import {
|
|
66
64
|
ThinCommonCartridgeManifestProfileDocumentSchema,
|
|
67
65
|
ThinCommonCartridgeManifestRawDocumentSchema,
|
|
68
66
|
} from "./thin/ccv1p4_imscp_v1p2_v1p0";
|
|
69
67
|
import { ThinLomManifestDocumentSchema } from "./thin/ccv1p4_lommanifest_v1p0";
|
|
70
68
|
import { ThinLomResourceDocumentSchema } from "./thin/ccv1p4_lomresource_v1p0";
|
|
69
|
+
import { ImsMdLooseLomDocumentSchema } from "./vdex/imsmd_loose_v1p3p2";
|
|
70
|
+
import { VdexDocumentSchema } from "./vdex/imsvdex_v1p0";
|
|
71
71
|
|
|
72
72
|
export const CommonCartridgeDerivedZodTemplates = {
|
|
73
73
|
curriculumStandardsMetadataSetDocument: CurriculumStandardsMetadataSetDocumentSchema,
|
|
@@ -86,37 +86,40 @@ 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: {
|
|
110
110
|
allowExtensions: boolean;
|
|
111
111
|
values: LomVocabularySchemaConfig;
|
|
112
|
-
requirements
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
// Input bag: callers pass a maybe-undefined requirements block straight through.
|
|
113
|
+
requirements?:
|
|
114
|
+
| {
|
|
115
|
+
requireGeneral?: boolean;
|
|
116
|
+
requireGeneralTitle?: boolean;
|
|
117
|
+
requireGeneralKeyword?: boolean;
|
|
118
|
+
requireEducational?: boolean;
|
|
119
|
+
requireEducationalIntendedEndUserRole?: boolean;
|
|
120
|
+
requireEducationalTypicalAgeRange?: boolean;
|
|
121
|
+
}
|
|
122
|
+
| undefined;
|
|
120
123
|
}) {
|
|
121
124
|
const object = config.allowExtensions ? looseObject : strictObject;
|
|
122
125
|
|
|
@@ -129,7 +132,7 @@ function createLomProfileSchemas(config: {
|
|
|
129
132
|
string: z.array(LanguageStringSchema),
|
|
130
133
|
});
|
|
131
134
|
|
|
132
|
-
const vocabulary = (valueSchema: z.
|
|
135
|
+
const vocabulary = (valueSchema: z.ZodType) =>
|
|
133
136
|
object({
|
|
134
137
|
source: z.string().optional(),
|
|
135
138
|
value: valueSchema.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>,
|
|
@@ -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,8 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import { CartridgeBasicLTILinkSchema } from "../shared/ccv1p4_imslticc_v1p4";
|
|
4
|
-
import { CurriculumStandardsMetadataSetSchema } from "../shared/ccv1p4_imscsmd_v1p1";
|
|
5
|
-
import { WebLinkSchema } from "../shared/ccv1p4_imswl_v1p4";
|
|
6
3
|
import {
|
|
7
4
|
NonEmptyStringSchema,
|
|
8
5
|
UriReferenceSchema,
|
|
@@ -11,6 +8,9 @@ import {
|
|
|
11
8
|
collectDuplicates,
|
|
12
9
|
strictObject,
|
|
13
10
|
} from "../shared";
|
|
11
|
+
import { CurriculumStandardsMetadataSetSchema } from "../shared/ccv1p4_imscsmd_v1p1";
|
|
12
|
+
import { CartridgeBasicLTILinkSchema } from "../shared/ccv1p4_imslticc_v1p4";
|
|
13
|
+
import { WebLinkSchema } from "../shared/ccv1p4_imswl_v1p4";
|
|
14
14
|
import { ThinLomManifestSchema } from "./ccv1p4_lommanifest_v1p0";
|
|
15
15
|
import { ThinLomResourceSchema } from "./ccv1p4_lomresource_v1p0";
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ export const ThinCommonCartridgeFileSchema = strictObject({
|
|
|
22
22
|
href: UriReferenceSchema,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
export const ThinCommonCartridgeItemSchema: z.
|
|
25
|
+
export const ThinCommonCartridgeItemSchema: z.ZodType = z.lazy(() =>
|
|
26
26
|
strictObject({
|
|
27
27
|
identifier: NonEmptyStringSchema,
|
|
28
28
|
identifierref: NonEmptyStringSchema.optional(),
|
|
@@ -31,7 +31,7 @@ export const ThinCommonCartridgeItemSchema: z.ZodTypeAny = z.lazy(() =>
|
|
|
31
31
|
}),
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
export const ThinCommonCartridgeItemOrgSchema: z.
|
|
34
|
+
export const ThinCommonCartridgeItemOrgSchema: z.ZodType = z.lazy(() =>
|
|
35
35
|
strictObject({
|
|
36
36
|
identifier: NonEmptyStringSchema,
|
|
37
37
|
item: z.array(ThinCommonCartridgeItemSchema).optional(),
|
|
@@ -51,7 +51,7 @@ export const VdexTermRefSchema = looseObject({
|
|
|
51
51
|
vocabularyIdentifier: UriReferenceSchema.optional(),
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
export const VdexTermSchema: z.
|
|
54
|
+
export const VdexTermSchema: z.ZodType = z.lazy(() =>
|
|
55
55
|
looseObject({
|
|
56
56
|
termIdentifier: VdexIdentifierSchema,
|
|
57
57
|
caption: VdexLangStringBagSchema.optional(),
|
package/src/config.ts
CHANGED
|
@@ -57,7 +57,7 @@ const AdapterSchema = z
|
|
|
57
57
|
}
|
|
58
58
|
if (adapter.auth.mode === "bearer" && !adapter.auth.tokenFromEnv) {
|
|
59
59
|
context.addIssue({
|
|
60
|
-
code:
|
|
60
|
+
code: "custom",
|
|
61
61
|
message: "adapter.auth.tokenFromEnv is required when adapter.auth.mode is bearer",
|
|
62
62
|
path: ["auth", "tokenFromEnv"],
|
|
63
63
|
});
|
|
@@ -100,14 +100,14 @@ export const RunnerConfigSchema = z
|
|
|
100
100
|
if (config.suite.name === "cmi5") {
|
|
101
101
|
if (!["runtime", "package", "all"].includes(config.suite.target)) {
|
|
102
102
|
context.addIssue({
|
|
103
|
-
code:
|
|
103
|
+
code: "custom",
|
|
104
104
|
message: "suite.target must be runtime, package, or all when suite.name is cmi5",
|
|
105
105
|
path: ["suite", "target"],
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
if (!config.adapter) {
|
|
109
109
|
context.addIssue({
|
|
110
|
-
code:
|
|
110
|
+
code: "custom",
|
|
111
111
|
message: "adapter is required when suite.name is cmi5",
|
|
112
112
|
path: ["adapter"],
|
|
113
113
|
});
|
package/src/h5p/v1/content.ts
CHANGED
package/src/h5p/v1/h5p-json.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
strictObject,
|
|
4
5
|
H5pMachineNameSchema,
|
|
@@ -25,7 +26,7 @@ export const H5pPackageManifestSchema = strictObject({
|
|
|
25
26
|
description: z.string().optional(),
|
|
26
27
|
author: z.string().optional(),
|
|
27
28
|
authors: z.array(H5pAuthorSchema).optional(),
|
|
28
|
-
source: z.
|
|
29
|
+
source: z.url().optional(),
|
|
29
30
|
license: H5pLicenseSchema.optional(),
|
|
30
31
|
licenseVersion: z.string().max(10).optional(),
|
|
31
32
|
licenseExtras: z.string().max(5000).optional(),
|
|
@@ -47,7 +48,7 @@ export const H5pPackageManifestSchema = strictObject({
|
|
|
47
48
|
for (const et of data.embedTypes) {
|
|
48
49
|
if (seen.has(et)) {
|
|
49
50
|
ctx.addIssue({
|
|
50
|
-
code:
|
|
51
|
+
code: "custom",
|
|
51
52
|
path: ["embedTypes"],
|
|
52
53
|
message: `Duplicate embed type: "${et}"`,
|
|
53
54
|
});
|
|
@@ -57,7 +58,7 @@ export const H5pPackageManifestSchema = strictObject({
|
|
|
57
58
|
// yearTo must be >= yearFrom when both are present
|
|
58
59
|
if (data.yearFrom !== undefined && data.yearTo !== undefined && data.yearTo < data.yearFrom) {
|
|
59
60
|
ctx.addIssue({
|
|
60
|
-
code:
|
|
61
|
+
code: "custom",
|
|
61
62
|
path: ["yearTo"],
|
|
62
63
|
message: "yearTo must be >= yearFrom",
|
|
63
64
|
});
|
package/src/h5p/v1/index.ts
CHANGED
|
@@ -44,10 +44,10 @@ export type {
|
|
|
44
44
|
export { H5pCopyrightSchema, H5pMediaFileSchema, H5pLibraryEmbedSchema, H5pContentParamsSchema } from "./content";
|
|
45
45
|
export type { H5pCopyright, H5pMediaFile, H5pLibraryEmbed, H5pContentParams } from "./content";
|
|
46
46
|
|
|
47
|
+
import { H5pCopyrightSchema, H5pMediaFileSchema, H5pLibraryEmbedSchema, H5pContentParamsSchema } from "./content";
|
|
47
48
|
import { H5pPackageManifestSchema } from "./h5p-json";
|
|
48
49
|
import { H5pLibraryManifestSchema } from "./library-json";
|
|
49
50
|
import { H5pSemanticsFieldSchema, H5pSemanticsSchema } from "./semantics";
|
|
50
|
-
import { H5pCopyrightSchema, H5pMediaFileSchema, H5pLibraryEmbedSchema, H5pContentParamsSchema } from "./content";
|
|
51
51
|
import {
|
|
52
52
|
H5pMachineNameSchema,
|
|
53
53
|
H5pLibraryFolderNameSchema,
|
|
@@ -57,27 +57,27 @@ import {
|
|
|
57
57
|
H5pChangelogEntrySchema,
|
|
58
58
|
} from "./shared";
|
|
59
59
|
|
|
60
|
-
export
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
60
|
+
export const H5pV1 = {
|
|
61
|
+
Schemas: {
|
|
62
|
+
PackageManifest: H5pPackageManifestSchema,
|
|
63
|
+
LibraryManifest: H5pLibraryManifestSchema,
|
|
64
|
+
SemanticsField: H5pSemanticsFieldSchema,
|
|
65
|
+
Semantics: H5pSemanticsSchema,
|
|
66
|
+
Copyright: H5pCopyrightSchema,
|
|
67
|
+
MediaFile: H5pMediaFileSchema,
|
|
68
|
+
LibraryEmbed: H5pLibraryEmbedSchema,
|
|
69
|
+
ContentParams: H5pContentParamsSchema,
|
|
70
|
+
},
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
}
|
|
72
|
+
Shared: {
|
|
73
|
+
MachineName: H5pMachineNameSchema,
|
|
74
|
+
LibraryFolderName: H5pLibraryFolderNameSchema,
|
|
75
|
+
VersionRef: H5pVersionRefSchema,
|
|
76
|
+
License: H5pLicenseSchema,
|
|
77
|
+
Author: H5pAuthorSchema,
|
|
78
|
+
ChangelogEntry: H5pChangelogEntrySchema,
|
|
79
|
+
},
|
|
80
|
+
} as const;
|
|
81
81
|
|
|
82
82
|
export type H5pV1Schemas = typeof H5pV1.Schemas;
|
|
83
83
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
|
|
2
3
|
import { strictObject, H5pMachineNameSchema, H5pVersionRefSchema } from "./shared";
|
|
3
4
|
|
|
4
5
|
const filePathSchema = strictObject({ path: z.string().min(1) });
|
|
@@ -59,7 +60,7 @@ export const H5pLibraryManifestSchema = strictObject({
|
|
|
59
60
|
if (data.runnable === 1 && data.embedTypes?.includes("iframe")) {
|
|
60
61
|
if (data.w === undefined || data.h === undefined) {
|
|
61
62
|
ctx.addIssue({
|
|
62
|
-
code:
|
|
63
|
+
code: "custom",
|
|
63
64
|
path: ["w"],
|
|
64
65
|
message: 'Runnable libraries with embedType "iframe" should declare w and h dimensions',
|
|
65
66
|
});
|
|
@@ -59,18 +59,18 @@ export const ResultSchema = strictObject({
|
|
|
59
59
|
comment: z.string().optional(),
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
62
|
+
export const LtiAgsV2_0 = {
|
|
63
|
+
Schemas: {
|
|
64
|
+
Endpoint: EndpointSchema,
|
|
65
|
+
LineItem: LineItemSchema,
|
|
66
|
+
Score: ScoreSchema,
|
|
67
|
+
ScoreSubmission: ScoreSubmissionSchema,
|
|
68
|
+
Result: ResultSchema,
|
|
69
|
+
AgsScope: AgsScopeSchema,
|
|
70
|
+
ScoreProgress: ScoreProgressSchema,
|
|
71
|
+
GradingProgress: GradingProgressSchema,
|
|
72
|
+
},
|
|
73
|
+
} as const;
|
|
74
74
|
|
|
75
75
|
export type LtiAgsV2_0Schemas = typeof LtiAgsV2_0.Schemas;
|
|
76
76
|
|
|
@@ -2,6 +2,7 @@ export * from "../../shared";
|
|
|
2
2
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
|
+
import { LineItemSchema } from "../../ags/v2_0";
|
|
5
6
|
import {
|
|
6
7
|
ContextSchema,
|
|
7
8
|
CustomParametersSchema,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
LtiVersionSchema,
|
|
16
17
|
strictObject,
|
|
17
18
|
} from "../../shared";
|
|
18
|
-
import { LineItemSchema } from "../../ags/v2_0";
|
|
19
19
|
|
|
20
20
|
export const ContentItemTypeSchema = z.enum(["file", "html", "image", "link", "ltiResourceLink"]);
|
|
21
21
|
|
|
@@ -68,15 +68,15 @@ export const DeepLinkingResponseSchema = strictObject({
|
|
|
68
68
|
errorLog: z.string().optional(),
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
71
|
+
export const LtiDeepLinkingV2_0 = {
|
|
72
|
+
Schemas: {
|
|
73
|
+
ContentItemType: ContentItemTypeSchema,
|
|
74
|
+
DeepLinkingSettings: DeepLinkingSettingsSchema,
|
|
75
|
+
DeepLinkingRequest: DeepLinkingRequestSchema,
|
|
76
|
+
ContentItem: ContentItemSchema,
|
|
77
|
+
DeepLinkingResponse: DeepLinkingResponseSchema,
|
|
78
|
+
},
|
|
79
|
+
} as const;
|
|
80
80
|
|
|
81
81
|
export type LtiDeepLinkingV2_0Schemas = typeof LtiDeepLinkingV2_0.Schemas;
|
|
82
82
|
|
package/src/lti/index.ts
CHANGED
|
@@ -11,11 +11,11 @@ export * as AgsV2_0 from "./ags/v2_0";
|
|
|
11
11
|
export * as NrpsV2_0 from "./nrps/v2_0";
|
|
12
12
|
export * as ProctoringV1_0 from "./proctoring/v1_0";
|
|
13
13
|
|
|
14
|
-
import { Lti13DerivedZodTemplates } from "./v1_3";
|
|
15
|
-
import { LtiDeepLinkingV2_0DerivedZodTemplates } from "./deep-linking/v2_0";
|
|
16
14
|
import { LtiAgsV2_0DerivedZodTemplates } from "./ags/v2_0";
|
|
15
|
+
import { LtiDeepLinkingV2_0DerivedZodTemplates } from "./deep-linking/v2_0";
|
|
17
16
|
import { LtiNrpsV2_0DerivedZodTemplates } from "./nrps/v2_0";
|
|
18
17
|
import { LtiProctoringV1_0DerivedZodTemplates } from "./proctoring/v1_0";
|
|
18
|
+
import { Lti13DerivedZodTemplates } from "./v1_3";
|
|
19
19
|
|
|
20
20
|
export const LtiDerivedZodTemplates = {
|
|
21
21
|
core: Lti13DerivedZodTemplates,
|