@edge-markets/connect-node 1.11.0 → 1.11.2
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 +9 -9
- package/dist/index.d.mts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +5 -9
- package/dist/index.mjs +5 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Supported environment variables:
|
|
|
84
84
|
|----------|-------------|
|
|
85
85
|
| `EDGE_CLIENT_ID` | User-facing OAuth client ID |
|
|
86
86
|
| `EDGE_CLIENT_SECRET` | User-facing OAuth client secret |
|
|
87
|
-
| `EDGE_ENVIRONMENT` | `production
|
|
87
|
+
| `EDGE_ENVIRONMENT` | `production` or `sandbox` |
|
|
88
88
|
| `EDGE_API_BASE_URL` | Optional Connect API override |
|
|
89
89
|
| `EDGE_OAUTH_BASE_URL` | Optional OAuth/token URL override |
|
|
90
90
|
| `EDGE_PARTNER_API_BASE_URL` | Optional partner dashboard API override |
|
|
@@ -106,7 +106,7 @@ the inline value wins and the helper returns a warning.
|
|
|
106
106
|
interface EdgeConnectServerConfig {
|
|
107
107
|
clientId: string // Your user-facing OAuth client ID
|
|
108
108
|
clientSecret: string // Your user-facing OAuth client secret (keep secret!)
|
|
109
|
-
environment: EdgeEnvironment // 'production' | '
|
|
109
|
+
environment: EdgeEnvironment // 'production' | 'sandbox'
|
|
110
110
|
|
|
111
111
|
// Optional
|
|
112
112
|
apiBaseUrl?: string // Custom API URL (dev only)
|
|
@@ -126,8 +126,8 @@ interface EdgeConnectServerConfig {
|
|
|
126
126
|
|
|
127
127
|
// By default the SDK derives partnerApiBaseUrl from apiBaseUrl by replacing
|
|
128
128
|
// /connect/v1 with /v1. For example:
|
|
129
|
-
// https://connect
|
|
130
|
-
// -> https://connect
|
|
129
|
+
// https://sandbox.connect.staging.edgeboost.io/connect/v1
|
|
130
|
+
// -> https://sandbox.connect.staging.edgeboost.io/v1
|
|
131
131
|
|
|
132
132
|
// Optional: Message Level Encryption (Connect endpoints only)
|
|
133
133
|
mle?: {
|
|
@@ -155,7 +155,7 @@ interface EdgeConnectServerConfig {
|
|
|
155
155
|
const edge = new EdgeConnectServer({
|
|
156
156
|
clientId: process.env.EDGE_CLIENT_ID!,
|
|
157
157
|
clientSecret: process.env.EDGE_CLIENT_SECRET!,
|
|
158
|
-
environment: '
|
|
158
|
+
environment: 'sandbox',
|
|
159
159
|
mle: {
|
|
160
160
|
enabled: true,
|
|
161
161
|
edgePublicKey: process.env.EDGE_MLE_EDGE_PUBLIC_KEY!,
|
|
@@ -176,7 +176,7 @@ Use `mtls` when EDGE has issued your partner backend a client certificate and ke
|
|
|
176
176
|
const edge = new EdgeConnectServer({
|
|
177
177
|
clientId: process.env.EDGE_CLIENT_ID!,
|
|
178
178
|
clientSecret: process.env.EDGE_CLIENT_SECRET!,
|
|
179
|
-
environment: '
|
|
179
|
+
environment: 'sandbox',
|
|
180
180
|
mtls: {
|
|
181
181
|
enabled: true,
|
|
182
182
|
cert: process.env.EDGE_MTLS_CERT!,
|
|
@@ -189,7 +189,7 @@ const edge = new EdgeConnectServer({
|
|
|
189
189
|
authentication material and must stay on your server.
|
|
190
190
|
|
|
191
191
|
`ca` is optional server trust material. Public EDGE Connect gateways such as
|
|
192
|
-
`https://connect.edgeboost.io` and `https://connect
|
|
192
|
+
`https://connect.edgeboost.io` and `https://sandbox.connect.staging.edgeboost.io` use
|
|
193
193
|
public certificates, so most partners should omit `ca`. If EDGE provides a
|
|
194
194
|
private server CA for a non-public endpoint, pass it as `ca`; the SDK appends it
|
|
195
195
|
to Node's default public trust roots instead of replacing them.
|
|
@@ -748,7 +748,7 @@ export class EdgeService {
|
|
|
748
748
|
this.edge = new EdgeConnectServer({
|
|
749
749
|
clientId: this.config.getOrThrow('EDGE_CLIENT_ID'),
|
|
750
750
|
clientSecret: this.config.getOrThrow('EDGE_CLIENT_SECRET'),
|
|
751
|
-
environment: this.config.get('EDGE_ENVIRONMENT', '
|
|
751
|
+
environment: this.config.get('EDGE_ENVIRONMENT', 'sandbox'),
|
|
752
752
|
})
|
|
753
753
|
}
|
|
754
754
|
|
|
@@ -781,7 +781,7 @@ import { EdgeConnectServer, isEdgeError } from '@edge-markets/connect-node'
|
|
|
781
781
|
const edge = new EdgeConnectServer({
|
|
782
782
|
clientId: process.env.EDGE_CLIENT_ID!,
|
|
783
783
|
clientSecret: process.env.EDGE_CLIENT_SECRET!,
|
|
784
|
-
environment: '
|
|
784
|
+
environment: 'sandbox',
|
|
785
785
|
})
|
|
786
786
|
|
|
787
787
|
const app = express()
|
package/dist/index.d.mts
CHANGED
|
@@ -37,15 +37,11 @@ interface EdgeConnectServerConfig {
|
|
|
37
37
|
* from `apiBaseUrl` by replacing `/connect/v1` with `/v1`, matching the
|
|
38
38
|
* EDGE Connect gateway layout:
|
|
39
39
|
*
|
|
40
|
-
* - user-scoped API: `https://connect
|
|
41
|
-
* - partner dashboard API: `https://connect
|
|
40
|
+
* - user-scoped API: `https://connect.edgeboost.io/connect/v1`
|
|
41
|
+
* - partner dashboard API: `https://connect.edgeboost.io/v1`
|
|
42
42
|
*/
|
|
43
43
|
partnerApiBaseUrl?: string;
|
|
44
44
|
oauthBaseUrl?: string;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
|
|
47
|
-
*/
|
|
48
|
-
cognitoDomain?: string;
|
|
49
45
|
redirectUri?: string;
|
|
50
46
|
timeout?: number;
|
|
51
47
|
retry?: RetryConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,15 +37,11 @@ interface EdgeConnectServerConfig {
|
|
|
37
37
|
* from `apiBaseUrl` by replacing `/connect/v1` with `/v1`, matching the
|
|
38
38
|
* EDGE Connect gateway layout:
|
|
39
39
|
*
|
|
40
|
-
* - user-scoped API: `https://connect
|
|
41
|
-
* - partner dashboard API: `https://connect
|
|
40
|
+
* - user-scoped API: `https://connect.edgeboost.io/connect/v1`
|
|
41
|
+
* - partner dashboard API: `https://connect.edgeboost.io/v1`
|
|
42
42
|
*/
|
|
43
43
|
partnerApiBaseUrl?: string;
|
|
44
44
|
oauthBaseUrl?: string;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
|
|
47
|
-
*/
|
|
48
|
-
cognitoDomain?: string;
|
|
49
45
|
redirectUri?: string;
|
|
50
46
|
timeout?: number;
|
|
51
47
|
retry?: RetryConfig;
|
package/dist/index.js
CHANGED
|
@@ -859,11 +859,7 @@ function getInstanceKey(config) {
|
|
|
859
859
|
config.partnerClientId || ""
|
|
860
860
|
]);
|
|
861
861
|
}
|
|
862
|
-
var MTLS_ENFORCED_HOSTS = /* @__PURE__ */ new Set([
|
|
863
|
-
"sandbox.connect.staging.edgeboost.io",
|
|
864
|
-
"connect-staging.edgeboost.io",
|
|
865
|
-
"connect.edgeboost.io"
|
|
866
|
-
]);
|
|
862
|
+
var MTLS_ENFORCED_HOSTS = /* @__PURE__ */ new Set(["sandbox.connect.staging.edgeboost.io", "connect.edgeboost.io"]);
|
|
867
863
|
var CONNECT_INGRESS_REQUIRED_MESSAGE = "Edge Connect API requests must go through the mTLS Connect gateway. Set EDGE_API_BASE_URL and EDGE_OAUTH_BASE_URL to the Connect gateway for this environment and configure EDGE_MTLS_CERT and EDGE_MTLS_KEY.";
|
|
868
864
|
var MTLS_REQUIRED_MESSAGE = "Edge Connect rejected this request because no trusted partner mTLS client certificate was presented. Configure the issued EDGE_MTLS_CERT and EDGE_MTLS_KEY and retry through the Connect gateway.";
|
|
869
865
|
var MTLS_CLIENT_UNREGISTERED_MESSAGE = "Edge Connect accepted the client certificate at the gateway, but the certificate is not registered for this partner. Contact EDGE DevRel to bind the certificate fingerprint to your OAuth client ID.";
|
|
@@ -880,7 +876,7 @@ function isMtlsEnforcedHost(host) {
|
|
|
880
876
|
return false;
|
|
881
877
|
}
|
|
882
878
|
function environmentRequiresMtls(environment, apiBaseUrl) {
|
|
883
|
-
if (environment === "sandbox" || environment === "
|
|
879
|
+
if (environment === "sandbox" || environment === "production") {
|
|
884
880
|
return true;
|
|
885
881
|
}
|
|
886
882
|
try {
|
|
@@ -1604,7 +1600,7 @@ function readPemValue(env, valueName, pathName, warnings) {
|
|
|
1604
1600
|
}
|
|
1605
1601
|
}
|
|
1606
1602
|
function readEnvironment(env) {
|
|
1607
|
-
const value = readEnv(env, "EDGE_ENVIRONMENT") || "
|
|
1603
|
+
const value = readEnv(env, "EDGE_ENVIRONMENT") || "sandbox";
|
|
1608
1604
|
if (!ENVIRONMENT_NAMES.has(value)) {
|
|
1609
1605
|
throw new import_connect6.EdgeValidationError("Invalid EDGE_ENVIRONMENT", {
|
|
1610
1606
|
EDGE_ENVIRONMENT: [`Must be one of: ${Array.from(ENVIRONMENT_NAMES).join(", ")}`]
|
|
@@ -1666,11 +1662,11 @@ function buildMtlsConfig(env, requireMtls, warnings) {
|
|
|
1666
1662
|
};
|
|
1667
1663
|
}
|
|
1668
1664
|
function inferMtlsRequirement(environment, apiBaseUrl) {
|
|
1669
|
-
if (environment === "sandbox" || environment === "
|
|
1665
|
+
if (environment === "sandbox" || environment === "production") return true;
|
|
1670
1666
|
const resolvedApiBaseUrl = apiBaseUrl || (0, import_connect6.getEnvironmentConfig)(environment).apiBaseUrl;
|
|
1671
1667
|
try {
|
|
1672
1668
|
const host = new URL(resolvedApiBaseUrl).host;
|
|
1673
|
-
return host === "sandbox.connect.staging.edgeboost.io" || host === "connect
|
|
1669
|
+
return host === "sandbox.connect.staging.edgeboost.io" || host === "connect.edgeboost.io";
|
|
1674
1670
|
} catch {
|
|
1675
1671
|
return false;
|
|
1676
1672
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -769,11 +769,7 @@ function getInstanceKey(config) {
|
|
|
769
769
|
config.partnerClientId || ""
|
|
770
770
|
]);
|
|
771
771
|
}
|
|
772
|
-
var MTLS_ENFORCED_HOSTS = /* @__PURE__ */ new Set([
|
|
773
|
-
"sandbox.connect.staging.edgeboost.io",
|
|
774
|
-
"connect-staging.edgeboost.io",
|
|
775
|
-
"connect.edgeboost.io"
|
|
776
|
-
]);
|
|
772
|
+
var MTLS_ENFORCED_HOSTS = /* @__PURE__ */ new Set(["sandbox.connect.staging.edgeboost.io", "connect.edgeboost.io"]);
|
|
777
773
|
var CONNECT_INGRESS_REQUIRED_MESSAGE = "Edge Connect API requests must go through the mTLS Connect gateway. Set EDGE_API_BASE_URL and EDGE_OAUTH_BASE_URL to the Connect gateway for this environment and configure EDGE_MTLS_CERT and EDGE_MTLS_KEY.";
|
|
778
774
|
var MTLS_REQUIRED_MESSAGE = "Edge Connect rejected this request because no trusted partner mTLS client certificate was presented. Configure the issued EDGE_MTLS_CERT and EDGE_MTLS_KEY and retry through the Connect gateway.";
|
|
779
775
|
var MTLS_CLIENT_UNREGISTERED_MESSAGE = "Edge Connect accepted the client certificate at the gateway, but the certificate is not registered for this partner. Contact EDGE DevRel to bind the certificate fingerprint to your OAuth client ID.";
|
|
@@ -790,7 +786,7 @@ function isMtlsEnforcedHost(host) {
|
|
|
790
786
|
return false;
|
|
791
787
|
}
|
|
792
788
|
function environmentRequiresMtls(environment, apiBaseUrl) {
|
|
793
|
-
if (environment === "sandbox" || environment === "
|
|
789
|
+
if (environment === "sandbox" || environment === "production") {
|
|
794
790
|
return true;
|
|
795
791
|
}
|
|
796
792
|
try {
|
|
@@ -1514,7 +1510,7 @@ function readPemValue(env, valueName, pathName, warnings) {
|
|
|
1514
1510
|
}
|
|
1515
1511
|
}
|
|
1516
1512
|
function readEnvironment(env) {
|
|
1517
|
-
const value = readEnv(env, "EDGE_ENVIRONMENT") || "
|
|
1513
|
+
const value = readEnv(env, "EDGE_ENVIRONMENT") || "sandbox";
|
|
1518
1514
|
if (!ENVIRONMENT_NAMES.has(value)) {
|
|
1519
1515
|
throw new EdgeValidationError4("Invalid EDGE_ENVIRONMENT", {
|
|
1520
1516
|
EDGE_ENVIRONMENT: [`Must be one of: ${Array.from(ENVIRONMENT_NAMES).join(", ")}`]
|
|
@@ -1576,11 +1572,11 @@ function buildMtlsConfig(env, requireMtls, warnings) {
|
|
|
1576
1572
|
};
|
|
1577
1573
|
}
|
|
1578
1574
|
function inferMtlsRequirement(environment, apiBaseUrl) {
|
|
1579
|
-
if (environment === "sandbox" || environment === "
|
|
1575
|
+
if (environment === "sandbox" || environment === "production") return true;
|
|
1580
1576
|
const resolvedApiBaseUrl = apiBaseUrl || getEnvironmentConfig2(environment).apiBaseUrl;
|
|
1581
1577
|
try {
|
|
1582
1578
|
const host = new URL(resolvedApiBaseUrl).host;
|
|
1583
|
-
return host === "sandbox.connect.staging.edgeboost.io" || host === "connect
|
|
1579
|
+
return host === "sandbox.connect.staging.edgeboost.io" || host === "connect.edgeboost.io";
|
|
1584
1580
|
} catch {
|
|
1585
1581
|
return false;
|
|
1586
1582
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-markets/connect-node",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"description": "Server SDK for EDGE Connect token exchange and API calls",
|
|
5
5
|
"author": "Edge Markets",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"undici": "^5.29.0",
|
|
25
|
-
"@edge-markets/connect": "^1.9.
|
|
25
|
+
"@edge-markets/connect": "^1.9.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsup": "^8.0.0",
|