@timeback/qti 0.1.4 → 0.1.5-beta.20260219190739
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/dist/errors.js +54 -2
- package/dist/index.d.ts +58 -7
- package/dist/index.js +522 -165
- package/dist/resources/assessment-items.d.ts +21 -2
- package/dist/resources/assessment-items.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/errors.js
CHANGED
|
@@ -884,6 +884,28 @@ var BEYONDAI_PATHS = {
|
|
|
884
884
|
},
|
|
885
885
|
powerpath: {
|
|
886
886
|
base: "/powerpath"
|
|
887
|
+
},
|
|
888
|
+
clr: {
|
|
889
|
+
credentials: "/ims/clr/v2p0/credentials",
|
|
890
|
+
discovery: "/ims/clr/v2p0/discovery"
|
|
891
|
+
},
|
|
892
|
+
case: {
|
|
893
|
+
base: "/ims/case/v1p1"
|
|
894
|
+
},
|
|
895
|
+
webhooks: {
|
|
896
|
+
webhookList: "/webhooks/",
|
|
897
|
+
webhookGet: "/webhooks/{id}",
|
|
898
|
+
webhookCreate: "/webhooks/",
|
|
899
|
+
webhookUpdate: "/webhooks/{id}",
|
|
900
|
+
webhookDelete: "/webhooks/{id}",
|
|
901
|
+
webhookActivate: "/webhooks/{id}/activate",
|
|
902
|
+
webhookDeactivate: "/webhooks/{id}/deactivate",
|
|
903
|
+
webhookFilterList: "/webhook-filters/",
|
|
904
|
+
webhookFilterGet: "/webhook-filters/{id}",
|
|
905
|
+
webhookFilterCreate: "/webhook-filters/",
|
|
906
|
+
webhookFilterUpdate: "/webhook-filters/{id}",
|
|
907
|
+
webhookFilterDelete: "/webhook-filters/{id}",
|
|
908
|
+
webhookFiltersByWebhook: "/webhook-filters/webhook/{webhookId}"
|
|
887
909
|
}
|
|
888
910
|
};
|
|
889
911
|
var LEARNWITHAI_PATHS = {
|
|
@@ -899,8 +921,11 @@ var LEARNWITHAI_PATHS = {
|
|
|
899
921
|
gradebook: "/gradebook/1.0",
|
|
900
922
|
resources: "/resources/1.0"
|
|
901
923
|
},
|
|
924
|
+
webhooks: null,
|
|
902
925
|
edubridge: null,
|
|
903
|
-
powerpath: null
|
|
926
|
+
powerpath: null,
|
|
927
|
+
clr: null,
|
|
928
|
+
case: null
|
|
904
929
|
};
|
|
905
930
|
var PLATFORM_PATHS = {
|
|
906
931
|
BEYOND_AI: BEYONDAI_PATHS,
|
|
@@ -922,8 +947,11 @@ function resolvePathProfiles(pathProfile, customPaths) {
|
|
|
922
947
|
return {
|
|
923
948
|
caliper: customPaths?.caliper ?? basePaths.caliper,
|
|
924
949
|
oneroster: customPaths?.oneroster ?? basePaths.oneroster,
|
|
950
|
+
webhooks: customPaths?.webhooks ?? basePaths.webhooks,
|
|
925
951
|
edubridge: customPaths?.edubridge ?? basePaths.edubridge,
|
|
926
|
-
powerpath: customPaths?.powerpath ?? basePaths.powerpath
|
|
952
|
+
powerpath: customPaths?.powerpath ?? basePaths.powerpath,
|
|
953
|
+
clr: customPaths?.clr ?? basePaths.clr,
|
|
954
|
+
case: customPaths?.case ?? basePaths.case
|
|
927
955
|
};
|
|
928
956
|
}
|
|
929
957
|
|
|
@@ -963,10 +991,22 @@ class TimebackProvider {
|
|
|
963
991
|
baseUrl: platformEndpoints.api[env],
|
|
964
992
|
authUrl: this.authUrl
|
|
965
993
|
},
|
|
994
|
+
clr: {
|
|
995
|
+
baseUrl: platformEndpoints.api[env],
|
|
996
|
+
authUrl: this.authUrl
|
|
997
|
+
},
|
|
998
|
+
case: {
|
|
999
|
+
baseUrl: platformEndpoints.api[env],
|
|
1000
|
+
authUrl: this.authUrl
|
|
1001
|
+
},
|
|
966
1002
|
caliper: {
|
|
967
1003
|
baseUrl: platformEndpoints.caliper[env],
|
|
968
1004
|
authUrl: this.authUrl
|
|
969
1005
|
},
|
|
1006
|
+
webhooks: {
|
|
1007
|
+
baseUrl: platformEndpoints.caliper[env],
|
|
1008
|
+
authUrl: this.authUrl
|
|
1009
|
+
},
|
|
970
1010
|
qti: {
|
|
971
1011
|
baseUrl: platformEndpoints.qti[env],
|
|
972
1012
|
authUrl: this.authUrl
|
|
@@ -980,7 +1020,10 @@ class TimebackProvider {
|
|
|
980
1020
|
oneroster: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
981
1021
|
edubridge: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
982
1022
|
powerpath: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
1023
|
+
clr: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
1024
|
+
case: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
983
1025
|
caliper: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
1026
|
+
webhooks: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
984
1027
|
qti: { baseUrl: config.baseUrl, authUrl: this.authUrl }
|
|
985
1028
|
};
|
|
986
1029
|
} else if (isServicesConfig(config)) {
|
|
@@ -999,10 +1042,19 @@ class TimebackProvider {
|
|
|
999
1042
|
} else {
|
|
1000
1043
|
throw new Error("Invalid provider configuration");
|
|
1001
1044
|
}
|
|
1045
|
+
for (const service of Object.keys(this.pathProfiles)) {
|
|
1046
|
+
if (this.pathProfiles[service] === null) {
|
|
1047
|
+
delete this.endpoints[service];
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1002
1050
|
}
|
|
1003
1051
|
getEndpoint(service) {
|
|
1004
1052
|
const endpoint = this.endpoints[service];
|
|
1005
1053
|
if (!endpoint) {
|
|
1054
|
+
const pathKey = service;
|
|
1055
|
+
if (pathKey in this.pathProfiles && this.pathProfiles[pathKey] === null) {
|
|
1056
|
+
throw new Error(`Service "${service}" is not supported on ${this.platform ?? "this"} platform.`);
|
|
1057
|
+
}
|
|
1006
1058
|
throw new Error(`Service "${service}" is not configured in this provider`);
|
|
1007
1059
|
}
|
|
1008
1060
|
return endpoint;
|
package/dist/index.d.ts
CHANGED
|
@@ -642,7 +642,26 @@ declare const QtiPaginationParams = z
|
|
|
642
642
|
// ASSESSMENT ITEMS (REQUEST INPUTS)
|
|
643
643
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
644
644
|
|
|
645
|
-
|
|
645
|
+
/**
|
|
646
|
+
* XML-format creation input.
|
|
647
|
+
*
|
|
648
|
+
* The preferred way to create assessment items — send raw QTI 3.0 XML and the
|
|
649
|
+
* server validates it against IMS QTI XSDs.
|
|
650
|
+
*/
|
|
651
|
+
declare const QtiAssessmentItemXmlCreateInput = z
|
|
652
|
+
.object({
|
|
653
|
+
format: z.string().pipe(z.literal('xml')),
|
|
654
|
+
xml: z.string().min(1),
|
|
655
|
+
metadata: QtiItemMetadata.optional(),
|
|
656
|
+
})
|
|
657
|
+
.strict()
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* JSON-format creation input (experimental on the server side).
|
|
661
|
+
*
|
|
662
|
+
* Sends a structured/parsed representation of a QTI item.
|
|
663
|
+
*/
|
|
664
|
+
declare const QtiAssessmentItemJsonCreateInput = z
|
|
646
665
|
.object({
|
|
647
666
|
identifier: z.string().min(1),
|
|
648
667
|
title: z.string().min(1),
|
|
@@ -660,6 +679,17 @@ declare const QtiAssessmentItemCreateInput = z
|
|
|
660
679
|
})
|
|
661
680
|
.strict()
|
|
662
681
|
|
|
682
|
+
/**
|
|
683
|
+
* Union of XML and JSON creation inputs for assessment items.
|
|
684
|
+
*
|
|
685
|
+
* Accepts either `{ format: 'xml', xml, metadata? }` or the structured JSON
|
|
686
|
+
* shape with `{ identifier, title, type, ... }`.
|
|
687
|
+
*/
|
|
688
|
+
declare const QtiAssessmentItemCreateInput = z.union([
|
|
689
|
+
QtiAssessmentItemXmlCreateInput,
|
|
690
|
+
QtiAssessmentItemJsonCreateInput,
|
|
691
|
+
])
|
|
692
|
+
|
|
663
693
|
declare const QtiAssessmentItemUpdateInput = z
|
|
664
694
|
.object({
|
|
665
695
|
identifier: z.string().min(1).optional(),
|
|
@@ -713,9 +743,9 @@ declare const QtiAssessmentSection = z
|
|
|
713
743
|
declare const QtiTestPart = z
|
|
714
744
|
.object({
|
|
715
745
|
identifier: z.string().min(1),
|
|
716
|
-
navigationMode: QtiNavigationMode,
|
|
717
|
-
submissionMode: QtiSubmissionMode,
|
|
718
|
-
'qti-assessment-section': z.
|
|
746
|
+
navigationMode: z.string().pipe(QtiNavigationMode),
|
|
747
|
+
submissionMode: z.string().pipe(QtiSubmissionMode),
|
|
748
|
+
'qti-assessment-section': z.array(QtiAssessmentSection),
|
|
719
749
|
})
|
|
720
750
|
.strict()
|
|
721
751
|
|
|
@@ -742,7 +772,7 @@ declare const QtiAssessmentTestCreateInput = z
|
|
|
742
772
|
maxAttempts: z.number().optional(),
|
|
743
773
|
toolsEnabled: z.record(z.string(), z.boolean()).optional(),
|
|
744
774
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
745
|
-
'qti-test-part': QtiTestPart,
|
|
775
|
+
'qti-test-part': z.array(QtiTestPart),
|
|
746
776
|
'qti-outcome-declaration': z.array(QtiTestOutcomeDeclaration).optional(),
|
|
747
777
|
})
|
|
748
778
|
.strict()
|
|
@@ -758,7 +788,7 @@ declare const QtiAssessmentTestUpdateInput = z
|
|
|
758
788
|
maxAttempts: z.number().optional(),
|
|
759
789
|
toolsEnabled: z.record(z.string(), z.boolean()).optional(),
|
|
760
790
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
761
|
-
'qti-test-part': QtiTestPart,
|
|
791
|
+
'qti-test-part': z.array(QtiTestPart),
|
|
762
792
|
'qti-outcome-declaration': z.array(QtiTestOutcomeDeclaration).optional(),
|
|
763
793
|
})
|
|
764
794
|
.strict()
|
|
@@ -847,6 +877,8 @@ type UpdateSectionRequest = input<typeof QtiAssessmentSection>
|
|
|
847
877
|
type AddItemRequest = input<typeof QtiAssessmentItemRef>
|
|
848
878
|
type ReorderItemsRequest = input<typeof QtiReorderItemsInput>
|
|
849
879
|
|
|
880
|
+
type CreateAssessmentItemXmlRequest = input<typeof QtiAssessmentItemXmlCreateInput>
|
|
881
|
+
type CreateAssessmentItemJsonRequest = input<typeof QtiAssessmentItemJsonCreateInput>
|
|
850
882
|
type CreateAssessmentItemRequest = input<typeof QtiAssessmentItemCreateInput>
|
|
851
883
|
type UpdateAssessmentItemRequest = input<typeof QtiAssessmentItemUpdateInput>
|
|
852
884
|
type ProcessResponseRequest = input<typeof QtiAssessmentItemProcessResponseInput>
|
|
@@ -933,6 +965,25 @@ declare class AssessmentItemsResource {
|
|
|
933
965
|
* @returns Score and feedback
|
|
934
966
|
*/
|
|
935
967
|
processResponse(identifier: string, body: Omit<ProcessResponseRequest, 'identifier'>): Promise<ProcessResponseResult>;
|
|
968
|
+
/**
|
|
969
|
+
* Create an assessment item from raw QTI 3.0 XML.
|
|
970
|
+
*
|
|
971
|
+
* This is the preferred creation method — the server validates the XML
|
|
972
|
+
* against IMS QTI XSDs. Optionally include metadata (subject, grade, etc.).
|
|
973
|
+
*
|
|
974
|
+
* @param body - XML string and optional metadata
|
|
975
|
+
* @returns The created assessment item
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* ```typescript
|
|
979
|
+
* const item = await client.assessmentItems.createFromXml({
|
|
980
|
+
* format: 'xml',
|
|
981
|
+
* xml: '<qti-assessment-item ...>...</qti-assessment-item>',
|
|
982
|
+
* metadata: { subject: 'Math', difficulty: 'easy' },
|
|
983
|
+
* })
|
|
984
|
+
* ```
|
|
985
|
+
*/
|
|
986
|
+
createFromXml(body: CreateAssessmentItemXmlRequest): Promise<AssessmentItem>;
|
|
936
987
|
/**
|
|
937
988
|
* Create an assessment item from metadata.
|
|
938
989
|
*
|
|
@@ -941,7 +992,7 @@ declare class AssessmentItemsResource {
|
|
|
941
992
|
* @param body - Assessment item metadata
|
|
942
993
|
* @returns The created assessment item
|
|
943
994
|
*/
|
|
944
|
-
createFromMetadata(body:
|
|
995
|
+
createFromMetadata(body: CreateAssessmentItemJsonRequest): Promise<AssessmentItem>;
|
|
945
996
|
}
|
|
946
997
|
|
|
947
998
|
/**
|