@edge-markets/connect 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/index.d.mts +34 -31
- package/dist/index.d.ts +34 -31
- package/dist/index.js +15 -43
- package/dist/index.mjs +14 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,13 +92,13 @@ import {
|
|
|
92
92
|
formatScopeForEnvironment,
|
|
93
93
|
} from '@edge-markets/connect'
|
|
94
94
|
|
|
95
|
-
const config = getEnvironmentConfig('
|
|
95
|
+
const config = getEnvironmentConfig('sandbox')
|
|
96
96
|
console.log(config.apiBaseUrl) // https://...
|
|
97
|
-
console.log(getLinkUrl('
|
|
97
|
+
console.log(getLinkUrl('sandbox')) // https://sandbox-oauth.staging-app.edgeboost.io/oauth/link
|
|
98
98
|
|
|
99
99
|
// Format scopes for your environment
|
|
100
|
-
const scopes = formatScopeForEnvironment(EDGE_SCOPES.BALANCE_READ, '
|
|
101
|
-
// Returns: 'edge-connect-
|
|
100
|
+
const scopes = formatScopeForEnvironment(EDGE_SCOPES.BALANCE_READ, 'sandbox')
|
|
101
|
+
// Returns: 'edge-connect-sandbox/balance.read'
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
### Error Handling
|
|
@@ -153,7 +153,9 @@ try {
|
|
|
153
153
|
| `EDGE_ENVIRONMENTS` | All environment configs |
|
|
154
154
|
| `getEnvironmentConfig(env)` | Get config for environment |
|
|
155
155
|
| `EDGE_SCOPES` | Available OAuth scopes |
|
|
156
|
-
| `
|
|
156
|
+
| `ACTIVE_EDGE_SCOPES` | Scopes enabled for current partner integrations |
|
|
157
|
+
| `ALL_EDGE_SCOPES` | Alias for all currently requestable scopes |
|
|
158
|
+
| `RESERVED_EDGE_SCOPES` | Future-only scopes that should not be requested |
|
|
157
159
|
| `formatScopeForEnvironment(scope, env)` | Format scope for Cognito |
|
|
158
160
|
|
|
159
161
|
### Errors
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type EdgeEnvironment = 'production' | '
|
|
1
|
+
type EdgeEnvironment = 'production' | 'sandbox';
|
|
2
2
|
declare const EDGE_LINK_PATH = "/oauth/link";
|
|
3
3
|
interface EdgeEnvironmentConfig {
|
|
4
4
|
/**
|
|
@@ -32,6 +32,7 @@ declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
|
|
|
32
32
|
*
|
|
33
33
|
* @module @edge-markets/connect/config
|
|
34
34
|
*/
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* Available OAuth scopes for EDGE Connect.
|
|
37
38
|
*
|
|
@@ -45,7 +46,7 @@ declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
|
|
|
45
46
|
* scopes: [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ],
|
|
46
47
|
* })
|
|
47
48
|
*
|
|
48
|
-
* // Or request all scopes
|
|
49
|
+
* // Or request all currently enabled scopes
|
|
49
50
|
* link.open({
|
|
50
51
|
* scopes: ALL_EDGE_SCOPES,
|
|
51
52
|
* })
|
|
@@ -63,9 +64,10 @@ declare const EDGE_SCOPES: {
|
|
|
63
64
|
*/
|
|
64
65
|
readonly BALANCE_READ: "balance.read";
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
-
* Not available
|
|
68
|
-
* EdgeFeatureUnavailableError until EDGE enables transfers
|
|
67
|
+
* Reserved for future fund transfers and EDGE-hosted verification sessions.
|
|
68
|
+
* Not available in sandbox or production. Requesting this scope from Link
|
|
69
|
+
* SDKs fails with EdgeFeatureUnavailableError until EDGE enables transfers
|
|
70
|
+
* for a partner.
|
|
69
71
|
*
|
|
70
72
|
* Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verification-session`, `GET /v1/transfers`
|
|
71
73
|
*/
|
|
@@ -76,27 +78,34 @@ declare const EDGE_SCOPES: {
|
|
|
76
78
|
*/
|
|
77
79
|
type EdgeScope = (typeof EDGE_SCOPES)[keyof typeof EDGE_SCOPES];
|
|
78
80
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
+
* Scopes active for current EDGE Connect partner integrations.
|
|
82
|
+
*
|
|
83
|
+
* Transfers are intentionally unavailable for now, so SDK Link flows request
|
|
84
|
+
* this set by default.
|
|
85
|
+
*/
|
|
86
|
+
declare const ACTIVE_EDGE_SCOPES: readonly EdgeScope[];
|
|
87
|
+
/**
|
|
88
|
+
* Reserved scopes kept in the SDK catalog for future feature launches.
|
|
89
|
+
*
|
|
90
|
+
* Do not request these scopes unless EDGE has explicitly enabled the feature
|
|
91
|
+
* for your integration.
|
|
92
|
+
*/
|
|
93
|
+
declare const RESERVED_EDGE_SCOPES: readonly EdgeScope[];
|
|
94
|
+
/**
|
|
95
|
+
* All currently requestable scopes as an array.
|
|
96
|
+
* This intentionally excludes reserved scopes such as `transfer.write`.
|
|
81
97
|
*
|
|
82
98
|
* @example
|
|
83
99
|
* ```typescript
|
|
84
100
|
* const link = new EdgeLink({
|
|
85
101
|
* clientId: 'your-client-id',
|
|
86
|
-
* environment: '
|
|
87
|
-
* scopes: ALL_EDGE_SCOPES, //
|
|
102
|
+
* environment: 'sandbox',
|
|
103
|
+
* scopes: ALL_EDGE_SCOPES, // Same values as ACTIVE_EDGE_SCOPES today
|
|
88
104
|
* onSuccess: handleSuccess,
|
|
89
105
|
* })
|
|
90
106
|
* ```
|
|
91
107
|
*/
|
|
92
108
|
declare const ALL_EDGE_SCOPES: readonly EdgeScope[];
|
|
93
|
-
/**
|
|
94
|
-
* Scopes active for current EDGE Connect partner integrations.
|
|
95
|
-
*
|
|
96
|
-
* Transfers are intentionally unavailable for now, so SDK default Link flows
|
|
97
|
-
* should request this set rather than {@link ALL_EDGE_SCOPES}.
|
|
98
|
-
*/
|
|
99
|
-
declare const ACTIVE_EDGE_SCOPES: readonly EdgeScope[];
|
|
100
109
|
/**
|
|
101
110
|
* Human-readable descriptions for each scope.
|
|
102
111
|
* Useful for building custom consent UIs or explaining permissions.
|
|
@@ -113,26 +122,20 @@ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
|
|
|
113
122
|
* Different environments may use different scope prefixes in the API Gateway.
|
|
114
123
|
* This function handles the prefix automatically.
|
|
115
124
|
*
|
|
116
|
-
* Note: 'development' environment uses 'staging' scope prefix because it
|
|
117
|
-
* connects to the staging API Gateway for local testing.
|
|
118
|
-
*
|
|
119
125
|
* @param scope - The scope to format
|
|
120
126
|
* @param environment - The target environment
|
|
121
127
|
* @returns The full scope string for API Gateway authorization
|
|
122
128
|
*
|
|
123
129
|
* @example
|
|
124
130
|
* ```typescript
|
|
125
|
-
* formatScopeForEnvironment('user.read', '
|
|
126
|
-
* // Returns: 'edge-connect-
|
|
131
|
+
* formatScopeForEnvironment('user.read', 'sandbox')
|
|
132
|
+
* // Returns: 'edge-connect-sandbox/user.read'
|
|
127
133
|
*
|
|
128
134
|
* formatScopeForEnvironment('user.read', 'production')
|
|
129
135
|
* // Returns: 'edge-connect/user.read'
|
|
130
|
-
*
|
|
131
|
-
* formatScopeForEnvironment('user.read', 'development')
|
|
132
|
-
* // Returns: 'edge-connect-staging/user.read' (maps to staging)
|
|
133
136
|
* ```
|
|
134
137
|
*/
|
|
135
|
-
declare function formatScopeForEnvironment(scope: EdgeScope, environment:
|
|
138
|
+
declare function formatScopeForEnvironment(scope: EdgeScope, environment: EdgeEnvironment): string;
|
|
136
139
|
/**
|
|
137
140
|
* Formats multiple scopes for an environment.
|
|
138
141
|
*
|
|
@@ -140,11 +143,11 @@ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'produ
|
|
|
140
143
|
* @param environment - The target environment
|
|
141
144
|
* @returns Array of full scope strings
|
|
142
145
|
*/
|
|
143
|
-
declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment:
|
|
146
|
+
declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: EdgeEnvironment): string[];
|
|
144
147
|
/**
|
|
145
148
|
* Parses a full scope string to extract the base scope.
|
|
146
149
|
*
|
|
147
|
-
* @param fullScope - The full scope string (e.g., 'edge-connect-
|
|
150
|
+
* @param fullScope - The full scope string (e.g., 'edge-connect-sandbox/user.read')
|
|
148
151
|
* @returns The base scope (e.g., 'user.read') or null if invalid
|
|
149
152
|
*/
|
|
150
153
|
declare function parseScope(fullScope: string): EdgeScope | null;
|
|
@@ -155,7 +158,7 @@ declare function isValidScope(scope: string): scope is EdgeScope;
|
|
|
155
158
|
/**
|
|
156
159
|
* Checks whether a scope string requests the future transfer feature.
|
|
157
160
|
* Accepts either short scopes (`transfer.write`) or formatted environment
|
|
158
|
-
* scopes (`edge-connect-
|
|
161
|
+
* scopes (`edge-connect-sandbox/transfer.write`).
|
|
159
162
|
*/
|
|
160
163
|
declare function isTransferWriteScope(scope: string): boolean;
|
|
161
164
|
|
|
@@ -2782,7 +2785,7 @@ interface EdgeTokens {
|
|
|
2782
2785
|
* ```typescript
|
|
2783
2786
|
* const link = new EdgeLink({
|
|
2784
2787
|
* clientId: 'your-client-id',
|
|
2785
|
-
* environment: '
|
|
2788
|
+
* environment: 'sandbox',
|
|
2786
2789
|
* onSuccess: (result: EdgeLinkSuccess) => {
|
|
2787
2790
|
* // Send to your backend
|
|
2788
2791
|
* fetch('/api/edge/exchange', {
|
|
@@ -3205,7 +3208,7 @@ declare function isFeatureUnavailableError(error: unknown): error is EdgeFeature
|
|
|
3205
3208
|
*
|
|
3206
3209
|
* This package provides the foundation for building EDGE Connect integrations:
|
|
3207
3210
|
* - Type definitions generated from the OpenAPI spec
|
|
3208
|
-
* - Environment configuration (production,
|
|
3211
|
+
* - Environment configuration (production, sandbox)
|
|
3209
3212
|
* - OAuth scope constants
|
|
3210
3213
|
* - Typed error classes
|
|
3211
3214
|
*
|
|
@@ -3245,4 +3248,4 @@ declare const SDK_VERSION = "1.0.0";
|
|
|
3245
3248
|
*/
|
|
3246
3249
|
declare const SDK_NAME = "@edge-markets/connect";
|
|
3247
3250
|
|
|
3248
|
-
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, type ApiError, type Balance, type BaseWebhookEvent, type ConsentRequiredError, type ConsentRevokedEventData, type CreateVerificationSessionRequest, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_ENVIRONMENTS, EDGE_LINK_PATH, EDGE_SCOPES, EDGE_WEBHOOK_EVENT_TYPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeFeatureUnavailableError, EdgeIdentityVerificationError, EdgeInsufficientScopeError, type EdgeLinkConfigBase, type EdgeLinkEvent, type EdgeLinkEventName, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type EdgeWebhookEvent, type EdgeWebhookEventType, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type PKCEPair, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, type SdkGeolocation, TRANSFER_CATEGORIES, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferCategory, type TransferCompletedEventData, type TransferExpiredEventData, type TransferFailedEventData, type TransferList, type TransferListItem, type TransferProcessingEventData, type TransferStatus, type TransferType, type User, type UserAddress, type VerificationSession, type VerificationSessionStatus, type VerificationSessionStatusResponse, type VerifyIdentityAddress, type VerifyIdentityOptions, type VerifyIdentityResult, type VerifyIdentityScores, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, getLinkUrl, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isFeatureUnavailableError, isIdentityVerificationError, isNetworkError, isProductionEnvironment, isTransferWriteScope, isValidScope, type operations, parseScope, type paths };
|
|
3251
|
+
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, type ApiError, type Balance, type BaseWebhookEvent, type ConsentRequiredError, type ConsentRevokedEventData, type CreateVerificationSessionRequest, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_ENVIRONMENTS, EDGE_LINK_PATH, EDGE_SCOPES, EDGE_WEBHOOK_EVENT_TYPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeFeatureUnavailableError, EdgeIdentityVerificationError, EdgeInsufficientScopeError, type EdgeLinkConfigBase, type EdgeLinkEvent, type EdgeLinkEventName, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type EdgeWebhookEvent, type EdgeWebhookEventType, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type PKCEPair, RESERVED_EDGE_SCOPES, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, type SdkGeolocation, TRANSFER_CATEGORIES, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferCategory, type TransferCompletedEventData, type TransferExpiredEventData, type TransferFailedEventData, type TransferList, type TransferListItem, type TransferProcessingEventData, type TransferStatus, type TransferType, type User, type UserAddress, type VerificationSession, type VerificationSessionStatus, type VerificationSessionStatusResponse, type VerifyIdentityAddress, type VerifyIdentityOptions, type VerifyIdentityResult, type VerifyIdentityScores, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, getLinkUrl, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isFeatureUnavailableError, isIdentityVerificationError, isNetworkError, isProductionEnvironment, isTransferWriteScope, isValidScope, type operations, parseScope, type paths };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type EdgeEnvironment = 'production' | '
|
|
1
|
+
type EdgeEnvironment = 'production' | 'sandbox';
|
|
2
2
|
declare const EDGE_LINK_PATH = "/oauth/link";
|
|
3
3
|
interface EdgeEnvironmentConfig {
|
|
4
4
|
/**
|
|
@@ -32,6 +32,7 @@ declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
|
|
|
32
32
|
*
|
|
33
33
|
* @module @edge-markets/connect/config
|
|
34
34
|
*/
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* Available OAuth scopes for EDGE Connect.
|
|
37
38
|
*
|
|
@@ -45,7 +46,7 @@ declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
|
|
|
45
46
|
* scopes: [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ],
|
|
46
47
|
* })
|
|
47
48
|
*
|
|
48
|
-
* // Or request all scopes
|
|
49
|
+
* // Or request all currently enabled scopes
|
|
49
50
|
* link.open({
|
|
50
51
|
* scopes: ALL_EDGE_SCOPES,
|
|
51
52
|
* })
|
|
@@ -63,9 +64,10 @@ declare const EDGE_SCOPES: {
|
|
|
63
64
|
*/
|
|
64
65
|
readonly BALANCE_READ: "balance.read";
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
-
* Not available
|
|
68
|
-
* EdgeFeatureUnavailableError until EDGE enables transfers
|
|
67
|
+
* Reserved for future fund transfers and EDGE-hosted verification sessions.
|
|
68
|
+
* Not available in sandbox or production. Requesting this scope from Link
|
|
69
|
+
* SDKs fails with EdgeFeatureUnavailableError until EDGE enables transfers
|
|
70
|
+
* for a partner.
|
|
69
71
|
*
|
|
70
72
|
* Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verification-session`, `GET /v1/transfers`
|
|
71
73
|
*/
|
|
@@ -76,27 +78,34 @@ declare const EDGE_SCOPES: {
|
|
|
76
78
|
*/
|
|
77
79
|
type EdgeScope = (typeof EDGE_SCOPES)[keyof typeof EDGE_SCOPES];
|
|
78
80
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
+
* Scopes active for current EDGE Connect partner integrations.
|
|
82
|
+
*
|
|
83
|
+
* Transfers are intentionally unavailable for now, so SDK Link flows request
|
|
84
|
+
* this set by default.
|
|
85
|
+
*/
|
|
86
|
+
declare const ACTIVE_EDGE_SCOPES: readonly EdgeScope[];
|
|
87
|
+
/**
|
|
88
|
+
* Reserved scopes kept in the SDK catalog for future feature launches.
|
|
89
|
+
*
|
|
90
|
+
* Do not request these scopes unless EDGE has explicitly enabled the feature
|
|
91
|
+
* for your integration.
|
|
92
|
+
*/
|
|
93
|
+
declare const RESERVED_EDGE_SCOPES: readonly EdgeScope[];
|
|
94
|
+
/**
|
|
95
|
+
* All currently requestable scopes as an array.
|
|
96
|
+
* This intentionally excludes reserved scopes such as `transfer.write`.
|
|
81
97
|
*
|
|
82
98
|
* @example
|
|
83
99
|
* ```typescript
|
|
84
100
|
* const link = new EdgeLink({
|
|
85
101
|
* clientId: 'your-client-id',
|
|
86
|
-
* environment: '
|
|
87
|
-
* scopes: ALL_EDGE_SCOPES, //
|
|
102
|
+
* environment: 'sandbox',
|
|
103
|
+
* scopes: ALL_EDGE_SCOPES, // Same values as ACTIVE_EDGE_SCOPES today
|
|
88
104
|
* onSuccess: handleSuccess,
|
|
89
105
|
* })
|
|
90
106
|
* ```
|
|
91
107
|
*/
|
|
92
108
|
declare const ALL_EDGE_SCOPES: readonly EdgeScope[];
|
|
93
|
-
/**
|
|
94
|
-
* Scopes active for current EDGE Connect partner integrations.
|
|
95
|
-
*
|
|
96
|
-
* Transfers are intentionally unavailable for now, so SDK default Link flows
|
|
97
|
-
* should request this set rather than {@link ALL_EDGE_SCOPES}.
|
|
98
|
-
*/
|
|
99
|
-
declare const ACTIVE_EDGE_SCOPES: readonly EdgeScope[];
|
|
100
109
|
/**
|
|
101
110
|
* Human-readable descriptions for each scope.
|
|
102
111
|
* Useful for building custom consent UIs or explaining permissions.
|
|
@@ -113,26 +122,20 @@ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
|
|
|
113
122
|
* Different environments may use different scope prefixes in the API Gateway.
|
|
114
123
|
* This function handles the prefix automatically.
|
|
115
124
|
*
|
|
116
|
-
* Note: 'development' environment uses 'staging' scope prefix because it
|
|
117
|
-
* connects to the staging API Gateway for local testing.
|
|
118
|
-
*
|
|
119
125
|
* @param scope - The scope to format
|
|
120
126
|
* @param environment - The target environment
|
|
121
127
|
* @returns The full scope string for API Gateway authorization
|
|
122
128
|
*
|
|
123
129
|
* @example
|
|
124
130
|
* ```typescript
|
|
125
|
-
* formatScopeForEnvironment('user.read', '
|
|
126
|
-
* // Returns: 'edge-connect-
|
|
131
|
+
* formatScopeForEnvironment('user.read', 'sandbox')
|
|
132
|
+
* // Returns: 'edge-connect-sandbox/user.read'
|
|
127
133
|
*
|
|
128
134
|
* formatScopeForEnvironment('user.read', 'production')
|
|
129
135
|
* // Returns: 'edge-connect/user.read'
|
|
130
|
-
*
|
|
131
|
-
* formatScopeForEnvironment('user.read', 'development')
|
|
132
|
-
* // Returns: 'edge-connect-staging/user.read' (maps to staging)
|
|
133
136
|
* ```
|
|
134
137
|
*/
|
|
135
|
-
declare function formatScopeForEnvironment(scope: EdgeScope, environment:
|
|
138
|
+
declare function formatScopeForEnvironment(scope: EdgeScope, environment: EdgeEnvironment): string;
|
|
136
139
|
/**
|
|
137
140
|
* Formats multiple scopes for an environment.
|
|
138
141
|
*
|
|
@@ -140,11 +143,11 @@ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'produ
|
|
|
140
143
|
* @param environment - The target environment
|
|
141
144
|
* @returns Array of full scope strings
|
|
142
145
|
*/
|
|
143
|
-
declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment:
|
|
146
|
+
declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: EdgeEnvironment): string[];
|
|
144
147
|
/**
|
|
145
148
|
* Parses a full scope string to extract the base scope.
|
|
146
149
|
*
|
|
147
|
-
* @param fullScope - The full scope string (e.g., 'edge-connect-
|
|
150
|
+
* @param fullScope - The full scope string (e.g., 'edge-connect-sandbox/user.read')
|
|
148
151
|
* @returns The base scope (e.g., 'user.read') or null if invalid
|
|
149
152
|
*/
|
|
150
153
|
declare function parseScope(fullScope: string): EdgeScope | null;
|
|
@@ -155,7 +158,7 @@ declare function isValidScope(scope: string): scope is EdgeScope;
|
|
|
155
158
|
/**
|
|
156
159
|
* Checks whether a scope string requests the future transfer feature.
|
|
157
160
|
* Accepts either short scopes (`transfer.write`) or formatted environment
|
|
158
|
-
* scopes (`edge-connect-
|
|
161
|
+
* scopes (`edge-connect-sandbox/transfer.write`).
|
|
159
162
|
*/
|
|
160
163
|
declare function isTransferWriteScope(scope: string): boolean;
|
|
161
164
|
|
|
@@ -2782,7 +2785,7 @@ interface EdgeTokens {
|
|
|
2782
2785
|
* ```typescript
|
|
2783
2786
|
* const link = new EdgeLink({
|
|
2784
2787
|
* clientId: 'your-client-id',
|
|
2785
|
-
* environment: '
|
|
2788
|
+
* environment: 'sandbox',
|
|
2786
2789
|
* onSuccess: (result: EdgeLinkSuccess) => {
|
|
2787
2790
|
* // Send to your backend
|
|
2788
2791
|
* fetch('/api/edge/exchange', {
|
|
@@ -3205,7 +3208,7 @@ declare function isFeatureUnavailableError(error: unknown): error is EdgeFeature
|
|
|
3205
3208
|
*
|
|
3206
3209
|
* This package provides the foundation for building EDGE Connect integrations:
|
|
3207
3210
|
* - Type definitions generated from the OpenAPI spec
|
|
3208
|
-
* - Environment configuration (production,
|
|
3211
|
+
* - Environment configuration (production, sandbox)
|
|
3209
3212
|
* - OAuth scope constants
|
|
3210
3213
|
* - Typed error classes
|
|
3211
3214
|
*
|
|
@@ -3245,4 +3248,4 @@ declare const SDK_VERSION = "1.0.0";
|
|
|
3245
3248
|
*/
|
|
3246
3249
|
declare const SDK_NAME = "@edge-markets/connect";
|
|
3247
3250
|
|
|
3248
|
-
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, type ApiError, type Balance, type BaseWebhookEvent, type ConsentRequiredError, type ConsentRevokedEventData, type CreateVerificationSessionRequest, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_ENVIRONMENTS, EDGE_LINK_PATH, EDGE_SCOPES, EDGE_WEBHOOK_EVENT_TYPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeFeatureUnavailableError, EdgeIdentityVerificationError, EdgeInsufficientScopeError, type EdgeLinkConfigBase, type EdgeLinkEvent, type EdgeLinkEventName, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type EdgeWebhookEvent, type EdgeWebhookEventType, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type PKCEPair, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, type SdkGeolocation, TRANSFER_CATEGORIES, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferCategory, type TransferCompletedEventData, type TransferExpiredEventData, type TransferFailedEventData, type TransferList, type TransferListItem, type TransferProcessingEventData, type TransferStatus, type TransferType, type User, type UserAddress, type VerificationSession, type VerificationSessionStatus, type VerificationSessionStatusResponse, type VerifyIdentityAddress, type VerifyIdentityOptions, type VerifyIdentityResult, type VerifyIdentityScores, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, getLinkUrl, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isFeatureUnavailableError, isIdentityVerificationError, isNetworkError, isProductionEnvironment, isTransferWriteScope, isValidScope, type operations, parseScope, type paths };
|
|
3251
|
+
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, type ApiError, type Balance, type BaseWebhookEvent, type ConsentRequiredError, type ConsentRevokedEventData, type CreateVerificationSessionRequest, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_ENVIRONMENTS, EDGE_LINK_PATH, EDGE_SCOPES, EDGE_WEBHOOK_EVENT_TYPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeFeatureUnavailableError, EdgeIdentityVerificationError, EdgeInsufficientScopeError, type EdgeLinkConfigBase, type EdgeLinkEvent, type EdgeLinkEventName, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type EdgeWebhookEvent, type EdgeWebhookEventType, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type PKCEPair, RESERVED_EDGE_SCOPES, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, type SdkGeolocation, TRANSFER_CATEGORIES, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferCategory, type TransferCompletedEventData, type TransferExpiredEventData, type TransferFailedEventData, type TransferList, type TransferListItem, type TransferProcessingEventData, type TransferStatus, type TransferType, type User, type UserAddress, type VerificationSession, type VerificationSessionStatus, type VerificationSessionStatusResponse, type VerifyIdentityAddress, type VerifyIdentityOptions, type VerifyIdentityResult, type VerifyIdentityScores, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, getLinkUrl, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isFeatureUnavailableError, isIdentityVerificationError, isNetworkError, isProductionEnvironment, isTransferWriteScope, isValidScope, type operations, parseScope, type paths };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
EdgeTokenExchangeError: () => EdgeTokenExchangeError,
|
|
43
43
|
EdgeValidationError: () => EdgeValidationError,
|
|
44
44
|
OTP_METHODS: () => OTP_METHODS,
|
|
45
|
+
RESERVED_EDGE_SCOPES: () => RESERVED_EDGE_SCOPES,
|
|
45
46
|
SCOPE_DESCRIPTIONS: () => SCOPE_DESCRIPTIONS,
|
|
46
47
|
SCOPE_ICONS: () => SCOPE_ICONS,
|
|
47
48
|
SDK_NAME: () => SDK_NAME,
|
|
@@ -105,47 +106,16 @@ var EDGE_ENVIRONMENTS = {
|
|
|
105
106
|
displayName: "Production",
|
|
106
107
|
isProduction: true
|
|
107
108
|
},
|
|
108
|
-
staging: {
|
|
109
|
-
cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
|
|
110
|
-
// Staging partner API — mTLS-enforced. Requires a partner client
|
|
111
|
-
// certificate on every request. Routed through API Gateway → VPC Link →
|
|
112
|
-
// internal ALB → ECS. Direct routes to the backend (e.g.
|
|
113
|
-
// backend.connect-staging.edgeboost.io) no longer exist.
|
|
114
|
-
apiBaseUrl: "https://connect-staging.edgeboost.io/connect/v1",
|
|
115
|
-
// OAuth token exchange — partner-facing, also mTLS-enforced.
|
|
116
|
-
oauthBaseUrl: "https://connect-staging.edgeboost.io/connect/oauth",
|
|
117
|
-
// User-facing captive frame for the Link SDK enrollment and transfer
|
|
118
|
-
// verification flows. Served from the edge-connect-oauth Vite app
|
|
119
|
-
// deployed on Amplify. No mTLS — browser traffic.
|
|
120
|
-
userClientUrl: "https://oauth.staging-app.edgeboost.io",
|
|
121
|
-
displayName: "Staging",
|
|
122
|
-
isProduction: false
|
|
123
|
-
},
|
|
124
109
|
sandbox: {
|
|
125
110
|
cognitoDomain: "https://edge-connect-sandbox.auth.us-east-1.amazoncognito.com",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
111
|
+
// Sandbox partner API — mTLS-enforced. Uses its own sandbox gateway and
|
|
112
|
+
// sandbox OAuth/JWKS issuer. The browser Link UI is served from a separate
|
|
113
|
+
// sandbox host.
|
|
114
|
+
apiBaseUrl: "https://sandbox.connect.staging.edgeboost.io/connect/v1",
|
|
115
|
+
oauthBaseUrl: "https://sandbox.connect.staging.edgeboost.io/connect/oauth",
|
|
116
|
+
userClientUrl: "https://sandbox-oauth.staging-app.edgeboost.io",
|
|
129
117
|
displayName: "Sandbox",
|
|
130
118
|
isProduction: false
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* Development environment for local testing with API Gateway.
|
|
134
|
-
*
|
|
135
|
-
* Architecture:
|
|
136
|
-
* - apiBaseUrl: Goes through API Gateway → ngrok → local backend (JWT validated by API Gateway)
|
|
137
|
-
* - oauthBaseUrl: Goes directly to ngrok → local backend (consent/token exchange)
|
|
138
|
-
* - userClientUrl: ngrok tunnel to local edgeboost-user-client (consent popup)
|
|
139
|
-
*
|
|
140
|
-
* The ngrok URL is configured in edgeboost-api/ngrok.yml with a static domain.
|
|
141
|
-
*/
|
|
142
|
-
development: {
|
|
143
|
-
cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
|
|
144
|
-
apiBaseUrl: "https://connect-staging.edgeboost.io/connect/v1",
|
|
145
|
-
oauthBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/oauth",
|
|
146
|
-
userClientUrl: "https://edgeboost-user-client.ngrok-free.app",
|
|
147
|
-
displayName: "Development",
|
|
148
|
-
isProduction: false
|
|
149
119
|
}
|
|
150
120
|
};
|
|
151
121
|
function getEnvironmentConfig(environment) {
|
|
@@ -182,16 +152,18 @@ var EDGE_SCOPES = {
|
|
|
182
152
|
*/
|
|
183
153
|
BALANCE_READ: "balance.read",
|
|
184
154
|
/**
|
|
185
|
-
*
|
|
186
|
-
* Not available
|
|
187
|
-
* EdgeFeatureUnavailableError until EDGE enables transfers
|
|
155
|
+
* Reserved for future fund transfers and EDGE-hosted verification sessions.
|
|
156
|
+
* Not available in sandbox or production. Requesting this scope from Link
|
|
157
|
+
* SDKs fails with EdgeFeatureUnavailableError until EDGE enables transfers
|
|
158
|
+
* for a partner.
|
|
188
159
|
*
|
|
189
160
|
* Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verification-session`, `GET /v1/transfers`
|
|
190
161
|
*/
|
|
191
162
|
TRANSFER_WRITE: "transfer.write"
|
|
192
163
|
};
|
|
193
|
-
var ALL_EDGE_SCOPES = Object.values(EDGE_SCOPES);
|
|
194
164
|
var ACTIVE_EDGE_SCOPES = [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ];
|
|
165
|
+
var RESERVED_EDGE_SCOPES = [EDGE_SCOPES.TRANSFER_WRITE];
|
|
166
|
+
var ALL_EDGE_SCOPES = ACTIVE_EDGE_SCOPES;
|
|
195
167
|
var SCOPE_DESCRIPTIONS = {
|
|
196
168
|
[EDGE_SCOPES.USER_READ]: "View your profile information (name and email)",
|
|
197
169
|
[EDGE_SCOPES.BALANCE_READ]: "View your EdgeBoost account balance",
|
|
@@ -203,8 +175,7 @@ var SCOPE_ICONS = {
|
|
|
203
175
|
[EDGE_SCOPES.TRANSFER_WRITE]: "arrow-left-right"
|
|
204
176
|
};
|
|
205
177
|
function formatScopeForEnvironment(scope, environment) {
|
|
206
|
-
const
|
|
207
|
-
const prefix = effectiveEnv === "production" ? "edge-connect" : `edge-connect-${effectiveEnv}`;
|
|
178
|
+
const prefix = environment === "production" ? "edge-connect" : `edge-connect-${environment}`;
|
|
208
179
|
return `${prefix}/${scope}`;
|
|
209
180
|
}
|
|
210
181
|
function formatScopesForEnvironment(scopes, environment) {
|
|
@@ -399,6 +370,7 @@ var SDK_NAME = "@edge-markets/connect";
|
|
|
399
370
|
EdgeTokenExchangeError,
|
|
400
371
|
EdgeValidationError,
|
|
401
372
|
OTP_METHODS,
|
|
373
|
+
RESERVED_EDGE_SCOPES,
|
|
402
374
|
SCOPE_DESCRIPTIONS,
|
|
403
375
|
SCOPE_ICONS,
|
|
404
376
|
SDK_NAME,
|
package/dist/index.mjs
CHANGED
|
@@ -35,47 +35,16 @@ var EDGE_ENVIRONMENTS = {
|
|
|
35
35
|
displayName: "Production",
|
|
36
36
|
isProduction: true
|
|
37
37
|
},
|
|
38
|
-
staging: {
|
|
39
|
-
cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
|
|
40
|
-
// Staging partner API — mTLS-enforced. Requires a partner client
|
|
41
|
-
// certificate on every request. Routed through API Gateway → VPC Link →
|
|
42
|
-
// internal ALB → ECS. Direct routes to the backend (e.g.
|
|
43
|
-
// backend.connect-staging.edgeboost.io) no longer exist.
|
|
44
|
-
apiBaseUrl: "https://connect-staging.edgeboost.io/connect/v1",
|
|
45
|
-
// OAuth token exchange — partner-facing, also mTLS-enforced.
|
|
46
|
-
oauthBaseUrl: "https://connect-staging.edgeboost.io/connect/oauth",
|
|
47
|
-
// User-facing captive frame for the Link SDK enrollment and transfer
|
|
48
|
-
// verification flows. Served from the edge-connect-oauth Vite app
|
|
49
|
-
// deployed on Amplify. No mTLS — browser traffic.
|
|
50
|
-
userClientUrl: "https://oauth.staging-app.edgeboost.io",
|
|
51
|
-
displayName: "Staging",
|
|
52
|
-
isProduction: false
|
|
53
|
-
},
|
|
54
38
|
sandbox: {
|
|
55
39
|
cognitoDomain: "https://edge-connect-sandbox.auth.us-east-1.amazoncognito.com",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
// Sandbox partner API — mTLS-enforced. Uses its own sandbox gateway and
|
|
41
|
+
// sandbox OAuth/JWKS issuer. The browser Link UI is served from a separate
|
|
42
|
+
// sandbox host.
|
|
43
|
+
apiBaseUrl: "https://sandbox.connect.staging.edgeboost.io/connect/v1",
|
|
44
|
+
oauthBaseUrl: "https://sandbox.connect.staging.edgeboost.io/connect/oauth",
|
|
45
|
+
userClientUrl: "https://sandbox-oauth.staging-app.edgeboost.io",
|
|
59
46
|
displayName: "Sandbox",
|
|
60
47
|
isProduction: false
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* Development environment for local testing with API Gateway.
|
|
64
|
-
*
|
|
65
|
-
* Architecture:
|
|
66
|
-
* - apiBaseUrl: Goes through API Gateway → ngrok → local backend (JWT validated by API Gateway)
|
|
67
|
-
* - oauthBaseUrl: Goes directly to ngrok → local backend (consent/token exchange)
|
|
68
|
-
* - userClientUrl: ngrok tunnel to local edgeboost-user-client (consent popup)
|
|
69
|
-
*
|
|
70
|
-
* The ngrok URL is configured in edgeboost-api/ngrok.yml with a static domain.
|
|
71
|
-
*/
|
|
72
|
-
development: {
|
|
73
|
-
cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
|
|
74
|
-
apiBaseUrl: "https://connect-staging.edgeboost.io/connect/v1",
|
|
75
|
-
oauthBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/oauth",
|
|
76
|
-
userClientUrl: "https://edgeboost-user-client.ngrok-free.app",
|
|
77
|
-
displayName: "Development",
|
|
78
|
-
isProduction: false
|
|
79
48
|
}
|
|
80
49
|
};
|
|
81
50
|
function getEnvironmentConfig(environment) {
|
|
@@ -112,16 +81,18 @@ var EDGE_SCOPES = {
|
|
|
112
81
|
*/
|
|
113
82
|
BALANCE_READ: "balance.read",
|
|
114
83
|
/**
|
|
115
|
-
*
|
|
116
|
-
* Not available
|
|
117
|
-
* EdgeFeatureUnavailableError until EDGE enables transfers
|
|
84
|
+
* Reserved for future fund transfers and EDGE-hosted verification sessions.
|
|
85
|
+
* Not available in sandbox or production. Requesting this scope from Link
|
|
86
|
+
* SDKs fails with EdgeFeatureUnavailableError until EDGE enables transfers
|
|
87
|
+
* for a partner.
|
|
118
88
|
*
|
|
119
89
|
* Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verification-session`, `GET /v1/transfers`
|
|
120
90
|
*/
|
|
121
91
|
TRANSFER_WRITE: "transfer.write"
|
|
122
92
|
};
|
|
123
|
-
var ALL_EDGE_SCOPES = Object.values(EDGE_SCOPES);
|
|
124
93
|
var ACTIVE_EDGE_SCOPES = [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ];
|
|
94
|
+
var RESERVED_EDGE_SCOPES = [EDGE_SCOPES.TRANSFER_WRITE];
|
|
95
|
+
var ALL_EDGE_SCOPES = ACTIVE_EDGE_SCOPES;
|
|
125
96
|
var SCOPE_DESCRIPTIONS = {
|
|
126
97
|
[EDGE_SCOPES.USER_READ]: "View your profile information (name and email)",
|
|
127
98
|
[EDGE_SCOPES.BALANCE_READ]: "View your EdgeBoost account balance",
|
|
@@ -133,8 +104,7 @@ var SCOPE_ICONS = {
|
|
|
133
104
|
[EDGE_SCOPES.TRANSFER_WRITE]: "arrow-left-right"
|
|
134
105
|
};
|
|
135
106
|
function formatScopeForEnvironment(scope, environment) {
|
|
136
|
-
const
|
|
137
|
-
const prefix = effectiveEnv === "production" ? "edge-connect" : `edge-connect-${effectiveEnv}`;
|
|
107
|
+
const prefix = environment === "production" ? "edge-connect" : `edge-connect-${environment}`;
|
|
138
108
|
return `${prefix}/${scope}`;
|
|
139
109
|
}
|
|
140
110
|
function formatScopesForEnvironment(scopes, environment) {
|
|
@@ -328,6 +298,7 @@ export {
|
|
|
328
298
|
EdgeTokenExchangeError,
|
|
329
299
|
EdgeValidationError,
|
|
330
300
|
OTP_METHODS,
|
|
301
|
+
RESERVED_EDGE_SCOPES,
|
|
331
302
|
SCOPE_DESCRIPTIONS,
|
|
332
303
|
SCOPE_ICONS,
|
|
333
304
|
SDK_NAME,
|