@alter-ai/alter-sdk 0.3.1 → 0.5.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 +163 -33
- package/dist/index.cjs +767 -92
- package/dist/index.d.cts +298 -24
- package/dist/index.d.ts +298 -24
- package/dist/index.js +744 -88
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -48,6 +48,14 @@ declare class TokenResponse {
|
|
|
48
48
|
readonly injectionHeader: string;
|
|
49
49
|
/** Header value format with {token} placeholder (e.g., "Bearer {token}", "{token}") */
|
|
50
50
|
readonly injectionFormat: string;
|
|
51
|
+
/** Extra credentials for multi-part auth (e.g. AWS SigV4 secret_key, region) */
|
|
52
|
+
readonly additionalCredentials: Record<string, string> | null;
|
|
53
|
+
/** Additional injection rules for multi-header or query param auth */
|
|
54
|
+
readonly additionalInjections: ReadonlyArray<{
|
|
55
|
+
readonly target: string;
|
|
56
|
+
readonly key: string;
|
|
57
|
+
readonly value_source: string;
|
|
58
|
+
}> | null;
|
|
51
59
|
constructor(data: {
|
|
52
60
|
access_token: string;
|
|
53
61
|
token_type?: string;
|
|
@@ -58,6 +66,12 @@ declare class TokenResponse {
|
|
|
58
66
|
provider_id?: string;
|
|
59
67
|
injection_header?: string;
|
|
60
68
|
injection_format?: string;
|
|
69
|
+
additional_credentials?: Record<string, string> | null;
|
|
70
|
+
additional_injections?: Array<{
|
|
71
|
+
target: string;
|
|
72
|
+
key: string;
|
|
73
|
+
value_source: string;
|
|
74
|
+
}> | null;
|
|
61
75
|
});
|
|
62
76
|
/**
|
|
63
77
|
* Parse expires_at from ISO string.
|
|
@@ -101,6 +115,7 @@ declare class ConnectionInfo {
|
|
|
101
115
|
readonly accountIdentifier: string | null;
|
|
102
116
|
readonly accountDisplayName: string | null;
|
|
103
117
|
readonly status: string;
|
|
118
|
+
readonly scopeMismatch: boolean;
|
|
104
119
|
readonly expiresAt: string | null;
|
|
105
120
|
readonly createdAt: string;
|
|
106
121
|
readonly lastUsedAt: string | null;
|
|
@@ -111,6 +126,7 @@ declare class ConnectionInfo {
|
|
|
111
126
|
account_identifier?: string | null;
|
|
112
127
|
account_display_name?: string | null;
|
|
113
128
|
status: string;
|
|
129
|
+
scope_mismatch?: boolean;
|
|
114
130
|
expires_at?: string | null;
|
|
115
131
|
created_at: string;
|
|
116
132
|
last_used_at?: string | null;
|
|
@@ -157,6 +173,40 @@ declare class ConnectionListResult {
|
|
|
157
173
|
has_more: boolean;
|
|
158
174
|
});
|
|
159
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Result of a headless connect() flow.
|
|
178
|
+
*
|
|
179
|
+
* Returned by connect() after the user completes OAuth in the browser.
|
|
180
|
+
* Contains the connection metadata (no tokens — use request() with
|
|
181
|
+
* the connectionId to make authenticated API calls).
|
|
182
|
+
*/
|
|
183
|
+
/**
|
|
184
|
+
* Per-connection policy (e.g., TTL expiry).
|
|
185
|
+
*/
|
|
186
|
+
interface ConnectionPolicy {
|
|
187
|
+
/** Hard expiry timestamp (ISO 8601 UTC) */
|
|
188
|
+
expires_at?: string | null;
|
|
189
|
+
/** Who set the policy: 'developer' or 'end_user' */
|
|
190
|
+
created_by?: string | null;
|
|
191
|
+
/** When the policy was set (ISO 8601 UTC) */
|
|
192
|
+
created_at?: string | null;
|
|
193
|
+
}
|
|
194
|
+
declare class ConnectResult {
|
|
195
|
+
readonly connectionId: string;
|
|
196
|
+
readonly providerId: string;
|
|
197
|
+
readonly accountIdentifier: string | null;
|
|
198
|
+
readonly scopes: string[];
|
|
199
|
+
readonly connectionPolicy: ConnectionPolicy | null;
|
|
200
|
+
constructor(data: {
|
|
201
|
+
connection_id: string;
|
|
202
|
+
provider_id: string;
|
|
203
|
+
account_identifier?: string | null;
|
|
204
|
+
scopes?: string[];
|
|
205
|
+
connection_policy?: ConnectionPolicy | null;
|
|
206
|
+
});
|
|
207
|
+
toJSON(): Record<string, unknown>;
|
|
208
|
+
toString(): string;
|
|
209
|
+
}
|
|
160
210
|
/**
|
|
161
211
|
* Audit log entry for an API call to a provider.
|
|
162
212
|
*
|
|
@@ -243,10 +293,72 @@ declare class APICallAuditLog {
|
|
|
243
293
|
* ```
|
|
244
294
|
*/
|
|
245
295
|
declare enum Provider {
|
|
246
|
-
|
|
296
|
+
ACUITY_SCHEDULING = "acuity-scheduling",
|
|
297
|
+
ADOBE = "adobe",
|
|
298
|
+
AIRCALL = "aircall",
|
|
299
|
+
AIRTABLE = "airtable",
|
|
300
|
+
APOLLO = "apollo",
|
|
301
|
+
ASANA = "asana",
|
|
302
|
+
ATLASSIAN = "atlassian",
|
|
303
|
+
ATTIO = "attio",
|
|
304
|
+
AUTODESK = "autodesk",
|
|
305
|
+
BASECAMP = "basecamp",
|
|
306
|
+
BITBUCKET = "bitbucket",
|
|
307
|
+
BITLY = "bitly",
|
|
308
|
+
BOX = "box",
|
|
309
|
+
BREX = "brex",
|
|
310
|
+
CALENDLY = "calendly",
|
|
311
|
+
CAL_COM = "cal-com",
|
|
312
|
+
CANVA = "canva",
|
|
313
|
+
CLICKUP = "clickup",
|
|
314
|
+
CLOSE = "close",
|
|
315
|
+
CONSTANT_CONTACT = "constant-contact",
|
|
316
|
+
CONTENTFUL = "contentful",
|
|
317
|
+
DEEL = "deel",
|
|
318
|
+
DIALPAD = "dialpad",
|
|
319
|
+
DIGITALOCEAN = "digitalocean",
|
|
320
|
+
DISCORD = "discord",
|
|
321
|
+
DOCUSIGN = "docusign",
|
|
322
|
+
DROPBOX = "dropbox",
|
|
323
|
+
EBAY = "ebay",
|
|
324
|
+
EVENTBRITE = "eventbrite",
|
|
325
|
+
FACEBOOK = "facebook",
|
|
326
|
+
FIGMA = "figma",
|
|
247
327
|
GITHUB = "github",
|
|
328
|
+
GOOGLE = "google",
|
|
329
|
+
HUBSPOT = "hubspot",
|
|
330
|
+
INSTAGRAM = "instagram",
|
|
331
|
+
LINEAR = "linear",
|
|
332
|
+
LINKEDIN = "linkedin",
|
|
333
|
+
MAILCHIMP = "mailchimp",
|
|
334
|
+
MERCURY = "mercury",
|
|
335
|
+
MICROSOFT = "microsoft",
|
|
336
|
+
MIRO = "miro",
|
|
337
|
+
MONDAY = "monday",
|
|
338
|
+
NOTION = "notion",
|
|
339
|
+
OUTREACH = "outreach",
|
|
340
|
+
PAGERDUTY = "pagerduty",
|
|
341
|
+
PAYPAL = "paypal",
|
|
342
|
+
PINTEREST = "pinterest",
|
|
343
|
+
PIPEDRIVE = "pipedrive",
|
|
344
|
+
QUICKBOOKS = "quickbooks",
|
|
345
|
+
RAMP = "ramp",
|
|
346
|
+
REDDIT = "reddit",
|
|
347
|
+
RINGCENTRAL = "ringcentral",
|
|
348
|
+
SALESFORCE = "salesforce",
|
|
349
|
+
SENTRY = "sentry",
|
|
248
350
|
SLACK = "slack",
|
|
249
|
-
|
|
351
|
+
SNAPCHAT = "snapchat",
|
|
352
|
+
SPOTIFY = "spotify",
|
|
353
|
+
SQUARE = "square",
|
|
354
|
+
SQUARESPACE = "squarespace",
|
|
355
|
+
STRIPE = "stripe",
|
|
356
|
+
TIKTOK = "tiktok",
|
|
357
|
+
TODOIST = "todoist",
|
|
358
|
+
TWITTER = "twitter",
|
|
359
|
+
TYPEFORM = "typeform",
|
|
360
|
+
WEBEX = "webex",
|
|
361
|
+
WEBFLOW = "webflow"
|
|
250
362
|
}
|
|
251
363
|
/**
|
|
252
364
|
* HTTP methods for type-safe method selection.
|
|
@@ -292,6 +404,8 @@ interface AlterVaultOptions {
|
|
|
292
404
|
clientType?: string;
|
|
293
405
|
/** AI framework (e.g., "langchain", "langgraph", "crewai") */
|
|
294
406
|
framework?: string;
|
|
407
|
+
/** JWT identity resolution: callable that returns the current user's JWT */
|
|
408
|
+
userTokenGetter?: () => string | Promise<string>;
|
|
295
409
|
}
|
|
296
410
|
/**
|
|
297
411
|
* Options for the request() method.
|
|
@@ -313,6 +427,10 @@ interface RequestOptions {
|
|
|
313
427
|
threadId?: string;
|
|
314
428
|
/** Tool invocation ID */
|
|
315
429
|
toolCallId?: string;
|
|
430
|
+
/** Provider ID for identity resolution (e.g., "google"). Alternative to connectionId. */
|
|
431
|
+
provider?: string;
|
|
432
|
+
/** Account identifier for multi-account disambiguation (only with provider) */
|
|
433
|
+
account?: string;
|
|
316
434
|
}
|
|
317
435
|
/**
|
|
318
436
|
* Options for the listConnections() method.
|
|
@@ -325,16 +443,30 @@ interface ListConnectionsOptions {
|
|
|
325
443
|
/** Offset for pagination (default 0) */
|
|
326
444
|
offset?: number;
|
|
327
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* Options for the connect() method.
|
|
448
|
+
*/
|
|
449
|
+
interface ConnectOptions {
|
|
450
|
+
/** Restrict to specific providers (e.g., ["google"]) */
|
|
451
|
+
providers?: string[];
|
|
452
|
+
/** Max seconds to wait for completion (default 300 = 5 min) */
|
|
453
|
+
timeout?: number;
|
|
454
|
+
/** Seconds between poll requests (default 2) */
|
|
455
|
+
pollInterval?: number;
|
|
456
|
+
/** If true, opens browser automatically. If false, prints URL. (default true) */
|
|
457
|
+
openBrowser?: boolean;
|
|
458
|
+
/** TTL bounds for connection policy. End user picks duration within bounds in Connect UI. */
|
|
459
|
+
connectionPolicy?: {
|
|
460
|
+
/** Maximum TTL the end user can select (seconds) */
|
|
461
|
+
maxTtlSeconds?: number;
|
|
462
|
+
/** Pre-selected TTL in Connect UI (seconds) */
|
|
463
|
+
defaultTtlSeconds?: number;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
328
466
|
/**
|
|
329
467
|
* Options for the createConnectSession() method.
|
|
330
468
|
*/
|
|
331
469
|
interface CreateConnectSessionOptions {
|
|
332
|
-
/** End user to create session for (requires at least id) */
|
|
333
|
-
endUser: {
|
|
334
|
-
id: string;
|
|
335
|
-
email?: string;
|
|
336
|
-
name?: string;
|
|
337
|
-
};
|
|
338
470
|
/** Restrict to specific providers (e.g., ["google", "github"]) */
|
|
339
471
|
allowedProviders?: string[];
|
|
340
472
|
/** URL to redirect after OAuth completion */
|
|
@@ -346,6 +478,13 @@ interface CreateConnectSessionOptions {
|
|
|
346
478
|
ipAddress?: string;
|
|
347
479
|
userAgent?: string;
|
|
348
480
|
};
|
|
481
|
+
/** TTL bounds for connection policy. End user picks duration within bounds in Connect UI. */
|
|
482
|
+
connectionPolicy?: {
|
|
483
|
+
/** Maximum TTL the end user can select (seconds) */
|
|
484
|
+
maxTtlSeconds?: number;
|
|
485
|
+
/** Pre-selected TTL in Connect UI (seconds) */
|
|
486
|
+
defaultTtlSeconds?: number;
|
|
487
|
+
};
|
|
349
488
|
}
|
|
350
489
|
/**
|
|
351
490
|
* Main SDK class for Alter Vault OAuth token management.
|
|
@@ -388,7 +527,7 @@ declare class AlterVault {
|
|
|
388
527
|
* 4. Logs the call for audit (fire-and-forget)
|
|
389
528
|
* 5. Returns the raw response
|
|
390
529
|
*/
|
|
391
|
-
request(connectionId: string, method: HttpMethod | string, url: string, options?: RequestOptions): Promise<Response>;
|
|
530
|
+
request(connectionId: string | null | undefined, method: HttpMethod | string, url: string, options?: RequestOptions): Promise<Response>;
|
|
392
531
|
/**
|
|
393
532
|
* List OAuth connections for this app.
|
|
394
533
|
*
|
|
@@ -402,6 +541,20 @@ declare class AlterVault {
|
|
|
402
541
|
* Returns a URL the user can open in their browser to authorize access.
|
|
403
542
|
*/
|
|
404
543
|
createConnectSession(options: CreateConnectSessionOptions): Promise<ConnectSession>;
|
|
544
|
+
/**
|
|
545
|
+
* Open OAuth in the user's browser and wait for completion.
|
|
546
|
+
*
|
|
547
|
+
* This is the headless connect flow for CLI tools, scripts, and
|
|
548
|
+
* server-side applications. It creates a Connect session, opens the
|
|
549
|
+
* browser, and polls until the user completes OAuth.
|
|
550
|
+
*
|
|
551
|
+
* @param options - Connect options
|
|
552
|
+
* @returns Array of ConnectResult objects (one per connected provider)
|
|
553
|
+
* @throws ConnectTimeoutError if the user doesn't complete within timeout
|
|
554
|
+
* @throws ConnectFlowError if the user denies or provider returns error
|
|
555
|
+
* @throws AlterSDKError if SDK is closed or session creation fails
|
|
556
|
+
*/
|
|
557
|
+
connect(options: ConnectOptions): Promise<ConnectResult[]>;
|
|
405
558
|
/**
|
|
406
559
|
* Close HTTP clients and release resources.
|
|
407
560
|
* Waits for any pending audit tasks before closing.
|
|
@@ -418,6 +571,25 @@ declare class AlterVault {
|
|
|
418
571
|
* Exception hierarchy for Alter SDK.
|
|
419
572
|
*
|
|
420
573
|
* All exceptions inherit from AlterSDKError for easy catching.
|
|
574
|
+
* The hierarchy is organized by **developer action** — what you should do
|
|
575
|
+
* when you catch each error:
|
|
576
|
+
*
|
|
577
|
+
* AlterSDKError
|
|
578
|
+
* ├── BackendError — Alter Vault backend returned an error
|
|
579
|
+
* │ ├── ReAuthRequiredError — User must re-authorize via Alter Connect
|
|
580
|
+
* │ │ ├── ConnectionExpiredError — TTL elapsed
|
|
581
|
+
* │ │ ├── ConnectionRevokedError — Auth permanently broken
|
|
582
|
+
* │ │ └── ConnectionDeletedError — User disconnected via Wallet
|
|
583
|
+
* │ ├── ConnectionNotFoundError — Wrong connection_id — fix your code
|
|
584
|
+
* │ └── PolicyViolationError — Policy denied — may resolve on its own
|
|
585
|
+
* ├── ConnectFlowError — Connect flow failed
|
|
586
|
+
* │ ├── ConnectDeniedError — User clicked Deny
|
|
587
|
+
* │ ├── ConnectConfigError — OAuth app misconfigured
|
|
588
|
+
* │ └── ConnectTimeoutError — User didn't complete in time
|
|
589
|
+
* ├── ProviderAPIError — Provider returned 4xx/5xx
|
|
590
|
+
* │ └── ScopeReauthRequiredError — 403 + scope mismatch, user must re-authorize
|
|
591
|
+
* └── NetworkError — Connection/timeout errors
|
|
592
|
+
* └── TimeoutError — Request timed out
|
|
421
593
|
*/
|
|
422
594
|
/**
|
|
423
595
|
* Base exception for all Alter SDK errors.
|
|
@@ -428,38 +600,110 @@ declare class AlterSDKError extends Error {
|
|
|
428
600
|
toString(): string;
|
|
429
601
|
}
|
|
430
602
|
/**
|
|
431
|
-
* Raised when
|
|
603
|
+
* Raised when the Alter Vault backend returns an error.
|
|
604
|
+
*/
|
|
605
|
+
declare class BackendError extends AlterSDKError {
|
|
606
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Raised when the user must re-authorize via Alter Connect.
|
|
610
|
+
*
|
|
611
|
+
* This is the parent class for all errors that require the user to go through
|
|
612
|
+
* the Connect flow again. Catch this to handle all re-auth cases in one place.
|
|
432
613
|
*/
|
|
433
|
-
declare class
|
|
614
|
+
declare class ReAuthRequiredError extends BackendError {
|
|
615
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Raised when a connection's TTL has expired.
|
|
619
|
+
*
|
|
620
|
+
* The time-limited access granted during the Connect flow has elapsed.
|
|
621
|
+
* The user must re-authorize to restore access.
|
|
622
|
+
*/
|
|
623
|
+
declare class ConnectionExpiredError extends ReAuthRequiredError {
|
|
624
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Raised when a connection's auth is permanently broken.
|
|
628
|
+
*
|
|
629
|
+
* This happens when:
|
|
630
|
+
* - The user revoked your app at the provider (e.g., Google Account settings)
|
|
631
|
+
* - The refresh token expired or was invalidated
|
|
632
|
+
* - Token refresh permanently failed (invalid_grant)
|
|
633
|
+
*
|
|
634
|
+
* The user must re-authorize via Alter Connect.
|
|
635
|
+
*/
|
|
636
|
+
declare class ConnectionRevokedError extends ReAuthRequiredError {
|
|
637
|
+
readonly connectionId: string | undefined;
|
|
638
|
+
constructor(message: string, connectionId?: string, details?: Record<string, unknown>);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Raised when a connection has been deliberately deleted.
|
|
642
|
+
*
|
|
643
|
+
* The end user disconnected the account via the Wallet dashboard.
|
|
644
|
+
* Re-authorization via Alter Connect will generate a **new** `connection_id`
|
|
645
|
+
* — update your stored reference from the `ConnectResult`.
|
|
646
|
+
*/
|
|
647
|
+
declare class ConnectionDeletedError extends ReAuthRequiredError {
|
|
648
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Raised when OAuth connection not found.
|
|
652
|
+
*
|
|
653
|
+
* No connection exists for the given connection_id.
|
|
654
|
+
* Check for typos or stale references.
|
|
655
|
+
*/
|
|
656
|
+
declare class ConnectionNotFoundError extends BackendError {
|
|
434
657
|
constructor(message: string, details?: Record<string, unknown>);
|
|
435
658
|
}
|
|
436
659
|
/**
|
|
437
660
|
* Raised when token access is denied by policy enforcement.
|
|
438
661
|
*
|
|
439
|
-
*
|
|
440
|
-
* (e.g.,
|
|
662
|
+
* The connection exists but access was denied by a Cerbos policy
|
|
663
|
+
* (e.g., outside business hours, IP allowlist, rate limit exceeded).
|
|
664
|
+
* This may resolve on its own (e.g., wait until business hours).
|
|
441
665
|
*/
|
|
442
|
-
declare class PolicyViolationError extends
|
|
666
|
+
declare class PolicyViolationError extends BackendError {
|
|
443
667
|
readonly policyError: string | undefined;
|
|
444
668
|
constructor(message: string, policyError?: string, details?: Record<string, unknown>);
|
|
445
669
|
}
|
|
446
670
|
/**
|
|
447
|
-
* Raised when
|
|
671
|
+
* Raised when the headless connect() flow fails.
|
|
448
672
|
*
|
|
449
|
-
* This
|
|
673
|
+
* This can happen when:
|
|
674
|
+
* - The user denies authorization
|
|
675
|
+
* - The provider returns an error
|
|
676
|
+
* - The OAuth app is misconfigured
|
|
677
|
+
* - The session expires before completion
|
|
450
678
|
*/
|
|
451
|
-
declare class
|
|
679
|
+
declare class ConnectFlowError extends AlterSDKError {
|
|
452
680
|
constructor(message: string, details?: Record<string, unknown>);
|
|
453
681
|
}
|
|
454
682
|
/**
|
|
455
|
-
* Raised when
|
|
683
|
+
* Raised when the user denies authorization during the Connect flow.
|
|
456
684
|
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
685
|
+
* The user explicitly clicked "Deny" or "Cancel" on the provider's
|
|
686
|
+
* authorization page.
|
|
459
687
|
*/
|
|
460
|
-
declare class
|
|
461
|
-
|
|
462
|
-
|
|
688
|
+
declare class ConnectDeniedError extends ConnectFlowError {
|
|
689
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Raised when the OAuth app is misconfigured.
|
|
693
|
+
*
|
|
694
|
+
* Check your OAuth app configuration in the Developer Portal.
|
|
695
|
+
* Common causes: wrong redirect URI, invalid client ID/secret.
|
|
696
|
+
*/
|
|
697
|
+
declare class ConnectConfigError extends ConnectFlowError {
|
|
698
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Raised when the connect() flow times out.
|
|
702
|
+
*
|
|
703
|
+
* The user did not complete OAuth within the specified timeout period.
|
|
704
|
+
*/
|
|
705
|
+
declare class ConnectTimeoutError extends ConnectFlowError {
|
|
706
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
463
707
|
}
|
|
464
708
|
/**
|
|
465
709
|
* Raised when provider API call fails.
|
|
@@ -471,6 +715,36 @@ declare class ProviderAPIError extends AlterSDKError {
|
|
|
471
715
|
readonly responseBody: string | undefined;
|
|
472
716
|
constructor(message: string, statusCode?: number, responseBody?: string, details?: Record<string, unknown>);
|
|
473
717
|
}
|
|
718
|
+
/**
|
|
719
|
+
* Raised when a provider API returns 403 and the connection has a scope mismatch.
|
|
720
|
+
*
|
|
721
|
+
* This indicates the connection's OAuth scopes don't match the provider config's
|
|
722
|
+
* required scopes — typically because the developer added new scopes after the
|
|
723
|
+
* user originally authorized. The user needs to re-authorize via a Connect session
|
|
724
|
+
* to grant the updated permissions.
|
|
725
|
+
*
|
|
726
|
+
* Recovery:
|
|
727
|
+
* ```typescript
|
|
728
|
+
* try {
|
|
729
|
+
* const result = await vault.request(connId, HttpMethod.GET, url);
|
|
730
|
+
* } catch (e) {
|
|
731
|
+
* if (e instanceof ScopeReauthRequiredError) {
|
|
732
|
+
* const session = await vault.createConnectSession({
|
|
733
|
+
* allowedProviders: [e.providerId],
|
|
734
|
+
* });
|
|
735
|
+
* notifyUser(e.connectionId, session.connectUrl);
|
|
736
|
+
* }
|
|
737
|
+
* }
|
|
738
|
+
* ```
|
|
739
|
+
*
|
|
740
|
+
* Extends ProviderAPIError so existing `catch` blocks for ProviderAPIError
|
|
741
|
+
* continue to work without code changes.
|
|
742
|
+
*/
|
|
743
|
+
declare class ScopeReauthRequiredError extends ProviderAPIError {
|
|
744
|
+
readonly connectionId: string | undefined;
|
|
745
|
+
readonly providerId: string | undefined;
|
|
746
|
+
constructor(message: string, connectionId?: string, providerId?: string, statusCode?: number, responseBody?: string, details?: Record<string, unknown>);
|
|
747
|
+
}
|
|
474
748
|
/**
|
|
475
749
|
* Raised when network operations fail.
|
|
476
750
|
*
|
|
@@ -493,4 +767,4 @@ declare class TimeoutError extends NetworkError {
|
|
|
493
767
|
constructor(message: string, details?: Record<string, unknown>);
|
|
494
768
|
}
|
|
495
769
|
|
|
496
|
-
export { APICallAuditLog, ActorType, AlterSDKError, AlterVault, type AlterVaultOptions, ConnectSession, ConnectionInfo, ConnectionListResult, ConnectionNotFoundError, type CreateConnectSessionOptions, HttpMethod, type ListConnectionsOptions, NetworkError, PolicyViolationError, Provider, ProviderAPIError, type RequestOptions,
|
|
770
|
+
export { APICallAuditLog, ActorType, AlterSDKError, AlterVault, type AlterVaultOptions, BackendError, ConnectConfigError, ConnectDeniedError, ConnectFlowError, type ConnectOptions, ConnectResult, ConnectSession, ConnectTimeoutError, ConnectionDeletedError, ConnectionExpiredError, ConnectionInfo, ConnectionListResult, ConnectionNotFoundError, ConnectionRevokedError, type CreateConnectSessionOptions, HttpMethod, type ListConnectionsOptions, NetworkError, PolicyViolationError, Provider, ProviderAPIError, ReAuthRequiredError, type RequestOptions, ScopeReauthRequiredError, TimeoutError, TokenResponse };
|