@topolo/cli 0.13.21 → 0.13.22
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 +63 -63
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3438,7 +3438,7 @@ var TopoloOAuth = class {
|
|
|
3438
3438
|
baseUrl;
|
|
3439
3439
|
fetchImpl;
|
|
3440
3440
|
constructor(options = {}) {
|
|
3441
|
-
this.baseUrl = resolveServiceUrl("auth", options.serviceUrls);
|
|
3441
|
+
this.baseUrl = options.environment ? assertTopoloServiceUrlEnvironment("auth", resolveServiceUrl("auth", options.serviceUrls), options.environment) : resolveServiceUrl("auth", options.serviceUrls);
|
|
3442
3442
|
this.fetchImpl = options.fetch ?? fetch;
|
|
3443
3443
|
}
|
|
3444
3444
|
/**
|
|
@@ -4378,6 +4378,67 @@ var TopoloReauthRequiredError = class extends TopoloAuthError2 {
|
|
|
4378
4378
|
this.reauthorization = Object.freeze({ ...reauthorization });
|
|
4379
4379
|
}
|
|
4380
4380
|
};
|
|
4381
|
+
var TOPOLO_RUNTIME_ENVIRONMENTS = ["production", "staging", "development", "local"];
|
|
4382
|
+
var TOPOLO_ENVIRONMENT_SERVICE_URLS = {
|
|
4383
|
+
production: {
|
|
4384
|
+
auth: "https://auth.topolo.app",
|
|
4385
|
+
developers: "https://developers.topolo.app"
|
|
4386
|
+
},
|
|
4387
|
+
staging: {
|
|
4388
|
+
auth: "https://auth.stg.topolo.us",
|
|
4389
|
+
developers: "https://developers.stg.topolo.us"
|
|
4390
|
+
},
|
|
4391
|
+
development: {
|
|
4392
|
+
auth: "https://auth.topolo.dev",
|
|
4393
|
+
developers: "https://developers.topolo.dev"
|
|
4394
|
+
},
|
|
4395
|
+
local: {}
|
|
4396
|
+
};
|
|
4397
|
+
function hostnameHasSuffix2(hostname, suffix) {
|
|
4398
|
+
return hostname === suffix || hostname.endsWith(`.${suffix}`);
|
|
4399
|
+
}
|
|
4400
|
+
function workersDevAccountMatches2(hostname, account) {
|
|
4401
|
+
if (!hostname.endsWith(".workers.dev")) return false;
|
|
4402
|
+
const labels = hostname.slice(0, -".workers.dev".length).split(".");
|
|
4403
|
+
return labels.length >= 2 && labels.at(-1) === account;
|
|
4404
|
+
}
|
|
4405
|
+
function originMatchesEnvironment2(url, environment) {
|
|
4406
|
+
const hostname = url.hostname.toLowerCase();
|
|
4407
|
+
if (environment === "local") {
|
|
4408
|
+
return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "127.0.0.1" || hostname === "[::1]";
|
|
4409
|
+
}
|
|
4410
|
+
if (url.protocol !== "https:") return false;
|
|
4411
|
+
if (environment === "production") {
|
|
4412
|
+
return hostnameHasSuffix2(hostname, "topolo.app") || hostnameHasSuffix2(hostname, "topolo.io") || hostname === "api.ol0.me" || workersDevAccountMatches2(hostname, "topolo");
|
|
4413
|
+
}
|
|
4414
|
+
if (environment === "staging") {
|
|
4415
|
+
return hostnameHasSuffix2(hostname, "stg.topolo.us") || workersDevAccountMatches2(hostname, "topolo-staging");
|
|
4416
|
+
}
|
|
4417
|
+
return hostnameHasSuffix2(hostname, "topolo.dev") || workersDevAccountMatches2(hostname, "topolo-development");
|
|
4418
|
+
}
|
|
4419
|
+
function assertTopoloServiceUrlEnvironment2(service, value, environment) {
|
|
4420
|
+
let url;
|
|
4421
|
+
try {
|
|
4422
|
+
url = new URL(value);
|
|
4423
|
+
} catch {
|
|
4424
|
+
throw new TopoloSdkError2("invalid_service_url", `Invalid URL configured for Topolo service "${service}".`);
|
|
4425
|
+
}
|
|
4426
|
+
if (url.protocol !== "https:" && url.protocol !== "http:" || url.username || url.password || !originMatchesEnvironment2(url, environment)) {
|
|
4427
|
+
throw new TopoloSdkError2(
|
|
4428
|
+
"environment_mismatch",
|
|
4429
|
+
`Refusing Topolo service "${service}": ${url.origin} does not belong to ${environment}.`
|
|
4430
|
+
);
|
|
4431
|
+
}
|
|
4432
|
+
return url.origin;
|
|
4433
|
+
}
|
|
4434
|
+
function topoloServiceOrigins2(serviceUrls, environment) {
|
|
4435
|
+
return Object.fromEntries(
|
|
4436
|
+
Object.entries(serviceUrls ?? {}).sort(([left], [right]) => left.localeCompare(right)).map(([service, value]) => [
|
|
4437
|
+
service,
|
|
4438
|
+
assertTopoloServiceUrlEnvironment2(service, value, environment)
|
|
4439
|
+
])
|
|
4440
|
+
);
|
|
4441
|
+
}
|
|
4381
4442
|
var APP_API_URLS2 = {
|
|
4382
4443
|
auth: "https://auth.topolo.app",
|
|
4383
4444
|
developers: "https://developers.topolo.app"
|
|
@@ -4408,7 +4469,7 @@ var TopoloOAuth2 = class {
|
|
|
4408
4469
|
baseUrl;
|
|
4409
4470
|
fetchImpl;
|
|
4410
4471
|
constructor(options = {}) {
|
|
4411
|
-
this.baseUrl = resolveServiceUrl2("auth", options.serviceUrls);
|
|
4472
|
+
this.baseUrl = options.environment ? assertTopoloServiceUrlEnvironment2("auth", resolveServiceUrl2("auth", options.serviceUrls), options.environment) : resolveServiceUrl2("auth", options.serviceUrls);
|
|
4412
4473
|
this.fetchImpl = options.fetch ?? fetch;
|
|
4413
4474
|
}
|
|
4414
4475
|
/**
|
|
@@ -4741,67 +4802,6 @@ function createProtectedActionSecretStore(options) {
|
|
|
4741
4802
|
}
|
|
4742
4803
|
};
|
|
4743
4804
|
}
|
|
4744
|
-
var TOPOLO_RUNTIME_ENVIRONMENTS = ["production", "staging", "development", "local"];
|
|
4745
|
-
var TOPOLO_ENVIRONMENT_SERVICE_URLS = {
|
|
4746
|
-
production: {
|
|
4747
|
-
auth: "https://auth.topolo.app",
|
|
4748
|
-
developers: "https://developers.topolo.app"
|
|
4749
|
-
},
|
|
4750
|
-
staging: {
|
|
4751
|
-
auth: "https://auth.stg.topolo.us",
|
|
4752
|
-
developers: "https://developers.stg.topolo.us"
|
|
4753
|
-
},
|
|
4754
|
-
development: {
|
|
4755
|
-
auth: "https://auth.topolo.dev",
|
|
4756
|
-
developers: "https://developers.topolo.dev"
|
|
4757
|
-
},
|
|
4758
|
-
local: {}
|
|
4759
|
-
};
|
|
4760
|
-
function hostnameHasSuffix2(hostname, suffix) {
|
|
4761
|
-
return hostname === suffix || hostname.endsWith(`.${suffix}`);
|
|
4762
|
-
}
|
|
4763
|
-
function workersDevAccountMatches2(hostname, account) {
|
|
4764
|
-
if (!hostname.endsWith(".workers.dev")) return false;
|
|
4765
|
-
const labels = hostname.slice(0, -".workers.dev".length).split(".");
|
|
4766
|
-
return labels.length >= 2 && labels.at(-1) === account;
|
|
4767
|
-
}
|
|
4768
|
-
function originMatchesEnvironment2(url, environment) {
|
|
4769
|
-
const hostname = url.hostname.toLowerCase();
|
|
4770
|
-
if (environment === "local") {
|
|
4771
|
-
return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "127.0.0.1" || hostname === "[::1]";
|
|
4772
|
-
}
|
|
4773
|
-
if (url.protocol !== "https:") return false;
|
|
4774
|
-
if (environment === "production") {
|
|
4775
|
-
return hostnameHasSuffix2(hostname, "topolo.app") || hostnameHasSuffix2(hostname, "topolo.io") || hostname === "api.ol0.me" || workersDevAccountMatches2(hostname, "topolo");
|
|
4776
|
-
}
|
|
4777
|
-
if (environment === "staging") {
|
|
4778
|
-
return hostnameHasSuffix2(hostname, "stg.topolo.us") || workersDevAccountMatches2(hostname, "topolo-staging");
|
|
4779
|
-
}
|
|
4780
|
-
return hostnameHasSuffix2(hostname, "topolo.dev") || workersDevAccountMatches2(hostname, "topolo-development");
|
|
4781
|
-
}
|
|
4782
|
-
function assertTopoloServiceUrlEnvironment2(service, value, environment) {
|
|
4783
|
-
let url;
|
|
4784
|
-
try {
|
|
4785
|
-
url = new URL(value);
|
|
4786
|
-
} catch {
|
|
4787
|
-
throw new TopoloSdkError2("invalid_service_url", `Invalid URL configured for Topolo service "${service}".`);
|
|
4788
|
-
}
|
|
4789
|
-
if (url.protocol !== "https:" && url.protocol !== "http:" || url.username || url.password || !originMatchesEnvironment2(url, environment)) {
|
|
4790
|
-
throw new TopoloSdkError2(
|
|
4791
|
-
"environment_mismatch",
|
|
4792
|
-
`Refusing Topolo service "${service}": ${url.origin} does not belong to ${environment}.`
|
|
4793
|
-
);
|
|
4794
|
-
}
|
|
4795
|
-
return url.origin;
|
|
4796
|
-
}
|
|
4797
|
-
function topoloServiceOrigins2(serviceUrls, environment) {
|
|
4798
|
-
return Object.fromEntries(
|
|
4799
|
-
Object.entries(serviceUrls ?? {}).sort(([left], [right]) => left.localeCompare(right)).map(([service, value]) => [
|
|
4800
|
-
service,
|
|
4801
|
-
assertTopoloServiceUrlEnvironment2(service, value, environment)
|
|
4802
|
-
])
|
|
4803
|
-
);
|
|
4804
|
-
}
|
|
4805
4805
|
var TOPOLO_ENVIRONMENTS = TOPOLO_RUNTIME_ENVIRONMENTS;
|
|
4806
4806
|
function contextKey(contextType, organizationId) {
|
|
4807
4807
|
return contextType === "organization" && organizationId ? `org:${organizationId}` : "personal";
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.13.
|
|
5
|
-
"topoloPublishedVersion": "0.13.
|
|
4
|
+
"version": "0.13.22",
|
|
5
|
+
"topoloPublishedVersion": "0.13.22",
|
|
6
6
|
"description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@modelcontextprotocol/sdk": "1.31.0",
|
|
36
|
-
"@topolo/mcp": "0.14.
|
|
37
|
-
"@topolo/sdk": "0.23.
|
|
36
|
+
"@topolo/mcp": "0.14.36",
|
|
37
|
+
"@topolo/sdk": "0.23.25",
|
|
38
38
|
"commander": "^12.1.0",
|
|
39
39
|
"undici": "6.29.0"
|
|
40
40
|
},
|