@timeback/oneroster 0.2.1-beta.20260313023436 → 0.2.1-beta.20260330020222
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-4fwv2yyb.js → chunk-bnh0e9yt.js} +68 -54
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +162 -66
- package/dist/index.js +261 -64
- package/dist/public-types.d.ts +161 -65
- package/dist/resources/resources/resources.d.ts +8 -0
- package/dist/resources/resources/resources.d.ts.map +1 -1
- package/dist/resources/resources/resources.type-test.d.ts.map +1 -1
- package/dist/resources/rostering/classes.d.ts.map +1 -1
- package/dist/resources/rostering/courses.d.ts.map +1 -1
- package/dist/resources/rostering/users.d.ts.map +1 -1
- package/dist/types/callable.d.ts +2 -2
- package/dist/types/callable.d.ts.map +1 -1
- 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
|
@@ -643,6 +643,13 @@ var BEYONDAI_PATHS = {
|
|
|
643
643
|
webhookFilterUpdate: "/webhook-filters/{id}",
|
|
644
644
|
webhookFilterDelete: "/webhook-filters/{id}",
|
|
645
645
|
webhookFiltersByWebhook: "/webhook-filters/webhook/{webhookId}"
|
|
646
|
+
},
|
|
647
|
+
reporting: {
|
|
648
|
+
mcp: "/mcp/reporting",
|
|
649
|
+
savedQueryExecute: "/reporting/saved-queries/{id}",
|
|
650
|
+
adminGroupCheck: "/mcp/admin/users/{email}/group",
|
|
651
|
+
adminGroupAdd: "/mcp/admin/users/{email}/group",
|
|
652
|
+
adminGroupRemove: "/mcp/admin/users/{email}/group"
|
|
646
653
|
}
|
|
647
654
|
};
|
|
648
655
|
var LEARNWITHAI_PATHS = {
|
|
@@ -659,6 +666,7 @@ var LEARNWITHAI_PATHS = {
|
|
|
659
666
|
resources: "/resources/1.0"
|
|
660
667
|
},
|
|
661
668
|
webhooks: null,
|
|
669
|
+
reporting: null,
|
|
662
670
|
edubridge: null,
|
|
663
671
|
powerpath: null,
|
|
664
672
|
clr: null,
|
|
@@ -687,6 +695,7 @@ function resolvePathProfiles(pathProfile, customPaths) {
|
|
|
687
695
|
caliper: customPaths?.caliper ?? basePaths.caliper,
|
|
688
696
|
oneroster: customPaths?.oneroster ?? basePaths.oneroster,
|
|
689
697
|
webhooks: customPaths?.webhooks ?? basePaths.webhooks,
|
|
698
|
+
reporting: customPaths?.reporting ?? basePaths.reporting,
|
|
690
699
|
edubridge: customPaths?.edubridge ?? basePaths.edubridge,
|
|
691
700
|
powerpath: customPaths?.powerpath ?? basePaths.powerpath,
|
|
692
701
|
clr: customPaths?.clr ?? basePaths.clr,
|
|
@@ -699,11 +708,11 @@ class TimebackProvider {
|
|
|
699
708
|
env;
|
|
700
709
|
auth;
|
|
701
710
|
timeout;
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
711
|
+
_endpoints;
|
|
712
|
+
_authUrl;
|
|
713
|
+
_tokenScope;
|
|
714
|
+
_pathProfiles;
|
|
715
|
+
_tokenManagers = new Map;
|
|
707
716
|
constructor(config) {
|
|
708
717
|
this.timeout = config.timeout ?? 30000;
|
|
709
718
|
if (isEnvConfig(config)) {
|
|
@@ -716,84 +725,89 @@ class TimebackProvider {
|
|
|
716
725
|
if (!platformEndpoints) {
|
|
717
726
|
throw new Error(`Unknown platform: ${platform}`);
|
|
718
727
|
}
|
|
719
|
-
this.
|
|
720
|
-
this.
|
|
721
|
-
this.
|
|
722
|
-
this.
|
|
728
|
+
this._authUrl = platformEndpoints.token[env];
|
|
729
|
+
this._tokenScope = platformEndpoints.tokenScope ?? undefined;
|
|
730
|
+
this._pathProfiles = PLATFORM_PATHS[platform] ?? BEYONDAI_PATHS;
|
|
731
|
+
this._endpoints = {
|
|
723
732
|
oneroster: {
|
|
724
733
|
baseUrl: platformEndpoints.api[env],
|
|
725
|
-
authUrl: this.
|
|
734
|
+
authUrl: this._authUrl
|
|
726
735
|
},
|
|
727
736
|
edubridge: {
|
|
728
737
|
baseUrl: platformEndpoints.api[env],
|
|
729
|
-
authUrl: this.
|
|
738
|
+
authUrl: this._authUrl
|
|
730
739
|
},
|
|
731
740
|
powerpath: {
|
|
732
741
|
baseUrl: platformEndpoints.api[env],
|
|
733
|
-
authUrl: this.
|
|
742
|
+
authUrl: this._authUrl
|
|
734
743
|
},
|
|
735
744
|
clr: {
|
|
736
745
|
baseUrl: platformEndpoints.api[env],
|
|
737
|
-
authUrl: this.
|
|
746
|
+
authUrl: this._authUrl
|
|
738
747
|
},
|
|
739
748
|
case: {
|
|
740
749
|
baseUrl: platformEndpoints.api[env],
|
|
741
|
-
authUrl: this.
|
|
750
|
+
authUrl: this._authUrl
|
|
742
751
|
},
|
|
743
752
|
caliper: {
|
|
744
753
|
baseUrl: platformEndpoints.caliper[env],
|
|
745
|
-
authUrl: this.
|
|
754
|
+
authUrl: this._authUrl
|
|
746
755
|
},
|
|
747
756
|
webhooks: {
|
|
748
757
|
baseUrl: platformEndpoints.caliper[env],
|
|
749
|
-
authUrl: this.
|
|
758
|
+
authUrl: this._authUrl
|
|
759
|
+
},
|
|
760
|
+
reporting: {
|
|
761
|
+
baseUrl: platformEndpoints.api[env],
|
|
762
|
+
authUrl: this._authUrl
|
|
750
763
|
},
|
|
751
764
|
qti: {
|
|
752
765
|
baseUrl: platformEndpoints.qti[env],
|
|
753
|
-
authUrl: this.
|
|
766
|
+
authUrl: this._authUrl
|
|
754
767
|
}
|
|
755
768
|
};
|
|
756
769
|
} else if (isExplicitConfig(config)) {
|
|
757
770
|
this.auth = config.auth;
|
|
758
|
-
this.
|
|
759
|
-
this.
|
|
760
|
-
this.
|
|
761
|
-
oneroster: { baseUrl: config.baseUrl, authUrl: this.
|
|
762
|
-
edubridge: { baseUrl: config.baseUrl, authUrl: this.
|
|
763
|
-
powerpath: { baseUrl: config.baseUrl, authUrl: this.
|
|
764
|
-
clr: { baseUrl: config.baseUrl, authUrl: this.
|
|
765
|
-
case: { baseUrl: config.baseUrl, authUrl: this.
|
|
766
|
-
caliper: { baseUrl: config.baseUrl, authUrl: this.
|
|
767
|
-
webhooks: { baseUrl: config.baseUrl, authUrl: this.
|
|
768
|
-
|
|
771
|
+
this._authUrl = config.authUrl;
|
|
772
|
+
this._pathProfiles = resolvePathProfiles(config.pathProfile, config.paths);
|
|
773
|
+
this._endpoints = {
|
|
774
|
+
oneroster: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
775
|
+
edubridge: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
776
|
+
powerpath: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
777
|
+
clr: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
778
|
+
case: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
779
|
+
caliper: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
780
|
+
webhooks: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
781
|
+
reporting: { baseUrl: config.baseUrl, authUrl: this._authUrl },
|
|
782
|
+
qti: { baseUrl: config.baseUrl, authUrl: this._authUrl }
|
|
769
783
|
};
|
|
770
784
|
} else if (isServicesConfig(config)) {
|
|
771
785
|
this.auth = config.auth;
|
|
772
|
-
this.
|
|
773
|
-
this.
|
|
774
|
-
this.
|
|
786
|
+
this._authUrl = config.authUrl;
|
|
787
|
+
this._pathProfiles = resolvePathProfiles(config.pathProfile, config.paths);
|
|
788
|
+
this._endpoints = {};
|
|
775
789
|
for (const [service, baseUrl] of Object.entries(config.services)) {
|
|
776
790
|
if (baseUrl) {
|
|
777
|
-
this.
|
|
791
|
+
this._endpoints[service] = {
|
|
778
792
|
baseUrl,
|
|
779
|
-
authUrl: this.
|
|
793
|
+
authUrl: this._authUrl
|
|
780
794
|
};
|
|
781
795
|
}
|
|
782
796
|
}
|
|
783
797
|
} else {
|
|
784
798
|
throw new Error("Invalid provider configuration");
|
|
785
799
|
}
|
|
786
|
-
for (const service of Object.keys(this.
|
|
787
|
-
if (this.
|
|
788
|
-
delete this.
|
|
800
|
+
for (const service of Object.keys(this._pathProfiles)) {
|
|
801
|
+
if (this._pathProfiles[service] === null) {
|
|
802
|
+
delete this._endpoints[service];
|
|
789
803
|
}
|
|
790
804
|
}
|
|
791
805
|
}
|
|
792
806
|
getEndpoint(service) {
|
|
793
|
-
const endpoint = this.
|
|
807
|
+
const endpoint = this._endpoints[service];
|
|
794
808
|
if (!endpoint) {
|
|
795
809
|
const pathKey = service;
|
|
796
|
-
if (pathKey in this.
|
|
810
|
+
if (pathKey in this._pathProfiles && this._pathProfiles[pathKey] === null) {
|
|
797
811
|
throw new Error(`Service "${service}" is not supported on ${this.platform ?? "this"} platform.`);
|
|
798
812
|
}
|
|
799
813
|
throw new Error(`Service "${service}" is not configured in this provider`);
|
|
@@ -801,13 +815,13 @@ class TimebackProvider {
|
|
|
801
815
|
return endpoint;
|
|
802
816
|
}
|
|
803
817
|
hasService(service) {
|
|
804
|
-
return service in this.
|
|
818
|
+
return service in this._endpoints;
|
|
805
819
|
}
|
|
806
820
|
getAvailableServices() {
|
|
807
|
-
return Object.keys(this.
|
|
821
|
+
return Object.keys(this._endpoints);
|
|
808
822
|
}
|
|
809
823
|
getTokenUrl() {
|
|
810
|
-
return this.
|
|
824
|
+
return this._authUrl;
|
|
811
825
|
}
|
|
812
826
|
getEndpointWithPaths(service) {
|
|
813
827
|
const endpoint = this.getEndpoint(service);
|
|
@@ -815,17 +829,17 @@ class TimebackProvider {
|
|
|
815
829
|
return { ...endpoint, paths };
|
|
816
830
|
}
|
|
817
831
|
getPaths() {
|
|
818
|
-
return this.
|
|
832
|
+
return this._pathProfiles;
|
|
819
833
|
}
|
|
820
834
|
getServicePaths(service) {
|
|
821
|
-
const paths = this.
|
|
835
|
+
const paths = this._pathProfiles[service];
|
|
822
836
|
if (!paths) {
|
|
823
837
|
throw new Error(`Service "${service}" is not supported on ${this.platform ?? "this"} platform.`);
|
|
824
838
|
}
|
|
825
839
|
return paths;
|
|
826
840
|
}
|
|
827
841
|
hasServiceSupport(service) {
|
|
828
|
-
return this.
|
|
842
|
+
return this._pathProfiles[service] !== null;
|
|
829
843
|
}
|
|
830
844
|
getTokenProvider(service) {
|
|
831
845
|
const endpoint = this.getEndpoint(service);
|
|
@@ -836,7 +850,7 @@ class TimebackProvider {
|
|
|
836
850
|
if (!this.auth) {
|
|
837
851
|
throw new Error(`Service "${service}" requires authentication but no credentials were provided`);
|
|
838
852
|
}
|
|
839
|
-
let manager = this.
|
|
853
|
+
let manager = this._tokenManagers.get(authUrl);
|
|
840
854
|
if (!manager) {
|
|
841
855
|
manager = new TokenManager({
|
|
842
856
|
tokenUrl: authUrl,
|
|
@@ -844,28 +858,28 @@ class TimebackProvider {
|
|
|
844
858
|
clientId: this.auth.clientId,
|
|
845
859
|
clientSecret: this.auth.clientSecret
|
|
846
860
|
},
|
|
847
|
-
scope: this.
|
|
861
|
+
scope: this._tokenScope
|
|
848
862
|
});
|
|
849
|
-
this.
|
|
863
|
+
this._tokenManagers.set(authUrl, manager);
|
|
850
864
|
}
|
|
851
865
|
return manager;
|
|
852
866
|
}
|
|
853
867
|
async checkAuth() {
|
|
854
|
-
if (!this.
|
|
868
|
+
if (!this._authUrl || !this.auth) {
|
|
855
869
|
throw new Error("No auth configured on this provider");
|
|
856
870
|
}
|
|
857
871
|
const startTime = Date.now();
|
|
858
|
-
let manager = this.
|
|
872
|
+
let manager = this._tokenManagers.get(this._authUrl);
|
|
859
873
|
if (!manager) {
|
|
860
874
|
manager = new TokenManager({
|
|
861
|
-
tokenUrl: this.
|
|
875
|
+
tokenUrl: this._authUrl,
|
|
862
876
|
credentials: {
|
|
863
877
|
clientId: this.auth.clientId,
|
|
864
878
|
clientSecret: this.auth.clientSecret
|
|
865
879
|
},
|
|
866
|
-
scope: this.
|
|
880
|
+
scope: this._tokenScope
|
|
867
881
|
});
|
|
868
|
-
this.
|
|
882
|
+
this._tokenManagers.set(this._authUrl, manager);
|
|
869
883
|
}
|
|
870
884
|
try {
|
|
871
885
|
await manager.getToken();
|
|
@@ -884,10 +898,10 @@ class TimebackProvider {
|
|
|
884
898
|
}
|
|
885
899
|
}
|
|
886
900
|
invalidateTokens() {
|
|
887
|
-
for (const manager of this.
|
|
901
|
+
for (const manager of this._tokenManagers.values()) {
|
|
888
902
|
manager.invalidate?.();
|
|
889
903
|
}
|
|
890
|
-
this.
|
|
904
|
+
this._tokenManagers.clear();
|
|
891
905
|
}
|
|
892
906
|
}
|
|
893
907
|
// ../../internal/client-infra/src/utils/utils.ts
|