@timeback/powerpath 0.1.1

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.
Files changed (45) hide show
  1. package/README.md +138 -0
  2. package/dist/client.d.ts +70 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/constants.d.ts +25 -0
  5. package/dist/constants.d.ts.map +1 -0
  6. package/dist/errors.d.ts +9 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +1480 -0
  9. package/dist/factory.d.ts +46 -0
  10. package/dist/factory.d.ts.map +1 -0
  11. package/dist/index.d.ts +40 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +16775 -0
  14. package/dist/lib/index.d.ts +10 -0
  15. package/dist/lib/index.d.ts.map +1 -0
  16. package/dist/lib/pagination.d.ts +20 -0
  17. package/dist/lib/pagination.d.ts.map +1 -0
  18. package/dist/lib/resolve.d.ts +21 -0
  19. package/dist/lib/resolve.d.ts.map +1 -0
  20. package/dist/lib/transport.d.ts +36 -0
  21. package/dist/lib/transport.d.ts.map +1 -0
  22. package/dist/resources/assessment.d.ts +29 -0
  23. package/dist/resources/assessment.d.ts.map +1 -0
  24. package/dist/resources/index.d.ts +7 -0
  25. package/dist/resources/index.d.ts.map +1 -0
  26. package/dist/resources/lesson-plans.d.ts +28 -0
  27. package/dist/resources/lesson-plans.d.ts.map +1 -0
  28. package/dist/resources/placement.d.ts +22 -0
  29. package/dist/resources/placement.d.ts.map +1 -0
  30. package/dist/resources/screening.d.ts +20 -0
  31. package/dist/resources/screening.d.ts.map +1 -0
  32. package/dist/resources/syllabus.d.ts +17 -0
  33. package/dist/resources/syllabus.d.ts.map +1 -0
  34. package/dist/resources/test-assignments.d.ts +63 -0
  35. package/dist/resources/test-assignments.d.ts.map +1 -0
  36. package/dist/types/client.d.ts +54 -0
  37. package/dist/types/client.d.ts.map +1 -0
  38. package/dist/types/index.d.ts +4 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types.d.ts +10 -0
  41. package/dist/types.d.ts.map +1 -0
  42. package/dist/types.js +0 -0
  43. package/dist/utils.d.ts +11 -0
  44. package/dist/utils.d.ts.map +1 -0
  45. package/package.json +45 -0
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # @timeback/powerpath
2
+
3
+ PowerPath SDK for placement tests, lesson plans, and assessment workflows.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @timeback/powerpath
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { PowerPathClient } from '@timeback/powerpath'
15
+
16
+ const client = new PowerPathClient({
17
+ env: 'staging',
18
+ auth: { clientId: 'your-client-id', clientSecret: 'your-client-secret' },
19
+ })
20
+
21
+ const { lessonPlanId } = await client.lessonPlans.create({
22
+ courseId: 'course-123',
23
+ userId: 'teacher-456',
24
+ })
25
+ ```
26
+
27
+ ## API Design
28
+
29
+ ### Standalone vs Composed
30
+
31
+ ```typescript
32
+ // Composed
33
+ import { TimebackClient } from '@timeback/core'
34
+
35
+ // Standalone
36
+ const powerpath = new PowerPathClient({ env: 'staging', auth })
37
+
38
+ const client = new TimebackClient({ env: 'staging', auth })
39
+ client.powerpath.lessonPlans.create({ courseId, userId })
40
+ ```
41
+
42
+ ### Client Structure
43
+
44
+ ```typescript
45
+ const client = new PowerPathClient(options)
46
+
47
+ client.assessments // Tests, attempts, and responses
48
+ client.lessonPlans // Course lesson plans and progress
49
+ client.placement // Placement testing
50
+ client.screening // MAP test sessions
51
+ client.syllabus // Course structure
52
+ client.testAssignments // Test assignment CRUD
53
+ ```
54
+
55
+ ### Typed Responses
56
+
57
+ All methods return typed responses:
58
+
59
+ ```typescript
60
+ import type { ExternalTestCreateResponse, GetNextPlacementTestResponse } from '@timeback/powerpath'
61
+
62
+ // Create a test - returns { lessonId, resourceId }
63
+ const test: ExternalTestCreateResponse = await client.assessments.createExternalTestOut({
64
+ courseId: 'course-123',
65
+ lessonType: 'test-out',
66
+ toolProvider: 'mastery-track',
67
+ grades: [3],
68
+ xp: 10,
69
+ resourceMetadata: { subject: 'Math' },
70
+ })
71
+ console.log(test.lessonId, test.resourceId)
72
+
73
+ // Get next placement test - returns { availableTests, lesson }
74
+ const next: GetNextPlacementTestResponse = await client.placement.getNextPlacementTest({
75
+ student: 'student-123',
76
+ subject: 'Math',
77
+ })
78
+ console.log(`${next.availableTests} tests available, next: ${next.lesson}`)
79
+ ```
80
+
81
+ ## Configuration
82
+
83
+ ```typescript
84
+ new PowerPathClient({
85
+ // Environment mode (recommended for Timeback APIs)
86
+ env: 'staging' | 'production',
87
+ auth: {
88
+ clientId: string,
89
+ clientSecret: string,
90
+ },
91
+
92
+ // OR explicit mode (custom API)
93
+ baseUrl: string,
94
+ auth: {
95
+ clientId: string,
96
+ clientSecret: string,
97
+ authUrl: string,
98
+ },
99
+
100
+ // OR provider mode (shared auth across clients)
101
+ provider: TimebackProvider,
102
+
103
+ // Optional
104
+ timeout?: number, // Request timeout in ms (default: 30000)
105
+ })
106
+ ```
107
+
108
+ Environment variables fallback:
109
+
110
+ - `POWERPATH_BASE_URL`
111
+ - `POWERPATH_TOKEN_URL`
112
+ - `POWERPATH_CLIENT_ID`
113
+ - `POWERPATH_CLIENT_SECRET`
114
+
115
+ ## Debug Mode
116
+
117
+ Enable debug logging by setting `DEBUG=1` or `DEBUG=true`:
118
+
119
+ ```bash
120
+ DEBUG=1 bun run my-script.ts
121
+ ```
122
+
123
+ ## Error Handling
124
+
125
+ ```typescript
126
+ import { NotFoundError, PowerPathError } from '@timeback/powerpath/errors'
127
+
128
+ try {
129
+ await client.testAssignments.get('missing-id')
130
+ } catch (error) {
131
+ if (error instanceof NotFoundError) {
132
+ console.log('Assignment not found')
133
+ } else if (error instanceof PowerPathError) {
134
+ console.log(error.statusCode)
135
+ console.log(error.message)
136
+ }
137
+ }
138
+ ```
@@ -0,0 +1,70 @@
1
+ /**
2
+ * PowerPath Client
3
+ *
4
+ * Main entry point for the PowerPath SDK.
5
+ */
6
+ /**
7
+ * PowerPath API client for adaptive learning workflows.
8
+ *
9
+ * Provides access to PowerPath endpoints including placement testing,
10
+ * lesson plans, assessment flow, screening sessions, and test assignments.
11
+ *
12
+ * @example Environment mode (Timeback APIs)
13
+ * ```typescript
14
+ * const client = new PowerPathClient({
15
+ * env: 'staging', // or 'production'
16
+ * auth: {
17
+ * clientId: 'your-client-id',
18
+ * clientSecret: 'your-client-secret',
19
+ * },
20
+ * })
21
+ * ```
22
+ *
23
+ * @example Provider mode (shared tokens)
24
+ * ```typescript
25
+ * import { TimebackProvider } from '@timeback/internal-client-infra'
26
+ *
27
+ * const provider = new TimebackProvider({
28
+ * platform: 'BEYOND_AI',
29
+ * env: 'staging',
30
+ * auth: { clientId: '...', clientSecret: '...' },
31
+ * })
32
+ *
33
+ * const client = new PowerPathClient({ provider })
34
+ * ```
35
+ *
36
+ * @example Explicit mode (custom API)
37
+ * ```typescript
38
+ * const client = new PowerPathClient({
39
+ * baseUrl: 'https://api.example.com',
40
+ * auth: {
41
+ * clientId: 'your-client-id',
42
+ * clientSecret: 'your-client-secret',
43
+ * authUrl: 'https://auth.example.com/oauth2/token',
44
+ * },
45
+ * })
46
+ * ```
47
+ *
48
+ * @example Environment variables fallback
49
+ * ```typescript
50
+ * // Set POWERPATH_BASE_URL, POWERPATH_TOKEN_URL,
51
+ * // POWERPATH_CLIENT_ID, POWERPATH_CLIENT_SECRET
52
+ * const client = new PowerPathClient()
53
+ * ```
54
+ */
55
+ export declare const PowerPathClient: {
56
+ new (config?: import("./types").PowerPathClientConfig): {
57
+ readonly transport: import("./types").PowerPathTransportLike;
58
+ readonly _provider?: import("@timeback/internal-client-infra").TimebackProvider | undefined;
59
+ readonly assessments: import("./resources").AssessmentResource;
60
+ readonly lessonPlans: import("./resources").LessonPlansResource;
61
+ readonly placement: import("./resources").PlacementResource;
62
+ readonly screening: import("./resources").ScreeningResource;
63
+ readonly syllabus: import("./resources").SyllabusResource;
64
+ readonly testAssignments: import("./resources").TestAssignmentsResource;
65
+ getTransport(): import("./types").PowerPathTransportLike;
66
+ checkAuth(): Promise<import("@timeback/internal-client-infra").AuthCheckResult>;
67
+ };
68
+ };
69
+ export type { PowerPathClientInstance } from './types';
70
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAA0B,CAAA;AAEtD,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * PowerPath Constants
3
+ *
4
+ * Configuration constants for the PowerPath client.
5
+ */
6
+ import type { ClientUrlMaps, Platform } from '@timeback/internal-client-infra';
7
+ /**
8
+ * Environment variable names for PowerPath configuration fallback.
9
+ */
10
+ export declare const POWERPATH_ENV_VARS: {
11
+ readonly baseUrl: "POWERPATH_BASE_URL";
12
+ readonly clientId: "POWERPATH_CLIENT_ID";
13
+ readonly clientSecret: "POWERPATH_CLIENT_SECRET";
14
+ readonly authUrl: "POWERPATH_TOKEN_URL";
15
+ };
16
+ /**
17
+ * Get URL maps for a specific platform.
18
+ * Defaults to 'BEYOND_AI' for backwards compatibility.
19
+ *
20
+ * Note: PowerPath uses the main API server.
21
+ * @param platform - Platform name
22
+ * @returns Client URL maps for the platform
23
+ */
24
+ export declare function getUrlMapsForPlatform(platform?: Platform): ClientUrlMaps;
25
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAM9E;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAA;AAMV;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,GAAE,QAA2B,GAAG,aAAa,CAM1F"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * PowerPath Error Classes
3
+ *
4
+ * Re-exports common errors from `@timeback/internal-client-infra`.
5
+ * PowerPath uses the same error format as other Timeback clients.
6
+ */
7
+ import { ApiError, ForbiddenError, InputValidationError, NotFoundError, UnauthorizedError, ValidationError } from '@timeback/internal-client-infra';
8
+ export { ApiError as PowerPathError, ForbiddenError, InputValidationError, NotFoundError, UnauthorizedError, ValidationError, };
9
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,CAAA"}