@alter-ai/alter-sdk 0.5.0 → 0.7.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 +126 -81
- package/dist/index.cjs +423 -155
- package/dist/index.d.cts +145 -80
- package/dist/index.d.ts +145 -80
- package/dist/index.js +416 -150
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* Actor types for tracking SDK callers.
|
|
14
|
+
*
|
|
15
|
+
* All agents (AI agents, MCP-connected agents, direct SDK agents) use
|
|
16
|
+
* AI_AGENT. MCP servers are transport, not actors — the agent calling
|
|
17
|
+
* through MCP is the actor. Transport metadata (clientType,
|
|
18
|
+
* connectionProtocol) is passed separately.
|
|
14
19
|
*/
|
|
15
20
|
declare enum ActorType {
|
|
16
21
|
BACKEND_SERVICE = "backend_service",
|
|
17
|
-
AI_AGENT = "ai_agent"
|
|
18
|
-
MCP_SERVER = "mcp_server"
|
|
22
|
+
AI_AGENT = "ai_agent"
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* OAuth token response from Alter Vault.
|
|
@@ -40,10 +44,10 @@ declare class TokenResponse {
|
|
|
40
44
|
readonly expiresAt: Date | null;
|
|
41
45
|
/** OAuth scopes granted */
|
|
42
46
|
readonly scopes: string[];
|
|
43
|
-
/**
|
|
44
|
-
readonly
|
|
47
|
+
/** Grant ID that provided this token */
|
|
48
|
+
readonly grantId: string;
|
|
45
49
|
/** Provider ID (google, github, etc.) */
|
|
46
|
-
readonly providerId: string;
|
|
50
|
+
readonly providerId: string | null;
|
|
47
51
|
/** HTTP header name for credential injection (e.g., "Authorization", "X-API-Key") */
|
|
48
52
|
readonly injectionHeader: string;
|
|
49
53
|
/** Header value format with {token} placeholder (e.g., "Bearer {token}", "{token}") */
|
|
@@ -62,7 +66,7 @@ declare class TokenResponse {
|
|
|
62
66
|
expires_in?: number | null;
|
|
63
67
|
expires_at?: string | null;
|
|
64
68
|
scopes?: string[];
|
|
65
|
-
|
|
69
|
+
grant_id: string;
|
|
66
70
|
provider_id?: string;
|
|
67
71
|
injection_header?: string;
|
|
68
72
|
injection_format?: string;
|
|
@@ -103,13 +107,13 @@ declare class TokenResponse {
|
|
|
103
107
|
toString(): string;
|
|
104
108
|
}
|
|
105
109
|
/**
|
|
106
|
-
* OAuth
|
|
110
|
+
* OAuth grant info from Alter Vault.
|
|
107
111
|
*
|
|
108
|
-
* Represents a
|
|
109
|
-
* Returned by
|
|
112
|
+
* Represents a granted OAuth service (e.g., Google, GitHub).
|
|
113
|
+
* Returned by listGrants(). Contains metadata only — no tokens.
|
|
110
114
|
*/
|
|
111
|
-
declare class
|
|
112
|
-
readonly
|
|
115
|
+
declare class GrantInfo {
|
|
116
|
+
readonly grantId: string;
|
|
113
117
|
readonly providerId: string;
|
|
114
118
|
readonly scopes: string[];
|
|
115
119
|
readonly accountIdentifier: string | null;
|
|
@@ -120,7 +124,7 @@ declare class ConnectionInfo {
|
|
|
120
124
|
readonly createdAt: string;
|
|
121
125
|
readonly lastUsedAt: string | null;
|
|
122
126
|
constructor(data: {
|
|
123
|
-
|
|
127
|
+
grant_id: string;
|
|
124
128
|
provider_id: string;
|
|
125
129
|
scopes?: string[];
|
|
126
130
|
account_identifier?: string | null;
|
|
@@ -155,54 +159,75 @@ declare class ConnectSession {
|
|
|
155
159
|
toString(): string;
|
|
156
160
|
}
|
|
157
161
|
/**
|
|
158
|
-
* Paginated list of
|
|
162
|
+
* Paginated list of grants.
|
|
159
163
|
*
|
|
160
|
-
* Returned by
|
|
164
|
+
* Returned by listGrants(). Contains grant array plus pagination metadata.
|
|
161
165
|
*/
|
|
162
|
-
declare class
|
|
163
|
-
readonly
|
|
166
|
+
declare class GrantListResult {
|
|
167
|
+
readonly grants: GrantInfo[];
|
|
164
168
|
readonly total: number;
|
|
165
169
|
readonly limit: number;
|
|
166
170
|
readonly offset: number;
|
|
167
171
|
readonly hasMore: boolean;
|
|
168
172
|
constructor(data: {
|
|
169
|
-
|
|
173
|
+
grants: GrantInfo[];
|
|
170
174
|
total: number;
|
|
171
175
|
limit: number;
|
|
172
176
|
offset: number;
|
|
173
177
|
has_more: boolean;
|
|
174
178
|
});
|
|
179
|
+
/**
|
|
180
|
+
* Custom JSON serialization — snake_case wire format.
|
|
181
|
+
*/
|
|
182
|
+
toJSON(): Record<string, unknown>;
|
|
175
183
|
}
|
|
176
184
|
/**
|
|
177
185
|
* Result of a headless connect() flow.
|
|
178
186
|
*
|
|
179
187
|
* Returned by connect() after the user completes OAuth in the browser.
|
|
180
|
-
* Contains the
|
|
181
|
-
* the
|
|
188
|
+
* Contains the grant metadata (no tokens — use request() with
|
|
189
|
+
* the grantId to make authenticated API calls).
|
|
182
190
|
*/
|
|
183
191
|
/**
|
|
184
|
-
* Per-
|
|
192
|
+
* Per-grant policy (e.g., TTL expiry).
|
|
185
193
|
*/
|
|
186
|
-
interface
|
|
194
|
+
interface GrantPolicy {
|
|
187
195
|
/** Hard expiry timestamp (ISO 8601 UTC) */
|
|
188
|
-
|
|
196
|
+
readonly expiresAt?: string | null;
|
|
189
197
|
/** Who set the policy: 'developer' or 'end_user' */
|
|
190
|
-
|
|
198
|
+
readonly createdBy?: string | null;
|
|
191
199
|
/** When the policy was set (ISO 8601 UTC) */
|
|
192
|
-
|
|
200
|
+
readonly createdAt?: string | null;
|
|
193
201
|
}
|
|
194
202
|
declare class ConnectResult {
|
|
195
|
-
readonly
|
|
203
|
+
readonly grantId: string;
|
|
196
204
|
readonly providerId: string;
|
|
197
205
|
readonly accountIdentifier: string | null;
|
|
198
206
|
readonly scopes: string[];
|
|
199
|
-
readonly
|
|
207
|
+
readonly grantPolicy: GrantPolicy | null;
|
|
200
208
|
constructor(data: {
|
|
201
|
-
|
|
209
|
+
grant_id: string;
|
|
202
210
|
provider_id: string;
|
|
203
211
|
account_identifier?: string | null;
|
|
204
212
|
scopes?: string[];
|
|
205
|
-
|
|
213
|
+
grant_policy?: GrantPolicy | null;
|
|
214
|
+
});
|
|
215
|
+
toJSON(): Record<string, unknown>;
|
|
216
|
+
toString(): string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Result of an authenticate() flow.
|
|
220
|
+
*
|
|
221
|
+
* Returned by authenticate() after the user completes IDP login in the browser.
|
|
222
|
+
* Contains the userToken (IDP JWT) that the SDK uses for subsequent
|
|
223
|
+
* identity-based request() calls.
|
|
224
|
+
*/
|
|
225
|
+
declare class AuthResult {
|
|
226
|
+
readonly userToken: string;
|
|
227
|
+
readonly userInfo: Record<string, unknown>;
|
|
228
|
+
constructor(data: {
|
|
229
|
+
user_token: string;
|
|
230
|
+
user_info?: Record<string, unknown>;
|
|
206
231
|
});
|
|
207
232
|
toJSON(): Record<string, unknown>;
|
|
208
233
|
toString(): string;
|
|
@@ -213,7 +238,7 @@ declare class ConnectResult {
|
|
|
213
238
|
* This is sent to the backend audit endpoint.
|
|
214
239
|
*/
|
|
215
240
|
declare class APICallAuditLog {
|
|
216
|
-
readonly
|
|
241
|
+
readonly grantId: string;
|
|
217
242
|
readonly providerId: string;
|
|
218
243
|
readonly method: string;
|
|
219
244
|
readonly url: string;
|
|
@@ -232,21 +257,27 @@ declare class APICallAuditLog {
|
|
|
232
257
|
readonly threadId: string | null;
|
|
233
258
|
/** Tool invocation ID for actor tracking */
|
|
234
259
|
readonly toolCallId: string | null;
|
|
260
|
+
/** Specific tool being invoked (e.g., "read_calendar") */
|
|
261
|
+
readonly toolId: string | null;
|
|
262
|
+
/** Tool bundle identifier (e.g., "google-calendar-mcp-server") */
|
|
263
|
+
readonly toolBundleId: string | null;
|
|
235
264
|
constructor(data: {
|
|
236
|
-
|
|
237
|
-
|
|
265
|
+
grant_id: string;
|
|
266
|
+
provider_id: string;
|
|
238
267
|
method: string;
|
|
239
268
|
url: string;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
269
|
+
request_headers?: Record<string, string> | null;
|
|
270
|
+
request_body?: unknown | null;
|
|
271
|
+
response_status: number;
|
|
272
|
+
response_headers?: Record<string, string> | null;
|
|
273
|
+
response_body?: unknown | null;
|
|
274
|
+
latency_ms: number;
|
|
246
275
|
reason?: string | null;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
276
|
+
run_id?: string | null;
|
|
277
|
+
thread_id?: string | null;
|
|
278
|
+
tool_call_id?: string | null;
|
|
279
|
+
tool_id?: string | null;
|
|
280
|
+
tool_bundle_id?: string | null;
|
|
250
281
|
});
|
|
251
282
|
/**
|
|
252
283
|
* Sanitize sensitive data before sending.
|
|
@@ -392,7 +423,7 @@ interface AlterVaultOptions {
|
|
|
392
423
|
apiKey: string;
|
|
393
424
|
/** HTTP request timeout in milliseconds (default: 30000) */
|
|
394
425
|
timeout?: number;
|
|
395
|
-
/** Actor type (use ActorType enum: AI_AGENT,
|
|
426
|
+
/** Actor type (use ActorType enum: AI_AGENT, BACKEND_SERVICE) */
|
|
396
427
|
actorType: ActorType | string;
|
|
397
428
|
/** Unique identifier for the actor (e.g., "email-assistant-v2") */
|
|
398
429
|
actorIdentifier: string;
|
|
@@ -400,10 +431,12 @@ interface AlterVaultOptions {
|
|
|
400
431
|
actorName?: string;
|
|
401
432
|
/** Actor version string (e.g., "1.0.0") */
|
|
402
433
|
actorVersion?: string;
|
|
403
|
-
/**
|
|
434
|
+
/** Transport client type (e.g., "cursor", "claude-desktop") */
|
|
404
435
|
clientType?: string;
|
|
405
436
|
/** AI framework (e.g., "langchain", "langgraph", "crewai") */
|
|
406
437
|
framework?: string;
|
|
438
|
+
/** Tool bundle identifier (e.g., "google-calendar-mcp-server", "stripe-toolkit") */
|
|
439
|
+
toolBundleId?: string;
|
|
407
440
|
/** JWT identity resolution: callable that returns the current user's JWT */
|
|
408
441
|
userTokenGetter?: () => string | Promise<string>;
|
|
409
442
|
}
|
|
@@ -427,18 +460,22 @@ interface RequestOptions {
|
|
|
427
460
|
threadId?: string;
|
|
428
461
|
/** Tool invocation ID */
|
|
429
462
|
toolCallId?: string;
|
|
430
|
-
/**
|
|
463
|
+
/** Specific tool being invoked within the bundle (e.g., "read_calendar") */
|
|
464
|
+
toolId?: string;
|
|
465
|
+
/** Tool bundle identifier for per-request override (e.g., "google-calendar-mcp-server") */
|
|
466
|
+
toolBundleId?: string;
|
|
467
|
+
/** Provider ID for identity resolution (e.g., "google"). Alternative to grantId. */
|
|
431
468
|
provider?: string;
|
|
432
469
|
/** Account identifier for multi-account disambiguation (only with provider) */
|
|
433
470
|
account?: string;
|
|
434
471
|
}
|
|
435
472
|
/**
|
|
436
|
-
* Options for the
|
|
473
|
+
* Options for the listGrants() method.
|
|
437
474
|
*/
|
|
438
|
-
interface
|
|
475
|
+
interface ListGrantsOptions {
|
|
439
476
|
/** Filter by provider ID (e.g., "google") */
|
|
440
477
|
providerId?: string;
|
|
441
|
-
/** Maximum number of
|
|
478
|
+
/** Maximum number of grants to return (default 100, max 1000) */
|
|
442
479
|
limit?: number;
|
|
443
480
|
/** Offset for pagination (default 0) */
|
|
444
481
|
offset?: number;
|
|
@@ -455,8 +492,8 @@ interface ConnectOptions {
|
|
|
455
492
|
pollInterval?: number;
|
|
456
493
|
/** If true, opens browser automatically. If false, prints URL. (default true) */
|
|
457
494
|
openBrowser?: boolean;
|
|
458
|
-
/** TTL bounds for
|
|
459
|
-
|
|
495
|
+
/** TTL bounds for grant policy. End user picks duration within bounds in Connect UI. */
|
|
496
|
+
grantPolicy?: {
|
|
460
497
|
/** Maximum TTL the end user can select (seconds) */
|
|
461
498
|
maxTtlSeconds?: number;
|
|
462
499
|
/** Pre-selected TTL in Connect UI (seconds) */
|
|
@@ -478,8 +515,8 @@ interface CreateConnectSessionOptions {
|
|
|
478
515
|
ipAddress?: string;
|
|
479
516
|
userAgent?: string;
|
|
480
517
|
};
|
|
481
|
-
/** TTL bounds for
|
|
482
|
-
|
|
518
|
+
/** TTL bounds for grant policy. End user picks duration within bounds in Connect UI. */
|
|
519
|
+
grantPolicy?: {
|
|
483
520
|
/** Maximum TTL the end user can select (seconds) */
|
|
484
521
|
maxTtlSeconds?: number;
|
|
485
522
|
/** Pre-selected TTL in Connect UI (seconds) */
|
|
@@ -492,7 +529,7 @@ interface CreateConnectSessionOptions {
|
|
|
492
529
|
* This class handles:
|
|
493
530
|
* - Executing API requests to any OAuth provider with automatic token injection
|
|
494
531
|
* - Audit logging of API calls
|
|
495
|
-
* - Actor tracking for AI agents and
|
|
532
|
+
* - Actor tracking for AI agents and backend services
|
|
496
533
|
*
|
|
497
534
|
* Tokens are retrieved and injected automatically — never exposed to callers.
|
|
498
535
|
*
|
|
@@ -504,7 +541,7 @@ interface CreateConnectSessionOptions {
|
|
|
504
541
|
*
|
|
505
542
|
* // Make API request (token injected automatically)
|
|
506
543
|
* const response = await vault.request(
|
|
507
|
-
* "
|
|
544
|
+
* "grant-uuid-here", HttpMethod.GET,
|
|
508
545
|
* "https://www.googleapis.com/calendar/v3/calendars/primary/events",
|
|
509
546
|
* );
|
|
510
547
|
* const events = await response.json();
|
|
@@ -527,14 +564,14 @@ declare class AlterVault {
|
|
|
527
564
|
* 4. Logs the call for audit (fire-and-forget)
|
|
528
565
|
* 5. Returns the raw response
|
|
529
566
|
*/
|
|
530
|
-
request(
|
|
567
|
+
request(grantId: string | null | undefined, method: HttpMethod | string, url: string, options?: RequestOptions): Promise<Response>;
|
|
531
568
|
/**
|
|
532
|
-
* List OAuth
|
|
569
|
+
* List OAuth grants for this app.
|
|
533
570
|
*
|
|
534
|
-
* Returns paginated
|
|
571
|
+
* Returns paginated grant metadata (no tokens).
|
|
535
572
|
* Useful for discovering which services a user has connected.
|
|
536
573
|
*/
|
|
537
|
-
|
|
574
|
+
listGrants(options?: ListGrantsOptions): Promise<GrantListResult>;
|
|
538
575
|
/**
|
|
539
576
|
* Create a Connect session for initiating OAuth flows.
|
|
540
577
|
*
|
|
@@ -555,6 +592,23 @@ declare class AlterVault {
|
|
|
555
592
|
* @throws AlterSDKError if SDK is closed or session creation fails
|
|
556
593
|
*/
|
|
557
594
|
connect(options: ConnectOptions): Promise<ConnectResult[]>;
|
|
595
|
+
/**
|
|
596
|
+
* Trigger IDP login for end user via browser.
|
|
597
|
+
*
|
|
598
|
+
* Opens the app's configured IDP login page in the user's default browser.
|
|
599
|
+
* Polls for completion and returns the user's IDP JWT token.
|
|
600
|
+
*
|
|
601
|
+
* After authenticate() completes, the returned userToken is automatically
|
|
602
|
+
* used for subsequent request() calls that use identity resolution.
|
|
603
|
+
*
|
|
604
|
+
* @param options - Optional configuration (timeout in milliseconds, default 300000 = 5 min)
|
|
605
|
+
* @returns AuthResult with userToken and userInfo
|
|
606
|
+
* @throws ConnectTimeoutError if authentication times out
|
|
607
|
+
* @throws AlterSDKError if session creation or authentication fails
|
|
608
|
+
*/
|
|
609
|
+
authenticate(options?: {
|
|
610
|
+
timeout?: number;
|
|
611
|
+
}): Promise<AuthResult>;
|
|
558
612
|
/**
|
|
559
613
|
* Close HTTP clients and release resources.
|
|
560
614
|
* Waits for any pending audit tasks before closing.
|
|
@@ -577,10 +631,11 @@ declare class AlterVault {
|
|
|
577
631
|
* AlterSDKError
|
|
578
632
|
* ├── BackendError — Alter Vault backend returned an error
|
|
579
633
|
* │ ├── ReAuthRequiredError — User must re-authorize via Alter Connect
|
|
580
|
-
* │ │ ├──
|
|
581
|
-
* │ │ ├──
|
|
582
|
-
* │ │
|
|
583
|
-
* │
|
|
634
|
+
* │ │ ├── GrantExpiredError — TTL elapsed
|
|
635
|
+
* │ │ ├── GrantRevokedError — Grant explicitly revoked
|
|
636
|
+
* │ │ ├── CredentialRevokedError — Underlying credential auth permanently broken
|
|
637
|
+
* │ │ └── GrantDeletedError — User disconnected via Wallet
|
|
638
|
+
* │ ├── GrantNotFoundError — Wrong grant_id — fix your code
|
|
584
639
|
* │ └── PolicyViolationError — Policy denied — may resolve on its own
|
|
585
640
|
* ├── ConnectFlowError — Connect flow failed
|
|
586
641
|
* │ ├── ConnectDeniedError — User clicked Deny
|
|
@@ -615,16 +670,26 @@ declare class ReAuthRequiredError extends BackendError {
|
|
|
615
670
|
constructor(message: string, details?: Record<string, unknown>);
|
|
616
671
|
}
|
|
617
672
|
/**
|
|
618
|
-
* Raised when a
|
|
673
|
+
* Raised when a grant's TTL has expired.
|
|
619
674
|
*
|
|
620
675
|
* The time-limited access granted during the Connect flow has elapsed.
|
|
621
676
|
* The user must re-authorize to restore access.
|
|
622
677
|
*/
|
|
623
|
-
declare class
|
|
678
|
+
declare class GrantExpiredError extends ReAuthRequiredError {
|
|
624
679
|
constructor(message: string, details?: Record<string, unknown>);
|
|
625
680
|
}
|
|
626
681
|
/**
|
|
627
|
-
* Raised when a
|
|
682
|
+
* Raised when a grant has been explicitly revoked.
|
|
683
|
+
*
|
|
684
|
+
* The grant was revoked via the SDK or dashboard.
|
|
685
|
+
* The user must re-authorize via Alter Connect.
|
|
686
|
+
*/
|
|
687
|
+
declare class GrantRevokedError extends ReAuthRequiredError {
|
|
688
|
+
readonly grantId: string | undefined;
|
|
689
|
+
constructor(message: string, grantId?: string, details?: Record<string, unknown>);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Raised when a credential's auth is permanently broken.
|
|
628
693
|
*
|
|
629
694
|
* This happens when:
|
|
630
695
|
* - The user revoked your app at the provider (e.g., Google Account settings)
|
|
@@ -633,33 +698,33 @@ declare class ConnectionExpiredError extends ReAuthRequiredError {
|
|
|
633
698
|
*
|
|
634
699
|
* The user must re-authorize via Alter Connect.
|
|
635
700
|
*/
|
|
636
|
-
declare class
|
|
637
|
-
readonly
|
|
638
|
-
constructor(message: string,
|
|
701
|
+
declare class CredentialRevokedError extends ReAuthRequiredError {
|
|
702
|
+
readonly grantId: string | undefined;
|
|
703
|
+
constructor(message: string, grantId?: string, details?: Record<string, unknown>);
|
|
639
704
|
}
|
|
640
705
|
/**
|
|
641
|
-
* Raised when a
|
|
706
|
+
* Raised when a grant has been deliberately deleted.
|
|
642
707
|
*
|
|
643
708
|
* The end user disconnected the account via the Wallet dashboard.
|
|
644
|
-
* Re-authorization via Alter Connect will generate a **new** `
|
|
709
|
+
* Re-authorization via Alter Connect will generate a **new** `grant_id`
|
|
645
710
|
* — update your stored reference from the `ConnectResult`.
|
|
646
711
|
*/
|
|
647
|
-
declare class
|
|
712
|
+
declare class GrantDeletedError extends ReAuthRequiredError {
|
|
648
713
|
constructor(message: string, details?: Record<string, unknown>);
|
|
649
714
|
}
|
|
650
715
|
/**
|
|
651
|
-
* Raised when OAuth
|
|
716
|
+
* Raised when OAuth grant not found.
|
|
652
717
|
*
|
|
653
|
-
* No
|
|
718
|
+
* No grant exists for the given grant_id.
|
|
654
719
|
* Check for typos or stale references.
|
|
655
720
|
*/
|
|
656
|
-
declare class
|
|
721
|
+
declare class GrantNotFoundError extends BackendError {
|
|
657
722
|
constructor(message: string, details?: Record<string, unknown>);
|
|
658
723
|
}
|
|
659
724
|
/**
|
|
660
725
|
* Raised when token access is denied by policy enforcement.
|
|
661
726
|
*
|
|
662
|
-
* The
|
|
727
|
+
* The grant exists but access was denied by a Cerbos policy
|
|
663
728
|
* (e.g., outside business hours, IP allowlist, rate limit exceeded).
|
|
664
729
|
* This may resolve on its own (e.g., wait until business hours).
|
|
665
730
|
*/
|
|
@@ -716,9 +781,9 @@ declare class ProviderAPIError extends AlterSDKError {
|
|
|
716
781
|
constructor(message: string, statusCode?: number, responseBody?: string, details?: Record<string, unknown>);
|
|
717
782
|
}
|
|
718
783
|
/**
|
|
719
|
-
* Raised when a provider API returns 403 and the
|
|
784
|
+
* Raised when a provider API returns 403 and the grant has a scope mismatch.
|
|
720
785
|
*
|
|
721
|
-
* This indicates the
|
|
786
|
+
* This indicates the grant's OAuth scopes don't match the provider config's
|
|
722
787
|
* required scopes — typically because the developer added new scopes after the
|
|
723
788
|
* user originally authorized. The user needs to re-authorize via a Connect session
|
|
724
789
|
* to grant the updated permissions.
|
|
@@ -726,13 +791,13 @@ declare class ProviderAPIError extends AlterSDKError {
|
|
|
726
791
|
* Recovery:
|
|
727
792
|
* ```typescript
|
|
728
793
|
* try {
|
|
729
|
-
* const result = await vault.request(
|
|
794
|
+
* const result = await vault.request(grantId, HttpMethod.GET, url);
|
|
730
795
|
* } catch (e) {
|
|
731
796
|
* if (e instanceof ScopeReauthRequiredError) {
|
|
732
797
|
* const session = await vault.createConnectSession({
|
|
733
798
|
* allowedProviders: [e.providerId],
|
|
734
799
|
* });
|
|
735
|
-
* notifyUser(e.
|
|
800
|
+
* notifyUser(e.grantId, session.connectUrl);
|
|
736
801
|
* }
|
|
737
802
|
* }
|
|
738
803
|
* ```
|
|
@@ -741,9 +806,9 @@ declare class ProviderAPIError extends AlterSDKError {
|
|
|
741
806
|
* continue to work without code changes.
|
|
742
807
|
*/
|
|
743
808
|
declare class ScopeReauthRequiredError extends ProviderAPIError {
|
|
744
|
-
readonly
|
|
809
|
+
readonly grantId: string | undefined;
|
|
745
810
|
readonly providerId: string | undefined;
|
|
746
|
-
constructor(message: string,
|
|
811
|
+
constructor(message: string, grantId?: string, providerId?: string, statusCode?: number, responseBody?: string, details?: Record<string, unknown>);
|
|
747
812
|
}
|
|
748
813
|
/**
|
|
749
814
|
* Raised when network operations fail.
|
|
@@ -767,4 +832,4 @@ declare class TimeoutError extends NetworkError {
|
|
|
767
832
|
constructor(message: string, details?: Record<string, unknown>);
|
|
768
833
|
}
|
|
769
834
|
|
|
770
|
-
export { APICallAuditLog, ActorType, AlterSDKError, AlterVault, type AlterVaultOptions, BackendError, ConnectConfigError, ConnectDeniedError, ConnectFlowError, type ConnectOptions, ConnectResult, ConnectSession, ConnectTimeoutError,
|
|
835
|
+
export { APICallAuditLog, ActorType, AlterSDKError, AlterVault, type AlterVaultOptions, AuthResult, BackendError, ConnectConfigError, ConnectDeniedError, ConnectFlowError, type ConnectOptions, ConnectResult, ConnectSession, ConnectTimeoutError, type CreateConnectSessionOptions, CredentialRevokedError, GrantDeletedError, GrantExpiredError, GrantInfo, GrantListResult, GrantNotFoundError, type GrantPolicy, GrantRevokedError, HttpMethod, type ListGrantsOptions, NetworkError, PolicyViolationError, Provider, ProviderAPIError, ReAuthRequiredError, type RequestOptions, ScopeReauthRequiredError, TimeoutError, TokenResponse };
|