@edge-markets/connect 1.0.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/dist/index.js ADDED
@@ -0,0 +1,348 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ALL_EDGE_SCOPES: () => ALL_EDGE_SCOPES,
24
+ EDGE_ENVIRONMENTS: () => EDGE_ENVIRONMENTS,
25
+ EDGE_SCOPES: () => EDGE_SCOPES,
26
+ EdgeApiError: () => EdgeApiError,
27
+ EdgeAuthenticationError: () => EdgeAuthenticationError,
28
+ EdgeConsentRequiredError: () => EdgeConsentRequiredError,
29
+ EdgeError: () => EdgeError,
30
+ EdgeInsufficientScopeError: () => EdgeInsufficientScopeError,
31
+ EdgeNetworkError: () => EdgeNetworkError,
32
+ EdgeNotFoundError: () => EdgeNotFoundError,
33
+ EdgePopupBlockedError: () => EdgePopupBlockedError,
34
+ EdgePopupClosedError: () => EdgePopupClosedError,
35
+ EdgeStateMismatchError: () => EdgeStateMismatchError,
36
+ EdgeTokenExchangeError: () => EdgeTokenExchangeError,
37
+ EdgeValidationError: () => EdgeValidationError,
38
+ OTP_METHODS: () => OTP_METHODS,
39
+ SCOPE_DESCRIPTIONS: () => SCOPE_DESCRIPTIONS,
40
+ SCOPE_ICONS: () => SCOPE_ICONS,
41
+ SDK_NAME: () => SDK_NAME,
42
+ SDK_VERSION: () => SDK_VERSION,
43
+ TRANSFER_STATUSES: () => TRANSFER_STATUSES,
44
+ TRANSFER_TYPES: () => TRANSFER_TYPES,
45
+ formatScopeForEnvironment: () => formatScopeForEnvironment,
46
+ formatScopesForEnvironment: () => formatScopesForEnvironment,
47
+ getAvailableEnvironments: () => getAvailableEnvironments,
48
+ getEnvironmentConfig: () => getEnvironmentConfig,
49
+ isApiError: () => isApiError,
50
+ isAuthenticationError: () => isAuthenticationError,
51
+ isConsentRequiredError: () => isConsentRequiredError,
52
+ isEdgeError: () => isEdgeError,
53
+ isNetworkError: () => isNetworkError,
54
+ isProductionEnvironment: () => isProductionEnvironment,
55
+ isValidScope: () => isValidScope,
56
+ parseScope: () => parseScope
57
+ });
58
+ module.exports = __toCommonJS(index_exports);
59
+
60
+ // src/types/api.types.ts
61
+ var TRANSFER_TYPES = ["debit", "credit"];
62
+ var TRANSFER_STATUSES = [
63
+ "pending_verification",
64
+ "completed",
65
+ "failed",
66
+ "expired"
67
+ ];
68
+ var OTP_METHODS = ["sms", "totp"];
69
+
70
+ // src/config/environments.ts
71
+ var EDGE_ENVIRONMENTS = {
72
+ production: {
73
+ authDomain: "auth.edgeboost.com",
74
+ apiBaseUrl: "https://api.edgeboost.com/connect/v1",
75
+ oauthBaseUrl: "https://api.edgeboost.com",
76
+ userClientUrl: "https://app.edgeboost.com",
77
+ displayName: "Production",
78
+ isProduction: true
79
+ },
80
+ staging: {
81
+ // Legacy: Cognito User Pool for staging (not used with new self-issued tokens)
82
+ authDomain: "edge-connect-staging.auth.us-east-1.amazoncognito.com",
83
+ // API Gateway via ngrok - Connect API endpoints (NestJS mounted at /connect)
84
+ apiBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/connect/v1",
85
+ // API Gateway via ngrok - OAuth token endpoint (NestJS mounted at /connect)
86
+ oauthBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/connect",
87
+ // User client for OAuth login/consent
88
+ userClientUrl: "https://edgeboost-user-client.ngrok.io",
89
+ displayName: "Staging",
90
+ isProduction: false
91
+ },
92
+ sandbox: {
93
+ authDomain: "sandbox-auth.edgeboost.com",
94
+ apiBaseUrl: "https://sandbox-api.edgeboost.com/connect/v1",
95
+ oauthBaseUrl: "https://sandbox-api.edgeboost.com",
96
+ userClientUrl: "https://sandbox.edgeboost.com",
97
+ displayName: "Sandbox",
98
+ isProduction: false
99
+ }
100
+ };
101
+ function getEnvironmentConfig(environment) {
102
+ return EDGE_ENVIRONMENTS[environment];
103
+ }
104
+ function isProductionEnvironment(environment) {
105
+ return EDGE_ENVIRONMENTS[environment].isProduction;
106
+ }
107
+ function getAvailableEnvironments() {
108
+ return Object.keys(EDGE_ENVIRONMENTS);
109
+ }
110
+
111
+ // src/config/scopes.ts
112
+ var EDGE_SCOPES = {
113
+ /**
114
+ * Read user profile information (name, email).
115
+ * Required for: `GET /v1/user`
116
+ */
117
+ USER_READ: "user.read",
118
+ /**
119
+ * Read account balance.
120
+ * Required for: `GET /v1/balance`
121
+ */
122
+ BALANCE_READ: "balance.read",
123
+ /**
124
+ * Initiate and verify fund transfers.
125
+ * Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verify`, `GET /v1/transfers`
126
+ */
127
+ TRANSFER_WRITE: "transfer.write"
128
+ };
129
+ var ALL_EDGE_SCOPES = Object.values(EDGE_SCOPES);
130
+ var SCOPE_DESCRIPTIONS = {
131
+ [EDGE_SCOPES.USER_READ]: "View your profile information (name and email)",
132
+ [EDGE_SCOPES.BALANCE_READ]: "View your EdgeBoost account balance",
133
+ [EDGE_SCOPES.TRANSFER_WRITE]: "Transfer funds to and from your EdgeBoost account"
134
+ };
135
+ var SCOPE_ICONS = {
136
+ [EDGE_SCOPES.USER_READ]: "user",
137
+ [EDGE_SCOPES.BALANCE_READ]: "wallet",
138
+ [EDGE_SCOPES.TRANSFER_WRITE]: "arrow-left-right"
139
+ };
140
+ function formatScopeForEnvironment(scope, environment) {
141
+ const prefix = environment === "production" ? "edge-connect" : `edge-connect-${environment}`;
142
+ return `${prefix}/${scope}`;
143
+ }
144
+ function formatScopesForEnvironment(scopes, environment) {
145
+ return [...scopes].map((scope) => formatScopeForEnvironment(scope, environment));
146
+ }
147
+ function parseScope(fullScope) {
148
+ const parts = fullScope.split("/");
149
+ if (parts.length !== 2) return null;
150
+ const baseScope = parts[1];
151
+ return Object.values(EDGE_SCOPES).includes(baseScope) ? baseScope : null;
152
+ }
153
+ function isValidScope(scope) {
154
+ return Object.values(EDGE_SCOPES).includes(scope);
155
+ }
156
+
157
+ // src/errors/edge.error.ts
158
+ var EdgeError = class _EdgeError extends Error {
159
+ constructor(code, message, statusCode, details) {
160
+ super(message);
161
+ this.name = "EdgeError";
162
+ this.code = code;
163
+ this.statusCode = statusCode;
164
+ this.details = details;
165
+ if (Error.captureStackTrace) {
166
+ Error.captureStackTrace(this, _EdgeError);
167
+ }
168
+ Object.setPrototypeOf(this, new.target.prototype);
169
+ }
170
+ /**
171
+ * Creates a user-friendly error message for display.
172
+ */
173
+ toUserMessage() {
174
+ return this.message;
175
+ }
176
+ /**
177
+ * Converts error to a plain object for logging/serialization.
178
+ */
179
+ toJSON() {
180
+ return {
181
+ name: this.name,
182
+ code: this.code,
183
+ message: this.message,
184
+ statusCode: this.statusCode,
185
+ details: this.details
186
+ };
187
+ }
188
+ };
189
+ var EdgeAuthenticationError = class extends EdgeError {
190
+ constructor(message, details) {
191
+ super(
192
+ "authentication_failed",
193
+ message || "Authentication failed or access token is invalid/expired",
194
+ 401,
195
+ details
196
+ );
197
+ this.name = "EdgeAuthenticationError";
198
+ }
199
+ };
200
+ var EdgeTokenExchangeError = class extends EdgeError {
201
+ constructor(message, details) {
202
+ super(
203
+ "token_exchange_failed",
204
+ message || "Failed to exchange authorization code for tokens",
205
+ 400,
206
+ details
207
+ );
208
+ this.name = "EdgeTokenExchangeError";
209
+ }
210
+ };
211
+ var EdgeConsentRequiredError = class extends EdgeError {
212
+ constructor(clientId, consentUrl, message) {
213
+ super(
214
+ "consent_required",
215
+ message || "User has not granted consent to this application",
216
+ 403,
217
+ { clientId, consentUrl }
218
+ );
219
+ this.name = "EdgeConsentRequiredError";
220
+ this.clientId = clientId;
221
+ this.consentUrl = consentUrl;
222
+ }
223
+ };
224
+ var EdgeInsufficientScopeError = class extends EdgeError {
225
+ constructor(missingScopes, message) {
226
+ super(
227
+ "insufficient_scope",
228
+ message || `Missing required scopes: ${missingScopes.join(", ")}`,
229
+ 403,
230
+ { missingScopes }
231
+ );
232
+ this.name = "EdgeInsufficientScopeError";
233
+ this.missingScopes = missingScopes;
234
+ }
235
+ };
236
+ var EdgeApiError = class extends EdgeError {
237
+ constructor(code, message, statusCode, details) {
238
+ super(code, message, statusCode, details);
239
+ this.name = "EdgeApiError";
240
+ }
241
+ };
242
+ var EdgeNotFoundError = class extends EdgeError {
243
+ constructor(resourceType, resourceId) {
244
+ super("not_found", `${resourceType} not found: ${resourceId}`, 404, { resourceType, resourceId });
245
+ this.name = "EdgeNotFoundError";
246
+ this.resourceType = resourceType;
247
+ this.resourceId = resourceId;
248
+ }
249
+ };
250
+ var EdgeValidationError = class extends EdgeError {
251
+ constructor(message, validationErrors) {
252
+ super("validation_failed", message, 400, { validationErrors });
253
+ this.name = "EdgeValidationError";
254
+ this.validationErrors = validationErrors;
255
+ }
256
+ };
257
+ var EdgePopupBlockedError = class extends EdgeError {
258
+ constructor() {
259
+ super(
260
+ "popup_blocked",
261
+ "Popup was blocked by the browser. Please allow popups for this site and try again."
262
+ );
263
+ this.name = "EdgePopupBlockedError";
264
+ }
265
+ toUserMessage() {
266
+ return "Please allow popups for this site to connect your EdgeBoost account.";
267
+ }
268
+ };
269
+ var EdgePopupClosedError = class extends EdgeError {
270
+ constructor() {
271
+ super("popup_closed", "User closed the authentication popup");
272
+ this.name = "EdgePopupClosedError";
273
+ }
274
+ };
275
+ var EdgeStateMismatchError = class extends EdgeError {
276
+ constructor() {
277
+ super(
278
+ "state_mismatch",
279
+ "Security error: state parameter mismatch. Please try again."
280
+ );
281
+ this.name = "EdgeStateMismatchError";
282
+ }
283
+ };
284
+ var EdgeNetworkError = class extends EdgeError {
285
+ constructor(message, cause) {
286
+ super("network_error", message || "Network request failed. Please check your connection.", void 0, {
287
+ originalError: cause?.message
288
+ });
289
+ this.name = "EdgeNetworkError";
290
+ this.cause = cause;
291
+ }
292
+ };
293
+ function isEdgeError(error) {
294
+ return error instanceof EdgeError;
295
+ }
296
+ function isAuthenticationError(error) {
297
+ return error instanceof EdgeAuthenticationError;
298
+ }
299
+ function isConsentRequiredError(error) {
300
+ return error instanceof EdgeConsentRequiredError;
301
+ }
302
+ function isApiError(error) {
303
+ return error instanceof EdgeApiError;
304
+ }
305
+ function isNetworkError(error) {
306
+ return error instanceof EdgeNetworkError;
307
+ }
308
+
309
+ // src/index.ts
310
+ var SDK_VERSION = "1.0.0";
311
+ var SDK_NAME = "@edge-markets/connect";
312
+ // Annotate the CommonJS export names for ESM import in node:
313
+ 0 && (module.exports = {
314
+ ALL_EDGE_SCOPES,
315
+ EDGE_ENVIRONMENTS,
316
+ EDGE_SCOPES,
317
+ EdgeApiError,
318
+ EdgeAuthenticationError,
319
+ EdgeConsentRequiredError,
320
+ EdgeError,
321
+ EdgeInsufficientScopeError,
322
+ EdgeNetworkError,
323
+ EdgeNotFoundError,
324
+ EdgePopupBlockedError,
325
+ EdgePopupClosedError,
326
+ EdgeStateMismatchError,
327
+ EdgeTokenExchangeError,
328
+ EdgeValidationError,
329
+ OTP_METHODS,
330
+ SCOPE_DESCRIPTIONS,
331
+ SCOPE_ICONS,
332
+ SDK_NAME,
333
+ SDK_VERSION,
334
+ TRANSFER_STATUSES,
335
+ TRANSFER_TYPES,
336
+ formatScopeForEnvironment,
337
+ formatScopesForEnvironment,
338
+ getAvailableEnvironments,
339
+ getEnvironmentConfig,
340
+ isApiError,
341
+ isAuthenticationError,
342
+ isConsentRequiredError,
343
+ isEdgeError,
344
+ isNetworkError,
345
+ isProductionEnvironment,
346
+ isValidScope,
347
+ parseScope
348
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,288 @@
1
+ // src/types/api.types.ts
2
+ var TRANSFER_TYPES = ["debit", "credit"];
3
+ var TRANSFER_STATUSES = [
4
+ "pending_verification",
5
+ "completed",
6
+ "failed",
7
+ "expired"
8
+ ];
9
+ var OTP_METHODS = ["sms", "totp"];
10
+
11
+ // src/config/environments.ts
12
+ var EDGE_ENVIRONMENTS = {
13
+ production: {
14
+ authDomain: "auth.edgeboost.com",
15
+ apiBaseUrl: "https://api.edgeboost.com/connect/v1",
16
+ oauthBaseUrl: "https://api.edgeboost.com",
17
+ userClientUrl: "https://app.edgeboost.com",
18
+ displayName: "Production",
19
+ isProduction: true
20
+ },
21
+ staging: {
22
+ // Legacy: Cognito User Pool for staging (not used with new self-issued tokens)
23
+ authDomain: "edge-connect-staging.auth.us-east-1.amazoncognito.com",
24
+ // API Gateway via ngrok - Connect API endpoints (NestJS mounted at /connect)
25
+ apiBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/connect/v1",
26
+ // API Gateway via ngrok - OAuth token endpoint (NestJS mounted at /connect)
27
+ oauthBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/connect",
28
+ // User client for OAuth login/consent
29
+ userClientUrl: "https://edgeboost-user-client.ngrok.io",
30
+ displayName: "Staging",
31
+ isProduction: false
32
+ },
33
+ sandbox: {
34
+ authDomain: "sandbox-auth.edgeboost.com",
35
+ apiBaseUrl: "https://sandbox-api.edgeboost.com/connect/v1",
36
+ oauthBaseUrl: "https://sandbox-api.edgeboost.com",
37
+ userClientUrl: "https://sandbox.edgeboost.com",
38
+ displayName: "Sandbox",
39
+ isProduction: false
40
+ }
41
+ };
42
+ function getEnvironmentConfig(environment) {
43
+ return EDGE_ENVIRONMENTS[environment];
44
+ }
45
+ function isProductionEnvironment(environment) {
46
+ return EDGE_ENVIRONMENTS[environment].isProduction;
47
+ }
48
+ function getAvailableEnvironments() {
49
+ return Object.keys(EDGE_ENVIRONMENTS);
50
+ }
51
+
52
+ // src/config/scopes.ts
53
+ var EDGE_SCOPES = {
54
+ /**
55
+ * Read user profile information (name, email).
56
+ * Required for: `GET /v1/user`
57
+ */
58
+ USER_READ: "user.read",
59
+ /**
60
+ * Read account balance.
61
+ * Required for: `GET /v1/balance`
62
+ */
63
+ BALANCE_READ: "balance.read",
64
+ /**
65
+ * Initiate and verify fund transfers.
66
+ * Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verify`, `GET /v1/transfers`
67
+ */
68
+ TRANSFER_WRITE: "transfer.write"
69
+ };
70
+ var ALL_EDGE_SCOPES = Object.values(EDGE_SCOPES);
71
+ var SCOPE_DESCRIPTIONS = {
72
+ [EDGE_SCOPES.USER_READ]: "View your profile information (name and email)",
73
+ [EDGE_SCOPES.BALANCE_READ]: "View your EdgeBoost account balance",
74
+ [EDGE_SCOPES.TRANSFER_WRITE]: "Transfer funds to and from your EdgeBoost account"
75
+ };
76
+ var SCOPE_ICONS = {
77
+ [EDGE_SCOPES.USER_READ]: "user",
78
+ [EDGE_SCOPES.BALANCE_READ]: "wallet",
79
+ [EDGE_SCOPES.TRANSFER_WRITE]: "arrow-left-right"
80
+ };
81
+ function formatScopeForEnvironment(scope, environment) {
82
+ const prefix = environment === "production" ? "edge-connect" : `edge-connect-${environment}`;
83
+ return `${prefix}/${scope}`;
84
+ }
85
+ function formatScopesForEnvironment(scopes, environment) {
86
+ return [...scopes].map((scope) => formatScopeForEnvironment(scope, environment));
87
+ }
88
+ function parseScope(fullScope) {
89
+ const parts = fullScope.split("/");
90
+ if (parts.length !== 2) return null;
91
+ const baseScope = parts[1];
92
+ return Object.values(EDGE_SCOPES).includes(baseScope) ? baseScope : null;
93
+ }
94
+ function isValidScope(scope) {
95
+ return Object.values(EDGE_SCOPES).includes(scope);
96
+ }
97
+
98
+ // src/errors/edge.error.ts
99
+ var EdgeError = class _EdgeError extends Error {
100
+ constructor(code, message, statusCode, details) {
101
+ super(message);
102
+ this.name = "EdgeError";
103
+ this.code = code;
104
+ this.statusCode = statusCode;
105
+ this.details = details;
106
+ if (Error.captureStackTrace) {
107
+ Error.captureStackTrace(this, _EdgeError);
108
+ }
109
+ Object.setPrototypeOf(this, new.target.prototype);
110
+ }
111
+ /**
112
+ * Creates a user-friendly error message for display.
113
+ */
114
+ toUserMessage() {
115
+ return this.message;
116
+ }
117
+ /**
118
+ * Converts error to a plain object for logging/serialization.
119
+ */
120
+ toJSON() {
121
+ return {
122
+ name: this.name,
123
+ code: this.code,
124
+ message: this.message,
125
+ statusCode: this.statusCode,
126
+ details: this.details
127
+ };
128
+ }
129
+ };
130
+ var EdgeAuthenticationError = class extends EdgeError {
131
+ constructor(message, details) {
132
+ super(
133
+ "authentication_failed",
134
+ message || "Authentication failed or access token is invalid/expired",
135
+ 401,
136
+ details
137
+ );
138
+ this.name = "EdgeAuthenticationError";
139
+ }
140
+ };
141
+ var EdgeTokenExchangeError = class extends EdgeError {
142
+ constructor(message, details) {
143
+ super(
144
+ "token_exchange_failed",
145
+ message || "Failed to exchange authorization code for tokens",
146
+ 400,
147
+ details
148
+ );
149
+ this.name = "EdgeTokenExchangeError";
150
+ }
151
+ };
152
+ var EdgeConsentRequiredError = class extends EdgeError {
153
+ constructor(clientId, consentUrl, message) {
154
+ super(
155
+ "consent_required",
156
+ message || "User has not granted consent to this application",
157
+ 403,
158
+ { clientId, consentUrl }
159
+ );
160
+ this.name = "EdgeConsentRequiredError";
161
+ this.clientId = clientId;
162
+ this.consentUrl = consentUrl;
163
+ }
164
+ };
165
+ var EdgeInsufficientScopeError = class extends EdgeError {
166
+ constructor(missingScopes, message) {
167
+ super(
168
+ "insufficient_scope",
169
+ message || `Missing required scopes: ${missingScopes.join(", ")}`,
170
+ 403,
171
+ { missingScopes }
172
+ );
173
+ this.name = "EdgeInsufficientScopeError";
174
+ this.missingScopes = missingScopes;
175
+ }
176
+ };
177
+ var EdgeApiError = class extends EdgeError {
178
+ constructor(code, message, statusCode, details) {
179
+ super(code, message, statusCode, details);
180
+ this.name = "EdgeApiError";
181
+ }
182
+ };
183
+ var EdgeNotFoundError = class extends EdgeError {
184
+ constructor(resourceType, resourceId) {
185
+ super("not_found", `${resourceType} not found: ${resourceId}`, 404, { resourceType, resourceId });
186
+ this.name = "EdgeNotFoundError";
187
+ this.resourceType = resourceType;
188
+ this.resourceId = resourceId;
189
+ }
190
+ };
191
+ var EdgeValidationError = class extends EdgeError {
192
+ constructor(message, validationErrors) {
193
+ super("validation_failed", message, 400, { validationErrors });
194
+ this.name = "EdgeValidationError";
195
+ this.validationErrors = validationErrors;
196
+ }
197
+ };
198
+ var EdgePopupBlockedError = class extends EdgeError {
199
+ constructor() {
200
+ super(
201
+ "popup_blocked",
202
+ "Popup was blocked by the browser. Please allow popups for this site and try again."
203
+ );
204
+ this.name = "EdgePopupBlockedError";
205
+ }
206
+ toUserMessage() {
207
+ return "Please allow popups for this site to connect your EdgeBoost account.";
208
+ }
209
+ };
210
+ var EdgePopupClosedError = class extends EdgeError {
211
+ constructor() {
212
+ super("popup_closed", "User closed the authentication popup");
213
+ this.name = "EdgePopupClosedError";
214
+ }
215
+ };
216
+ var EdgeStateMismatchError = class extends EdgeError {
217
+ constructor() {
218
+ super(
219
+ "state_mismatch",
220
+ "Security error: state parameter mismatch. Please try again."
221
+ );
222
+ this.name = "EdgeStateMismatchError";
223
+ }
224
+ };
225
+ var EdgeNetworkError = class extends EdgeError {
226
+ constructor(message, cause) {
227
+ super("network_error", message || "Network request failed. Please check your connection.", void 0, {
228
+ originalError: cause?.message
229
+ });
230
+ this.name = "EdgeNetworkError";
231
+ this.cause = cause;
232
+ }
233
+ };
234
+ function isEdgeError(error) {
235
+ return error instanceof EdgeError;
236
+ }
237
+ function isAuthenticationError(error) {
238
+ return error instanceof EdgeAuthenticationError;
239
+ }
240
+ function isConsentRequiredError(error) {
241
+ return error instanceof EdgeConsentRequiredError;
242
+ }
243
+ function isApiError(error) {
244
+ return error instanceof EdgeApiError;
245
+ }
246
+ function isNetworkError(error) {
247
+ return error instanceof EdgeNetworkError;
248
+ }
249
+
250
+ // src/index.ts
251
+ var SDK_VERSION = "1.0.0";
252
+ var SDK_NAME = "@edge-markets/connect";
253
+ export {
254
+ ALL_EDGE_SCOPES,
255
+ EDGE_ENVIRONMENTS,
256
+ EDGE_SCOPES,
257
+ EdgeApiError,
258
+ EdgeAuthenticationError,
259
+ EdgeConsentRequiredError,
260
+ EdgeError,
261
+ EdgeInsufficientScopeError,
262
+ EdgeNetworkError,
263
+ EdgeNotFoundError,
264
+ EdgePopupBlockedError,
265
+ EdgePopupClosedError,
266
+ EdgeStateMismatchError,
267
+ EdgeTokenExchangeError,
268
+ EdgeValidationError,
269
+ OTP_METHODS,
270
+ SCOPE_DESCRIPTIONS,
271
+ SCOPE_ICONS,
272
+ SDK_NAME,
273
+ SDK_VERSION,
274
+ TRANSFER_STATUSES,
275
+ TRANSFER_TYPES,
276
+ formatScopeForEnvironment,
277
+ formatScopesForEnvironment,
278
+ getAvailableEnvironments,
279
+ getEnvironmentConfig,
280
+ isApiError,
281
+ isAuthenticationError,
282
+ isConsentRequiredError,
283
+ isEdgeError,
284
+ isNetworkError,
285
+ isProductionEnvironment,
286
+ isValidScope,
287
+ parseScope
288
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@edge-markets/connect",
3
+ "version": "1.0.0",
4
+ "description": "Core types, configuration, and utilities for EDGE Connect SDK",
5
+ "author": "EdgeBoost",
6
+ "license": "MIT",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.ts",
10
+ "sideEffects": false,
11
+ "exports": {
12
+ ".": {
13
+ "import": {
14
+ "types": "./dist/index.d.mts",
15
+ "default": "./dist/index.mjs"
16
+ },
17
+ "require": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ }
22
+ },
23
+ "scripts": {
24
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
25
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
26
+ "generate:types": "openapi-typescript http://localhost:9080/api/v3/api/docs-json -o src/types/generated.ts",
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "vitest",
29
+ "test:run": "vitest run"
30
+ },
31
+ "devDependencies": {
32
+ "openapi-typescript": "^7.0.0",
33
+ "tsup": "^8.0.0",
34
+ "typescript": "^5.3.0",
35
+ "vitest": "^1.0.0"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md"
40
+ ],
41
+ "keywords": [
42
+ "edgeboost",
43
+ "edge-connect",
44
+ "sdk",
45
+ "oauth",
46
+ "fintech",
47
+ "typescript"
48
+ ],
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/edgeboost/edge-connect-sdk.git",
52
+ "directory": "packages/core"
53
+ },
54
+ "engines": {
55
+ "node": ">=18"
56
+ }
57
+ }
58
+