@timeback/core 0.2.1 → 0.2.2-beta.20260320221119
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-aw1d6bdn.js → chunk-2mkbbgd8.js} +1 -1
- package/dist/{chunk-2z9zawsc.js → chunk-bjb7ngh9.js} +210 -210
- package/dist/errors.d.ts +94 -4
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +1350 -16
- package/dist/index.js +24 -6
- package/dist/qti.d.ts +1 -11
- package/dist/types.d.ts +704 -4
- package/dist/utils.d.ts +1 -8
- package/dist/utils.js +2 -2
- package/package.json +1 -1
- package/dist/client.d.ts +0 -228
- package/dist/client.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -24
- package/dist/constants.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/broadcast-results.d.ts +0 -20
- package/dist/lib/broadcast-results.d.ts.map +0 -1
- package/dist/manager.d.ts +0 -129
- package/dist/manager.d.ts.map +0 -1
- package/dist/qti.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -246
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts.map +0 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Utility Functions
|
|
3
|
-
*
|
|
4
|
-
* Re-exported utilities from sub-clients for convenience.
|
|
5
|
-
*/
|
|
6
|
-
export { aggregateActivityMetrics } from '@timeback/edubridge';
|
|
7
|
-
export type { AggregatedMetrics, DailyActivityMap, EnrollmentFacts, SubjectMetrics, } from '@timeback/edubridge';
|
|
8
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
1
|
+
export { AggregatedMetrics, DailyActivityMap, EnrollmentFacts, SubjectMetrics, aggregateActivityMetrics } from '@timeback/edubridge';
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
package/dist/client.d.ts
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import type { CaliperClientInstance } from '@timeback/caliper';
|
|
2
|
-
import type { CaseClientInstance } from '@timeback/case';
|
|
3
|
-
import type { ClrClientInstance } from '@timeback/clr';
|
|
4
|
-
import type { EdubridgeClientInstance } from '@timeback/edubridge';
|
|
5
|
-
import type { AuthCheckResult, TimebackProvider } from '@timeback/internal-client-infra';
|
|
6
|
-
import type { OneRosterClientInstance } from '@timeback/oneroster';
|
|
7
|
-
import type { PowerPathClientInstance } from '@timeback/powerpath';
|
|
8
|
-
import type { QtiClientInstance } from '@timeback/qti';
|
|
9
|
-
import type { ReportingClientInstance } from '@timeback/reporting';
|
|
10
|
-
import type { WebhooksClientInstance } from '@timeback/webhooks';
|
|
11
|
-
import type { TimebackClientConfig } from './types/index';
|
|
12
|
-
/**
|
|
13
|
-
* Timeback Client
|
|
14
|
-
*
|
|
15
|
-
* Unified client for all Timeback education APIs.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Unified client for Timeback education APIs.
|
|
19
|
-
*
|
|
20
|
-
* Provides access to all Timeback APIs with shared authentication:
|
|
21
|
-
* - **OneRoster**: Rostering and gradebook data
|
|
22
|
-
* - **Edubridge**: Simplified enrollments and analytics
|
|
23
|
-
* - **Caliper**: Learning analytics events
|
|
24
|
-
* - **Reporting**: Ad-hoc queries and saved reporting endpoints
|
|
25
|
-
* - **QTI**: Assessment content management
|
|
26
|
-
* - **PowerPath**: Placement tests, lesson plans, and assessments
|
|
27
|
-
* - **CLR**: Comprehensive Learner Record credentials
|
|
28
|
-
* - **CASE**: Competency and Academic Standards Exchange
|
|
29
|
-
*
|
|
30
|
-
* All sub-clients share a single OAuth token, reducing auth requests.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* // Environment mode
|
|
35
|
-
* const timeback = new TimebackClient({
|
|
36
|
-
* env: 'staging',
|
|
37
|
-
* auth: { clientId: '...', clientSecret: '...' },
|
|
38
|
-
* })
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* // Platform selection
|
|
44
|
-
* const timeback = new TimebackClient({
|
|
45
|
-
* platform: 'LEARNWITH_AI',
|
|
46
|
-
* env: 'production',
|
|
47
|
-
* auth: { clientId: '...', clientSecret: '...' },
|
|
48
|
-
* })
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* // Provider mode (pre-built provider)
|
|
54
|
-
* import { TimebackProvider } from '@timeback/internal-client-infra'
|
|
55
|
-
*
|
|
56
|
-
* const provider = new TimebackProvider({
|
|
57
|
-
* platform: 'BEYOND_AI',
|
|
58
|
-
* env: 'staging',
|
|
59
|
-
* auth: { clientId: '...', clientSecret: '...' },
|
|
60
|
-
* })
|
|
61
|
-
*
|
|
62
|
-
* const timeback = new TimebackClient({ provider })
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* // Base URL mode (self-hosted)
|
|
68
|
-
* const timeback = new TimebackClient({
|
|
69
|
-
* baseUrl: 'https://timeback.myschool.edu',
|
|
70
|
-
* auth: {
|
|
71
|
-
* clientId: '...',
|
|
72
|
-
* clientSecret: '...',
|
|
73
|
-
* authUrl: 'https://timeback.myschool.edu/oauth/token',
|
|
74
|
-
* },
|
|
75
|
-
* })
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export declare class TimebackClient {
|
|
79
|
-
private readonly provider;
|
|
80
|
-
private _closed;
|
|
81
|
-
private _oneroster?;
|
|
82
|
-
private _edubridge?;
|
|
83
|
-
private _caliper?;
|
|
84
|
-
private _qti?;
|
|
85
|
-
private _powerpath?;
|
|
86
|
-
private _clr?;
|
|
87
|
-
private _case?;
|
|
88
|
-
private _reporting?;
|
|
89
|
-
private _webhooks?;
|
|
90
|
-
/**
|
|
91
|
-
* Creates a new Timeback client.
|
|
92
|
-
*
|
|
93
|
-
* @param config - Client configuration (env, baseUrl, provider, or services mode).
|
|
94
|
-
* If omitted, reads from TIMEBACK_ENV, TIMEBACK_CLIENT_ID,
|
|
95
|
-
* and TIMEBACK_CLIENT_SECRET environment variables.
|
|
96
|
-
*/
|
|
97
|
-
constructor(config?: TimebackClientConfig);
|
|
98
|
-
/**
|
|
99
|
-
* OneRoster API client for rostering and gradebook operations.
|
|
100
|
-
*
|
|
101
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
102
|
-
* sub-clients through the provider.
|
|
103
|
-
*
|
|
104
|
-
* @returns The OneRoster client instance
|
|
105
|
-
* @throws {Error} If client has been closed or service not configured
|
|
106
|
-
*/
|
|
107
|
-
get oneroster(): OneRosterClientInstance;
|
|
108
|
-
/**
|
|
109
|
-
* Edubridge API client for simplified enrollments and analytics.
|
|
110
|
-
*
|
|
111
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
112
|
-
* sub-clients through the provider.
|
|
113
|
-
*
|
|
114
|
-
* @returns The Edubridge client instance
|
|
115
|
-
* @throws {Error} If client has been closed or service not configured
|
|
116
|
-
*/
|
|
117
|
-
get edubridge(): EdubridgeClientInstance;
|
|
118
|
-
/**
|
|
119
|
-
* Caliper API client for learning analytics events.
|
|
120
|
-
*
|
|
121
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
122
|
-
* sub-clients through the provider.
|
|
123
|
-
*
|
|
124
|
-
* @returns The Caliper client instance
|
|
125
|
-
* @throws {Error} If client has been closed or service not configured
|
|
126
|
-
*/
|
|
127
|
-
get caliper(): CaliperClientInstance;
|
|
128
|
-
/**
|
|
129
|
-
* QTI API client for assessment content management.
|
|
130
|
-
*
|
|
131
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
132
|
-
* sub-clients through the provider.
|
|
133
|
-
*
|
|
134
|
-
* @returns The QTI client instance
|
|
135
|
-
* @throws {Error} If client has been closed or service not configured
|
|
136
|
-
*/
|
|
137
|
-
get qti(): QtiClientInstance;
|
|
138
|
-
/**
|
|
139
|
-
* PowerPath API client for placement tests and lesson plans.
|
|
140
|
-
*
|
|
141
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
142
|
-
* sub-clients through the provider.
|
|
143
|
-
*
|
|
144
|
-
* @returns The PowerPath client instance
|
|
145
|
-
* @throws {Error} If client has been closed or service not configured
|
|
146
|
-
*/
|
|
147
|
-
get powerpath(): PowerPathClientInstance;
|
|
148
|
-
/**
|
|
149
|
-
* CLR API client for Comprehensive Learner Record credentials.
|
|
150
|
-
*
|
|
151
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
152
|
-
* sub-clients through the provider.
|
|
153
|
-
*
|
|
154
|
-
* @returns The CLR client instance
|
|
155
|
-
* @throws {Error} If client has been closed or service not configured
|
|
156
|
-
*/
|
|
157
|
-
get clr(): ClrClientInstance;
|
|
158
|
-
/**
|
|
159
|
-
* CASE API client for Competency and Academic Standards Exchange.
|
|
160
|
-
*
|
|
161
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
162
|
-
* sub-clients through the provider.
|
|
163
|
-
*
|
|
164
|
-
* @returns The CASE client instance
|
|
165
|
-
* @throws {Error} If client has been closed or service not configured
|
|
166
|
-
*/
|
|
167
|
-
get case(): CaseClientInstance;
|
|
168
|
-
/**
|
|
169
|
-
* Reporting API client for reporting queries and saved reporting endpoints.
|
|
170
|
-
*
|
|
171
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
172
|
-
* sub-clients through the provider.
|
|
173
|
-
*
|
|
174
|
-
* @returns The Reporting client instance
|
|
175
|
-
* @throws {Error} If client has been closed or service not configured
|
|
176
|
-
*/
|
|
177
|
-
get reporting(): ReportingClientInstance;
|
|
178
|
-
/**
|
|
179
|
-
* Webhooks API client for managing webhook registrations and filters.
|
|
180
|
-
*
|
|
181
|
-
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
182
|
-
* sub-clients through the provider.
|
|
183
|
-
*
|
|
184
|
-
* @returns The Webhooks client instance
|
|
185
|
-
* @throws {Error} If client has been closed or service not configured
|
|
186
|
-
*/
|
|
187
|
-
get webhooks(): WebhooksClientInstance;
|
|
188
|
-
/**
|
|
189
|
-
* Verify that OAuth authentication is working.
|
|
190
|
-
*
|
|
191
|
-
* Attempts to acquire a token using the provider's credentials.
|
|
192
|
-
* Returns a health check result with success/failure and latency info.
|
|
193
|
-
*
|
|
194
|
-
* @returns Auth check result
|
|
195
|
-
* @throws {Error} If client has been closed
|
|
196
|
-
*/
|
|
197
|
-
checkAuth(): Promise<AuthCheckResult>;
|
|
198
|
-
/**
|
|
199
|
-
* Close the client and release resources.
|
|
200
|
-
*
|
|
201
|
-
* After calling close():
|
|
202
|
-
* - Cached OAuth tokens are invalidated
|
|
203
|
-
* - Sub-client references are cleared
|
|
204
|
-
* - Further API calls will throw an error
|
|
205
|
-
*/
|
|
206
|
-
close(): void;
|
|
207
|
-
/**
|
|
208
|
-
* Check if the client has been closed.
|
|
209
|
-
* @returns True if closed
|
|
210
|
-
*/
|
|
211
|
-
get closed(): boolean;
|
|
212
|
-
/**
|
|
213
|
-
* Get the underlying provider for advanced use cases.
|
|
214
|
-
*
|
|
215
|
-
* @returns The TimebackProvider instance used by this client
|
|
216
|
-
*/
|
|
217
|
-
getProvider(): TimebackProvider;
|
|
218
|
-
/**
|
|
219
|
-
* Throw if the client has been closed.
|
|
220
|
-
*/
|
|
221
|
-
private assertOpen;
|
|
222
|
-
/**
|
|
223
|
-
* Throw if a service is not configured.
|
|
224
|
-
* @param service - Service name to check
|
|
225
|
-
*/
|
|
226
|
-
private assertService;
|
|
227
|
-
}
|
|
228
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,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,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;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;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAmB;IAChC,OAAO,CAAC,KAAK,CAAC,CAAoB;IAClC,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,SAAS,CAAC,CAAwB;IAE1C;;;;;;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;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,iBAAiB,CAS3B;IAED;;;;;;;;OAQG;IACH,IAAI,IAAI,IAAI,kBAAkB,CAS7B;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,QAAQ,IAAI,sBAAsB,CASrC;IAMD;;;;;;;;OAQG;IACH,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC,CAGpC;IAED;;;;;;;OAOG;IACH,KAAK,IAAI,IAAI,CAgBZ;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;CAgBrB"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Timeback API Endpoints
|
|
3
|
-
*
|
|
4
|
-
* Re-exports URL constants from `@timeback/internal-constants`.
|
|
5
|
-
*/
|
|
6
|
-
import type { ResolveEnvVars } from '@timeback/internal-client-infra';
|
|
7
|
-
import type { Environment, EnvServiceUrls, Platform } from './types';
|
|
8
|
-
/**
|
|
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)
|
|
14
|
-
*/
|
|
15
|
-
export declare const TIMEBACK_ENV_VARS: ResolveEnvVars;
|
|
16
|
-
/**
|
|
17
|
-
* Get all service URLs for a given platform and environment.
|
|
18
|
-
*
|
|
19
|
-
* @param env - Target environment (staging or production)
|
|
20
|
-
* @param platform - Target platform (defaults to 'BEYOND_AI')
|
|
21
|
-
* @returns Service URLs for the environment
|
|
22
|
-
*/
|
|
23
|
-
export declare function getServiceUrlsForEnv(env: Environment, platform?: Platform): EnvServiceUrls;
|
|
24
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,MAAM,iCAAiC,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;;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Broadcast Results Factory
|
|
3
|
-
*
|
|
4
|
-
* Creates a hybrid object that is both a Record<string, BroadcastResult<T>>
|
|
5
|
-
* and has convenience methods for accessing results.
|
|
6
|
-
*/
|
|
7
|
-
import type { BroadcastResult, BroadcastResults } from '../types/index';
|
|
8
|
-
/**
|
|
9
|
-
* Create a BroadcastResults object with convenience methods.
|
|
10
|
-
*
|
|
11
|
-
* Methods are non-enumerable so they don't appear in Object.keys/entries.
|
|
12
|
-
*
|
|
13
|
-
* @template T - The type of values in successful results
|
|
14
|
-
* @param results - Raw results object from broadcast operation
|
|
15
|
-
* @returns Enhanced results object with convenience methods
|
|
16
|
-
*
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
export declare function createBroadcastResults<T>(results: Record<string, BroadcastResult<T>>): BroadcastResults<T>;
|
|
20
|
-
//# sourceMappingURL=broadcast-results.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast-results.d.ts","sourceRoot":"","sources":["../../src/lib/broadcast-results.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GACzC,gBAAgB,CAAC,CAAC,CAAC,CAgDrB"}
|
package/dist/manager.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Timeback Manager
|
|
3
|
-
*
|
|
4
|
-
* Orchestration layer for managing multiple TimebackClient instances.
|
|
5
|
-
* Enables operations across multiple clients from a single interface.
|
|
6
|
-
*/
|
|
7
|
-
import { TimebackClient } from './client';
|
|
8
|
-
import type { BroadcastResults, TimebackClientConfig } from './types/index';
|
|
9
|
-
/**
|
|
10
|
-
* Manages multiple TimebackClient instances.
|
|
11
|
-
*
|
|
12
|
-
* Use this when you need to:
|
|
13
|
-
* - Manage multiple clients with different configurations
|
|
14
|
-
* - Fan-out requests to multiple clients simultaneously
|
|
15
|
-
* - Aggregate data from multiple sources
|
|
16
|
-
*
|
|
17
|
-
* The manager tracks registered client names at the type level,
|
|
18
|
-
* providing autocomplete for `get()` and `has()`.
|
|
19
|
-
*
|
|
20
|
-
* @typeParam TNames - Union of registered client names (tracked automatically)
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const manager = new TimebackManager()
|
|
25
|
-
* .register('alpha', { env: 'production', auth: { ... } })
|
|
26
|
-
* .register('beta', { env: 'production', auth: { ... } })
|
|
27
|
-
*
|
|
28
|
-
* // Autocomplete suggests 'alpha' | 'beta'
|
|
29
|
-
* const users = await manager.get('alpha').oneroster.users.list()
|
|
30
|
-
*
|
|
31
|
-
* // Fan-out to all clients
|
|
32
|
-
* const results = await manager.broadcast(client => client.oneroster.users.create(user))
|
|
33
|
-
* // { alpha: { ok: true, value: {...} }, beta: { ok: true, value: {...} } }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare class TimebackManager<TNames extends string = never> {
|
|
37
|
-
private readonly clients;
|
|
38
|
-
/**
|
|
39
|
-
* Register a new client with a given name.
|
|
40
|
-
*
|
|
41
|
-
* Returns a new manager type that includes the registered name,
|
|
42
|
-
* enabling autocomplete for `get()`.
|
|
43
|
-
*
|
|
44
|
-
* @param {string} name - Unique identifier for this client
|
|
45
|
-
* @param {TimebackClientConfig} config - Configuration for the TimebackClient
|
|
46
|
-
* @returns {TimebackManager<TNames | N>} - A new manager type that includes the registered name, enabling autocomplete for `get()`
|
|
47
|
-
* @throws {Error} If a client with this name is already registered
|
|
48
|
-
*/
|
|
49
|
-
register<N extends string>(name: N, config: TimebackClientConfig): TimebackManager<TNames | N>;
|
|
50
|
-
/**
|
|
51
|
-
* Get a registered client by name.
|
|
52
|
-
*
|
|
53
|
-
* @param name - The name used when registering the client (autocomplete enabled)
|
|
54
|
-
* @returns The TimebackClient instance
|
|
55
|
-
* @throws {Error} If no client with this name is registered
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* const client = manager.get('alpha') // autocomplete suggests registered names
|
|
60
|
-
* const schools = await client.oneroster.schools.list()
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
get(name: TNames): TimebackClient;
|
|
64
|
-
/**
|
|
65
|
-
* Check if a client with the given name is registered.
|
|
66
|
-
*
|
|
67
|
-
* Accepts any string since it's a runtime check.
|
|
68
|
-
* Returns true only for registered names.
|
|
69
|
-
*
|
|
70
|
-
* @param name - The name to check
|
|
71
|
-
* @returns True if registered
|
|
72
|
-
*/
|
|
73
|
-
has(name: string): name is TNames;
|
|
74
|
-
/**
|
|
75
|
-
* Get all registered client names.
|
|
76
|
-
* @returns Array of registered client names
|
|
77
|
-
*/
|
|
78
|
-
get names(): string[];
|
|
79
|
-
/**
|
|
80
|
-
* Get the number of registered clients.
|
|
81
|
-
* @returns Number of registered clients
|
|
82
|
-
*/
|
|
83
|
-
get size(): number;
|
|
84
|
-
/**
|
|
85
|
-
* Execute a function on all registered clients.
|
|
86
|
-
*
|
|
87
|
-
* Uses `Promise.allSettled` semantics — always completes, never throws.
|
|
88
|
-
* Each result indicates success or failure per client.
|
|
89
|
-
*
|
|
90
|
-
* All operations run in parallel.
|
|
91
|
-
*
|
|
92
|
-
* @param fn - Function to execute on each client (name is typed)
|
|
93
|
-
* @returns BroadcastResults with typed property access and convenience methods
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* const results = await manager.broadcast(c => c.oneroster.users.create(user))
|
|
98
|
-
*
|
|
99
|
-
* // Typed property access (autocomplete works)
|
|
100
|
-
* results.alpha.ok
|
|
101
|
-
*
|
|
102
|
-
* if (results.allSucceeded) {
|
|
103
|
-
* console.log('Synced to all platforms!')
|
|
104
|
-
* }
|
|
105
|
-
*
|
|
106
|
-
* results.succeeded.forEach(([name, user]) => {
|
|
107
|
-
* console.log(`Created on ${name}:`, user.id)
|
|
108
|
-
* })
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
broadcast<T>(fn: (client: TimebackClient, name: TNames) => T | Promise<T>): Promise<BroadcastResults<T, TNames>>;
|
|
112
|
-
/**
|
|
113
|
-
* Unregister and close a client.
|
|
114
|
-
*
|
|
115
|
-
* Note: This doesn't update the type — use a new manager if you need
|
|
116
|
-
* type-safe tracking after unregistration.
|
|
117
|
-
*
|
|
118
|
-
* @param name - The name of the client to remove
|
|
119
|
-
* @returns true if the client was removed, false if it didn't exist
|
|
120
|
-
*/
|
|
121
|
-
unregister(name: TNames): boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Close all registered clients and clear the registry.
|
|
124
|
-
*
|
|
125
|
-
* Call this during application shutdown to release resources.
|
|
126
|
-
*/
|
|
127
|
-
close(): void;
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=manager.d.ts.map
|
package/dist/manager.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGzC,OAAO,KAAK,EAAmB,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,eAAe,CAAC,MAAM,SAAS,MAAM,GAAG,KAAK;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAE5D;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAO7F;IAED;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAShC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,MAAM,CAEhC;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,EAAE,CAEpB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,SAAS,CAAC,CAAC,EAChB,EAAE,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CA2BtC;IAED;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUhC;IAED;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAMZ;CACD"}
|
package/dist/qti.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"qti.d.ts","sourceRoot":"","sources":["../src/qti.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACN,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,4BAA4B,EAC5B,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,WAAW,GACX,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EACX,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,qBAAqB,CAAA"}
|