@timeback/powerpath 0.2.2-beta.20260317020503 → 0.2.2-beta.20260331191116
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/{chunk-5a9p0re1.js → chunk-setst1c6.js} +56 -56
- package/dist/errors.js +1 -1
- package/dist/index.js +201 -53
- package/package.json +1 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/public-types.d.ts.map +0 -1
|
@@ -636,11 +636,11 @@ class TimebackProvider {
|
|
|
636
636
|
env;
|
|
637
637
|
auth;
|
|
638
638
|
timeout;
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
639
|
+
_endpoints;
|
|
640
|
+
_authUrl;
|
|
641
|
+
_tokenScope;
|
|
642
|
+
_pathProfiles;
|
|
643
|
+
_tokenManagers = new Map;
|
|
644
644
|
constructor(config) {
|
|
645
645
|
this.timeout = config.timeout ?? 30000;
|
|
646
646
|
if (isEnvConfig(config)) {
|
|
@@ -653,89 +653,89 @@ class TimebackProvider {
|
|
|
653
653
|
if (!platformEndpoints) {
|
|
654
654
|
throw new Error(`Unknown platform: ${platform}`);
|
|
655
655
|
}
|
|
656
|
-
this.
|
|
657
|
-
this.
|
|
658
|
-
this.
|
|
659
|
-
this.
|
|
656
|
+
this._authUrl = platformEndpoints.token[env];
|
|
657
|
+
this._tokenScope = platformEndpoints.tokenScope ?? undefined;
|
|
658
|
+
this._pathProfiles = PLATFORM_PATHS[platform] ?? BEYONDAI_PATHS;
|
|
659
|
+
this._endpoints = {
|
|
660
660
|
oneroster: {
|
|
661
661
|
baseUrl: platformEndpoints.api[env],
|
|
662
|
-
authUrl: this.
|
|
662
|
+
authUrl: this._authUrl
|
|
663
663
|
},
|
|
664
664
|
edubridge: {
|
|
665
665
|
baseUrl: platformEndpoints.api[env],
|
|
666
|
-
authUrl: this.
|
|
666
|
+
authUrl: this._authUrl
|
|
667
667
|
},
|
|
668
668
|
powerpath: {
|
|
669
669
|
baseUrl: platformEndpoints.api[env],
|
|
670
|
-
authUrl: this.
|
|
670
|
+
authUrl: this._authUrl
|
|
671
671
|
},
|
|
672
672
|
clr: {
|
|
673
673
|
baseUrl: platformEndpoints.api[env],
|
|
674
|
-
authUrl: this.
|
|
674
|
+
authUrl: this._authUrl
|
|
675
675
|
},
|
|
676
676
|
case: {
|
|
677
677
|
baseUrl: platformEndpoints.api[env],
|
|
678
|
-
authUrl: this.
|
|
678
|
+
authUrl: this._authUrl
|
|
679
679
|
},
|
|
680
680
|
caliper: {
|
|
681
681
|
baseUrl: platformEndpoints.caliper[env],
|
|
682
|
-
authUrl: this.
|
|
682
|
+
authUrl: this._authUrl
|
|
683
683
|
},
|
|
684
684
|
webhooks: {
|
|
685
685
|
baseUrl: platformEndpoints.caliper[env],
|
|
686
|
-
authUrl: this.
|
|
686
|
+
authUrl: this._authUrl
|
|
687
687
|
},
|
|
688
688
|
reporting: {
|
|
689
689
|
baseUrl: platformEndpoints.api[env],
|
|
690
|
-
authUrl: this.
|
|
690
|
+
authUrl: this._authUrl
|
|
691
691
|
},
|
|
692
692
|
qti: {
|
|
693
693
|
baseUrl: platformEndpoints.qti[env],
|
|
694
|
-
authUrl: this.
|
|
694
|
+
authUrl: this._authUrl
|
|
695
695
|
}
|
|
696
696
|
};
|
|
697
697
|
} else if (isExplicitConfig(config)) {
|
|
698
698
|
this.auth = config.auth;
|
|
699
|
-
this.
|
|
700
|
-
this.
|
|
701
|
-
this.
|
|
702
|
-
oneroster: { baseUrl: config.baseUrl, authUrl: this.
|
|
703
|
-
edubridge: { baseUrl: config.baseUrl, authUrl: this.
|
|
704
|
-
powerpath: { baseUrl: config.baseUrl, authUrl: this.
|
|
705
|
-
clr: { baseUrl: config.baseUrl, authUrl: this.
|
|
706
|
-
case: { baseUrl: config.baseUrl, authUrl: this.
|
|
707
|
-
caliper: { baseUrl: config.baseUrl, authUrl: this.
|
|
708
|
-
webhooks: { baseUrl: config.baseUrl, authUrl: this.
|
|
709
|
-
reporting: { baseUrl: config.baseUrl, authUrl: this.
|
|
710
|
-
qti: { baseUrl: config.baseUrl, authUrl: this.
|
|
699
|
+
this._authUrl = config.authUrl;
|
|
700
|
+
this._pathProfiles = resolvePathProfiles(config.pathProfile, config.paths);
|
|
701
|
+
this._endpoints = {
|
|
702
|
+
oneroster: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
703
|
+
edubridge: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
704
|
+
powerpath: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
705
|
+
clr: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
706
|
+
case: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
707
|
+
caliper: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
708
|
+
webhooks: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
709
|
+
reporting: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
710
|
+
qti: { baseUrl: config.baseUrl, authUrl: this._authUrl }
|
|
711
711
|
};
|
|
712
712
|
} else if (isServicesConfig(config)) {
|
|
713
713
|
this.auth = config.auth;
|
|
714
|
-
this.
|
|
715
|
-
this.
|
|
716
|
-
this.
|
|
714
|
+
this._authUrl = config.authUrl;
|
|
715
|
+
this._pathProfiles = resolvePathProfiles(config.pathProfile, config.paths);
|
|
716
|
+
this._endpoints = {};
|
|
717
717
|
for (const [service, baseUrl] of Object.entries(config.services)) {
|
|
718
718
|
if (baseUrl) {
|
|
719
|
-
this.
|
|
719
|
+
this._endpoints[service] = {
|
|
720
720
|
baseUrl,
|
|
721
|
-
authUrl: this.
|
|
721
|
+
authUrl: this._authUrl
|
|
722
722
|
};
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
} else {
|
|
726
726
|
throw new Error("Invalid provider configuration");
|
|
727
727
|
}
|
|
728
|
-
for (const service of Object.keys(this.
|
|
729
|
-
if (this.
|
|
730
|
-
delete this.
|
|
728
|
+
for (const service of Object.keys(this._pathProfiles)) {
|
|
729
|
+
if (this._pathProfiles[service] === null) {
|
|
730
|
+
delete this._endpoints[service];
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
getEndpoint(service) {
|
|
735
|
-
const endpoint = this.
|
|
735
|
+
const endpoint = this._endpoints[service];
|
|
736
736
|
if (!endpoint) {
|
|
737
737
|
const pathKey = service;
|
|
738
|
-
if (pathKey in this.
|
|
738
|
+
if (pathKey in this._pathProfiles && this._pathProfiles[pathKey] === null) {
|
|
739
739
|
throw new Error(`Service "${service}" is not supported on ${this.platform ?? "this"} platform.`);
|
|
740
740
|
}
|
|
741
741
|
throw new Error(`Service "${service}" is not configured in this provider`);
|
|
@@ -743,13 +743,13 @@ class TimebackProvider {
|
|
|
743
743
|
return endpoint;
|
|
744
744
|
}
|
|
745
745
|
hasService(service) {
|
|
746
|
-
return service in this.
|
|
746
|
+
return service in this._endpoints;
|
|
747
747
|
}
|
|
748
748
|
getAvailableServices() {
|
|
749
|
-
return Object.keys(this.
|
|
749
|
+
return Object.keys(this._endpoints);
|
|
750
750
|
}
|
|
751
751
|
getTokenUrl() {
|
|
752
|
-
return this.
|
|
752
|
+
return this._authUrl;
|
|
753
753
|
}
|
|
754
754
|
getEndpointWithPaths(service) {
|
|
755
755
|
const endpoint = this.getEndpoint(service);
|
|
@@ -757,17 +757,17 @@ class TimebackProvider {
|
|
|
757
757
|
return { ...endpoint, paths };
|
|
758
758
|
}
|
|
759
759
|
getPaths() {
|
|
760
|
-
return this.
|
|
760
|
+
return this._pathProfiles;
|
|
761
761
|
}
|
|
762
762
|
getServicePaths(service) {
|
|
763
|
-
const paths = this.
|
|
763
|
+
const paths = this._pathProfiles[service];
|
|
764
764
|
if (!paths) {
|
|
765
765
|
throw new Error(`Service "${service}" is not supported on ${this.platform ?? "this"} platform.`);
|
|
766
766
|
}
|
|
767
767
|
return paths;
|
|
768
768
|
}
|
|
769
769
|
hasServiceSupport(service) {
|
|
770
|
-
return this.
|
|
770
|
+
return this._pathProfiles[service] !== null;
|
|
771
771
|
}
|
|
772
772
|
getTokenProvider(service) {
|
|
773
773
|
const endpoint = this.getEndpoint(service);
|
|
@@ -778,7 +778,7 @@ class TimebackProvider {
|
|
|
778
778
|
if (!this.auth) {
|
|
779
779
|
throw new Error(`Service "${service}" requires authentication but no credentials were provided`);
|
|
780
780
|
}
|
|
781
|
-
let manager = this.
|
|
781
|
+
let manager = this._tokenManagers.get(authUrl);
|
|
782
782
|
if (!manager) {
|
|
783
783
|
manager = new TokenManager({
|
|
784
784
|
tokenUrl: authUrl,
|
|
@@ -786,28 +786,28 @@ class TimebackProvider {
|
|
|
786
786
|
clientId: this.auth.clientId,
|
|
787
787
|
clientSecret: this.auth.clientSecret
|
|
788
788
|
},
|
|
789
|
-
scope: this.
|
|
789
|
+
scope: this._tokenScope
|
|
790
790
|
});
|
|
791
|
-
this.
|
|
791
|
+
this._tokenManagers.set(authUrl, manager);
|
|
792
792
|
}
|
|
793
793
|
return manager;
|
|
794
794
|
}
|
|
795
795
|
async checkAuth() {
|
|
796
|
-
if (!this.
|
|
796
|
+
if (!this._authUrl || !this.auth) {
|
|
797
797
|
throw new Error("No auth configured on this provider");
|
|
798
798
|
}
|
|
799
799
|
const startTime = Date.now();
|
|
800
|
-
let manager = this.
|
|
800
|
+
let manager = this._tokenManagers.get(this._authUrl);
|
|
801
801
|
if (!manager) {
|
|
802
802
|
manager = new TokenManager({
|
|
803
|
-
tokenUrl: this.
|
|
803
|
+
tokenUrl: this._authUrl,
|
|
804
804
|
credentials: {
|
|
805
805
|
clientId: this.auth.clientId,
|
|
806
806
|
clientSecret: this.auth.clientSecret
|
|
807
807
|
},
|
|
808
|
-
scope: this.
|
|
808
|
+
scope: this._tokenScope
|
|
809
809
|
});
|
|
810
|
-
this.
|
|
810
|
+
this._tokenManagers.set(this._authUrl, manager);
|
|
811
811
|
}
|
|
812
812
|
try {
|
|
813
813
|
await manager.getToken();
|
|
@@ -826,10 +826,10 @@ class TimebackProvider {
|
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
invalidateTokens() {
|
|
829
|
-
for (const manager of this.
|
|
829
|
+
for (const manager of this._tokenManagers.values()) {
|
|
830
830
|
manager.invalidate?.();
|
|
831
831
|
}
|
|
832
|
-
this.
|
|
832
|
+
this._tokenManagers.clear();
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
// ../../internal/client-infra/src/utils/utils.ts
|
package/dist/errors.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
resolveToProvider,
|
|
9
9
|
validateNonEmptyString,
|
|
10
10
|
validateWithSchema
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-setst1c6.js";
|
|
12
12
|
import"./chunk-6jf1natv.js";
|
|
13
13
|
|
|
14
14
|
// src/constants.ts
|
|
@@ -63,7 +63,7 @@ var TimebackSubject = z.enum([
|
|
|
63
63
|
"None",
|
|
64
64
|
"Other"
|
|
65
65
|
]).meta({ id: "TimebackSubject", description: "Subject area" });
|
|
66
|
-
var
|
|
66
|
+
var NumericTimebackGrade = z.union([
|
|
67
67
|
z.literal(-1),
|
|
68
68
|
z.literal(0),
|
|
69
69
|
z.literal(1),
|
|
@@ -79,7 +79,39 @@ var TimebackGrade = z.union([
|
|
|
79
79
|
z.literal(11),
|
|
80
80
|
z.literal(12),
|
|
81
81
|
z.literal(13)
|
|
82
|
-
])
|
|
82
|
+
]);
|
|
83
|
+
var StringTimebackGrade = z.string().transform((value, ctx) => {
|
|
84
|
+
const raw = value.toLowerCase().trim().replaceAll("_", " ");
|
|
85
|
+
if (raw === "") {
|
|
86
|
+
ctx.addIssue({
|
|
87
|
+
code: "custom",
|
|
88
|
+
message: "must be a valid Timeback grade"
|
|
89
|
+
});
|
|
90
|
+
return z.NEVER;
|
|
91
|
+
}
|
|
92
|
+
const stripped = raw.replace(/\bgrade\b/g, "").replace(/(\d+)(st|nd|rd|th)\b/g, "$1").trim();
|
|
93
|
+
if (stripped === "pre-k" || stripped === "pk") {
|
|
94
|
+
return -1;
|
|
95
|
+
}
|
|
96
|
+
if (stripped === "k") {
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
if (stripped === "middle school") {
|
|
100
|
+
return 7;
|
|
101
|
+
}
|
|
102
|
+
const normalized = stripped.replace(/\s+/g, "");
|
|
103
|
+
const withoutLeadingZeros = normalized.replace(/^0+/, "") || "0";
|
|
104
|
+
const parsed = Number(withoutLeadingZeros);
|
|
105
|
+
if (!Number.isInteger(parsed)) {
|
|
106
|
+
ctx.addIssue({
|
|
107
|
+
code: "custom",
|
|
108
|
+
message: "must be a valid Timeback grade"
|
|
109
|
+
});
|
|
110
|
+
return z.NEVER;
|
|
111
|
+
}
|
|
112
|
+
return parsed;
|
|
113
|
+
});
|
|
114
|
+
var TimebackGrade = z.union([z.number(), StringTimebackGrade]).pipe(NumericTimebackGrade).meta({
|
|
83
115
|
id: "TimebackGrade",
|
|
84
116
|
description: "Grade level (-1 = Pre-K, 0 = K, 1-12 = grades, 13 = AP)"
|
|
85
117
|
});
|
|
@@ -703,7 +735,6 @@ var TimebackConfig = z6.object({
|
|
|
703
735
|
// ../../types/src/zod/edubridge.ts
|
|
704
736
|
import { z as z7 } from "zod/v4";
|
|
705
737
|
var EdubridgeDateString = z7.union([IsoDateTimeString, IsoDateString]);
|
|
706
|
-
var EdubridgeDateStringInput = EdubridgeDateString.transform((date) => date.includes("T") ? date : `${date}T00:00:00.000Z`);
|
|
707
738
|
var EduBridgeEnrollment = z7.object({
|
|
708
739
|
id: z7.string(),
|
|
709
740
|
role: z7.string(),
|
|
@@ -793,18 +824,18 @@ var EdubridgeUsersListParams = z7.object({
|
|
|
793
824
|
orgSourcedIds: z7.array(NonEmptyString).optional()
|
|
794
825
|
});
|
|
795
826
|
var EdubridgeActivityParams = EmailOrStudentId.extend({
|
|
796
|
-
startDate:
|
|
797
|
-
endDate:
|
|
827
|
+
startDate: EdubridgeDateString,
|
|
828
|
+
endDate: EdubridgeDateString,
|
|
798
829
|
timezone: z7.string().optional()
|
|
799
830
|
});
|
|
800
831
|
var EdubridgeWeeklyFactsParams = EmailOrStudentId.extend({
|
|
801
|
-
weekDate:
|
|
832
|
+
weekDate: EdubridgeDateString,
|
|
802
833
|
timezone: z7.string().optional()
|
|
803
834
|
});
|
|
804
835
|
var EdubridgeEnrollmentFactsParams = z7.object({
|
|
805
836
|
enrollmentId: NonEmptyString,
|
|
806
|
-
startDate:
|
|
807
|
-
endDate:
|
|
837
|
+
startDate: EdubridgeDateString.optional(),
|
|
838
|
+
endDate: EdubridgeDateString.optional(),
|
|
808
839
|
timezone: z7.string().optional()
|
|
809
840
|
});
|
|
810
841
|
// ../../types/src/zod/masterytrack.ts
|
|
@@ -893,7 +924,42 @@ var Ref = z9.object({
|
|
|
893
924
|
type: z9.string().optional(),
|
|
894
925
|
href: z9.string().optional()
|
|
895
926
|
}).strict();
|
|
927
|
+
var GuidRefType = z9.enum([
|
|
928
|
+
"academicSession",
|
|
929
|
+
"assessmentLineItem",
|
|
930
|
+
"category",
|
|
931
|
+
"class",
|
|
932
|
+
"course",
|
|
933
|
+
"demographics",
|
|
934
|
+
"enrollment",
|
|
935
|
+
"gradingPeriod",
|
|
936
|
+
"lineItem",
|
|
937
|
+
"org",
|
|
938
|
+
"resource",
|
|
939
|
+
"result",
|
|
940
|
+
"scoreScale",
|
|
941
|
+
"student",
|
|
942
|
+
"teacher",
|
|
943
|
+
"term",
|
|
944
|
+
"user",
|
|
945
|
+
"componentResource",
|
|
946
|
+
"courseComponent"
|
|
947
|
+
]);
|
|
948
|
+
var GuidRef = z9.object({
|
|
949
|
+
sourcedId: NonEmptyString,
|
|
950
|
+
type: GuidRefType,
|
|
951
|
+
href: z9.url()
|
|
952
|
+
}).strict();
|
|
896
953
|
var OneRosterDateString = z9.union([IsoDateString, IsoDateTimeString]).transform((date) => date.includes("T") ? date : `${date}T00:00:00Z`);
|
|
954
|
+
var LearningObjectiveResult = z9.object({
|
|
955
|
+
learningObjectiveId: z9.string(),
|
|
956
|
+
score: z9.number().optional(),
|
|
957
|
+
textScore: z9.string().optional()
|
|
958
|
+
});
|
|
959
|
+
var LearningObjectiveScoreSetSchema = z9.array(z9.object({
|
|
960
|
+
source: z9.string(),
|
|
961
|
+
learningObjectiveResults: z9.array(LearningObjectiveResult)
|
|
962
|
+
}));
|
|
897
963
|
var OneRosterUserRoleInput = z9.object({
|
|
898
964
|
roleType: z9.enum(["primary", "secondary"]),
|
|
899
965
|
role: OneRosterUserRole,
|
|
@@ -906,35 +972,46 @@ var OneRosterUserRoleInput = z9.object({
|
|
|
906
972
|
var OneRosterUserCreateInput = z9.object({
|
|
907
973
|
sourcedId: NonEmptyString.describe("sourcedId must be a non-empty string"),
|
|
908
974
|
status: Status.optional(),
|
|
909
|
-
enabledUser: z9.
|
|
975
|
+
enabledUser: z9.union([
|
|
976
|
+
z9.boolean(),
|
|
977
|
+
z9.enum(["true", "false"]).transform((value) => value === "true")
|
|
978
|
+
]),
|
|
910
979
|
givenName: NonEmptyString.describe("givenName must be a non-empty string"),
|
|
911
980
|
familyName: NonEmptyString.describe("familyName must be a non-empty string"),
|
|
912
|
-
middleName: NonEmptyString.optional(),
|
|
913
|
-
|
|
981
|
+
middleName: NonEmptyString.nullable().optional(),
|
|
982
|
+
preferredFirstName: NonEmptyString.nullable().optional(),
|
|
983
|
+
preferredMiddleName: NonEmptyString.nullable().optional(),
|
|
984
|
+
preferredLastName: NonEmptyString.nullable().optional(),
|
|
985
|
+
username: NonEmptyString.nullable().optional(),
|
|
914
986
|
email: z9.email(),
|
|
987
|
+
userMasterIdentifier: z9.string().nullable().optional(),
|
|
915
988
|
roles: z9.array(OneRosterUserRoleInput).min(1, "roles must include at least one role"),
|
|
916
989
|
userIds: z9.array(z9.object({
|
|
917
990
|
type: NonEmptyString,
|
|
918
991
|
identifier: NonEmptyString
|
|
919
992
|
}).strict()).optional(),
|
|
920
993
|
agents: z9.array(Ref).optional(),
|
|
994
|
+
primaryOrg: Ref.optional(),
|
|
921
995
|
grades: z9.array(TimebackGrade).optional(),
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
password: NonEmptyString.optional(),
|
|
996
|
+
sms: NonEmptyString.nullable().optional(),
|
|
997
|
+
phone: NonEmptyString.nullable().optional(),
|
|
998
|
+
pronouns: NonEmptyString.nullable().optional(),
|
|
999
|
+
password: NonEmptyString.nullable().optional(),
|
|
927
1000
|
metadata: Metadata
|
|
928
1001
|
}).strict();
|
|
929
1002
|
var OneRosterCourseCreateInput = z9.object({
|
|
930
1003
|
sourcedId: NonEmptyString.describe("sourcedId must be a non-empty string").optional(),
|
|
931
|
-
status: Status
|
|
1004
|
+
status: Status,
|
|
932
1005
|
title: NonEmptyString.describe("title must be a non-empty string"),
|
|
933
1006
|
org: Ref,
|
|
934
|
-
courseCode: NonEmptyString.optional(),
|
|
935
|
-
subjects: z9.array(TimebackSubject).optional(),
|
|
936
|
-
|
|
937
|
-
|
|
1007
|
+
courseCode: NonEmptyString.nullable().optional(),
|
|
1008
|
+
subjects: z9.array(TimebackSubject).nullable().optional(),
|
|
1009
|
+
subjectCodes: z9.array(z9.string()).nullable().optional(),
|
|
1010
|
+
grades: z9.array(TimebackGrade).nullable().optional(),
|
|
1011
|
+
level: NonEmptyString.nullable().optional(),
|
|
1012
|
+
academicSession: Ref.nullable().optional(),
|
|
1013
|
+
schoolYear: GuidRef.nullable().optional(),
|
|
1014
|
+
gradingScheme: NonEmptyString.nullable().optional(),
|
|
938
1015
|
metadata: Metadata
|
|
939
1016
|
}).strict();
|
|
940
1017
|
var OneRosterClassCreateInput = z9.object({
|
|
@@ -944,9 +1021,9 @@ var OneRosterClassCreateInput = z9.object({
|
|
|
944
1021
|
terms: z9.array(Ref).min(1, "terms must have at least one item"),
|
|
945
1022
|
course: Ref,
|
|
946
1023
|
org: Ref,
|
|
947
|
-
classCode: NonEmptyString.optional(),
|
|
1024
|
+
classCode: NonEmptyString.nullable().optional(),
|
|
948
1025
|
classType: z9.enum(["homeroom", "scheduled"]).optional(),
|
|
949
|
-
location: NonEmptyString.optional(),
|
|
1026
|
+
location: NonEmptyString.nullable().optional(),
|
|
950
1027
|
grades: z9.array(TimebackGrade).optional(),
|
|
951
1028
|
subjects: z9.array(TimebackSubject).optional(),
|
|
952
1029
|
subjectCodes: z9.array(NonEmptyString).optional(),
|
|
@@ -981,18 +1058,21 @@ var OneRosterLineItemCreateInput = z9.object({
|
|
|
981
1058
|
category: Ref,
|
|
982
1059
|
assignDate: OneRosterDateString,
|
|
983
1060
|
dueDate: OneRosterDateString,
|
|
984
|
-
status: Status,
|
|
985
|
-
description: z9.string().optional(),
|
|
1061
|
+
status: Status.optional(),
|
|
1062
|
+
description: z9.string().nullable().optional(),
|
|
986
1063
|
resultValueMin: z9.number().nullable().optional(),
|
|
987
1064
|
resultValueMax: z9.number().nullable().optional(),
|
|
988
|
-
|
|
1065
|
+
gradingPeriod: Ref.nullable().optional(),
|
|
1066
|
+
academicSession: Ref.nullable().optional(),
|
|
1067
|
+
scoreScale: Ref.nullable().optional(),
|
|
1068
|
+
learningObjectiveSet: LearningObjectiveSetSchema.nullable().optional(),
|
|
989
1069
|
metadata: Metadata
|
|
990
1070
|
}).strict();
|
|
991
1071
|
var OneRosterResultCreateInput = z9.object({
|
|
992
1072
|
sourcedId: NonEmptyString.optional(),
|
|
993
1073
|
lineItem: Ref,
|
|
994
1074
|
student: Ref,
|
|
995
|
-
class: Ref.optional(),
|
|
1075
|
+
class: Ref.nullable().optional(),
|
|
996
1076
|
scoreDate: OneRosterDateString,
|
|
997
1077
|
scoreStatus: z9.enum([
|
|
998
1078
|
"exempt",
|
|
@@ -1004,14 +1084,20 @@ var OneRosterResultCreateInput = z9.object({
|
|
|
1004
1084
|
score: z9.number().nullable().optional(),
|
|
1005
1085
|
textScore: z9.string().nullable().optional(),
|
|
1006
1086
|
status: Status,
|
|
1087
|
+
scoreScale: Ref.nullable().optional(),
|
|
1007
1088
|
comment: z9.string().nullable().optional(),
|
|
1089
|
+
learningObjectiveSet: LearningObjectiveScoreSetSchema.nullable().optional(),
|
|
1090
|
+
inProgress: z9.string().optional(),
|
|
1091
|
+
incomplete: z9.string().optional(),
|
|
1092
|
+
late: z9.string().optional(),
|
|
1093
|
+
missing: z9.string().optional(),
|
|
1008
1094
|
metadata: Metadata
|
|
1009
1095
|
}).strict();
|
|
1010
1096
|
var OneRosterScoreScaleCreateInput = z9.object({
|
|
1011
1097
|
sourcedId: NonEmptyString.optional(),
|
|
1012
1098
|
title: NonEmptyString.describe("title must be a non-empty string"),
|
|
1013
|
-
status: Status
|
|
1014
|
-
type:
|
|
1099
|
+
status: Status,
|
|
1100
|
+
type: NonEmptyString,
|
|
1015
1101
|
class: Ref,
|
|
1016
1102
|
course: Ref.nullable().optional(),
|
|
1017
1103
|
scoreScaleValue: z9.array(z9.object({
|
|
@@ -1020,13 +1106,11 @@ var OneRosterScoreScaleCreateInput = z9.object({
|
|
|
1020
1106
|
value: z9.string().optional(),
|
|
1021
1107
|
description: z9.string().optional()
|
|
1022
1108
|
}).strict()),
|
|
1023
|
-
minScore: z9.number().optional(),
|
|
1024
|
-
maxScore: z9.number().optional(),
|
|
1025
1109
|
metadata: Metadata
|
|
1026
1110
|
}).strict();
|
|
1027
1111
|
var OneRosterAssessmentLineItemCreateInput = z9.object({
|
|
1028
1112
|
sourcedId: NonEmptyString.optional(),
|
|
1029
|
-
status: Status
|
|
1113
|
+
status: Status,
|
|
1030
1114
|
dateLastModified: IsoDateTimeString.optional(),
|
|
1031
1115
|
title: NonEmptyString.describe("title must be a non-empty string"),
|
|
1032
1116
|
description: z9.string().nullable().optional(),
|
|
@@ -1044,18 +1128,9 @@ var OneRosterAssessmentLineItemCreateInput = z9.object({
|
|
|
1044
1128
|
course: Ref.nullable().optional(),
|
|
1045
1129
|
metadata: Metadata
|
|
1046
1130
|
}).strict();
|
|
1047
|
-
var LearningObjectiveResult = z9.object({
|
|
1048
|
-
learningObjectiveId: z9.string(),
|
|
1049
|
-
score: z9.number().optional(),
|
|
1050
|
-
textScore: z9.string().optional()
|
|
1051
|
-
});
|
|
1052
|
-
var LearningObjectiveScoreSetSchema = z9.array(z9.object({
|
|
1053
|
-
source: z9.string(),
|
|
1054
|
-
learningObjectiveResults: z9.array(LearningObjectiveResult)
|
|
1055
|
-
}));
|
|
1056
1131
|
var OneRosterAssessmentResultCreateInput = z9.object({
|
|
1057
1132
|
sourcedId: NonEmptyString.optional(),
|
|
1058
|
-
status: Status
|
|
1133
|
+
status: Status,
|
|
1059
1134
|
dateLastModified: IsoDateTimeString.optional(),
|
|
1060
1135
|
metadata: Metadata,
|
|
1061
1136
|
assessmentLineItem: Ref,
|
|
@@ -1084,7 +1159,7 @@ var OneRosterOrgCreateInput = z9.object({
|
|
|
1084
1159
|
status: Status.optional(),
|
|
1085
1160
|
name: NonEmptyString.describe("name must be a non-empty string"),
|
|
1086
1161
|
type: OrganizationType,
|
|
1087
|
-
identifier:
|
|
1162
|
+
identifier: z9.string().nullish(),
|
|
1088
1163
|
parent: Ref.optional(),
|
|
1089
1164
|
metadata: Metadata
|
|
1090
1165
|
}).strict();
|
|
@@ -1092,8 +1167,8 @@ var OneRosterSchoolCreateInput = z9.object({
|
|
|
1092
1167
|
sourcedId: NonEmptyString.optional(),
|
|
1093
1168
|
status: Status.optional(),
|
|
1094
1169
|
name: NonEmptyString.describe("name must be a non-empty string"),
|
|
1095
|
-
type: z9.literal("school").
|
|
1096
|
-
identifier:
|
|
1170
|
+
type: z9.literal("school").default("school"),
|
|
1171
|
+
identifier: z9.string().nullish(),
|
|
1097
1172
|
parent: Ref.optional(),
|
|
1098
1173
|
metadata: Metadata
|
|
1099
1174
|
}).strict();
|
|
@@ -1111,11 +1186,13 @@ var OneRosterAcademicSessionCreateInput = z9.object({
|
|
|
1111
1186
|
metadata: Metadata
|
|
1112
1187
|
}).strict();
|
|
1113
1188
|
var OneRosterComponentResourceCreateInput = z9.object({
|
|
1114
|
-
sourcedId: NonEmptyString
|
|
1189
|
+
sourcedId: NonEmptyString,
|
|
1115
1190
|
title: NonEmptyString.describe("title must be a non-empty string"),
|
|
1116
1191
|
courseComponent: Ref,
|
|
1117
1192
|
resource: Ref,
|
|
1118
1193
|
status: Status,
|
|
1194
|
+
sortOrder: z9.number().optional(),
|
|
1195
|
+
lessonType: LessonType.optional(),
|
|
1119
1196
|
metadata: Metadata
|
|
1120
1197
|
}).strict();
|
|
1121
1198
|
var OneRosterCourseComponentCreateInput = z9.object({
|
|
@@ -1123,8 +1200,17 @@ var OneRosterCourseComponentCreateInput = z9.object({
|
|
|
1123
1200
|
title: NonEmptyString.describe("title must be a non-empty string"),
|
|
1124
1201
|
course: Ref,
|
|
1125
1202
|
status: Status,
|
|
1203
|
+
sortOrder: z9.number().optional(),
|
|
1204
|
+
parent: Ref.nullable().optional(),
|
|
1205
|
+
courseComponent: Ref.nullable().optional(),
|
|
1206
|
+
prerequisites: z9.array(z9.string()).nullable().optional(),
|
|
1207
|
+
prerequisiteCriteria: z9.string().nullable().optional(),
|
|
1208
|
+
unlockDate: OneRosterDateString.nullable().optional(),
|
|
1126
1209
|
metadata: Metadata
|
|
1127
|
-
}).strict()
|
|
1210
|
+
}).strict().transform(({ courseComponent, parent, ...rest }) => ({
|
|
1211
|
+
...rest,
|
|
1212
|
+
parent: parent === undefined ? courseComponent ?? undefined : parent
|
|
1213
|
+
}));
|
|
1128
1214
|
var OneRosterEnrollInput = z9.object({
|
|
1129
1215
|
sourcedId: NonEmptyString.describe("sourcedId must be a non-empty string"),
|
|
1130
1216
|
role: z9.enum(["student", "teacher"]),
|
|
@@ -1144,8 +1230,23 @@ var OneRosterCredentialInput = z9.object({
|
|
|
1144
1230
|
})
|
|
1145
1231
|
}).strict();
|
|
1146
1232
|
var OneRosterDemographicsCreateInput = z9.object({
|
|
1147
|
-
sourcedId: NonEmptyString.describe("sourcedId must be a non-empty string")
|
|
1148
|
-
|
|
1233
|
+
sourcedId: NonEmptyString.describe("sourcedId must be a non-empty string"),
|
|
1234
|
+
status: Status.optional(),
|
|
1235
|
+
metadata: Metadata,
|
|
1236
|
+
birthDate: z9.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable().optional(),
|
|
1237
|
+
sex: z9.enum(["male", "female"]).nullable().optional(),
|
|
1238
|
+
americanIndianOrAlaskaNative: StringBoolean.nullable().optional(),
|
|
1239
|
+
asian: StringBoolean.nullable().optional(),
|
|
1240
|
+
blackOrAfricanAmerican: StringBoolean.nullable().optional(),
|
|
1241
|
+
nativeHawaiianOrOtherPacificIslander: StringBoolean.nullable().optional(),
|
|
1242
|
+
white: StringBoolean.nullable().optional(),
|
|
1243
|
+
demographicRaceTwoOrMoreRaces: StringBoolean.nullable().optional(),
|
|
1244
|
+
hispanicOrLatinoEthnicity: StringBoolean.nullable().optional(),
|
|
1245
|
+
countryOfBirthCode: z9.string().nullable().optional(),
|
|
1246
|
+
stateOfBirthAbbreviation: z9.string().nullable().optional(),
|
|
1247
|
+
cityOfBirth: z9.string().nullable().optional(),
|
|
1248
|
+
publicSchoolResidenceStatus: z9.string().nullable().optional()
|
|
1249
|
+
}).strict();
|
|
1149
1250
|
var CommonResourceMetadataSchema = z9.object({
|
|
1150
1251
|
type: ResourceType,
|
|
1151
1252
|
subject: TimebackSubject.nullish(),
|
|
@@ -1215,16 +1316,63 @@ var ResourceMetadataSchema = z9.discriminatedUnion("type", [
|
|
|
1215
1316
|
CourseMaterialMetadataSchema,
|
|
1216
1317
|
AssessmentBankMetadataSchema
|
|
1217
1318
|
]);
|
|
1319
|
+
var ReservedResourceMetadataKeys = new Set([
|
|
1320
|
+
"type",
|
|
1321
|
+
"subject",
|
|
1322
|
+
"grades",
|
|
1323
|
+
"language",
|
|
1324
|
+
"xp",
|
|
1325
|
+
"url",
|
|
1326
|
+
"keywords",
|
|
1327
|
+
"learningObjectiveSet",
|
|
1328
|
+
"lessonType",
|
|
1329
|
+
"subType",
|
|
1330
|
+
"questionType",
|
|
1331
|
+
"difficulty",
|
|
1332
|
+
"format",
|
|
1333
|
+
"author",
|
|
1334
|
+
"pageCount",
|
|
1335
|
+
"duration",
|
|
1336
|
+
"speaker",
|
|
1337
|
+
"captionsAvailable",
|
|
1338
|
+
"launchUrl",
|
|
1339
|
+
"toolProvider",
|
|
1340
|
+
"instructionalMethod",
|
|
1341
|
+
"courseIdOnFail",
|
|
1342
|
+
"resolution",
|
|
1343
|
+
"resources"
|
|
1344
|
+
]);
|
|
1345
|
+
var UntypedResourceMetadataSchema = z9.record(z9.string(), z9.unknown()).superRefine((metadata, ctx) => {
|
|
1346
|
+
if ("fail_fast" in metadata) {
|
|
1347
|
+
const result = FastFailConfigSchema.safeParse(metadata.fail_fast);
|
|
1348
|
+
if (!result.success) {
|
|
1349
|
+
for (const issue of result.error.issues) {
|
|
1350
|
+
ctx.addIssue({
|
|
1351
|
+
...issue,
|
|
1352
|
+
path: ["fail_fast", ...issue.path]
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
const reservedKeys = Object.keys(metadata).filter((key) => ReservedResourceMetadataKeys.has(key));
|
|
1358
|
+
if (reservedKeys.length === 0) {
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
ctx.addIssue({
|
|
1362
|
+
code: "custom",
|
|
1363
|
+
message: `metadata keys ${reservedKeys.map((key) => `\`${key}\``).join(", ")} require a valid \`type\` discriminator`
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1218
1366
|
var OneRosterResourceCreateInput = z9.object({
|
|
1219
1367
|
sourcedId: NonEmptyString.optional(),
|
|
1220
1368
|
title: NonEmptyString.describe("title must be a non-empty string"),
|
|
1221
1369
|
vendorResourceId: NonEmptyString.describe("vendorResourceId must be a non-empty string"),
|
|
1222
1370
|
roles: z9.array(z9.enum(["primary", "secondary"])).optional(),
|
|
1223
1371
|
importance: z9.enum(["primary", "secondary"]).optional(),
|
|
1224
|
-
vendorId:
|
|
1225
|
-
applicationId:
|
|
1372
|
+
vendorId: NonEmptyString.nullable().optional(),
|
|
1373
|
+
applicationId: NonEmptyString.nullable().optional(),
|
|
1226
1374
|
status: Status.optional(),
|
|
1227
|
-
metadata: ResourceMetadataSchema.nullable().optional()
|
|
1375
|
+
metadata: z9.union([ResourceMetadataSchema, UntypedResourceMetadataSchema]).nullable().optional()
|
|
1228
1376
|
}).strict();
|
|
1229
1377
|
var CourseStructureItem = z9.object({
|
|
1230
1378
|
url: NonEmptyString.describe("courseStructure.url must be a non-empty string"),
|
package/package.json
CHANGED
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,OAAO,EAAE,eAAe,EAAE,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAM3D,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAExE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAE9F,YAAY,EAEX,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAE3B,OAAO,EACP,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,4CAA4C,EAC5C,kCAAkC,EAClC,4BAA4B,EAC5B,gCAAgC,EAChC,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,EAC5B,eAAe,EACf,mCAAmC,EAEnC,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EAEtB,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EAExB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,+BAA+B,EAE/B,gBAAgB,EAEhB,6BAA6B,EAC7B,cAAc,EACd,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EAClB,WAAW,GACX,MAAM,qCAAqC,CAAA;AAM5C,YAAY,EACX,gCAAgC,EAChC,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,mCAAmC,EACnC,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,yCAAyC,EACzC,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,wCAAwC,EACxC,yCAAyC,EACzC,+BAA+B,EAC/B,oBAAoB,EACpB,gCAAgC,EAChC,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,aAAa,EACb,kCAAkC,GAClC,MAAM,qBAAqB,CAAA;AAM5B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public-types.d.ts","sourceRoot":"","sources":["../src/public-types.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AAEnD,YAAY,EACX,gCAAgC,EAChC,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,mCAAmC,EACnC,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,yCAAyC,EACzC,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,wCAAwC,EACxC,yCAAyC,EACzC,+BAA+B,EAC/B,oBAAoB,EACpB,gCAAgC,EAChC,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,aAAa,EACb,kCAAkC,GAClC,MAAM,qBAAqB,CAAA"}
|