@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/types.d.ts CHANGED
@@ -1,10 +1,710 @@
1
+ import * as types from '@timeback/caliper/types';
2
+ export { types as Caliper };
3
+ import * as types$1 from '@timeback/edubridge/types';
4
+ export { types$1 as Edubridge };
5
+ import * as types$2 from '@timeback/oneroster/types';
6
+ export { types$2 as OneRoster };
7
+ import * as types$3 from '@timeback/powerpath/types';
8
+ export { types$3 as PowerPath };
9
+ import * as types$4 from '@timeback/qti/types';
10
+ export { types$4 as Qti };
11
+ import * as types$5 from '@timeback/webhooks/types';
12
+ export { types$5 as Webhooks };
13
+
1
14
  /**
2
- * All types for the Timeback unified client.
15
+ * Interface for obtaining OAuth2 access tokens.
16
+ *
17
+ * Implementations handle token caching and refresh automatically.
18
+ */
19
+ interface TokenProvider {
20
+ /**
21
+ * Get a valid access token.
22
+ *
23
+ * Returns a cached token if still valid, otherwise fetches a new one.
24
+ *
25
+ * @returns A valid access token string
26
+ * @throws {Error} If token acquisition fails
27
+ */
28
+ getToken(): Promise<string>;
29
+ /**
30
+ * Invalidate the cached token.
31
+ *
32
+ * Forces the next getToken() call to fetch a fresh token.
33
+ * Should be called when a request fails with 401 Unauthorized.
34
+ *
35
+ * Optional - not all implementations may support invalidation.
36
+ */
37
+ invalidate?(): void;
38
+ }
39
+
40
+ /**
41
+ * All supported platforms.
42
+ */
43
+ declare const PLATFORMS$1: readonly ["BEYOND_AI", "LEARNWITH_AI"];
44
+
45
+ /**
46
+ * Shared Types
47
+ *
48
+ * Common types for API client infrastructure.
49
+ */
50
+
51
+ /**
52
+ * Result of an auth check operation.
53
+ */
54
+ interface AuthCheckResult {
55
+ /** Whether auth succeeded */
56
+ ok: boolean;
57
+ /** Time taken to complete the check (ms) */
58
+ latencyMs: number;
59
+ /** Error message if failed */
60
+ error?: string;
61
+ /** Detailed check results */
62
+ checks: {
63
+ /** Token acquisition succeeded */
64
+ tokenAcquisition: boolean;
65
+ };
66
+ }
67
+
68
+ /**
69
+ * Config Types
70
+ *
71
+ * Types for TimebackProvider and provider resolution.
72
+ */
73
+
74
+ /**
75
+ * Caliper API path profile.
76
+ * Defines paths for Caliper operations. Use `null` for unsupported operations.
77
+ */
78
+ interface CaliperPaths {
79
+ /** Path for sending events (POST) */
80
+ send: string;
81
+ /** Path for validating events (POST), null if not supported */
82
+ validate: string | null;
83
+ /** Path for listing events (GET), null if not supported */
84
+ list: string | null;
85
+ /** Path template for getting single event (GET), use {id} placeholder */
86
+ get: string | null;
87
+ /** Path template for job status (GET), use {id} placeholder */
88
+ jobStatus: string | null;
89
+ }
90
+ /**
91
+ * Webhook API path profile.
92
+ * Defines paths for webhook management operations.
93
+ * Nullability is at the platform level (`webhooks: WebhookPaths | null` in PlatformPaths).
94
+ */
95
+ interface WebhookPaths {
96
+ /** Path for listing webhooks (GET) */
97
+ webhookList: string;
98
+ /** Path template for getting a single webhook (GET), use {id} placeholder */
99
+ webhookGet: string;
100
+ /** Path for creating a webhook (POST) */
101
+ webhookCreate: string;
102
+ /** Path template for updating a webhook (PUT), use {id} placeholder */
103
+ webhookUpdate: string;
104
+ /** Path template for deleting a webhook (DELETE), use {id} placeholder */
105
+ webhookDelete: string;
106
+ /** Path template for activating a webhook (PUT), use {id} placeholder */
107
+ webhookActivate: string;
108
+ /** Path template for deactivating a webhook (PUT), use {id} placeholder */
109
+ webhookDeactivate: string;
110
+ /** Path for listing all webhook filters (GET) */
111
+ webhookFilterList: string;
112
+ /** Path template for getting a single webhook filter (GET), use {id} placeholder */
113
+ webhookFilterGet: string;
114
+ /** Path for creating a webhook filter (POST) */
115
+ webhookFilterCreate: string;
116
+ /** Path template for updating a webhook filter (PUT), use {id} placeholder */
117
+ webhookFilterUpdate: string;
118
+ /** Path template for deleting a webhook filter (DELETE), use {id} placeholder */
119
+ webhookFilterDelete: string;
120
+ /** Path template for listing filters by webhook (GET), use {webhookId} placeholder */
121
+ webhookFiltersByWebhook: string;
122
+ }
123
+ /**
124
+ * Reporting API path profile.
125
+ * Defines paths for reporting MCP and REST operations.
126
+ * Nullability is at the platform level (`reporting: ReportingPaths | null` in PlatformPaths).
127
+ */
128
+ interface ReportingPaths {
129
+ /** Path for the reporting MCP JSON-RPC endpoint (POST) */
130
+ mcp: string;
131
+ /** Path template for executing a saved query (GET), use {id} placeholder */
132
+ savedQueryExecute: string;
133
+ /** Path template for checking reporting group membership (GET), use {email} placeholder */
134
+ adminGroupCheck: string;
135
+ /** Path template for adding a user to the reporting group (POST), use {email} placeholder */
136
+ adminGroupAdd: string;
137
+ /** Path template for removing a user from the reporting group (DELETE), use {email} placeholder */
138
+ adminGroupRemove: string;
139
+ }
140
+ /**
141
+ * OneRoster API path profile.
142
+ * Defines the base path prefix for all OneRoster resources.
143
+ */
144
+ interface OneRosterPaths {
145
+ /** Base path prefix for rostering resources (users, schools, classes, etc.) */
146
+ rostering: string;
147
+ /** Base path prefix for gradebook resources (lineItems, results, etc.) */
148
+ gradebook: string;
149
+ /** Base path prefix for resources API (digital learning resources) */
150
+ resources: string;
151
+ }
152
+ /**
153
+ * Edubridge API path profile.
154
+ * Defines path prefixes for Edubridge operations.
155
+ */
156
+ interface EdubridgePaths {
157
+ /** Base path prefix for all Edubridge resources */
158
+ base: string;
159
+ }
160
+ /**
161
+ * PowerPath API path profile.
162
+ * Defines path prefixes for PowerPath operations.
163
+ */
164
+ interface PowerPathPaths {
165
+ /** Base path prefix for all PowerPath resources */
166
+ base: string;
167
+ }
168
+ /**
169
+ * CASE API path profile.
170
+ * Defines path prefix for CASE (Competency and Academic Standards Exchange) operations.
171
+ */
172
+ interface CasePaths {
173
+ /** Base path prefix for all CASE resources */
174
+ base: string;
175
+ }
176
+ /**
177
+ * CLR API path profile.
178
+ * Defines path prefixes for CLR (Comprehensive Learner Record) operations.
179
+ */
180
+ interface ClrPaths {
181
+ /** Path for upserting CLR credentials (POST) */
182
+ credentials: string;
183
+ /** Path for API discovery (GET) */
184
+ discovery: string;
185
+ }
186
+ /**
187
+ * Platform path profiles for all services.
188
+ * Use `null` to indicate a service is not supported on the platform.
189
+ */
190
+ interface PlatformPaths {
191
+ caliper: CaliperPaths;
192
+ oneroster: OneRosterPaths;
193
+ webhooks: WebhookPaths | null;
194
+ reporting: ReportingPaths | null;
195
+ edubridge: EdubridgePaths | null;
196
+ powerpath: PowerPathPaths | null;
197
+ clr: ClrPaths | null;
198
+ case: CasePaths | null;
199
+ }
200
+ /**
201
+ * Services that have path configuration.
202
+ * Subset of ServiceName - excludes services without path profiles (e.g., 'qti').
203
+ */
204
+ type PathEnabledService = keyof PlatformPaths;
205
+ /**
206
+ * Supported Timeback platform implementations.
207
+ */
208
+ type Platform$1 = (typeof PLATFORMS$1)[number];
209
+ /**
210
+ * Supported deployment environments.
211
+ */
212
+ type Environment$1 = 'staging' | 'production';
213
+ /**
214
+ * Supported service names.
215
+ */
216
+ type ServiceName = 'oneroster' | 'caliper' | 'webhooks' | 'reporting' | 'edubridge' | 'qti' | 'powerpath' | 'clr' | 'case';
217
+ /**
218
+ * Resolved endpoint for a single service.
219
+ */
220
+ interface ResolvedEndpoint {
221
+ /** Base URL for the service API */
222
+ baseUrl: string;
223
+ /** OAuth2 token URL for this endpoint. Undefined for public/no-auth services. */
224
+ authUrl?: string;
225
+ }
226
+ /**
227
+ * Auth credentials for a provider.
228
+ */
229
+ interface ProviderAuth {
230
+ clientId: string;
231
+ clientSecret: string;
232
+ }
233
+ /**
234
+ * Configuration for environment-based provider.
235
+ * Uses known Timeback platform endpoints.
236
+ */
237
+ interface ProviderEnvConfig {
238
+ /** Timeback platform (defaults to 'BEYOND_AI') */
239
+ platform?: Platform$1;
240
+ /** Target environment */
241
+ env: Environment$1;
242
+ /** OAuth2 credentials */
243
+ auth: ProviderAuth;
244
+ /** Request timeout in milliseconds */
245
+ timeout?: number;
246
+ }
247
+ /**
248
+ * Configuration for explicit URL provider.
249
+ * Single base URL for all services.
250
+ */
251
+ interface ProviderExplicitConfig {
252
+ /** Base URL for all services */
253
+ baseUrl: string;
254
+ /** OAuth2 token URL. Omit for public/no-auth services. */
255
+ authUrl?: string;
256
+ /** OAuth2 credentials. Required if authUrl is provided. */
257
+ auth?: ProviderAuth;
258
+ /** Request timeout in milliseconds */
259
+ timeout?: number;
260
+ /**
261
+ * Use a built-in path profile by name.
262
+ * Defaults to 'BEYOND_AI' if neither pathProfile nor paths is specified.
263
+ */
264
+ pathProfile?: Platform$1;
265
+ /** Custom path overrides (takes precedence over pathProfile) */
266
+ paths?: Partial<PlatformPaths>;
267
+ }
268
+ /**
269
+ * Configuration for multi-service provider.
270
+ * Different URLs for different services.
271
+ */
272
+ interface ProviderServicesConfig {
273
+ /** Per-service base URLs */
274
+ services: Partial<Record<ServiceName, string>>;
275
+ /** OAuth2 token URL. Omit for public/no-auth services. */
276
+ authUrl?: string;
277
+ /** OAuth2 credentials. Required if authUrl is provided. */
278
+ auth?: ProviderAuth;
279
+ /** Request timeout in milliseconds */
280
+ timeout?: number;
281
+ /**
282
+ * Use a built-in path profile by name.
283
+ * Defaults to 'BEYOND_AI' if neither pathProfile nor paths is specified.
284
+ */
285
+ pathProfile?: Platform$1;
286
+ /** Custom path overrides (takes precedence over pathProfile) */
287
+ paths?: Partial<PlatformPaths>;
288
+ }
289
+ /**
290
+ * Union of all provider configuration types.
291
+ */
292
+ type TimebackProviderConfig = ProviderEnvConfig | ProviderExplicitConfig | ProviderServicesConfig;
293
+
294
+ /**
295
+ * Timeback Provider
296
+ *
297
+ * Encapsulates platform connection configuration including endpoints and auth.
298
+ * Providers are complete "connection" objects that clients consume.
299
+ */
300
+
301
+ /**
302
+ * Timeback Provider - encapsulates a complete platform connection.
303
+ *
304
+ * A provider contains everything needed to connect to Timeback APIs:
305
+ * - Service endpoints (URLs)
306
+ * - Authentication credentials
307
+ * - Configuration options
308
+ *
309
+ * Providers can be created from:
310
+ * - Platform + environment (uses known Timeback endpoints)
311
+ * - Explicit base URL (single URL for all services)
312
+ * - Per-service URLs (different URLs for each service)
313
+ *
314
+ * @example
315
+ * ```typescript
316
+ * // Environment-based provider (Timeback hosted)
317
+ * const provider = new TimebackProvider({
318
+ * platform: 'BEYOND_AI',
319
+ * env: 'staging',
320
+ * auth: { clientId: '...', clientSecret: '...' },
321
+ * })
322
+ * ```
323
+ *
324
+ * @example
325
+ * ```typescript
326
+ * // Explicit URL provider (self-hosted)
327
+ * const provider = new TimebackProvider({
328
+ * baseUrl: 'https://api.myschool.edu',
329
+ * authUrl: 'https://auth.myschool.edu/oauth/token',
330
+ * auth: { clientId: '...', clientSecret: '...' },
331
+ * })
332
+ * ```
333
+ *
334
+ * @example
335
+ * ```typescript
336
+ * // Per-service URLs
337
+ * const provider = new TimebackProvider({
338
+ * services: {
339
+ * oneroster: 'https://roster.myschool.edu',
340
+ * caliper: 'https://analytics.myschool.edu',
341
+ * },
342
+ * authUrl: 'https://auth.myschool.edu/oauth/token',
343
+ * auth: { clientId: '...', clientSecret: '...' },
344
+ * })
345
+ * ```
346
+ */
347
+ declare class TimebackProvider {
348
+ /** Platform identifier (if using known platform) */
349
+ readonly platform?: Platform$1;
350
+ /** Environment (if using known platform) */
351
+ readonly env?: Environment$1;
352
+ /** OAuth2 credentials. Undefined for public/no-auth services. */
353
+ readonly auth?: ProviderAuth;
354
+ /** Request timeout in milliseconds */
355
+ readonly timeout: number;
356
+ /** Resolved endpoints for each service */
357
+ /** @internal */
358
+ readonly _endpoints: Partial<Record<ServiceName, ResolvedEndpoint>>;
359
+ /** Token URL for authentication. Undefined for public/no-auth services. */
360
+ /** @internal */
361
+ readonly _authUrl?: string;
362
+ /** OAuth2 scope to request with access tokens. */
363
+ /** @internal */
364
+ readonly _tokenScope?: string;
365
+ /** API path profiles for this platform */
366
+ /** @internal */
367
+ readonly _pathProfiles: PlatformPaths;
368
+ /** Cached TokenManagers by authUrl (for token sharing) */
369
+ /** @internal */
370
+ readonly _tokenManagers: Map<string, TokenProvider>;
371
+ /**
372
+ * Create a new TimebackProvider.
373
+ *
374
+ * @param config - Provider configuration (env-based, explicit URL, or per-service)
375
+ * @throws {Error} If configuration is invalid or missing required fields
376
+ */
377
+ constructor(config: TimebackProviderConfig);
378
+ /**
379
+ * Get the resolved endpoint for a specific service.
380
+ *
381
+ * @param service - Service name (oneroster, caliper, edubridge, qti, powerpath)
382
+ * @returns Resolved endpoint with baseUrl and authUrl
383
+ * @throws If the service is not configured in this provider
384
+ */
385
+ getEndpoint(service: ServiceName): ResolvedEndpoint;
386
+ /**
387
+ * Check if a service is available in this provider.
388
+ *
389
+ * @param service - Service name to check
390
+ * @returns True if the service is configured
391
+ */
392
+ hasService(service: ServiceName): boolean;
393
+ /**
394
+ * Get all configured service names.
395
+ *
396
+ * @returns Array of service names available in this provider
397
+ */
398
+ getAvailableServices(): ServiceName[];
399
+ /**
400
+ * Get the token URL for this provider.
401
+ * @returns The token URL for authentication
402
+ */
403
+ getTokenUrl(): string | undefined;
404
+ /**
405
+ * Get endpoint with paths for a service that has path configuration.
406
+ *
407
+ * @param service - Service name that has paths in PlatformPaths
408
+ * @returns Resolved endpoint with baseUrl, authUrl, and paths
409
+ * @throws If service is not configured or not supported on this platform
410
+ */
411
+ getEndpointWithPaths<S extends PathEnabledService>(service: S & ServiceName): ResolvedEndpoint & {
412
+ paths: NonNullable<PlatformPaths[S]>;
413
+ };
414
+ /**
415
+ * Get all path profiles for this provider (raw, may contain nulls).
416
+ *
417
+ * @returns Platform path profiles
418
+ */
419
+ getPaths(): PlatformPaths;
420
+ /**
421
+ * Get paths for a specific service.
422
+ *
423
+ * @param service - Service name
424
+ * @returns Path configuration for the service
425
+ * @throws If the service is not supported on this platform
426
+ */
427
+ getServicePaths<S extends PathEnabledService>(service: S): NonNullable<PlatformPaths[S]>;
428
+ /**
429
+ * Check if a service is supported on this platform.
430
+ *
431
+ * @param service - Service name
432
+ * @returns true if the service has path configuration
433
+ */
434
+ hasServiceSupport(service: PathEnabledService): boolean;
435
+ /**
436
+ * Get a TokenProvider for a specific service.
437
+ *
438
+ * TokenProviders are cached by authUrl, so services sharing the same
439
+ * token endpoint will share the same cached OAuth tokens.
440
+ *
441
+ * @param service - Service name (oneroster, caliper, edubridge, qti, powerpath)
442
+ * @returns Cached TokenProvider for the service's token endpoint, or undefined for public/no-auth services
443
+ * @throws If the service is not configured in this provider
444
+ * @throws If auth is required but not configured
445
+ */
446
+ getTokenProvider(service: ServiceName): TokenProvider | undefined;
447
+ /**
448
+ * Verify that OAuth authentication is working.
449
+ *
450
+ * Attempts to acquire a token using the provider's credentials.
451
+ * Returns a health check result with success/failure and latency info.
452
+ *
453
+ * @returns Auth check result
454
+ * @throws {Error} If no auth is configured on this provider
455
+ */
456
+ checkAuth(): Promise<AuthCheckResult>;
457
+ /**
458
+ * Invalidate all cached OAuth tokens.
459
+ *
460
+ * Call this when closing the client or when tokens need to be refreshed.
461
+ * New tokens will be acquired on the next API call.
462
+ */
463
+ invalidateTokens(): void;
464
+ }
465
+
466
+ /**
467
+ * All supported platforms.
468
+ */
469
+ declare const PLATFORMS: readonly ["BEYOND_AI", "LEARNWITH_AI"];
470
+
471
+ /**
472
+ * Timeback Core Types
473
+ *
474
+ * Configuration types for the unified Timeback client,
475
+ * plus re-exports of entity types from all services.
476
+ *
477
+ * @example
478
+ * ```typescript
479
+ * import type { User, School, Organization } from '@timeback/core/types'
480
+ * ```
481
+ */
482
+
483
+ /**
484
+ * Supported Timeback platform implementations.
485
+ * Derived from the PLATFORMS constant.
486
+ */
487
+ type Platform = (typeof PLATFORMS)[number];
488
+ /**
489
+ * Timeback deployment environment.
490
+ */
491
+ type Environment = 'staging' | 'production';
492
+ /**
493
+ * Resolved service URLs for environment mode.
494
+ * @internal
495
+ */
496
+ interface EnvServiceUrls {
497
+ oneroster: string;
498
+ caliper: string;
499
+ webhooks: string;
500
+ edubridge: string;
501
+ qti: string;
502
+ powerpath?: string;
503
+ authUrl: string;
504
+ }
505
+ /**
506
+ * OAuth2 client credentials for environment mode.
507
+ * Token URL is derived from the environment.
508
+ */
509
+ interface EnvAuthCredentials {
510
+ clientId: string;
511
+ clientSecret: string;
512
+ }
513
+ /**
514
+ * OAuth2 client credentials with explicit token URL.
515
+ * Required when using baseUrl or services mode.
516
+ */
517
+ interface ExplicitAuthCredentials {
518
+ clientId: string;
519
+ clientSecret: string;
520
+ authUrl: string;
521
+ }
522
+ /**
523
+ * Service endpoint configuration.
524
+ * Can be a simple URL string or an object with baseUrl and optional authUrl override.
525
+ */
526
+ type ServiceEndpoint = string | {
527
+ baseUrl: string;
528
+ authUrl?: string;
529
+ };
530
+ /**
531
+ * Explicit URLs for each service.
532
+ * All fields optional — only configure services you need.
533
+ */
534
+ interface ServiceUrls {
535
+ /** OneRoster API endpoint */
536
+ oneroster?: ServiceEndpoint;
537
+ /** Caliper API endpoint */
538
+ caliper?: ServiceEndpoint;
539
+ /** Webhooks API endpoint */
540
+ webhooks?: ServiceEndpoint;
541
+ /** Edubridge API endpoint */
542
+ edubridge?: ServiceEndpoint;
543
+ /** QTI API endpoint */
544
+ qti?: ServiceEndpoint;
545
+ /** PowerPath API endpoint */
546
+ powerpath?: ServiceEndpoint;
547
+ }
548
+ /**
549
+ * Environment mode: URLs derived from platform and environment.
3
550
  *
4
551
  * @example
5
552
  * ```typescript
6
- * import type { TimebackClientConfig, Environment } from '@timeback/core/types'
553
+ * // BeyondAI platform (default)
554
+ * const client = new TimebackClient({
555
+ * env: 'staging',
556
+ * auth: { clientId: '...', clientSecret: '...' },
557
+ * })
558
+ *
559
+ * // LearnWith.AI platform
560
+ * const client = new TimebackClient({
561
+ * platform: 'LEARNWITH_AI',
562
+ * env: 'production',
563
+ * auth: { clientId: '...', clientSecret: '...' },
564
+ * })
565
+ * ```
566
+ */
567
+ interface EnvConfig {
568
+ platform?: Platform;
569
+ env: Environment;
570
+ auth?: Partial<EnvAuthCredentials>;
571
+ timeout?: number;
572
+ }
573
+ /**
574
+ * Base URL mode: Single base URL, service paths derived automatically.
575
+ *
576
+ * @example
577
+ * ```typescript
578
+ * const client = new TimebackClient({
579
+ * baseUrl: 'https://timeback.myschool.edu',
580
+ * auth: {
581
+ * clientId: '...',
582
+ * clientSecret: '...',
583
+ * authUrl: 'https://timeback.myschool.edu/oauth/token',
584
+ * },
585
+ * })
586
+ * ```
587
+ */
588
+ interface BaseUrlConfig {
589
+ baseUrl: string;
590
+ auth: ExplicitAuthCredentials;
591
+ timeout?: number;
592
+ }
593
+ /**
594
+ * Explicit services mode: Full control over each service URL.
595
+ *
596
+ * @example
597
+ * ```typescript
598
+ * const client = new TimebackClient({
599
+ * services: {
600
+ * oneroster: 'https://roster.example.com/v1p2',
601
+ * caliper: 'https://analytics.example.com/caliper',
602
+ * edubridge: 'https://api.example.com/edubridge',
603
+ * qti: 'https://qti.example.com/api',
604
+ * },
605
+ * auth: {
606
+ * clientId: '...',
607
+ * clientSecret: '...',
608
+ * authUrl: 'https://auth.example.com/oauth/token',
609
+ * },
610
+ * })
611
+ * ```
612
+ */
613
+ interface ServicesConfig {
614
+ services: ServiceUrls;
615
+ auth: ExplicitAuthCredentials;
616
+ timeout?: number;
617
+ }
618
+ /**
619
+ * Provider mode: use a pre-built TimebackProvider.
620
+ *
621
+ * @example
622
+ * ```typescript
623
+ * import { TimebackProvider } from '@timeback/core'
624
+ *
625
+ * const provider = new TimebackProvider({
626
+ * platform: 'BEYOND_AI',
627
+ * env: 'staging',
628
+ * auth: { clientId: '...', clientSecret: '...' },
629
+ * })
630
+ *
631
+ * const client = new TimebackClient({ provider })
632
+ * ```
633
+ */
634
+ interface ProviderConfig {
635
+ provider: TimebackProvider;
636
+ }
637
+ /**
638
+ * Configuration for the unified Timeback client.
639
+ *
640
+ * Supports four modes:
641
+ * - **Provider**: `{ provider: TimebackProvider }` — pre-built provider
642
+ * - **Environment**: `{ env: 'staging' | 'production', auth: {...} }`
643
+ * - **Base URL**: `{ baseUrl: '...', auth: {..., authUrl: '...' } }`
644
+ * - **Explicit services**: `{ services: {...}, auth: {..., authUrl: '...' } }`
645
+ */
646
+ type TimebackClientConfig = ProviderConfig | EnvConfig | BaseUrlConfig | ServicesConfig;
647
+ /**
648
+ * Result of a broadcast operation for a single client.
649
+ * Similar to PromiseSettledResult but with simpler `ok` boolean.
650
+ */
651
+ type BroadcastResult<T> = {
652
+ ok: true;
653
+ value: T;
654
+ } | {
655
+ ok: false;
656
+ error: Error;
657
+ };
658
+ /**
659
+ * Convenience methods available on broadcast results.
660
+ *
661
+ * @typeParam T - The value type returned by successful operations
662
+ * @typeParam TNames - Union of client names (for typed tuples)
663
+ */
664
+ interface BroadcastResultMethods<T, TNames extends string = string> {
665
+ /** Get all successful results as [name, value] tuples */
666
+ readonly succeeded: Array<[TNames, T]>;
667
+ /** Get all failed results as [name, error] tuples */
668
+ readonly failed: Array<[TNames, Error]>;
669
+ /** True if all operations succeeded */
670
+ readonly allSucceeded: boolean;
671
+ /** True if any operation failed */
672
+ readonly anyFailed: boolean;
673
+ /** Get all successful values (throws if any failed) */
674
+ values(): T[];
675
+ }
676
+ /**
677
+ * Broadcast results with both direct property access and convenience methods.
678
+ *
679
+ * Access results directly by name or use helper methods:
680
+ *
681
+ * @typeParam T - The value type returned by successful operations
682
+ * @typeParam TNames - Union of client names (enables autocomplete)
683
+ *
684
+ * @example
685
+ * ```typescript
686
+ * const results = await manager.broadcast(c => c.oneroster.users.create(user))
687
+ *
688
+ * // Direct access (like a plain object):
689
+ * results.alpha.ok
690
+ * results['beta'].error
691
+ *
692
+ * // Convenience methods:
693
+ * if (results.allSucceeded) {
694
+ * console.log('All platforms synced!')
695
+ * }
696
+ *
697
+ * results.succeeded.forEach(([name, user]) => {
698
+ * console.log(`Created on ${name}:`, user.id)
699
+ * })
700
+ *
701
+ * results.failed.forEach(([name, error]) => {
702
+ * console.error(`Failed on ${name}:`, error.message)
703
+ * })
7
704
  * ```
8
705
  */
9
- export * from './types/index';
10
- //# sourceMappingURL=types.d.ts.map
706
+ type BroadcastResults<T, TNames extends string = string> = {
707
+ [K in TNames]: BroadcastResult<T>;
708
+ } & BroadcastResultMethods<T, TNames>;
709
+
710
+ export type { BaseUrlConfig, BroadcastResult, BroadcastResultMethods, BroadcastResults, EnvAuthCredentials, EnvConfig, EnvServiceUrls, Environment, ExplicitAuthCredentials, Platform, ProviderConfig, ServiceEndpoint, ServiceUrls, ServicesConfig, TimebackClientConfig };