@timesheet/sdk 1.0.4 → 1.1.0
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/CHANGELOG.md +67 -1
- package/README.md +103 -16
- package/dist/auth/ApiKeyAuth.d.ts +13 -0
- package/dist/auth/ApiKeyAuth.d.ts.map +1 -0
- package/dist/auth/Authentication.d.ts +8 -0
- package/dist/auth/Authentication.d.ts.map +1 -0
- package/dist/auth/OAuth21Auth.d.ts +53 -0
- package/dist/auth/OAuth21Auth.d.ts.map +1 -0
- package/dist/auth/OAuth2Auth.d.ts +22 -0
- package/dist/auth/OAuth2Auth.d.ts.map +1 -0
- package/dist/auth/OAuthDiscovery.d.ts +30 -0
- package/dist/auth/OAuthDiscovery.d.ts.map +1 -0
- package/dist/auth/OAuthMetadata.d.ts +53 -0
- package/dist/auth/OAuthMetadata.d.ts.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/pkce.d.ts +11 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/config/ClientConfig.d.ts +10 -0
- package/dist/config/ClientConfig.d.ts.map +1 -0
- package/dist/config/RetryConfig.d.ts +17 -0
- package/dist/config/RetryConfig.d.ts.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/exceptions/TimesheetApiError.d.ts +7 -0
- package/dist/exceptions/TimesheetApiError.d.ts.map +1 -0
- package/dist/exceptions/TimesheetAuthError.d.ts +5 -0
- package/dist/exceptions/TimesheetAuthError.d.ts.map +1 -0
- package/dist/exceptions/TimesheetRateLimitError.d.ts +7 -0
- package/dist/exceptions/TimesheetRateLimitError.d.ts.map +1 -0
- package/dist/exceptions/index.d.ts +4 -0
- package/dist/exceptions/index.d.ts.map +1 -0
- package/dist/http/ApiClient.d.ts +18 -0
- package/dist/http/ApiClient.d.ts.map +1 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/index.d.ts +19 -1900
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +7 -1
- package/dist/models/Absence.d.ts +136 -0
- package/dist/models/Absence.d.ts.map +1 -0
- package/dist/models/Automation.d.ts +56 -0
- package/dist/models/Automation.d.ts.map +1 -0
- package/dist/models/Contract.d.ts +141 -0
- package/dist/models/Contract.d.ts.map +1 -0
- package/dist/models/Document.d.ts +367 -0
- package/dist/models/Document.d.ts.map +1 -0
- package/dist/models/Event.d.ts +22 -0
- package/dist/models/Event.d.ts.map +1 -0
- package/dist/models/Expense.d.ts +63 -0
- package/dist/models/Expense.d.ts.map +1 -0
- package/dist/models/Note.d.ts +50 -0
- package/dist/models/Note.d.ts.map +1 -0
- package/dist/models/Organization.d.ts +88 -0
- package/dist/models/Organization.d.ts.map +1 -0
- package/dist/models/Page.d.ts +17 -0
- package/dist/models/Page.d.ts.map +1 -0
- package/dist/models/Pause.d.ts +35 -0
- package/dist/models/Pause.d.ts.map +1 -0
- package/dist/models/Profile.d.ts +54 -0
- package/dist/models/Profile.d.ts.map +1 -0
- package/dist/models/Project.d.ts +127 -0
- package/dist/models/Project.d.ts.map +1 -0
- package/dist/models/Rate.d.ts +44 -0
- package/dist/models/Rate.d.ts.map +1 -0
- package/dist/models/Reports.d.ts +343 -0
- package/dist/models/Reports.d.ts.map +1 -0
- package/dist/models/Settings.d.ts +31 -0
- package/dist/models/Settings.d.ts.map +1 -0
- package/dist/models/Tag.d.ts +37 -0
- package/dist/models/Tag.d.ts.map +1 -0
- package/dist/models/Task.d.ts +142 -0
- package/dist/models/Task.d.ts.map +1 -0
- package/dist/models/Team.d.ts +116 -0
- package/dist/models/Team.d.ts.map +1 -0
- package/dist/models/Timer.d.ts +41 -0
- package/dist/models/Timer.d.ts.map +1 -0
- package/dist/models/Todo.d.ts +58 -0
- package/dist/models/Todo.d.ts.map +1 -0
- package/dist/models/Webhook.d.ts +49 -0
- package/dist/models/Webhook.d.ts.map +1 -0
- package/dist/models/common.d.ts +40 -0
- package/dist/models/common.d.ts.map +1 -0
- package/dist/models/index.d.ts +23 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/resources/AbsenceResource.d.ts +18 -0
- package/dist/resources/AbsenceResource.d.ts.map +1 -0
- package/dist/resources/AbsenceTypeResource.d.ts +14 -0
- package/dist/resources/AbsenceTypeResource.d.ts.map +1 -0
- package/dist/resources/AutomationResource.d.ts +14 -0
- package/dist/resources/AutomationResource.d.ts.map +1 -0
- package/dist/resources/ContractResource.d.ts +18 -0
- package/dist/resources/ContractResource.d.ts.map +1 -0
- package/dist/resources/ContractTemplateResource.d.ts +14 -0
- package/dist/resources/ContractTemplateResource.d.ts.map +1 -0
- package/dist/resources/DocumentResource.d.ts +14 -0
- package/dist/resources/DocumentResource.d.ts.map +1 -0
- package/dist/resources/EventResource.d.ts +18 -0
- package/dist/resources/EventResource.d.ts.map +1 -0
- package/dist/resources/ExpenseResource.d.ts +20 -0
- package/dist/resources/ExpenseResource.d.ts.map +1 -0
- package/dist/resources/NoteResource.d.ts +19 -0
- package/dist/resources/NoteResource.d.ts.map +1 -0
- package/dist/resources/OrganizationResource.d.ts +19 -0
- package/dist/resources/OrganizationResource.d.ts.map +1 -0
- package/dist/resources/PauseResource.d.ts +14 -0
- package/dist/resources/PauseResource.d.ts.map +1 -0
- package/dist/resources/ProfileResource.d.ts +9 -0
- package/dist/resources/ProfileResource.d.ts.map +1 -0
- package/dist/resources/ProjectResource.d.ts +22 -0
- package/dist/resources/ProjectResource.d.ts.map +1 -0
- package/dist/resources/RateResource.d.ts +14 -0
- package/dist/resources/RateResource.d.ts.map +1 -0
- package/dist/resources/Resource.d.ts +13 -0
- package/dist/resources/Resource.d.ts.map +1 -0
- package/dist/resources/SettingsResource.d.ts +9 -0
- package/dist/resources/SettingsResource.d.ts.map +1 -0
- package/dist/resources/TagResource.d.ts +14 -0
- package/dist/resources/TagResource.d.ts.map +1 -0
- package/dist/resources/TaskResource.d.ts +17 -0
- package/dist/resources/TaskResource.d.ts.map +1 -0
- package/dist/resources/TeamResource.d.ts +23 -0
- package/dist/resources/TeamResource.d.ts.map +1 -0
- package/dist/resources/TimerResource.d.ts +13 -0
- package/dist/resources/TimerResource.d.ts.map +1 -0
- package/dist/resources/TodoResource.d.ts +14 -0
- package/dist/resources/TodoResource.d.ts.map +1 -0
- package/dist/resources/WebhookResource.d.ts +14 -0
- package/dist/resources/WebhookResource.d.ts.map +1 -0
- package/dist/resources/index.d.ts +25 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/reports/DocumentReportResource.d.ts +10 -0
- package/dist/resources/reports/DocumentReportResource.d.ts.map +1 -0
- package/dist/resources/reports/ExpenseReportResource.d.ts +9 -0
- package/dist/resources/reports/ExpenseReportResource.d.ts.map +1 -0
- package/dist/resources/reports/ExportResource.d.ts +24 -0
- package/dist/resources/reports/ExportResource.d.ts.map +1 -0
- package/dist/resources/reports/NoteReportResource.d.ts +9 -0
- package/dist/resources/reports/NoteReportResource.d.ts.map +1 -0
- package/dist/resources/reports/ReportsClient.d.ts +15 -0
- package/dist/resources/reports/ReportsClient.d.ts.map +1 -0
- package/dist/resources/reports/TaskReportResource.d.ts +9 -0
- package/dist/resources/reports/TaskReportResource.d.ts.map +1 -0
- package/dist/resources/reports/index.d.ts +7 -0
- package/dist/resources/reports/index.d.ts.map +1 -0
- package/dist/utils/date.d.ts +9 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/package.json +6 -17
- package/dist/index.d.mts +0 -1936
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,69 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
## [1.1.0] - 2026-05-23
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Team member management on `TeamResource`:
|
|
13
|
+
- `addMember()`, `updateMember()`, `removeMember()`, `removeInvitedMember()`
|
|
14
|
+
- `batchAddMembers()` for bulk member registration
|
|
15
|
+
- `getMemberStatus()` for retrieving members with current activity status
|
|
16
|
+
- Project member management on `ProjectResource`:
|
|
17
|
+
- `listMembers()`, `addMember()`, `getMember()`, `updateMember()`, `removeMember()`
|
|
18
|
+
- `updateMembers()` for full member-list replacement
|
|
19
|
+
- `batchAddMembers()` / `batchRemoveMembers()` for bulk operations
|
|
20
|
+
- E-invoicing fields on `Document` and `DocumentUpdateRequest`:
|
|
21
|
+
- VAT/tax IDs, registration and bank details (BIC, IBAN)
|
|
22
|
+
- Reverse charge, cash discount, payment term, delivery and due dates
|
|
23
|
+
- Order, project, procurement and contract references, cost center
|
|
24
|
+
- Government invoice flag, original invoice references
|
|
25
|
+
- E-invoice type, currency and document type fields
|
|
26
|
+
- QR code support on `Document` (`showQrCode`, `qrCodeType`, `qrCodeContent`, `qrCodeDescription`)
|
|
27
|
+
- Payment status flags on `Document` (`fullyPaid`, `partiallyPaid`)
|
|
28
|
+
- Absence file attachments: `fileName` and `fileUri` on `Absence`, `AbsenceCreateRequest`, `AbsenceUpdateRequest`
|
|
29
|
+
- Absence documentation tracking: `documentationStatus`, `documentationDueDate`, `requestedByMember` on `Absence`
|
|
30
|
+
- `ContractListParams.userId` and `ContractListParams.status` filters
|
|
31
|
+
- Extracted shared `TeamPermission` and `ProjectPermission` interfaces
|
|
32
|
+
- New types: `TeamMemberCreateRequest`, `TeamMemberUpdateRequest`, `TeamMemberProjectRegistration`, `MemberStatusParams`, `MemberStatusList`, `ProjectMemberCreateRequest`, `ProjectMemberUpdateRequest`, `ProjectMemberListParams`, `ProjectMemberList`, `ProjectRegistration`
|
|
33
|
+
- `Project.titleAndClient` and `Project.salaryVisible` convenience fields
|
|
34
|
+
- `DocumentListParams.organizationUnassigned` filter
|
|
35
|
+
- `ProjectListParams.empty` filter
|
|
36
|
+
- `TeamMemberListParams`: `withoutProjectMembers`, `userIds`, `withoutUserIds`
|
|
37
|
+
- `ListParams.search` (free-text search) and `ListParams.offset` (result offset) for all list endpoints
|
|
38
|
+
- `ApiClient.delete()` now accepts an optional request body for endpoints that support batch deletes
|
|
39
|
+
- Additional fields on `Contract`: `employmentModelName`, `holidayCollectionName`
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
- **BREAKING**: `AbsenceListParams` fields renamed from `startDateTime` / `endDateTime` to `startDate` / `endDate` to match the API
|
|
43
|
+
- **BREAKING**: `Document` monetary fields are now serialized as `string` (BigDecimal) instead of `number`: `taskSubtotal`, `expenseSubtotal`, `subtotal`, `tax`, `taxValue`, `taxSecond`, `taxSecondValue`, `discount`, `discountValue`, `discountSecondValue`, `total`, `payment`
|
|
44
|
+
- **BREAKING**: `TeamMember.uid` renamed to `TeamMember.id`; `user` field added for the linked user identifier
|
|
45
|
+
- **BREAKING**: `ProjectMember.uid` renamed to `ProjectMember.id`; `user` field added for the linked user identifier
|
|
46
|
+
- **BREAKING**: `TeamResource.getColleagues()` now returns `NavigablePage<Member>` instead of `NavigablePage<TeamMember>`
|
|
47
|
+
- **BREAKING**: `Contract.userId` removed; use `Contract.member` to access the associated user
|
|
48
|
+
- `Project.permission` and `Team.permission` now use the shared `TeamPermission` / `ProjectPermission` interfaces
|
|
49
|
+
- `ExportResource.getFields()` `scope` parameter changed from `'all' | 'project' | 'team'` to `'project' | 'team' | 'task' | 'todo'` (defaults to `'task'`)
|
|
50
|
+
- `Document.organization` (full `Organization` reference) now included alongside `organizationId`
|
|
51
|
+
- `TodoResource.list()` updated to handle the bare-array response from `GET /v1/todos`
|
|
52
|
+
|
|
53
|
+
### Removed
|
|
54
|
+
- **BREAKING**: `ContractAmendment` and `ContractAmendmentCreateRequest` types removed
|
|
55
|
+
- **BREAKING**: `ContractResource.listAmendments()` and `ContractResource.createAmendment()` removed
|
|
56
|
+
- **BREAKING**: `ProjectListParams.statistics` removed (statistics are now always included)
|
|
57
|
+
|
|
58
|
+
## [1.0.6] - 2026-01-27
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
- Replaced `tsup` / `rollup` with `esbuild` for builds to resolve native binary installation issues
|
|
62
|
+
- Type declarations are now emitted via `tsc` directly
|
|
63
|
+
|
|
64
|
+
## [1.0.5] - 2026-01-27
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
- `EventResource` for real-time Server-Sent Events (SSE) streaming
|
|
68
|
+
- File upload methods on `ExpenseResource` and `NoteResource` (`uploadFile()` and combined create-with-file helpers)
|
|
69
|
+
- `ApiClient.postMultipart()` for `multipart/form-data` requests
|
|
70
|
+
- `ApiClient.getBaseUrl()` and `ApiClient.getAuthHeaders()` to support SSE and custom transports
|
|
71
|
+
|
|
9
72
|
## [1.0.4] - 2026-01-04
|
|
10
73
|
|
|
11
74
|
### Added
|
|
@@ -100,7 +163,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
100
163
|
- Removed complex mocking in favor of simple validation tests
|
|
101
164
|
- Updated GitHub Actions to use non-deprecated action versions
|
|
102
165
|
|
|
103
|
-
[Unreleased]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0
|
|
166
|
+
[Unreleased]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.1.0...HEAD
|
|
167
|
+
[1.1.0]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.6...v1.1.0
|
|
168
|
+
[1.0.6]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.4...v1.0.6
|
|
169
|
+
[1.0.5]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.4...v1.0.5
|
|
104
170
|
[1.0.4]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.3...v1.0.4
|
|
105
171
|
[1.0.3]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.2...v1.0.3
|
|
106
172
|
[1.0.2]: https://github.com/timesheetIO/timesheet-typescript/compare/v1.0.1...v1.0.2
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ The official TypeScript SDK for the [Timesheet API](https://timesheet.io), provi
|
|
|
13
13
|
- ✅ **Type-Safe** - Full TypeScript support with comprehensive types
|
|
14
14
|
- ✅ **Modern Architecture** - Promise-based with async/await support
|
|
15
15
|
- ✅ **Authentication** - Built-in API Key, OAuth2, and OAuth 2.1 (PKCE) with automatic discovery (RFC 8414)
|
|
16
|
+
- ✅ **Real-Time Events** - Server-Sent Events (SSE) for live updates
|
|
17
|
+
- ✅ **File Uploads** - Multipart uploads for expense receipts and note attachments
|
|
16
18
|
- ✅ **Error Handling** - Typed exceptions for better error management
|
|
17
19
|
- ✅ **Pagination** - Automatic pagination with async iterators
|
|
18
20
|
- ✅ **Retry Logic** - Configurable retry with exponential backoff
|
|
@@ -225,22 +227,28 @@ const client = new TimesheetClient({
|
|
|
225
227
|
All API resources are available through the client:
|
|
226
228
|
|
|
227
229
|
```typescript
|
|
228
|
-
client.tasks
|
|
229
|
-
client.projects
|
|
230
|
-
client.tags
|
|
231
|
-
client.teams
|
|
232
|
-
client.organizations
|
|
233
|
-
client.timer
|
|
234
|
-
client.rates
|
|
235
|
-
client.expenses
|
|
236
|
-
client.notes
|
|
237
|
-
client.pauses
|
|
238
|
-
client.documents
|
|
239
|
-
client.webhooks
|
|
240
|
-
client.automations
|
|
241
|
-
client.todos
|
|
242
|
-
client.
|
|
243
|
-
client.
|
|
230
|
+
client.tasks // Task management
|
|
231
|
+
client.projects // Project management (including project members)
|
|
232
|
+
client.tags // Tag management
|
|
233
|
+
client.teams // Team management (including team members)
|
|
234
|
+
client.organizations // Organization settings
|
|
235
|
+
client.timer // Real-time time tracking
|
|
236
|
+
client.rates // Billing rates
|
|
237
|
+
client.expenses // Expense tracking (with file upload)
|
|
238
|
+
client.notes // Note attachments (with file upload)
|
|
239
|
+
client.pauses // Break time tracking
|
|
240
|
+
client.documents // Document and invoice generation
|
|
241
|
+
client.webhooks // Webhook subscriptions
|
|
242
|
+
client.automations // Time tracking automation
|
|
243
|
+
client.todos // Todo management
|
|
244
|
+
client.events // Real-time SSE event streaming
|
|
245
|
+
client.absences // Absence requests and approvals
|
|
246
|
+
client.absenceTypes // Absence type configuration
|
|
247
|
+
client.contracts // Employment contracts
|
|
248
|
+
client.contractTemplates // Contract templates
|
|
249
|
+
client.profile // User profile
|
|
250
|
+
client.settings // User settings
|
|
251
|
+
client.reports // Reports API (documents, tasks, expenses, notes, exports)
|
|
244
252
|
```
|
|
245
253
|
|
|
246
254
|
## Examples
|
|
@@ -315,6 +323,85 @@ const stoppedTimer = await client.timer.stop({
|
|
|
315
323
|
});
|
|
316
324
|
```
|
|
317
325
|
|
|
326
|
+
### Real-Time Events (SSE)
|
|
327
|
+
|
|
328
|
+
Subscribe to live changes for tasks, projects, teams, and other entities via Server-Sent Events.
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
const subscription = await client.events.subscribe({
|
|
332
|
+
onConnected: (connectionId) => {
|
|
333
|
+
console.log('Connected with ID:', connectionId);
|
|
334
|
+
},
|
|
335
|
+
onEvent: (event) => {
|
|
336
|
+
switch (event.event) {
|
|
337
|
+
case 'task.create':
|
|
338
|
+
console.log('New task:', event.item);
|
|
339
|
+
break;
|
|
340
|
+
case 'task.update':
|
|
341
|
+
console.log('Task updated:', event.item);
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
onError: (error) => {
|
|
346
|
+
console.error('SSE error:', error);
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Check connection status
|
|
351
|
+
const status = await client.events.getStatus();
|
|
352
|
+
|
|
353
|
+
// Close when done
|
|
354
|
+
subscription.close();
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### File Uploads
|
|
358
|
+
|
|
359
|
+
Attach receipts to expenses and files to notes via `multipart/form-data` uploads.
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
// Upload a receipt to an existing expense
|
|
363
|
+
await client.expenses.uploadFile('expense-id', {
|
|
364
|
+
file: fileBuffer, // Buffer, Blob, or ReadableStream
|
|
365
|
+
filename: 'receipt.pdf',
|
|
366
|
+
contentType: 'application/pdf',
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// Create a note with an attachment in one call
|
|
370
|
+
const note = await client.notes.createWithFile({
|
|
371
|
+
taskId: 'task-id',
|
|
372
|
+
description: 'Meeting notes',
|
|
373
|
+
file: fileBuffer,
|
|
374
|
+
filename: 'notes.pdf',
|
|
375
|
+
});
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Team and Project Members
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
// Add a member to a team
|
|
382
|
+
const teamMember = await client.teams.addMember('team-id', {
|
|
383
|
+
email: 'colleague@example.com',
|
|
384
|
+
permission: { role: 'manager' },
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Get team members with current activity status
|
|
388
|
+
const status = await client.teams.getMemberStatus({
|
|
389
|
+
teamId: 'team-id',
|
|
390
|
+
status: 'running', // all | active | inactive | running | idle
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
// Add a member to a project
|
|
394
|
+
await client.projects.addMember('project-id', {
|
|
395
|
+
userId: 'user-id',
|
|
396
|
+
permission: { role: 'member' },
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// List project members
|
|
400
|
+
const members = await client.projects.listMembers('project-id', {
|
|
401
|
+
status: 'active',
|
|
402
|
+
});
|
|
403
|
+
```
|
|
404
|
+
|
|
318
405
|
### Pagination
|
|
319
406
|
|
|
320
407
|
```typescript
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { Authentication } from './Authentication';
|
|
3
|
+
export declare class ApiKeyAuth implements Authentication {
|
|
4
|
+
private readonly apiKey;
|
|
5
|
+
constructor(apiKey: string);
|
|
6
|
+
private isValidFormat;
|
|
7
|
+
applyAuth(config: AxiosRequestConfig): void;
|
|
8
|
+
needsRefresh(): boolean;
|
|
9
|
+
refresh(): Promise<void>;
|
|
10
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
11
|
+
isValid(): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ApiKeyAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiKeyAuth.d.ts","sourceRoot":"","sources":["../../src/auth/ApiKeyAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQvD,qBAAa,UAAW,YAAW,cAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAuB3C,OAAO,CAAC,aAAa;IAMrB,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAO3C,YAAY,IAAI,OAAO;IAMjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAMvD,OAAO,IAAI,OAAO;CAOnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
+
export interface Authentication {
|
|
3
|
+
applyAuth(config: AxiosRequestConfig): void;
|
|
4
|
+
needsRefresh(): boolean;
|
|
5
|
+
refresh(): Promise<void>;
|
|
6
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Authentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authentication.d.ts","sourceRoot":"","sources":["../../src/auth/Authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAKhD,MAAM,WAAW,cAAc;IAM7B,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAO5C,YAAY,IAAI,OAAO,CAAC;IAOxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAKzB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { Authentication } from './Authentication';
|
|
3
|
+
import { type CodeChallengeMethod, type PkceCodePair } from './pkce';
|
|
4
|
+
export interface AuthorizationUrlOptions {
|
|
5
|
+
clientId: string;
|
|
6
|
+
redirectUri: string;
|
|
7
|
+
codeChallenge: string;
|
|
8
|
+
codeChallengeMethod?: CodeChallengeMethod;
|
|
9
|
+
state?: string;
|
|
10
|
+
scope?: string;
|
|
11
|
+
resource?: string;
|
|
12
|
+
authorizationEndpoint?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TokenExchangeOptions {
|
|
15
|
+
clientId: string;
|
|
16
|
+
clientSecret?: string;
|
|
17
|
+
authorizationCode: string;
|
|
18
|
+
redirectUri: string;
|
|
19
|
+
codeVerifier: string;
|
|
20
|
+
resource?: string;
|
|
21
|
+
tokenEndpoint?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface OAuth21RefreshOptions {
|
|
24
|
+
clientId: string;
|
|
25
|
+
clientSecret?: string;
|
|
26
|
+
refreshToken: string;
|
|
27
|
+
resource?: string;
|
|
28
|
+
tokenEndpoint?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class OAuth21Auth implements Authentication {
|
|
31
|
+
private static readonly DEFAULT_TOKEN_ENDPOINT;
|
|
32
|
+
private static readonly DEFAULT_AUTH_ENDPOINT;
|
|
33
|
+
private accessToken;
|
|
34
|
+
private refreshToken?;
|
|
35
|
+
private readonly clientId?;
|
|
36
|
+
private readonly clientSecret?;
|
|
37
|
+
private readonly resource?;
|
|
38
|
+
private readonly tokenEndpoint;
|
|
39
|
+
private tokenExpiry?;
|
|
40
|
+
private refreshPromise?;
|
|
41
|
+
constructor(accessToken: string);
|
|
42
|
+
constructor(options: OAuth21RefreshOptions);
|
|
43
|
+
applyAuth(config: AxiosRequestConfig): void;
|
|
44
|
+
needsRefresh(): boolean;
|
|
45
|
+
refresh(): Promise<void>;
|
|
46
|
+
private performRefresh;
|
|
47
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
48
|
+
static fromAuthorizationCode(options: TokenExchangeOptions): Promise<OAuth21Auth>;
|
|
49
|
+
static buildAuthorizationUrl(options: AuthorizationUrlOptions): string;
|
|
50
|
+
static generatePkce(method?: CodeChallengeMethod): PkceCodePair;
|
|
51
|
+
private parseTokenExpiry;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=OAuth21Auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuth21Auth.d.ts","sourceRoot":"","sources":["../../src/auth/OAuth21Auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,QAAQ,CAAC;AAKhB,MAAM,WAAW,uBAAuB;IAEtC,QAAQ,EAAE,MAAM,CAAC;IAEjB,WAAW,EAAE,MAAM,CAAC;IAEpB,aAAa,EAAE,MAAM,CAAC;IAEtB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAE1C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAKD,MAAM,WAAW,oBAAoB;IAEnC,QAAQ,EAAE,MAAM,CAAC;IAEjB,Y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W,CAAC;IAuEvF,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM;IA6DtE,MAAM,CAAC,YAAY,CAAC,MAAM,GAAE,mBAA4B,GAAG,YAAY;IAIvE,OAAO,CAAC,gBAAgB;CAkBzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { Authentication } from './Authentication';
|
|
3
|
+
export declare class OAuth2Auth implements Authentication {
|
|
4
|
+
private static readonly TOKEN_ENDPOINT;
|
|
5
|
+
private accessToken;
|
|
6
|
+
private refreshToken?;
|
|
7
|
+
private readonly clientId?;
|
|
8
|
+
private readonly clientSecret?;
|
|
9
|
+
private tokenExpiry?;
|
|
10
|
+
private refreshPromise?;
|
|
11
|
+
constructor(accessToken: string);
|
|
12
|
+
constructor(clientId: string, clientSecret: string, refreshToken: string);
|
|
13
|
+
applyAuth(config: AxiosRequestConfig): void;
|
|
14
|
+
needsRefresh(): boolean;
|
|
15
|
+
refresh(): Promise<void>;
|
|
16
|
+
private performRefresh;
|
|
17
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
18
|
+
static fromAuthorizationCode(clientId: string, clientSecret: string, authorizationCode: string, redirectUri: string): Promise<OAuth2Auth>;
|
|
19
|
+
static buildAuthorizationUrl(clientId: string, redirectUri: string, state?: string): string;
|
|
20
|
+
private parseTokenExpiry;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=OAuth2Auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuth2Auth.d.ts","sourceRoot":"","sources":["../../src/auth/OAuth2Auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOvD,qBAAa,UAAW,YAAW,cAAc;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA2C;IAEjF,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAS;IACvC,OAAO,CAAC,WAAW,CAAC,CAAO;IAC3B,OAAO,CAAC,cAAc,CAAC,CAAgB;gBAO3B,WAAW,EAAE,MAAM;gBASnB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAiBxE,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAO3C,YAAY,IAAI,OAAO;IAcjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAkBhB,cAAc;IAqCtB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;WAoB1C,qBAAqB,CAChC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IA+CtB,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAc3F,OAAO,CAAC,gBAAgB;CAkBzB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AuthorizationServerMetadata, OpenIdConfiguration, ProtectedResourceMetadata, OAuthDiscoveryResult } from './OAuthMetadata';
|
|
2
|
+
export interface OAuthDiscoveryOptions {
|
|
3
|
+
cacheTtl?: number;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
fetchOpenIdConfig?: boolean;
|
|
6
|
+
fetchProtectedResource?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class OAuthDiscovery {
|
|
9
|
+
private static readonly DEFAULT_CACHE_TTL;
|
|
10
|
+
private static readonly DEFAULT_TIMEOUT;
|
|
11
|
+
private readonly cache;
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(options?: OAuthDiscoveryOptions);
|
|
14
|
+
discover(issuerUrl: string): Promise<OAuthDiscoveryResult>;
|
|
15
|
+
fetchAuthorizationServerMetadata(issuerUrl: string): Promise<AuthorizationServerMetadata>;
|
|
16
|
+
fetchOpenIdConfiguration(issuerUrl: string): Promise<OpenIdConfiguration>;
|
|
17
|
+
fetchProtectedResourceMetadata(resourceUrl: string): Promise<ProtectedResourceMetadata>;
|
|
18
|
+
clearCache(): void;
|
|
19
|
+
clearCacheForIssuer(issuerUrl: string): void;
|
|
20
|
+
isCached(issuerUrl: string): boolean;
|
|
21
|
+
private normalizeIssuerUrl;
|
|
22
|
+
private getCached;
|
|
23
|
+
private setCache;
|
|
24
|
+
private validateAuthorizationServerMetadata;
|
|
25
|
+
private validateOpenIdConfiguration;
|
|
26
|
+
private validateProtectedResourceMetadata;
|
|
27
|
+
}
|
|
28
|
+
export declare function getDefaultDiscovery(): OAuthDiscovery;
|
|
29
|
+
export declare function discoverOAuth(issuerUrl: string, options?: OAuthDiscoveryOptions): Promise<OAuthDiscoveryResult>;
|
|
30
|
+
//# sourceMappingURL=OAuthDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuthDiscovery.d.ts","sourceRoot":"","sources":["../../src/auth/OAuthDiscovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAKzB,MAAM,WAAW,qBAAqB;IAEpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AA+BD,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAkB;IAC3D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEhD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;gBAE9C,OAAO,GAAE,qBAA0B;IA0BzC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgD1D,gCAAgC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAyBzF,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAyBzE,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAsB7F,UAAU,IAAI,IAAI;IAOlB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAO5C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKpC,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,mCAAmC;IAmB3C,OAAO,CAAC,2BAA2B;IAenC,OAAO,CAAC,iCAAiC;CAQ1C;AAUD,wBAAgB,mBAAmB,IAAI,cAAc,CAKpD;AAiBD,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAG/B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface AuthorizationServerMetadata {
|
|
2
|
+
issuer: string;
|
|
3
|
+
authorization_endpoint: string;
|
|
4
|
+
token_endpoint: string;
|
|
5
|
+
registration_endpoint?: string;
|
|
6
|
+
scopes_supported?: string[];
|
|
7
|
+
response_types_supported: string[];
|
|
8
|
+
grant_types_supported?: string[];
|
|
9
|
+
token_endpoint_auth_methods_supported?: string[];
|
|
10
|
+
code_challenge_methods_supported?: string[];
|
|
11
|
+
revocation_endpoint?: string;
|
|
12
|
+
revocation_endpoint_auth_methods_supported?: string[];
|
|
13
|
+
introspection_endpoint?: string;
|
|
14
|
+
introspection_endpoint_auth_methods_supported?: string[];
|
|
15
|
+
service_documentation?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ProtectedResourceMetadata {
|
|
18
|
+
resource: string;
|
|
19
|
+
authorization_servers: string[];
|
|
20
|
+
scopes_supported?: string[];
|
|
21
|
+
bearer_methods_supported?: string[];
|
|
22
|
+
resource_documentation?: string;
|
|
23
|
+
resource_signing_alg_values_supported?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface OpenIdConfiguration {
|
|
26
|
+
issuer: string;
|
|
27
|
+
authorization_endpoint: string;
|
|
28
|
+
token_endpoint: string;
|
|
29
|
+
userinfo_endpoint?: string;
|
|
30
|
+
jwks_uri: string;
|
|
31
|
+
registration_endpoint?: string;
|
|
32
|
+
scopes_supported?: string[];
|
|
33
|
+
response_types_supported: string[];
|
|
34
|
+
response_modes_supported?: string[];
|
|
35
|
+
grant_types_supported?: string[];
|
|
36
|
+
token_endpoint_auth_methods_supported?: string[];
|
|
37
|
+
token_endpoint_auth_signing_alg_values_supported?: string[];
|
|
38
|
+
service_documentation?: string;
|
|
39
|
+
ui_locales_supported?: string[];
|
|
40
|
+
op_policy_uri?: string;
|
|
41
|
+
op_tos_uri?: string;
|
|
42
|
+
revocation_endpoint?: string;
|
|
43
|
+
introspection_endpoint?: string;
|
|
44
|
+
code_challenge_methods_supported?: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface OAuthDiscoveryResult {
|
|
47
|
+
issuer: string;
|
|
48
|
+
authorizationServer: AuthorizationServerMetadata;
|
|
49
|
+
protectedResource?: ProtectedResourceMetadata;
|
|
50
|
+
openIdConfiguration?: OpenIdConfiguration;
|
|
51
|
+
fetchedAt: Date;
|
|
52
|
+
}
|
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;IAGjB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAG/B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAG5B,wBAAwB,EAAE,MAAM,EAAE,CAAC;IAGnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IAGjC,qCAAqC,CAAC,EAAE,MAAM,EAAE,CAAC;IAGjD,gDAAgD,CAAC,EAAE,MAAM,EAAE,CAAC;IAG5D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAG/B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAGhC,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAGhC,gCAAgC,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7C;AAKD,MAAM,WAAW,oBAAoB;IAEnC,MAAM,EAAE,MAAM,CAAC;IAGf,mBAAmB,EAAE,2BAA2B,CAAC;IAGjD,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAG9C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAG1C,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type CodeChallengeMethod = 'S256' | 'plain';
|
|
2
|
+
export interface PkceCodePair {
|
|
3
|
+
codeVerifier: string;
|
|
4
|
+
codeChallenge: string;
|
|
5
|
+
codeChallengeMethod: CodeChallengeMethod;
|
|
6
|
+
}
|
|
7
|
+
export declare function generateCodeVerifier(length?: number): string;
|
|
8
|
+
export declare function generateCodeChallenge(codeVerifier: string, method?: CodeChallengeMethod): string;
|
|
9
|
+
export declare function generatePkceCodePair(method?: CodeChallengeMethod, verifierLength?: number): PkceCodePair;
|
|
10
|
+
export declare function isValidCodeVerifier(codeVerifier: string): boolean;
|
|
11
|
+
//# sourceMappingURL=pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../src/auth/pkce.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAC;AAKnD,MAAM,WAAW,YAAY;IAE3B,YAAY,EAAE,MAAM,CAAC;IAErB,aAAa,EAAE,MAAM,CAAC;IAEtB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAWD,wBAAgB,oBAAoB,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM,CAQhE;AAeD,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,MAAM,GAAE,mBAA4B,GACnC,MAAM,CAQR;AAgCD,wBAAgB,oBAAoB,CAClC,MAAM,GAAE,mBAA4B,EACpC,cAAc,GAAE,MAAW,GAC1B,YAAY,CASd;AAQD,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAQjE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import type { Authentication } from '../auth/Authentication';
|
|
3
|
+
import type { RetryConfig } from './RetryConfig';
|
|
4
|
+
export interface ClientConfig {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
authentication: Authentication;
|
|
7
|
+
retryConfig: RetryConfig;
|
|
8
|
+
httpClient?: AxiosInstance;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ClientConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientConfig.d.ts","sourceRoot":"","sources":["../../src/config/ClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD,MAAM,WAAW,YAAY;IAI3B,OAAO,EAAE,MAAM,CAAC;IAKhB,cAAc,EAAE,cAAc,CAAC;IAK/B,WAAW,EAAE,WAAW,CAAC;IAKzB,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class RetryConfig {
|
|
2
|
+
readonly maxRetries: number;
|
|
3
|
+
readonly initialDelay: number;
|
|
4
|
+
readonly maxDelay: number;
|
|
5
|
+
readonly backoffMultiplier: number;
|
|
6
|
+
readonly retryableStatusCodes: number[];
|
|
7
|
+
constructor(options?: Partial<RetryConfigOptions>);
|
|
8
|
+
static default(): RetryConfig;
|
|
9
|
+
}
|
|
10
|
+
export interface RetryConfigOptions {
|
|
11
|
+
maxRetries: number;
|
|
12
|
+
initialDelay: number;
|
|
13
|
+
maxDelay: number;
|
|
14
|
+
backoffMultiplier: number;
|
|
15
|
+
retryableStatusCodes: number[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=RetryConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RetryConfig.d.ts","sourceRoot":"","sources":["../../src/config/RetryConfig.ts"],"names":[],"mappings":"AAGA,qBAAa,WAAW;IACtB,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,iBAAiB,EAAE,MAAM,CAAC;IAC1C,SAAgB,oBAAoB,EAAE,MAAM,EAAE,CAAC;gBAEnC,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAWrD,MAAM,CAAC,OAAO,IAAI,WAAW;CAG9B;AAKD,MAAM,WAAW,kBAAkB;IAKjC,UAAU,EAAE,MAAM,CAAC;IAMnB,YAAY,EAAE,MAAM,CAAC;IAMrB,QAAQ,EAAE,MAAM,CAAC;IAMjB,iBAAiB,EAAE,MAAM,CAAC;IAM1B,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class TimesheetApiError extends Error {
|
|
2
|
+
readonly statusCode?: number;
|
|
3
|
+
readonly responseBody?: string;
|
|
4
|
+
readonly errorCode?: string;
|
|
5
|
+
constructor(message: string, statusCode?: number, responseBody?: string, errorCode?: string);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=TimesheetApiError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimesheetApiError.d.ts","sourceRoot":"","sources":["../../src/exceptions/TimesheetApiError.ts"],"names":[],"mappings":"AAGA,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAUvB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAmB5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimesheetAuthError.d.ts","sourceRoot":"","sources":["../../src/exceptions/TimesheetAuthError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,qBAAa,kBAAmB,SAAQ,iBAAiB;gBAQ3C,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAY,EAAE,YAAY,CAAC,EAAE,MAAM;CAI7E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TimesheetApiError } from './TimesheetApiError';
|
|
2
|
+
export declare class TimesheetRateLimitError extends TimesheetApiError {
|
|
3
|
+
readonly retryAfter?: string;
|
|
4
|
+
constructor(message: string, retryAfter?: string);
|
|
5
|
+
getRetryAfterDate(): Date | null;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=TimesheetRateLimitError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimesheetRateLimitError.d.ts","sourceRoot":"","sources":["../../src/exceptions/TimesheetRateLimitError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,qBAAa,uBAAwB,SAAQ,iBAAiB;IAC5D,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAQxB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAWhD,iBAAiB,IAAI,IAAI,GAAG,IAAI;CAmBjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import type { ClientConfig } from '../config';
|
|
4
|
+
export declare class ApiClient {
|
|
5
|
+
private readonly config;
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(config: ClientConfig);
|
|
8
|
+
request<T>(config: AxiosRequestConfig): Promise<T>;
|
|
9
|
+
get<T, P = Record<string, unknown>>(path: string, params?: P): Promise<T>;
|
|
10
|
+
post<T, P = Record<string, unknown>>(path: string, data?: unknown, params?: P): Promise<T>;
|
|
11
|
+
put<T, P = Record<string, unknown>>(path: string, data?: unknown, params?: P): Promise<T>;
|
|
12
|
+
delete<T, P = Record<string, unknown>>(path: string, params?: P, data?: unknown): Promise<T>;
|
|
13
|
+
postMultipart<T>(path: string, formData: FormData): Promise<T>;
|
|
14
|
+
private sleep;
|
|
15
|
+
getBaseUrl(): string;
|
|
16
|
+
getAuthHeaders(): Promise<Record<string, string> | undefined>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiClient.d.ts","sourceRoot":"","sources":["../../src/http/ApiClient.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAW9C,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;gBAE/B,MAAM,EAAE,YAAY;IAiC1B,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAoElD,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAWzE,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IA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