@37signals/basecamp 0.10.0 → 0.12.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/README.md +146 -14
- package/dist/client.d.ts +16 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +272 -161
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/generated/metadata.d.ts.map +1 -1
- package/dist/generated/metadata.js +178 -17
- package/dist/generated/metadata.js.map +1 -1
- package/dist/generated/metadata.ts +178 -17
- package/dist/generated/openapi-stripped.json +2126 -309
- package/dist/generated/path-mapping.d.ts.map +1 -1
- package/dist/generated/path-mapping.js +13 -1
- package/dist/generated/path-mapping.js.map +1 -1
- package/dist/generated/path-mapping.ts +13 -1
- package/dist/generated/schema.d.ts +1416 -176
- package/dist/generated/services/bookmarks.d.ts +76 -0
- package/dist/generated/services/bookmarks.d.ts.map +1 -0
- package/dist/generated/services/bookmarks.js +114 -0
- package/dist/generated/services/bookmarks.js.map +1 -0
- package/dist/generated/services/bookmarks.ts +158 -0
- package/dist/generated/services/calendars.d.ts +47 -0
- package/dist/generated/services/calendars.d.ts.map +1 -0
- package/dist/generated/services/calendars.js +73 -0
- package/dist/generated/services/calendars.js.map +1 -0
- package/dist/generated/services/calendars.ts +102 -0
- package/dist/generated/services/drafts.d.ts +38 -0
- package/dist/generated/services/drafts.d.ts.map +1 -0
- package/dist/generated/services/drafts.js +40 -0
- package/dist/generated/services/drafts.js.map +1 -0
- package/dist/generated/services/drafts.ts +67 -0
- package/dist/generated/services/everything.d.ts +69 -22
- package/dist/generated/services/everything.d.ts.map +1 -1
- package/dist/generated/services/everything.js +23 -35
- package/dist/generated/services/everything.js.map +1 -1
- package/dist/generated/services/everything.ts +86 -49
- package/dist/generated/services/index.d.ts +6 -2
- package/dist/generated/services/index.d.ts.map +1 -1
- package/dist/generated/services/index.js +6 -2
- package/dist/generated/services/index.js.map +1 -1
- package/dist/generated/services/index.ts +6 -2
- package/dist/generated/services/my-assignments.d.ts +52 -0
- package/dist/generated/services/my-assignments.d.ts.map +1 -1
- package/dist/generated/services/my-assignments.js +71 -0
- package/dist/generated/services/my-assignments.js.map +1 -1
- package/dist/generated/services/my-assignments.ts +104 -0
- package/dist/generated/services/my-notes.d.ts +45 -0
- package/dist/generated/services/my-notes.d.ts.map +1 -0
- package/dist/generated/services/my-notes.js +62 -0
- package/dist/generated/services/my-notes.js.map +1 -0
- package/dist/generated/services/my-notes.ts +92 -0
- package/dist/generated/services/todos.d.ts +33 -0
- package/dist/generated/services/todos.d.ts.map +1 -1
- package/dist/generated/services/todos.js +46 -0
- package/dist/generated/services/todos.js.map +1 -1
- package/dist/generated/services/todos.ts +71 -0
- package/dist/hooks/otel.d.ts +1 -1
- package/dist/hooks/otel.js +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +4 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/oauth/device-errors.d.ts +29 -0
- package/dist/oauth/device-errors.d.ts.map +1 -0
- package/dist/oauth/device-errors.js +52 -0
- package/dist/oauth/device-errors.js.map +1 -0
- package/dist/oauth/device-login.d.ts +50 -0
- package/dist/oauth/device-login.d.ts.map +1 -0
- package/dist/oauth/device-login.js +118 -0
- package/dist/oauth/device-login.js.map +1 -0
- package/dist/oauth/device.d.ts +112 -0
- package/dist/oauth/device.d.ts.map +1 -0
- package/dist/oauth/device.js +746 -0
- package/dist/oauth/device.js.map +1 -0
- package/dist/oauth/discovery.d.ts.map +1 -1
- package/dist/oauth/discovery.js +1 -0
- package/dist/oauth/discovery.js.map +1 -1
- package/dist/oauth/exchange.d.ts.map +1 -1
- package/dist/oauth/exchange.js +75 -9
- package/dist/oauth/exchange.js.map +1 -1
- package/dist/oauth/index.d.ts +4 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +4 -0
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/limits.d.ts +15 -0
- package/dist/oauth/limits.d.ts.map +1 -0
- package/dist/oauth/limits.js +15 -0
- package/dist/oauth/limits.js.map +1 -0
- package/dist/oauth/token-manager.d.ts.map +1 -1
- package/dist/oauth/token-manager.js +15 -4
- package/dist/oauth/token-manager.js.map +1 -1
- package/dist/oauth/token-store.d.ts.map +1 -1
- package/dist/oauth/token-store.js +6 -0
- package/dist/oauth/token-store.js.map +1 -1
- package/dist/oauth/types.d.ts +35 -3
- package/dist/oauth/types.d.ts.map +1 -1
- package/dist/pagination.d.ts +6 -2
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/services/base.d.ts +3 -1
- package/dist/services/base.d.ts.map +1 -1
- package/dist/services/base.js +16 -5
- package/dist/services/base.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/metadata.ts +178 -17
- package/src/generated/openapi-stripped.json +2126 -309
- package/src/generated/path-mapping.ts +13 -1
- package/src/generated/schema.d.ts +1416 -176
- package/src/generated/services/bookmarks.ts +158 -0
- package/src/generated/services/calendars.ts +102 -0
- package/src/generated/services/drafts.ts +67 -0
- package/src/generated/services/everything.ts +86 -49
- package/src/generated/services/index.ts +6 -2
- package/src/generated/services/my-assignments.ts +104 -0
- package/src/generated/services/my-notes.ts +92 -0
- package/src/generated/services/todos.ts +71 -0
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* // High-level service methods
|
|
16
16
|
* const projects = await client.projects.list();
|
|
17
|
-
* const todo = await client.todos.create(
|
|
17
|
+
* const todo = await client.todos.create(todolistId, {
|
|
18
18
|
* content: "Ship the feature",
|
|
19
19
|
* assigneeIds: [userId],
|
|
20
20
|
* });
|
|
@@ -41,7 +41,7 @@ export { BaseService, type FetchResponse } from "./services/base.js";
|
|
|
41
41
|
export { AuthorizationService, type Identity, type AuthorizedAccount, type AuthorizationInfo, type GetAuthorizationInfoOptions, } from "./services/authorization.js";
|
|
42
42
|
export { ProjectsService, type Project, type ListProjectOptions, type CreateProjectRequest, type UpdateProjectRequest, } from "./generated/services/projects.js";
|
|
43
43
|
export { TodosService, type UpdateTodoRequest, type TodoFields, } from "./services/todos-extensions.js";
|
|
44
|
-
export { type Todo, type ListTodoOptions, type CreateTodoRequest, type ReplaceTodoRequest, type RepositionTodoRequest, } from "./generated/services/todos.js";
|
|
44
|
+
export { type Todo, type ListTodoOptions, type CreateTodoRequest, type CreateTodosetTodoTodoRequest, type ReplaceTodoRequest, type RepositionTodoRequest, } from "./generated/services/todos.js";
|
|
45
45
|
export { TodolistsService, type Todolist, type ListTodolistOptions, type CreateTodolistRequest, type UpdateTodolistRequest, type RepositionTodolistRequest, } from "./generated/services/todolists.js";
|
|
46
46
|
export { TodosetsService, type Todoset, } from "./generated/services/todosets.js";
|
|
47
47
|
export { HillChartsService, type UpdateSettingsHillChartRequest, } from "./generated/services/hill-charts.js";
|
|
@@ -68,6 +68,10 @@ export { WebhookReceiver, WebhookVerificationError, type WebhookEventHandler, ty
|
|
|
68
68
|
export { verifyWebhookSignature, signWebhookPayload } from "./webhooks/verify.js";
|
|
69
69
|
export { parseEventKind, WebhookEventKind, type WebhookEvent, type WebhookDelivery, type WebhookDeliveryRequest, type WebhookDeliveryResponse, type WebhookCopy, } from "./webhooks/events.js";
|
|
70
70
|
export { createNodeHandler, type NodeHandlerOptions } from "./webhooks/adapters/node-http.js";
|
|
71
|
+
export { BookmarksService, type Bookmark, type BookmarkStatus, type ListMyBookmarksBookmarkOptions, } from "./generated/services/bookmarks.js";
|
|
72
|
+
export { DraftsService, type Draft, type ListMyDraftsDraftOptions, } from "./generated/services/drafts.js";
|
|
73
|
+
export { CalendarsService, type Calendar, type UpdateCalendarCalendarRequest, } from "./generated/services/calendars.js";
|
|
74
|
+
export { MyNotesService, type MyNote, type UpdateMyNoteMyNoteRequest, } from "./generated/services/my-notes.js";
|
|
71
75
|
export { SubscriptionsService, type Subscription, type UpdateSubscriptionRequest, } from "./generated/services/subscriptions.js";
|
|
72
76
|
export { EventsService, type Event, } from "./generated/services/events.js";
|
|
73
77
|
export { AttachmentsService, } from "./generated/services/attachments.js";
|
|
@@ -78,7 +82,7 @@ export { type Upload, type CreateUploadRequest, type UpdateUploadRequest, } from
|
|
|
78
82
|
export { SchedulesService, type Schedule, type ScheduleEntry, type CreateEntryScheduleRequest, type UpdateEntryScheduleRequest, type UpdateSettingsScheduleRequest, type ListEntriesScheduleOptions, } from "./generated/services/schedules.js";
|
|
79
83
|
export { TimesheetsService, type ForRecordingTimesheetOptions, type ForProjectTimesheetOptions, type ReportTimesheetOptions, } from "./generated/services/timesheets.js";
|
|
80
84
|
export { TimelineService, } from "./generated/services/timeline.js";
|
|
81
|
-
export { EverythingService, type
|
|
85
|
+
export { EverythingService, type EverythingFile, type BucketTodosGroup, type BucketCardsGroup, type EverythingMessagesEverythingOptions, type EverythingCommentsEverythingOptions, type EverythingCheckinsEverythingOptions, type EverythingForwardsEverythingOptions, type EverythingFilesEverythingOptions, type EverythingOpenTodosEverythingOptions, type EverythingCompletedTodosEverythingOptions, type EverythingUnassignedTodosEverythingOptions, type EverythingNoDueDateTodosEverythingOptions, type EverythingOpenCardsEverythingOptions, type EverythingCompletedCardsEverythingOptions, type EverythingUnassignedCardsEverythingOptions, type EverythingNoDueDateCardsEverythingOptions, type EverythingNotNowCardsEverythingOptions, } from "./generated/services/everything.js";
|
|
82
86
|
export { SearchService, type SearchSearchOptions, } from "./generated/services/search.js";
|
|
83
87
|
export { ReportsService, type PersonProgressReportOptions, } from "./generated/services/reports.js";
|
|
84
88
|
export { RecordingsService, type Recording, type ListRecordingOptions, } from "./generated/services/recordings.js";
|
|
@@ -93,8 +97,12 @@ export { GaugesService, } from "./generated/services/gauges.js";
|
|
|
93
97
|
export { MyAssignmentsService, } from "./generated/services/my-assignments.js";
|
|
94
98
|
export { MyNotificationsService, } from "./generated/services/my-notifications.js";
|
|
95
99
|
export { otelHooks, type OtelHooksOptions, } from "./hooks/otel.js";
|
|
96
|
-
export type { OAuthConfig, OAuthToken, ExchangeRequest, RefreshRequest, RawTokenResponse, OAuthErrorResponse, ProtectedResourceMetadata, FallbackReason, DiscoverySelectionErrorReason, DiscoverFromResourceResult, } from "./oauth/types.js";
|
|
100
|
+
export type { OAuthConfig, OAuthToken, ExchangeRequest, RefreshRequest, RawTokenResponse, OAuthErrorResponse, ProtectedResourceMetadata, FallbackReason, DiscoverySelectionErrorReason, DiscoverFromResourceResult, DeviceAuthorization, } from "./oauth/types.js";
|
|
97
101
|
export { discover, discoverProtectedResource, discoverFromResource, discoverLaunchpad, requireOriginRoot, DiscoverySelectionError, LAUNCHPAD_BASE_URL, type DiscoverOptions, type DiscoverFromResourceOptions, } from "./oauth/discovery.js";
|
|
102
|
+
export { requestDeviceAuthorization, pollDeviceToken, DEVICE_CODE_GRANT_TYPE, type RequestDeviceAuthorizationParams, type PollDeviceTokenParams, type MonotonicClock, } from "./oauth/device.js";
|
|
103
|
+
export { performDeviceLogin, type DeviceLoginOptions, } from "./oauth/device-login.js";
|
|
104
|
+
export { DeviceFlowError, type DeviceFlowReason, } from "./oauth/device-errors.js";
|
|
105
|
+
export { performInteractiveLogin, type InteractiveLoginOptions, } from "./oauth/interactive-login.js";
|
|
98
106
|
export { exchangeCode, refreshToken, isTokenExpired, type TokenOptions, } from "./oauth/exchange.js";
|
|
99
107
|
export { generatePKCE, generateState, type PKCE, } from "./oauth/pkce.js";
|
|
100
108
|
export { redactHeaders, redactHeadersRecord, } from "./security.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,WAAW,EACX,KAAK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d,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,2BAA2B,GACjC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,KAAK,IAAI,GACV,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,aAAa,EACb,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAGvB,YAAY,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* // High-level service methods
|
|
16
16
|
* const projects = await client.projects.list();
|
|
17
|
-
* const todo = await client.todos.create(
|
|
17
|
+
* const todo = await client.todos.create(todolistId, {
|
|
18
18
|
* content: "Ship the feature",
|
|
19
19
|
* assigneeIds: [userId],
|
|
20
20
|
* });
|
|
@@ -90,6 +90,10 @@ export { WebhookReceiver, WebhookVerificationError, } from "./webhooks/handler.j
|
|
|
90
90
|
export { verifyWebhookSignature, signWebhookPayload } from "./webhooks/verify.js";
|
|
91
91
|
export { parseEventKind, WebhookEventKind, } from "./webhooks/events.js";
|
|
92
92
|
export { createNodeHandler } from "./webhooks/adapters/node-http.js";
|
|
93
|
+
export { BookmarksService, } from "./generated/services/bookmarks.js";
|
|
94
|
+
export { DraftsService, } from "./generated/services/drafts.js";
|
|
95
|
+
export { CalendarsService, } from "./generated/services/calendars.js";
|
|
96
|
+
export { MyNotesService, } from "./generated/services/my-notes.js";
|
|
93
97
|
export { SubscriptionsService, } from "./generated/services/subscriptions.js";
|
|
94
98
|
export { EventsService, } from "./generated/services/events.js";
|
|
95
99
|
// File services - generated
|
|
@@ -129,8 +133,14 @@ export { MyAssignmentsService, } from "./generated/services/my-assignments.js";
|
|
|
129
133
|
export { MyNotificationsService, } from "./generated/services/my-notifications.js";
|
|
130
134
|
// OpenTelemetry hooks
|
|
131
135
|
export { otelHooks, } from "./hooks/otel.js";
|
|
132
|
-
// OAuth
|
|
136
|
+
// OAuth discovery (single-hop RFC 8414 + resource-first RFC 9728)
|
|
133
137
|
export { discover, discoverProtectedResource, discoverFromResource, discoverLaunchpad, requireOriginRoot, DiscoverySelectionError, LAUNCHPAD_BASE_URL, } from "./oauth/discovery.js";
|
|
138
|
+
// Device authorization grant (RFC 8628)
|
|
139
|
+
export { requestDeviceAuthorization, pollDeviceToken, DEVICE_CODE_GRANT_TYPE, } from "./oauth/device.js";
|
|
140
|
+
export { performDeviceLogin, } from "./oauth/device-login.js";
|
|
141
|
+
export { DeviceFlowError, } from "./oauth/device-errors.js";
|
|
142
|
+
// Interactive login (authorization-code flow orchestrator)
|
|
143
|
+
export { performInteractiveLogin, } from "./oauth/interactive-login.js";
|
|
134
144
|
export { exchangeCode, refreshToken, isTokenExpired, } from "./oauth/exchange.js";
|
|
135
145
|
// PKCE utilities
|
|
136
146
|
export { generatePKCE, generateState, } from "./oauth/pkce.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,sBAAsB;AACtB,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,WAAW,GAKZ,MAAM,aAAa,CAAC;AAErB,4BAA4B;AAC5B,OAAO,EAAqB,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/E,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEzD,iCAAiC;AACjC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAyC,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEhF,WAAW;AACX,OAAO,EAAuB,eAAe,EAAE,MAAM,eAAe,CAAC;AAErE,SAAS;AACT,OAAO,EACL,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,eAAe,EACf,WAAW,GAGZ,MAAM,aAAa,CAAC;AAErB,QAAQ;AACR,OAAO,EACL,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,GAOX,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AAChF,uDAAuD;AACvD,gFAAgF;AAEhF,6DAA6D;AAC7D,OAAO,EAAE,WAAW,EAAsB,MAAM,oBAAoB,CAAC;AAErE,yEAAyE;AACzE,OAAO,EACL,oBAAoB,GAKrB,MAAM,6BAA6B,CAAC;AAErC,4BAA4B;AAC5B,OAAO,EACL,eAAe,GAKhB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,YAAY,GAGb,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,sBAAsB;AACtB,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,WAAW,GAK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vC,6BAA6B;AAC7B,OAAO,EACL,aAAa,GAMd,MAAM,gCAAgC,CAAC;AAExC,8BAA8B;AAC9B,OAAO,EACL,cAAc,GACf,MAAM,iCAAiC,CAAC;AAEzC,6BAA6B;AAC7B,OAAO,EACL,aAAa,GACd,MAAM,gCAAgC,CAAC;AAExC,qCAAqC;AACrC,OAAO,EACL,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAEhD,uCAAuC;AACvC,OAAO,EACL,sBAAsB,GACvB,MAAM,0CAA0C,CAAC;AAElD,sBAAsB;AACtB,OAAO,EACL,SAAS,GAEV,MAAM,iBAAiB,CAAC;AAqBzB,kEAAkE;AAClE,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,GAGnB,MAAM,sBAAsB,CAAC;AAE9B,wCAAwC;AACxC,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,GAIvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,GAEhB,MAAM,0BAA0B,CAAC;AAElC,2DAA2D;AAC3D,OAAO,EACL,uBAAuB,GAExB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,GAEf,MAAM,qBAAqB,CAAC;AAE7B,iBAAiB;AACjB,OAAO,EACL,YAAY,EACZ,aAAa,GAEd,MAAM,iBAAiB,CAAC;AAEzB,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,OAAO,EACL,aAAa,EACb,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal errors for the RFC 8628 device authorization grant.
|
|
3
|
+
*
|
|
4
|
+
* A single {@link DeviceFlowError} carries a {@link DeviceFlowReason}; the parent
|
|
5
|
+
* BasecampError category is DERIVED from the reason (SPEC.md §16), so callers can
|
|
6
|
+
* branch on either `.reason` (precise) or `.code`/`.exitCode` (coarse).
|
|
7
|
+
*/
|
|
8
|
+
import { BasecampError, type BasecampErrorOptions } from "../errors.js";
|
|
9
|
+
/**
|
|
10
|
+
* Why a device flow terminated.
|
|
11
|
+
*
|
|
12
|
+
* - `access_denied` — the user declined the authorization → auth
|
|
13
|
+
* - `expired` — the device/user code expired before approval → auth
|
|
14
|
+
* - `transport` — a network failure ended the flow → network (retryable)
|
|
15
|
+
* - `unavailable` — the selected AS cannot do device flow → validation
|
|
16
|
+
* - `cancelled` — the caller cancelled (aborted) the flow → usage
|
|
17
|
+
*/
|
|
18
|
+
export type DeviceFlowReason = "access_denied" | "expired" | "transport" | "unavailable" | "cancelled";
|
|
19
|
+
/**
|
|
20
|
+
* Terminal device-flow error. Its `code` (and thus `exitCode`) is derived from
|
|
21
|
+
* `reason`; `transport` is retryable.
|
|
22
|
+
*/
|
|
23
|
+
export declare class DeviceFlowError extends BasecampError {
|
|
24
|
+
readonly reason: DeviceFlowReason;
|
|
25
|
+
constructor(reason: DeviceFlowReason, message: string, options?: BasecampErrorOptions);
|
|
26
|
+
/** Serializes like BasecampError, plus the precise device-flow reason. */
|
|
27
|
+
toJSON(): Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=device-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-errors.d.ts","sourceRoot":"","sources":["../../src/oauth/device-errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAkB,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAExF;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,SAAS,GACT,WAAW,GACX,aAAa,GACb,WAAW,CAAC;AAwBhB;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAChD,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;gBAEtB,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB;IAYrF,0EAA0E;IAC1E,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGlC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal errors for the RFC 8628 device authorization grant.
|
|
3
|
+
*
|
|
4
|
+
* A single {@link DeviceFlowError} carries a {@link DeviceFlowReason}; the parent
|
|
5
|
+
* BasecampError category is DERIVED from the reason (SPEC.md §16), so callers can
|
|
6
|
+
* branch on either `.reason` (precise) or `.code`/`.exitCode` (coarse).
|
|
7
|
+
*/
|
|
8
|
+
import { BasecampError } from "../errors.js";
|
|
9
|
+
/** Maps a device-flow reason to its parent BasecampError category. */
|
|
10
|
+
function categoryFor(reason) {
|
|
11
|
+
switch (reason) {
|
|
12
|
+
case "access_denied":
|
|
13
|
+
case "expired":
|
|
14
|
+
return "auth_required";
|
|
15
|
+
case "transport":
|
|
16
|
+
return "network";
|
|
17
|
+
case "unavailable":
|
|
18
|
+
return "validation";
|
|
19
|
+
case "cancelled":
|
|
20
|
+
return "usage";
|
|
21
|
+
default:
|
|
22
|
+
// DeviceFlowReason is an exhaustive union in TS, but this is a public
|
|
23
|
+
// runtime class: a JS caller can still construct new DeviceFlowError(
|
|
24
|
+
// "some_new_reason", …). Fall back to "api_error" — the cross-SDK default
|
|
25
|
+
// for unknown reasons (Go/Ruby/Python/Kotlin do the same) — rather than
|
|
26
|
+
// returning undefined, which would give BasecampError an invalid code.
|
|
27
|
+
return "api_error";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Terminal device-flow error. Its `code` (and thus `exitCode`) is derived from
|
|
32
|
+
* `reason`; `transport` is retryable.
|
|
33
|
+
*/
|
|
34
|
+
export class DeviceFlowError extends BasecampError {
|
|
35
|
+
reason;
|
|
36
|
+
constructor(reason, message, options) {
|
|
37
|
+
// The reason derives retryability authoritatively: spread caller options
|
|
38
|
+
// FIRST so a caller-supplied `retryable` cannot flip the reason's verdict
|
|
39
|
+
// (only `transport` is retryable).
|
|
40
|
+
super(categoryFor(reason), message, {
|
|
41
|
+
...options,
|
|
42
|
+
retryable: reason === "transport",
|
|
43
|
+
});
|
|
44
|
+
this.name = "DeviceFlowError";
|
|
45
|
+
this.reason = reason;
|
|
46
|
+
}
|
|
47
|
+
/** Serializes like BasecampError, plus the precise device-flow reason. */
|
|
48
|
+
toJSON() {
|
|
49
|
+
return { ...super.toJSON(), reason: this.reason };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=device-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-errors.js","sourceRoot":"","sources":["../../src/oauth/device-errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAA6C,MAAM,cAAc,CAAC;AAkBxF,sEAAsE;AACtE,SAAS,WAAW,CAAC,MAAwB;IAC3C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,eAAe,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,eAAe,CAAC;QACzB,KAAK,WAAW;YACd,OAAO,SAAS,CAAC;QACnB,KAAK,aAAa;YAChB,OAAO,YAAY,CAAC;QACtB,KAAK,WAAW;YACd,OAAO,OAAO,CAAC;QACjB;YACE,sEAAsE;YACtE,sEAAsE;YACtE,0EAA0E;YAC1E,wEAAwE;YACxE,uEAAuE;YACvE,OAAO,WAAW,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IACvC,MAAM,CAAmB;IAElC,YAAY,MAAwB,EAAE,OAAe,EAAE,OAA8B;QACnF,yEAAyE;QACzE,0EAA0E;QAC1E,mCAAmC;QACnC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE;YAClC,GAAG,OAAO;YACV,SAAS,EAAE,MAAM,KAAK,WAAW;SAClC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,0EAA0E;IAC1E,MAAM;QACJ,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 8628 device login orchestration.
|
|
3
|
+
*
|
|
4
|
+
* `performDeviceLogin` accepts an ALREADY-SELECTED OAuthConfig (from discovery),
|
|
5
|
+
* guards the device capability, requests a device code, surfaces it through a
|
|
6
|
+
* display hook, and polls for the token.
|
|
7
|
+
*/
|
|
8
|
+
import { type MonotonicClock } from "./device.js";
|
|
9
|
+
import type { OAuthConfig, OAuthToken, DeviceAuthorization } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Options for {@link performDeviceLogin}.
|
|
12
|
+
*/
|
|
13
|
+
export interface DeviceLoginOptions {
|
|
14
|
+
/** The already-selected authorization-server config (from discovery). */
|
|
15
|
+
config: OAuthConfig;
|
|
16
|
+
/** The public client id (e.g. "basecamp-cli"). */
|
|
17
|
+
clientId: string;
|
|
18
|
+
/** Requested scope. Omitted → server default (`read`). */
|
|
19
|
+
scope?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Display hook: show the user the verification URI + user code. Called once,
|
|
22
|
+
* after the device code is obtained and before polling begins.
|
|
23
|
+
*/
|
|
24
|
+
display: (auth: DeviceAuthorization) => void | Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Cancellation signal for the WHOLE flow: checked before any work, threaded
|
|
27
|
+
* into the device-code request (an abort cancels it in flight), re-checked
|
|
28
|
+
* before the display hook, and honored throughout the polling loop. An
|
|
29
|
+
* abort anywhere rejects with DeviceFlowError("cancelled") — a code is
|
|
30
|
+
* never surfaced after cancellation.
|
|
31
|
+
*/
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
/** Injectable monotonic clock (ms) for the polling deadline. */
|
|
34
|
+
clock?: MonotonicClock;
|
|
35
|
+
/** Custom fetch (testing). */
|
|
36
|
+
fetch?: typeof globalThis.fetch;
|
|
37
|
+
/**
|
|
38
|
+
* Injectable sleep (testing). Forwarded to the poll loop so tests can drive the
|
|
39
|
+
* interval schedule without real delays; defaults to a real, abortable timer.
|
|
40
|
+
*/
|
|
41
|
+
sleepFn?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Runs the full device authorization grant against a selected config.
|
|
45
|
+
*
|
|
46
|
+
* @throws DeviceFlowError("unavailable") when the config cannot do device flow;
|
|
47
|
+
* other DeviceFlowError reasons on denial/expiry/transport/cancellation.
|
|
48
|
+
*/
|
|
49
|
+
export declare function performDeviceLogin(options: DeviceLoginOptions): Promise<OAuthToken>;
|
|
50
|
+
//# sourceMappingURL=device-login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-login.d.ts","sourceRoot":"","sources":["../../src/oauth/device-login.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,MAAM,EAAE,WAAW,CAAC;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,gEAAgE;IAChE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAmHzF"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 8628 device login orchestration.
|
|
3
|
+
*
|
|
4
|
+
* `performDeviceLogin` accepts an ALREADY-SELECTED OAuthConfig (from discovery),
|
|
5
|
+
* guards the device capability, requests a device code, surfaces it through a
|
|
6
|
+
* display hook, and polls for the token.
|
|
7
|
+
*/
|
|
8
|
+
import { BasecampError } from "../errors.js";
|
|
9
|
+
import { DeviceFlowError } from "./device-errors.js";
|
|
10
|
+
import { requestDeviceAuthorization, pollDeviceToken, throwIfAborted, validatedClockSample, DEVICE_CODE_GRANT_TYPE, defaultClock, } from "./device.js";
|
|
11
|
+
/**
|
|
12
|
+
* Runs the full device authorization grant against a selected config.
|
|
13
|
+
*
|
|
14
|
+
* @throws DeviceFlowError("unavailable") when the config cannot do device flow;
|
|
15
|
+
* other DeviceFlowError reasons on denial/expiry/transport/cancellation.
|
|
16
|
+
*/
|
|
17
|
+
export async function performDeviceLogin(options) {
|
|
18
|
+
const { config, clientId, scope, display, signal, clock = defaultClock, fetch: customFetch, sleepFn } = options;
|
|
19
|
+
// Capability guard requires BOTH the endpoint and the advertised grant type.
|
|
20
|
+
// Require a genuine array: a manually-constructed config could supply
|
|
21
|
+
// grantTypesSupported as a string, and String.prototype.includes would
|
|
22
|
+
// substring-match and wrongly pass the guard (the other SDKs defend the same
|
|
23
|
+
// way — Python/Ruby check the collection type, Go/Kotlin are statically typed).
|
|
24
|
+
const supportsDeviceGrant = Array.isArray(config.grantTypesSupported) && config.grantTypesSupported.includes(DEVICE_CODE_GRANT_TYPE);
|
|
25
|
+
if (!config.deviceAuthorizationEndpoint || !supportsDeviceGrant) {
|
|
26
|
+
throw new DeviceFlowError("unavailable", "The selected authorization server does not support the device authorization grant");
|
|
27
|
+
}
|
|
28
|
+
// A non-function display is a usage error, not a late TypeError: it is the
|
|
29
|
+
// only mechanism surfacing the verification code, so dereferencing it AFTER
|
|
30
|
+
// the request would mint a code nobody can approve. Reject before any
|
|
31
|
+
// network activity (matching Go) — a JS caller can pass anything.
|
|
32
|
+
if (typeof display !== "function") {
|
|
33
|
+
throw new BasecampError("usage", "performDeviceLogin requires a display callback function");
|
|
34
|
+
}
|
|
35
|
+
// Honor a cancellation raised before any work: an already-aborted signal
|
|
36
|
+
// must not fire the authorization request or surface a code via display.
|
|
37
|
+
throwIfAborted(signal);
|
|
38
|
+
const auth = await requestDeviceAuthorization({
|
|
39
|
+
deviceAuthorizationEndpoint: config.deviceAuthorizationEndpoint,
|
|
40
|
+
clientId,
|
|
41
|
+
scope,
|
|
42
|
+
fetch: customFetch,
|
|
43
|
+
// Threaded so an abort DURING the request cancels it in flight and
|
|
44
|
+
// surfaces as the contractual cancelled — never a code shown post-cancel.
|
|
45
|
+
signal,
|
|
46
|
+
});
|
|
47
|
+
// Anchor the code's lifetime at ISSUANCE — the response's arrival, per
|
|
48
|
+
// SPEC §16 — before the display hook, so a slow display eats into the
|
|
49
|
+
// deadline instead of resetting it. Expiry past this point is arbitrated
|
|
50
|
+
// by the server (expired_token), so receipt-anchoring fails safe.
|
|
51
|
+
// Validated like the poller's samples — a malformed injected clock is the
|
|
52
|
+
// typed usage error before the code is surfaced.
|
|
53
|
+
const issuedAt = validatedClockSample(clock(), "performDeviceLogin");
|
|
54
|
+
// Re-check before surfacing the code: an abort racing the request's
|
|
55
|
+
// completion — or landing during the clock sample above (itself a callback
|
|
56
|
+
// seam) — must not reach the display hook.
|
|
57
|
+
throwIfAborted(signal);
|
|
58
|
+
// Race an async display hook against the abort signal: a hook awaiting user
|
|
59
|
+
// interaction must not hold a cancelled flow open until it settles. On
|
|
60
|
+
// abort the hook's promise is left to settle on its own (JS cannot cancel
|
|
61
|
+
// it) — the flow rejects promptly and never proceeds to polling.
|
|
62
|
+
await new Promise((resolve, reject) => {
|
|
63
|
+
const onAbort = () => reject(new DeviceFlowError("cancelled", "Device flow cancelled"));
|
|
64
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
65
|
+
if (signal?.aborted) {
|
|
66
|
+
// The abort won between the entry throwIfAborted and the registration
|
|
67
|
+
// above: the event is already spent, so the once-listener would never
|
|
68
|
+
// fire — and never auto-remove. Drop it before rejecting manually
|
|
69
|
+
// (same race handling as the sleep helper).
|
|
70
|
+
signal.removeEventListener("abort", onAbort);
|
|
71
|
+
onAbort();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
Promise.resolve()
|
|
75
|
+
.then(() => {
|
|
76
|
+
// The abort can win between scheduling and this deferred callback —
|
|
77
|
+
// the outer promise has already rejected then, but this callback still
|
|
78
|
+
// runs. Re-check so a cancelled flow never surfaces the code.
|
|
79
|
+
if (signal?.aborted)
|
|
80
|
+
return undefined;
|
|
81
|
+
return display(auth);
|
|
82
|
+
})
|
|
83
|
+
.then(() => {
|
|
84
|
+
signal?.removeEventListener("abort", onAbort);
|
|
85
|
+
resolve();
|
|
86
|
+
}, (err) => {
|
|
87
|
+
signal?.removeEventListener("abort", onAbort);
|
|
88
|
+
reject(err);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
// Deduct the elapsed display time from the issuance anchor so polling gets
|
|
92
|
+
// only the REMAINING lifetime. `expiresIn` is seconds; the clock is ms, so
|
|
93
|
+
// convert the elapsed span before subtracting.
|
|
94
|
+
const remainingSeconds = auth.expiresIn - (validatedClockSample(clock(), "performDeviceLogin") - issuedAt) / 1000;
|
|
95
|
+
// Re-check after the clock read: an abort landing after the display race
|
|
96
|
+
// settled (its listener is already removed) must still win over expiry —
|
|
97
|
+
// cancellation beats every other classification.
|
|
98
|
+
throwIfAborted(signal);
|
|
99
|
+
if (remainingSeconds <= 0) {
|
|
100
|
+
throw new DeviceFlowError("expired", "Device code expired before authorization completed");
|
|
101
|
+
}
|
|
102
|
+
return pollDeviceToken({
|
|
103
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
104
|
+
clientId,
|
|
105
|
+
deviceCode: auth.deviceCode,
|
|
106
|
+
interval: auth.interval,
|
|
107
|
+
expiresIn: remainingSeconds,
|
|
108
|
+
// Absolute issuance-anchored deadline: clock time elapsing between the
|
|
109
|
+
// remainingSeconds computation above and pollDeviceToken's own clock()
|
|
110
|
+
// anchor would otherwise be handed BACK to the code's lifetime.
|
|
111
|
+
deadlineAtMs: issuedAt + auth.expiresIn * 1000,
|
|
112
|
+
signal,
|
|
113
|
+
clock,
|
|
114
|
+
fetch: customFetch,
|
|
115
|
+
sleepFn,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=device-login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-login.js","sourceRoot":"","sources":["../../src/oauth/device-login.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,GAEb,MAAM,aAAa,CAAC;AAqCrB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA2B;IAClE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,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CAAC;IACvB,IAAI,gBAAgB,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAe,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,eAAe,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,SAAS,EAAE,gBAAgB;QAC3B,uEAAuE;QACvE,uEAAuE;QACvE,gEAAgE;QAChE,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI;QAC9C,MAAM;QACN,KAAK;QACL,KAAK,EAAE,WAAW;QAClB,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 8628 device authorization grant — request + poll.
|
|
3
|
+
*
|
|
4
|
+
* `requestDeviceAuthorization` obtains a device/user code pair;
|
|
5
|
+
* `pollDeviceToken` runs the §3.5 polling loop against the token endpoint. Both
|
|
6
|
+
* are TLS-guarded. The polling clock is monotonic and injectable for tests.
|
|
7
|
+
*/
|
|
8
|
+
import { MAX_TOKEN_LIFETIME_SECONDS } from "./limits.js";
|
|
9
|
+
export { MAX_TOKEN_LIFETIME_SECONDS };
|
|
10
|
+
import type { DeviceAuthorization, OAuthToken } from "./types.js";
|
|
11
|
+
/** URN grant type for the device authorization grant. */
|
|
12
|
+
export declare const DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
13
|
+
/** Monotonic clock in milliseconds. Injectable so tests can advance time. */
|
|
14
|
+
export type MonotonicClock = () => number;
|
|
15
|
+
/**
|
|
16
|
+
* Default monotonic clock (ms): `performance.now()`, which every supported
|
|
17
|
+
* Node/browser runtime provides. The `Date.now()` branch is a last resort for
|
|
18
|
+
* exotic runtimes without `performance` — wall-clock, so not strictly monotonic;
|
|
19
|
+
* inject a real monotonic clock there if NTP steps matter.
|
|
20
|
+
*/
|
|
21
|
+
export declare const defaultClock: MonotonicClock;
|
|
22
|
+
/**
|
|
23
|
+
* Validate one sample from an injected clock seam. `Number.isFinite` performs
|
|
24
|
+
* no coercion, so a bigint, string, or Symbol sample fails exactly like a
|
|
25
|
+
* NaN/Infinity one — the typed usage error, never a raw TypeError out of later
|
|
26
|
+
* deadline arithmetic. Shared by the poller and the login orchestrator so both
|
|
27
|
+
* validate EVERY sample the same way.
|
|
28
|
+
*/
|
|
29
|
+
export declare function validatedClockSample(sample: unknown, entry: string): number;
|
|
30
|
+
/**
|
|
31
|
+
* Parameters for {@link requestDeviceAuthorization}.
|
|
32
|
+
*/
|
|
33
|
+
export interface RequestDeviceAuthorizationParams {
|
|
34
|
+
/** The device_authorization_endpoint from discovery. */
|
|
35
|
+
deviceAuthorizationEndpoint: string;
|
|
36
|
+
/** The public client id (e.g. "basecamp-cli"). */
|
|
37
|
+
clientId: string;
|
|
38
|
+
/** Requested scope. Omitted from the request entirely when unset → server default `read`. */
|
|
39
|
+
scope?: string;
|
|
40
|
+
/** Custom fetch (testing). */
|
|
41
|
+
fetch?: typeof globalThis.fetch;
|
|
42
|
+
/** Request timeout in milliseconds (default: 30000). */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Cancellation signal — aborting rejects with DeviceFlowError("cancelled"). */
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Requests a device/user code pair (RFC 8628 §3.1–3.2).
|
|
49
|
+
*
|
|
50
|
+
* @throws DeviceFlowError("cancelled") when the signal aborts;
|
|
51
|
+
* DeviceFlowError("transport") on a network failure; BasecampError on
|
|
52
|
+
* validation / non-2xx.
|
|
53
|
+
*/
|
|
54
|
+
export declare function requestDeviceAuthorization(params: RequestDeviceAuthorizationParams): Promise<DeviceAuthorization>;
|
|
55
|
+
/**
|
|
56
|
+
* Parameters for {@link pollDeviceToken}.
|
|
57
|
+
*/
|
|
58
|
+
export interface PollDeviceTokenParams {
|
|
59
|
+
/** The token_endpoint from discovery. */
|
|
60
|
+
tokenEndpoint: string;
|
|
61
|
+
/** The public client id. */
|
|
62
|
+
clientId: string;
|
|
63
|
+
/** The device_code from {@link requestDeviceAuthorization}. */
|
|
64
|
+
deviceCode: string;
|
|
65
|
+
/** Polling interval in seconds. */
|
|
66
|
+
interval: number;
|
|
67
|
+
/** Code lifetime in seconds (monotonic deadline). */
|
|
68
|
+
expiresIn: number;
|
|
69
|
+
/**
|
|
70
|
+
* Absolute monotonic deadline (ms, same clock as `clock`) anchoring the
|
|
71
|
+
* code's expiry at ISSUANCE. When set it overrides the `clock() + expiresIn`
|
|
72
|
+
* anchoring so time elapsed before this call is never handed back to the
|
|
73
|
+
* lifetime. Must be finite and no later than `expiresIn` seconds from now —
|
|
74
|
+
* a deadline can only shorten the validated lifetime, never extend it.
|
|
75
|
+
*/
|
|
76
|
+
deadlineAtMs?: number;
|
|
77
|
+
/** Cancellation signal — aborting rejects with DeviceFlowError("cancelled"). */
|
|
78
|
+
signal?: AbortSignal;
|
|
79
|
+
/** Injectable monotonic clock (ms). Default performance.now(). */
|
|
80
|
+
clock?: MonotonicClock;
|
|
81
|
+
/** Custom fetch (testing). */
|
|
82
|
+
fetch?: typeof globalThis.fetch;
|
|
83
|
+
/** Per-request timeout in milliseconds (default: 30000). */
|
|
84
|
+
timeoutMs?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Injectable sleep (testing). Receives the wait in ms and the cancellation
|
|
87
|
+
* signal; defaults to a real, abortable timer. Lets tests assert the interval
|
|
88
|
+
* schedule (slow_down, backoff) without real delays.
|
|
89
|
+
*/
|
|
90
|
+
sleepFn?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Polls the token endpoint until the user approves, denies, or the codes expire
|
|
94
|
+
* (RFC 8628 §3.4–3.5). Handles authorization_pending, sustained slow_down (+5s),
|
|
95
|
+
* a monotonic expiry deadline, exponential backoff on connection timeouts, and
|
|
96
|
+
* cooperative cancellation.
|
|
97
|
+
*/
|
|
98
|
+
export declare function pollDeviceToken(params: PollDeviceTokenParams): Promise<OAuthToken>;
|
|
99
|
+
/**
|
|
100
|
+
* Validates a Retry-After delta for the 429 poll contract (SPEC §16): a
|
|
101
|
+
* positive integral number of seconds. A representable delta beyond
|
|
102
|
+
* MAX_DEVICE_SECONDS (the shared 32-bit-ms timer bound) CLAMPS to the
|
|
103
|
+
* ceiling — the wait rule clips to the remaining code lifetime, honoring the
|
|
104
|
+
* throttle. Anything else — missing, an HTTP-date, fractional, non-positive,
|
|
105
|
+
* or unrepresentable (beyond 2^53) — returns 0 so the caller falls back to
|
|
106
|
+
* the current interval. Trimming is ASCII SP/HTAB only (RFC 9110
|
|
107
|
+
* OWS) — NOT String.prototype.trim(), whose Unicode whitespace (NBSP above
|
|
108
|
+
* all) would trim a malformed value into validity.
|
|
109
|
+
*/
|
|
110
|
+
export declare function parseRetryAfterSeconds(header: string | null): number;
|
|
111
|
+
export declare function throwIfAborted(signal?: AbortSignal): void;
|
|
112
|
+
//# sourceMappingURL=device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/oauth/device.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,EAAE,0BAA0B,EAAE,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAwC,MAAM,YAAY,CAAC;AAExG,yDAAyD;AACzD,eAAO,MAAM,sBAAsB,iDAAiD,CAAC;AAwDrF,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAC0C,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,oB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