@edge-markets/connect 1.0.0 → 1.2.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 CHANGED
@@ -132,3 +132,9 @@ isApiError(error) // API error
132
132
  MIT
133
133
 
134
134
 
135
+
136
+
137
+
138
+
139
+
140
+
package/dist/index.d.mts CHANGED
@@ -2430,86 +2430,21 @@ interface EdgeLinkExit {
2430
2430
  };
2431
2431
  }
2432
2432
 
2433
- /**
2434
- * EDGE Connect Environment Configuration
2435
- *
2436
- * Defines the URLs and settings for each deployment environment.
2437
- * Partners select an environment when initializing the SDK.
2438
- *
2439
- * @module @edge-markets/connect/config
2440
- */
2441
- /**
2442
- * Available EDGE Connect environments.
2443
- *
2444
- * - `production`: Live environment with real money
2445
- * - `staging`: Test environment with test accounts (use during development)
2446
- * - `sandbox`: Isolated environment with mock data (coming soon)
2447
- *
2448
- * @example
2449
- * ```typescript
2450
- * const edge = new EdgeConnectServer({
2451
- * clientId: process.env.EDGE_CLIENT_ID,
2452
- * clientSecret: process.env.EDGE_CLIENT_SECRET,
2453
- * environment: 'staging', // <-- autocomplete shows all options
2454
- * })
2455
- * ```
2456
- */
2457
- type EdgeEnvironment = 'production' | 'staging' | 'sandbox';
2458
- /**
2459
- * Configuration for a specific environment.
2460
- */
2433
+ type EdgeEnvironment = 'production' | 'staging' | 'sandbox' | 'development';
2461
2434
  interface EdgeEnvironmentConfig {
2462
- /** Legacy: Cognito domain for OAuth token endpoints. */
2463
- authDomain: string;
2464
- /** Base URL for the Connect API endpoints (without trailing slash). */
2435
+ /**
2436
+ * @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
2437
+ */
2438
+ cognitoDomain: string;
2465
2439
  apiBaseUrl: string;
2466
- /** Base URL for OAuth token operations (without trailing slash). */
2467
2440
  oauthBaseUrl: string;
2468
- /** URL for the EdgeBoost user client (for Link popup). */
2469
2441
  userClientUrl: string;
2470
- /** Human-readable name for debugging/logging. */
2471
2442
  displayName: string;
2472
- /** Whether this environment uses real money. */
2473
2443
  isProduction: boolean;
2474
2444
  }
2475
- /**
2476
- * Environment configurations.
2477
- *
2478
- * These URLs are updated when infrastructure changes.
2479
- * Partners shouldn't need to modify these directly.
2480
- */
2481
2445
  declare const EDGE_ENVIRONMENTS: Readonly<Record<EdgeEnvironment, EdgeEnvironmentConfig>>;
2482
- /**
2483
- * Gets the configuration for a specific environment.
2484
- *
2485
- * @param environment - The environment to get config for
2486
- * @returns The environment configuration
2487
- *
2488
- * @example
2489
- * ```typescript
2490
- * const config = getEnvironmentConfig('staging')
2491
- * console.log(`Using ${config.displayName} at ${config.apiBaseUrl}`)
2492
- * ```
2493
- */
2494
2446
  declare function getEnvironmentConfig(environment: EdgeEnvironment): EdgeEnvironmentConfig;
2495
- /**
2496
- * Checks if an environment is the production environment.
2497
- *
2498
- * @param environment - The environment to check
2499
- * @returns true if this is the production environment
2500
- *
2501
- * @example
2502
- * ```typescript
2503
- * if (isProductionEnvironment('staging')) {
2504
- * // false - staging is not production
2505
- * }
2506
- * ```
2507
- */
2508
2447
  declare function isProductionEnvironment(environment: EdgeEnvironment): boolean;
2509
- /**
2510
- * Gets all available environment names.
2511
- * Useful for building environment selectors in admin UIs.
2512
- */
2513
2448
  declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
2514
2449
 
2515
2450
  /**
@@ -2588,12 +2523,15 @@ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
2588
2523
  /**
2589
2524
  * Builds the full scope string for a given environment.
2590
2525
  *
2591
- * Different environments may use different scope prefixes in Cognito.
2526
+ * Different environments may use different scope prefixes in the API Gateway.
2592
2527
  * This function handles the prefix automatically.
2593
2528
  *
2529
+ * Note: 'development' environment uses 'staging' scope prefix because it
2530
+ * connects to the staging API Gateway for local testing.
2531
+ *
2594
2532
  * @param scope - The scope to format
2595
2533
  * @param environment - The target environment
2596
- * @returns The full scope string for Cognito
2534
+ * @returns The full scope string for API Gateway authorization
2597
2535
  *
2598
2536
  * @example
2599
2537
  * ```typescript
@@ -2602,9 +2540,12 @@ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
2602
2540
  *
2603
2541
  * formatScopeForEnvironment('user.read', 'production')
2604
2542
  * // Returns: 'edge-connect/user.read'
2543
+ *
2544
+ * formatScopeForEnvironment('user.read', 'development')
2545
+ * // Returns: 'edge-connect-staging/user.read' (maps to staging)
2605
2546
  * ```
2606
2547
  */
2607
- declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox'): string;
2548
+ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox' | 'development'): string;
2608
2549
  /**
2609
2550
  * Formats multiple scopes for an environment.
2610
2551
  *
@@ -2612,7 +2553,7 @@ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'produ
2612
2553
  * @param environment - The target environment
2613
2554
  * @returns Array of full scope strings
2614
2555
  */
2615
- declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox'): string[];
2556
+ declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox' | 'development'): string[];
2616
2557
  /**
2617
2558
  * Parses a full scope string to extract the base scope.
2618
2559
  *
package/dist/index.d.ts CHANGED
@@ -2430,86 +2430,21 @@ interface EdgeLinkExit {
2430
2430
  };
2431
2431
  }
2432
2432
 
2433
- /**
2434
- * EDGE Connect Environment Configuration
2435
- *
2436
- * Defines the URLs and settings for each deployment environment.
2437
- * Partners select an environment when initializing the SDK.
2438
- *
2439
- * @module @edge-markets/connect/config
2440
- */
2441
- /**
2442
- * Available EDGE Connect environments.
2443
- *
2444
- * - `production`: Live environment with real money
2445
- * - `staging`: Test environment with test accounts (use during development)
2446
- * - `sandbox`: Isolated environment with mock data (coming soon)
2447
- *
2448
- * @example
2449
- * ```typescript
2450
- * const edge = new EdgeConnectServer({
2451
- * clientId: process.env.EDGE_CLIENT_ID,
2452
- * clientSecret: process.env.EDGE_CLIENT_SECRET,
2453
- * environment: 'staging', // <-- autocomplete shows all options
2454
- * })
2455
- * ```
2456
- */
2457
- type EdgeEnvironment = 'production' | 'staging' | 'sandbox';
2458
- /**
2459
- * Configuration for a specific environment.
2460
- */
2433
+ type EdgeEnvironment = 'production' | 'staging' | 'sandbox' | 'development';
2461
2434
  interface EdgeEnvironmentConfig {
2462
- /** Legacy: Cognito domain for OAuth token endpoints. */
2463
- authDomain: string;
2464
- /** Base URL for the Connect API endpoints (without trailing slash). */
2435
+ /**
2436
+ * @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
2437
+ */
2438
+ cognitoDomain: string;
2465
2439
  apiBaseUrl: string;
2466
- /** Base URL for OAuth token operations (without trailing slash). */
2467
2440
  oauthBaseUrl: string;
2468
- /** URL for the EdgeBoost user client (for Link popup). */
2469
2441
  userClientUrl: string;
2470
- /** Human-readable name for debugging/logging. */
2471
2442
  displayName: string;
2472
- /** Whether this environment uses real money. */
2473
2443
  isProduction: boolean;
2474
2444
  }
2475
- /**
2476
- * Environment configurations.
2477
- *
2478
- * These URLs are updated when infrastructure changes.
2479
- * Partners shouldn't need to modify these directly.
2480
- */
2481
2445
  declare const EDGE_ENVIRONMENTS: Readonly<Record<EdgeEnvironment, EdgeEnvironmentConfig>>;
2482
- /**
2483
- * Gets the configuration for a specific environment.
2484
- *
2485
- * @param environment - The environment to get config for
2486
- * @returns The environment configuration
2487
- *
2488
- * @example
2489
- * ```typescript
2490
- * const config = getEnvironmentConfig('staging')
2491
- * console.log(`Using ${config.displayName} at ${config.apiBaseUrl}`)
2492
- * ```
2493
- */
2494
2446
  declare function getEnvironmentConfig(environment: EdgeEnvironment): EdgeEnvironmentConfig;
2495
- /**
2496
- * Checks if an environment is the production environment.
2497
- *
2498
- * @param environment - The environment to check
2499
- * @returns true if this is the production environment
2500
- *
2501
- * @example
2502
- * ```typescript
2503
- * if (isProductionEnvironment('staging')) {
2504
- * // false - staging is not production
2505
- * }
2506
- * ```
2507
- */
2508
2447
  declare function isProductionEnvironment(environment: EdgeEnvironment): boolean;
2509
- /**
2510
- * Gets all available environment names.
2511
- * Useful for building environment selectors in admin UIs.
2512
- */
2513
2448
  declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
2514
2449
 
2515
2450
  /**
@@ -2588,12 +2523,15 @@ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
2588
2523
  /**
2589
2524
  * Builds the full scope string for a given environment.
2590
2525
  *
2591
- * Different environments may use different scope prefixes in Cognito.
2526
+ * Different environments may use different scope prefixes in the API Gateway.
2592
2527
  * This function handles the prefix automatically.
2593
2528
  *
2529
+ * Note: 'development' environment uses 'staging' scope prefix because it
2530
+ * connects to the staging API Gateway for local testing.
2531
+ *
2594
2532
  * @param scope - The scope to format
2595
2533
  * @param environment - The target environment
2596
- * @returns The full scope string for Cognito
2534
+ * @returns The full scope string for API Gateway authorization
2597
2535
  *
2598
2536
  * @example
2599
2537
  * ```typescript
@@ -2602,9 +2540,12 @@ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
2602
2540
  *
2603
2541
  * formatScopeForEnvironment('user.read', 'production')
2604
2542
  * // Returns: 'edge-connect/user.read'
2543
+ *
2544
+ * formatScopeForEnvironment('user.read', 'development')
2545
+ * // Returns: 'edge-connect-staging/user.read' (maps to staging)
2605
2546
  * ```
2606
2547
  */
2607
- declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox'): string;
2548
+ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox' | 'development'): string;
2608
2549
  /**
2609
2550
  * Formats multiple scopes for an environment.
2610
2551
  *
@@ -2612,7 +2553,7 @@ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'produ
2612
2553
  * @param environment - The target environment
2613
2554
  * @returns Array of full scope strings
2614
2555
  */
2615
- declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox'): string[];
2556
+ declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox' | 'development'): string[];
2616
2557
  /**
2617
2558
  * Parses a full scope string to extract the base scope.
2618
2559
  *
package/dist/index.js CHANGED
@@ -70,32 +70,46 @@ var OTP_METHODS = ["sms", "totp"];
70
70
  // src/config/environments.ts
71
71
  var EDGE_ENVIRONMENTS = {
72
72
  production: {
73
- authDomain: "auth.edgeboost.com",
73
+ cognitoDomain: "https://edge-connect.auth.us-east-1.amazoncognito.com",
74
74
  apiBaseUrl: "https://api.edgeboost.com/connect/v1",
75
- oauthBaseUrl: "https://api.edgeboost.com",
75
+ oauthBaseUrl: "https://api.edgeboost.com/api/v3/oauth",
76
76
  userClientUrl: "https://app.edgeboost.com",
77
77
  displayName: "Production",
78
78
  isProduction: true
79
79
  },
80
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",
81
+ cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
82
+ apiBaseUrl: "https://staging-api.edgeboost.io/connect/v1",
83
+ oauthBaseUrl: "https://staging-api.edgeboost.io/api/v3/oauth",
84
+ userClientUrl: "https://connect-staging.edgeboost.io",
89
85
  displayName: "Staging",
90
86
  isProduction: false
91
87
  },
92
88
  sandbox: {
93
- authDomain: "sandbox-auth.edgeboost.com",
89
+ cognitoDomain: "https://edge-connect-sandbox.auth.us-east-1.amazoncognito.com",
94
90
  apiBaseUrl: "https://sandbox-api.edgeboost.com/connect/v1",
95
- oauthBaseUrl: "https://sandbox-api.edgeboost.com",
91
+ oauthBaseUrl: "https://sandbox-api.edgeboost.com/api/v3/oauth",
96
92
  userClientUrl: "https://sandbox.edgeboost.com",
97
93
  displayName: "Sandbox",
98
94
  isProduction: false
95
+ },
96
+ /**
97
+ * Development environment for local testing with API Gateway.
98
+ *
99
+ * Architecture:
100
+ * - apiBaseUrl: Goes through API Gateway → ngrok → local backend (JWT validated by API Gateway)
101
+ * - oauthBaseUrl: Goes directly to ngrok → local backend (consent/token exchange)
102
+ * - userClientUrl: ngrok tunnel to local edgeboost-user-client (consent popup)
103
+ *
104
+ * The ngrok URL is configured in edgeboost-api/ngrok.yml with a static domain.
105
+ */
106
+ development: {
107
+ cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
108
+ apiBaseUrl: "https://connect-staging.edgeboost.io/connect/v1",
109
+ oauthBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/oauth",
110
+ userClientUrl: "https://edgeboost-user-client.ngrok-free.app",
111
+ displayName: "Development",
112
+ isProduction: false
99
113
  }
100
114
  };
101
115
  function getEnvironmentConfig(environment) {
@@ -138,7 +152,8 @@ var SCOPE_ICONS = {
138
152
  [EDGE_SCOPES.TRANSFER_WRITE]: "arrow-left-right"
139
153
  };
140
154
  function formatScopeForEnvironment(scope, environment) {
141
- const prefix = environment === "production" ? "edge-connect" : `edge-connect-${environment}`;
155
+ const effectiveEnv = environment === "development" ? "staging" : environment;
156
+ const prefix = effectiveEnv === "production" ? "edge-connect" : `edge-connect-${effectiveEnv}`;
142
157
  return `${prefix}/${scope}`;
143
158
  }
144
159
  function formatScopesForEnvironment(scopes, environment) {
package/dist/index.mjs CHANGED
@@ -11,32 +11,46 @@ var OTP_METHODS = ["sms", "totp"];
11
11
  // src/config/environments.ts
12
12
  var EDGE_ENVIRONMENTS = {
13
13
  production: {
14
- authDomain: "auth.edgeboost.com",
14
+ cognitoDomain: "https://edge-connect.auth.us-east-1.amazoncognito.com",
15
15
  apiBaseUrl: "https://api.edgeboost.com/connect/v1",
16
- oauthBaseUrl: "https://api.edgeboost.com",
16
+ oauthBaseUrl: "https://api.edgeboost.com/api/v3/oauth",
17
17
  userClientUrl: "https://app.edgeboost.com",
18
18
  displayName: "Production",
19
19
  isProduction: true
20
20
  },
21
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",
22
+ cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
23
+ apiBaseUrl: "https://staging-api.edgeboost.io/connect/v1",
24
+ oauthBaseUrl: "https://staging-api.edgeboost.io/api/v3/oauth",
25
+ userClientUrl: "https://connect-staging.edgeboost.io",
30
26
  displayName: "Staging",
31
27
  isProduction: false
32
28
  },
33
29
  sandbox: {
34
- authDomain: "sandbox-auth.edgeboost.com",
30
+ cognitoDomain: "https://edge-connect-sandbox.auth.us-east-1.amazoncognito.com",
35
31
  apiBaseUrl: "https://sandbox-api.edgeboost.com/connect/v1",
36
- oauthBaseUrl: "https://sandbox-api.edgeboost.com",
32
+ oauthBaseUrl: "https://sandbox-api.edgeboost.com/api/v3/oauth",
37
33
  userClientUrl: "https://sandbox.edgeboost.com",
38
34
  displayName: "Sandbox",
39
35
  isProduction: false
36
+ },
37
+ /**
38
+ * Development environment for local testing with API Gateway.
39
+ *
40
+ * Architecture:
41
+ * - apiBaseUrl: Goes through API Gateway → ngrok → local backend (JWT validated by API Gateway)
42
+ * - oauthBaseUrl: Goes directly to ngrok → local backend (consent/token exchange)
43
+ * - userClientUrl: ngrok tunnel to local edgeboost-user-client (consent popup)
44
+ *
45
+ * The ngrok URL is configured in edgeboost-api/ngrok.yml with a static domain.
46
+ */
47
+ development: {
48
+ cognitoDomain: "https://edge-connect-staging.auth.us-east-1.amazoncognito.com",
49
+ apiBaseUrl: "https://connect-staging.edgeboost.io/connect/v1",
50
+ oauthBaseUrl: "https://revocable-overvaliantly-emmalyn.ngrok-free.app/oauth",
51
+ userClientUrl: "https://edgeboost-user-client.ngrok-free.app",
52
+ displayName: "Development",
53
+ isProduction: false
40
54
  }
41
55
  };
42
56
  function getEnvironmentConfig(environment) {
@@ -79,7 +93,8 @@ var SCOPE_ICONS = {
79
93
  [EDGE_SCOPES.TRANSFER_WRITE]: "arrow-left-right"
80
94
  };
81
95
  function formatScopeForEnvironment(scope, environment) {
82
- const prefix = environment === "production" ? "edge-connect" : `edge-connect-${environment}`;
96
+ const effectiveEnv = environment === "development" ? "staging" : environment;
97
+ const prefix = effectiveEnv === "production" ? "edge-connect" : `edge-connect-${effectiveEnv}`;
83
98
  return `${prefix}/${scope}`;
84
99
  }
85
100
  function formatScopesForEnvironment(scopes, environment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edge-markets/connect",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Core types, configuration, and utilities for EDGE Connect SDK",
5
5
  "author": "EdgeBoost",
6
6
  "license": "MIT",
@@ -20,14 +20,6 @@
20
20
  }
21
21
  }
22
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
23
  "devDependencies": {
32
24
  "openapi-typescript": "^7.0.0",
33
25
  "tsup": "^8.0.0",
@@ -53,6 +45,13 @@
53
45
  },
54
46
  "engines": {
55
47
  "node": ">=18"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
51
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
52
+ "generate:types": "openapi-typescript http://localhost:9080/api/v3/api/docs-json -o src/types/generated.ts",
53
+ "typecheck": "tsc --noEmit",
54
+ "test": "vitest --passWithNoTests",
55
+ "test:run": "vitest run --passWithNoTests"
56
56
  }
57
- }
58
-
57
+ }