@timeback/core 0.1.5 → 0.1.6-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/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/errors.js +54 -2
- package/dist/index.js +79543 -26841
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types.js +35 -28
- package/dist/utils.js +510 -164
- package/package.json +9 -6
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { CaliperClientInstance } from '@timeback/caliper';
|
|
2
|
+
import type { CaseClientInstance } from '@timeback/case';
|
|
3
|
+
import type { ClrClientInstance } from '@timeback/clr';
|
|
2
4
|
import type { EdubridgeClientInstance } from '@timeback/edubridge';
|
|
3
5
|
import type { AuthCheckResult, TimebackProvider } from '@timeback/internal-client-infra';
|
|
4
6
|
import type { OneRosterClientInstance } from '@timeback/oneroster';
|
|
5
7
|
import type { PowerPathClientInstance } from '@timeback/powerpath';
|
|
6
8
|
import type { QtiClientInstance } from '@timeback/qti';
|
|
9
|
+
import type { WebhooksClientInstance } from '@timeback/webhooks';
|
|
7
10
|
import type { TimebackClientConfig } from './types/index';
|
|
8
11
|
/**
|
|
9
12
|
* Timeback Client
|
|
@@ -19,6 +22,8 @@ import type { TimebackClientConfig } from './types/index';
|
|
|
19
22
|
* - **Caliper**: Learning analytics events
|
|
20
23
|
* - **QTI**: Assessment content management
|
|
21
24
|
* - **PowerPath**: Placement tests, lesson plans, and assessments
|
|
25
|
+
* - **CLR**: Comprehensive Learner Record credentials
|
|
26
|
+
* - **CASE**: Competency and Academic Standards Exchange
|
|
22
27
|
*
|
|
23
28
|
* All sub-clients share a single OAuth token, reducing auth requests.
|
|
24
29
|
*
|
|
@@ -76,6 +81,9 @@ export declare class TimebackClient {
|
|
|
76
81
|
private _caliper?;
|
|
77
82
|
private _qti?;
|
|
78
83
|
private _powerpath?;
|
|
84
|
+
private _clr?;
|
|
85
|
+
private _case?;
|
|
86
|
+
private _webhooks?;
|
|
79
87
|
/**
|
|
80
88
|
* Creates a new Timeback client.
|
|
81
89
|
*
|
|
@@ -134,6 +142,36 @@ export declare class TimebackClient {
|
|
|
134
142
|
* @throws {Error} If client has been closed or service not configured
|
|
135
143
|
*/
|
|
136
144
|
get powerpath(): PowerPathClientInstance;
|
|
145
|
+
/**
|
|
146
|
+
* CLR API client for Comprehensive Learner Record credentials.
|
|
147
|
+
*
|
|
148
|
+
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
149
|
+
* sub-clients through the provider.
|
|
150
|
+
*
|
|
151
|
+
* @returns The CLR client instance
|
|
152
|
+
* @throws {Error} If client has been closed or service not configured
|
|
153
|
+
*/
|
|
154
|
+
get clr(): ClrClientInstance;
|
|
155
|
+
/**
|
|
156
|
+
* CASE API client for Competency and Academic Standards Exchange.
|
|
157
|
+
*
|
|
158
|
+
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
159
|
+
* sub-clients through the provider.
|
|
160
|
+
*
|
|
161
|
+
* @returns The CASE client instance
|
|
162
|
+
* @throws {Error} If client has been closed or service not configured
|
|
163
|
+
*/
|
|
164
|
+
get case(): CaseClientInstance;
|
|
165
|
+
/**
|
|
166
|
+
* Webhooks API client for managing webhook registrations and filters.
|
|
167
|
+
*
|
|
168
|
+
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
169
|
+
* sub-clients through the provider.
|
|
170
|
+
*
|
|
171
|
+
* @returns The Webhooks client instance
|
|
172
|
+
* @throws {Error} If client has been closed or service not configured
|
|
173
|
+
*/
|
|
174
|
+
get webhooks(): WebhooksClientInstance;
|
|
137
175
|
/**
|
|
138
176
|
* Verify that OAuth authentication is working.
|
|
139
177
|
*
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names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AAoB,EAUxC;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,OAAO,IAAI,qBAAqB,CASnC;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,iBAAiB,CAS3B;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,iBAAiB,CAS3B;IAED;;;;;;;;OAQG;IACH,IAAI,IAAI,IAAI,kBAAkB,CAS7B;IAED;;;;;;;;OAQG;IACH,IAAI,QAAQ,IAAI,sBAAsB,CASrC;IAMD;;;;;;;;OAQG;IACH,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC,CAGpC;IAED;;;;;;;OAOG;IACH,KAAK,IAAI,IAAI,CAeZ;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;;;OAIG;IACH,WAAW,IAAI,gBAAgB,CAE9B;IAED;;OAEG;IACH,OAAO,CAAC,UAAU;IAMlB;;;OAGG;IACH,OAAO,CAAC,aAAa;CAOrB"}
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAMpE;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAM/B,CAAA;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,WAAW,EAChB,QAAQ,GAAE,QAA2B,GACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAMpE;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAM/B,CAAA;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,WAAW,EAChB,QAAQ,GAAE,QAA2B,GACnC,cAAc,CAUhB"}
|
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;
|