@timeback/core 0.1.2 → 0.1.4
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 +13 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/errors.js +42 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19707 -919
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types.js +7 -0
- package/dist/utils.js +575 -68
- package/package.json +7 -5
package/dist/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { CaliperClientInstance } from '@timeback/caliper';
|
|
|
2
2
|
import type { EdubridgeClientInstance } from '@timeback/edubridge';
|
|
3
3
|
import type { AuthCheckResult, TimebackProvider } from '@timeback/internal-client-infra';
|
|
4
4
|
import type { OneRosterClientInstance } from '@timeback/oneroster';
|
|
5
|
+
import type { PowerPathClientInstance } from '@timeback/powerpath';
|
|
5
6
|
import type { QtiClientInstance } from '@timeback/qti';
|
|
6
7
|
import type { TimebackClientConfig } from './types/index';
|
|
7
8
|
/**
|
|
@@ -17,6 +18,7 @@ import type { TimebackClientConfig } from './types/index';
|
|
|
17
18
|
* - **Edubridge**: Simplified enrollments and analytics
|
|
18
19
|
* - **Caliper**: Learning analytics events
|
|
19
20
|
* - **QTI**: Assessment content management
|
|
21
|
+
* - **PowerPath**: Placement tests, lesson plans, and assessments
|
|
20
22
|
*
|
|
21
23
|
* All sub-clients share a single OAuth token, reducing auth requests.
|
|
22
24
|
*
|
|
@@ -69,6 +71,7 @@ export declare class TimebackClient {
|
|
|
69
71
|
private _edubridge?;
|
|
70
72
|
private _caliper?;
|
|
71
73
|
private _qti?;
|
|
74
|
+
private _powerpath?;
|
|
72
75
|
/**
|
|
73
76
|
* Creates a new Timeback client.
|
|
74
77
|
*
|
|
@@ -117,6 +120,16 @@ export declare class TimebackClient {
|
|
|
117
120
|
* @throws {Error} If client has been closed or service not configured
|
|
118
121
|
*/
|
|
119
122
|
get qti(): QtiClientInstance;
|
|
123
|
+
/**
|
|
124
|
+
* PowerPath API client for placement tests and lesson plans.
|
|
125
|
+
*
|
|
126
|
+
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
127
|
+
* sub-clients through the provider.
|
|
128
|
+
*
|
|
129
|
+
* @returns The PowerPath client instance
|
|
130
|
+
* @throws {Error} If client has been closed or service not configured
|
|
131
|
+
*/
|
|
132
|
+
get powerpath(): PowerPathClientInstance;
|
|
120
133
|
/**
|
|
121
134
|
* Verify that OAuth authentication is working.
|
|
122
135
|
*
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,QAAQ,CAAC,CAAuB;IACxC,OAAO,CAAC,IAAI,CAAC,CAAmB;IAChC,OAAO,CAAC,UAAU,CAAC,CAAyB;IAE5C;;;;;;OAMG;IACH,YAAY,MAAM,CAAC,EAAE,oBAAoB,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;IAMD;;;;;;;;OAQG;IACH,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC,CAGpC;IAED;;;;;;;OAOG;IACH,KAAK,IAAI,IAAI,CAYZ;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
CHANGED
|
@@ -7,6 +7,10 @@ import type { ResolveEnvVars } from '@timeback/internal-client-infra';
|
|
|
7
7
|
import type { Environment, EnvServiceUrls, Platform } from './types';
|
|
8
8
|
/**
|
|
9
9
|
* Environment variable names for Timeback client configuration.
|
|
10
|
+
*
|
|
11
|
+
* Supports fallback chains - tries each env var in order until one is defined:
|
|
12
|
+
* - `TIMEBACK_API_*` (canonical/preferred)
|
|
13
|
+
* - `TIMEBACK_*` (legacy shorthand)
|
|
10
14
|
*/
|
|
11
15
|
export declare const TIMEBACK_ENV_VARS: ResolveEnvVars;
|
|
12
16
|
/**
|
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
|
|
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,CAShB"}
|
package/dist/errors.js
CHANGED
|
@@ -487,6 +487,9 @@ var BEYONDAI_PATHS = {
|
|
|
487
487
|
},
|
|
488
488
|
edubridge: {
|
|
489
489
|
base: "/edubridge"
|
|
490
|
+
},
|
|
491
|
+
powerpath: {
|
|
492
|
+
base: "/powerpath"
|
|
490
493
|
}
|
|
491
494
|
};
|
|
492
495
|
var LEARNWITHAI_PATHS = {
|
|
@@ -502,7 +505,8 @@ var LEARNWITHAI_PATHS = {
|
|
|
502
505
|
gradebook: "/gradebook/1.0",
|
|
503
506
|
resources: "/resources/1.0"
|
|
504
507
|
},
|
|
505
|
-
edubridge: null
|
|
508
|
+
edubridge: null,
|
|
509
|
+
powerpath: null
|
|
506
510
|
};
|
|
507
511
|
var PLATFORM_PATHS = {
|
|
508
512
|
BEYOND_AI: BEYONDAI_PATHS,
|
|
@@ -524,7 +528,8 @@ function resolvePathProfiles(pathProfile, customPaths) {
|
|
|
524
528
|
return {
|
|
525
529
|
caliper: customPaths?.caliper ?? basePaths.caliper,
|
|
526
530
|
oneroster: customPaths?.oneroster ?? basePaths.oneroster,
|
|
527
|
-
edubridge: customPaths?.edubridge ?? basePaths.edubridge
|
|
531
|
+
edubridge: customPaths?.edubridge ?? basePaths.edubridge,
|
|
532
|
+
powerpath: customPaths?.powerpath ?? basePaths.powerpath
|
|
528
533
|
};
|
|
529
534
|
}
|
|
530
535
|
|
|
@@ -560,6 +565,10 @@ class TimebackProvider {
|
|
|
560
565
|
baseUrl: platformEndpoints.api[env],
|
|
561
566
|
authUrl: this.authUrl
|
|
562
567
|
},
|
|
568
|
+
powerpath: {
|
|
569
|
+
baseUrl: platformEndpoints.api[env],
|
|
570
|
+
authUrl: this.authUrl
|
|
571
|
+
},
|
|
563
572
|
caliper: {
|
|
564
573
|
baseUrl: platformEndpoints.caliper[env],
|
|
565
574
|
authUrl: this.authUrl
|
|
@@ -576,6 +585,7 @@ class TimebackProvider {
|
|
|
576
585
|
this.endpoints = {
|
|
577
586
|
oneroster: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
578
587
|
edubridge: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
588
|
+
powerpath: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
579
589
|
caliper: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
580
590
|
qti: { baseUrl: config.baseUrl, authUrl: this.authUrl }
|
|
581
591
|
};
|
|
@@ -694,7 +704,17 @@ class TimebackProvider {
|
|
|
694
704
|
// ../../internal/client-infra/src/utils/utils.ts
|
|
695
705
|
function getEnv(key) {
|
|
696
706
|
try {
|
|
697
|
-
|
|
707
|
+
if (typeof process === "undefined")
|
|
708
|
+
return;
|
|
709
|
+
if (typeof key === "string") {
|
|
710
|
+
return process.env[key];
|
|
711
|
+
}
|
|
712
|
+
for (const k of key) {
|
|
713
|
+
const value = process.env[k];
|
|
714
|
+
if (value !== undefined)
|
|
715
|
+
return value;
|
|
716
|
+
}
|
|
717
|
+
return;
|
|
698
718
|
} catch {
|
|
699
719
|
return;
|
|
700
720
|
}
|
|
@@ -715,6 +735,18 @@ var DEFAULT_PROVIDER_REGISTRY = {
|
|
|
715
735
|
};
|
|
716
736
|
|
|
717
737
|
// ../../internal/client-infra/src/config/resolve.ts
|
|
738
|
+
function primaryEnvVar(key) {
|
|
739
|
+
if (typeof key === "string") {
|
|
740
|
+
return key;
|
|
741
|
+
}
|
|
742
|
+
if (key.length === 0) {
|
|
743
|
+
throw new Error(`Missing env var key: ${key}`);
|
|
744
|
+
}
|
|
745
|
+
return key[0];
|
|
746
|
+
}
|
|
747
|
+
function formatEnvVarKey(key) {
|
|
748
|
+
return primaryEnvVar(key);
|
|
749
|
+
}
|
|
718
750
|
function validateEnv(env) {
|
|
719
751
|
if (env !== "staging" && env !== "production") {
|
|
720
752
|
throw new Error(`Invalid env "${env}": must be "staging" or "production"`);
|
|
@@ -725,10 +757,10 @@ function validateAuth(auth, envVars) {
|
|
|
725
757
|
const clientId = auth?.clientId ?? getEnv(envVars.clientId);
|
|
726
758
|
const clientSecret = auth?.clientSecret ?? getEnv(envVars.clientSecret);
|
|
727
759
|
if (!clientId) {
|
|
728
|
-
throw new Error(`Missing clientId: provide in config or set ${envVars.clientId}`);
|
|
760
|
+
throw new Error(`Missing clientId: provide in config or set ${formatEnvVarKey(envVars.clientId)}`);
|
|
729
761
|
}
|
|
730
762
|
if (!clientSecret) {
|
|
731
|
-
throw new Error(`Missing clientSecret: provide in config or set ${envVars.clientSecret}`);
|
|
763
|
+
throw new Error(`Missing clientSecret: provide in config or set ${formatEnvVarKey(envVars.clientSecret)}`);
|
|
732
764
|
}
|
|
733
765
|
return { clientId, clientSecret };
|
|
734
766
|
}
|
|
@@ -744,21 +776,21 @@ function buildMissingEnvError(envVars) {
|
|
|
744
776
|
const clientId = getEnv(envVars.clientId);
|
|
745
777
|
const clientSecret = getEnv(envVars.clientSecret);
|
|
746
778
|
if (baseUrl === undefined && clientId === undefined) {
|
|
747
|
-
const hint = envVars.env ?? envVars.baseUrl;
|
|
779
|
+
const hint = formatEnvVarKey(envVars.env ?? envVars.baseUrl);
|
|
748
780
|
return `Missing env: provide in config or set ${hint}`;
|
|
749
781
|
}
|
|
750
782
|
const missing = [];
|
|
751
783
|
if (baseUrl === undefined) {
|
|
752
|
-
missing.push(envVars.env ?? envVars.baseUrl);
|
|
784
|
+
missing.push(formatEnvVarKey(envVars.env ?? envVars.baseUrl));
|
|
753
785
|
}
|
|
754
786
|
if (baseUrl !== undefined && authUrl === undefined) {
|
|
755
|
-
missing.push(envVars.authUrl);
|
|
787
|
+
missing.push(formatEnvVarKey(envVars.authUrl));
|
|
756
788
|
}
|
|
757
789
|
if (clientId === undefined) {
|
|
758
|
-
missing.push(envVars.clientId);
|
|
790
|
+
missing.push(formatEnvVarKey(envVars.clientId));
|
|
759
791
|
}
|
|
760
792
|
if (clientSecret === undefined) {
|
|
761
|
-
missing.push(envVars.clientSecret);
|
|
793
|
+
missing.push(formatEnvVarKey(envVars.clientSecret));
|
|
762
794
|
}
|
|
763
795
|
return `Missing environment variables: ${missing.join(", ")}`;
|
|
764
796
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export type { BroadcastResult, BroadcastResultMethods, BroadcastResults } from '
|
|
|
24
24
|
export { ApiError, ForbiddenError, isApiError, NotFoundError, UnauthorizedError, ValidationError, } from '@timeback/internal-client-infra';
|
|
25
25
|
export { whereToFilter } from '@timeback/internal-client-infra';
|
|
26
26
|
export type { FieldCondition, FieldOperators, FilterValue, OrCondition, WhereClause, } from '@timeback/internal-client-infra';
|
|
27
|
-
export
|
|
27
|
+
export { getServiceUrlsForEnv } from './constants';
|
|
28
|
+
export type { Environment, EnvServiceUrls, TimebackClientConfig } from './types/index';
|
|
28
29
|
export type { AuthCheckResult } from '@timeback/internal-client-infra';
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAM9F,OAAO,EACN,QAAQ,EACR,cAAc,EACd,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,MAAM,iCAAiC,CAAA;AAMxC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAE/D,YAAY,EACX,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,GACX,MAAM,iCAAiC,CAAA;AAMxC,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAM9F,OAAO,EACN,QAAQ,EACR,cAAc,EACd,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,MAAM,iCAAiC,CAAA;AAMxC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAE/D,YAAY,EACX,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,GACX,MAAM,iCAAiC,CAAA;AAMxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAMlD,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEtF,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA"}
|