@topolo/cli 0.1.13 → 0.1.15
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 +34 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ var SERVICES = {
|
|
|
80
80
|
mdm: "https://topolo-mdm-api.topolo.app",
|
|
81
81
|
messaging: "https://messages.topolo.app",
|
|
82
82
|
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
83
|
-
one: "https://
|
|
83
|
+
one: "https://one.topolo.app",
|
|
84
84
|
pay: "https://topolo-pay.topolo.workers.dev",
|
|
85
85
|
"quro.api": "https://api.ol0.me",
|
|
86
86
|
"quro.redirect": "https://ol0.me",
|
|
@@ -677,7 +677,7 @@ var APPLICATIONS = {
|
|
|
677
677
|
{
|
|
678
678
|
"name": "topoloone-worker",
|
|
679
679
|
"kind": "worker",
|
|
680
|
-
"apiUrl": "https://
|
|
680
|
+
"apiUrl": "https://one.topolo.app",
|
|
681
681
|
"domains": [],
|
|
682
682
|
"routes": [
|
|
683
683
|
"one.topolo.app/*"
|
|
@@ -1083,8 +1083,9 @@ var APPLICATION_REQUIREMENTS = [
|
|
|
1083
1083
|
];
|
|
1084
1084
|
function applicationRequirementScopes(application) {
|
|
1085
1085
|
const scopes = /* @__PURE__ */ new Set(["all"]);
|
|
1086
|
-
const
|
|
1087
|
-
const
|
|
1086
|
+
const deployTargets = application.deployTargets;
|
|
1087
|
+
const hasBrowserSurface = Boolean(application.productionUrl) || deployTargets.some((target) => target.kind === "pages");
|
|
1088
|
+
const hasApiSurface = application.services.length > 0 || deployTargets.some((target) => Boolean(target.apiUrl));
|
|
1088
1089
|
if (hasBrowserSurface) scopes.add("browser");
|
|
1089
1090
|
if (hasApiSurface) scopes.add("api");
|
|
1090
1091
|
if (application.id === "cli" || application.id === "mcp" || application.id === "cloudcontrol") {
|
|
@@ -1270,10 +1271,11 @@ function statusRank(status) {
|
|
|
1270
1271
|
}
|
|
1271
1272
|
var DEFAULT_SERVICE_URLS = SERVICES;
|
|
1272
1273
|
function resolveServiceUrl(service, overrides) {
|
|
1273
|
-
|
|
1274
|
+
var _a;
|
|
1275
|
+
const override = overrides == null ? void 0 : overrides[service];
|
|
1274
1276
|
if (override) return override;
|
|
1275
1277
|
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
|
|
1276
|
-
const envValue = typeof process !== "undefined" ? process.env
|
|
1278
|
+
const envValue = typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a[envKey] : void 0;
|
|
1277
1279
|
if (envValue) return envValue;
|
|
1278
1280
|
return DEFAULT_SERVICE_URLS[service];
|
|
1279
1281
|
}
|
|
@@ -1287,8 +1289,9 @@ var TopoloClient = class {
|
|
|
1287
1289
|
fetchImpl;
|
|
1288
1290
|
debug;
|
|
1289
1291
|
constructor(options) {
|
|
1292
|
+
var _a;
|
|
1290
1293
|
if (!options.credential) throw new TopoloAuthError("credential is required");
|
|
1291
|
-
if (!options.agent
|
|
1294
|
+
if (!((_a = options.agent) == null ? void 0 : _a.clientName)) throw new TopoloAuthError("agent.clientName is required");
|
|
1292
1295
|
this.credential = options.credential;
|
|
1293
1296
|
this.agent = options.agent;
|
|
1294
1297
|
this.serviceUrls = options.serviceUrls;
|
|
@@ -1476,6 +1479,7 @@ var CrmModule = class {
|
|
|
1476
1479
|
}
|
|
1477
1480
|
client;
|
|
1478
1481
|
async listContacts(options = {}) {
|
|
1482
|
+
var _a, _b, _c;
|
|
1479
1483
|
const res = await this.client.request({
|
|
1480
1484
|
service: "crm",
|
|
1481
1485
|
path: "/api/contacts",
|
|
@@ -1485,12 +1489,12 @@ var CrmModule = class {
|
|
|
1485
1489
|
pageSize: options.pageSize
|
|
1486
1490
|
}
|
|
1487
1491
|
});
|
|
1488
|
-
const rows = Array.isArray(res
|
|
1492
|
+
const rows = Array.isArray(res == null ? void 0 : res.contacts) ? res.contacts : Array.isArray(res == null ? void 0 : res.data) ? res.data : [];
|
|
1489
1493
|
return {
|
|
1490
1494
|
contacts: rows.map(toSummary),
|
|
1491
|
-
total: res
|
|
1492
|
-
page: res
|
|
1493
|
-
pageSize: res
|
|
1495
|
+
total: (res == null ? void 0 : res.total) ?? ((_a = res == null ? void 0 : res.pagination) == null ? void 0 : _a.total) ?? rows.length,
|
|
1496
|
+
page: (res == null ? void 0 : res.page) ?? ((_b = res == null ? void 0 : res.pagination) == null ? void 0 : _b.page) ?? options.page ?? 1,
|
|
1497
|
+
pageSize: (res == null ? void 0 : res.pageSize) ?? ((_c = res == null ? void 0 : res.pagination) == null ? void 0 : _c.pageSize) ?? options.pageSize ?? rows.length
|
|
1494
1498
|
};
|
|
1495
1499
|
}
|
|
1496
1500
|
async getContact(contactId) {
|
|
@@ -1690,7 +1694,9 @@ function resolveAgentName(configAgentName) {
|
|
|
1690
1694
|
return process.env.TOPOLO_AGENT_NAME ?? configAgentName;
|
|
1691
1695
|
}
|
|
1692
1696
|
function resolveServiceUrls(configUrls) {
|
|
1693
|
-
const merged = {
|
|
1697
|
+
const merged = {
|
|
1698
|
+
...configUrls ?? {}
|
|
1699
|
+
};
|
|
1694
1700
|
for (const [k, v] of Object.entries(process.env)) {
|
|
1695
1701
|
if (k.startsWith("TOPOLO_SERVICE_URL_") && v) {
|
|
1696
1702
|
merged[k.slice("TOPOLO_SERVICE_URL_".length).toLowerCase()] = v;
|
|
@@ -1942,7 +1948,7 @@ function sleep(ms) {
|
|
|
1942
1948
|
}
|
|
1943
1949
|
|
|
1944
1950
|
// src/version.ts
|
|
1945
|
-
var CLI_VERSION = "0.1.
|
|
1951
|
+
var CLI_VERSION = "0.1.15";
|
|
1946
1952
|
|
|
1947
1953
|
// src/client.ts
|
|
1948
1954
|
async function buildClient(options) {
|
|
@@ -5095,25 +5101,29 @@ async function requirePlatformAdminSession() {
|
|
|
5095
5101
|
|
|
5096
5102
|
// src/commands/services.ts
|
|
5097
5103
|
function registerServicesCommand(program2) {
|
|
5098
|
-
program2.command("services").description("List every Topolo service the SDK can route to").option("--json", "Output JSON", true).option("--no-json", "Output human-readable table").action((opts) => {
|
|
5104
|
+
program2.command("services").description("List every Topolo service the SDK can route to").option("--json", "Output JSON", true).option("--no-json", "Output human-readable table").action(async (opts) => {
|
|
5099
5105
|
const mode = resolveOutputMode(opts.json);
|
|
5100
5106
|
try {
|
|
5101
|
-
const
|
|
5102
|
-
|
|
5103
|
-
const effectiveUrl = resolveServiceUrl(id);
|
|
5104
|
-
return {
|
|
5105
|
-
id,
|
|
5106
|
-
defaultUrl,
|
|
5107
|
-
effectiveUrl,
|
|
5108
|
-
overridden: defaultUrl !== effectiveUrl
|
|
5109
|
-
};
|
|
5110
|
-
});
|
|
5107
|
+
const config = await readConfig();
|
|
5108
|
+
const rows = buildRows(resolveServiceUrls(config.serviceUrls));
|
|
5111
5109
|
emit({ services: rows }, mode, () => formatRows2(rows));
|
|
5112
5110
|
} catch (err) {
|
|
5113
5111
|
fail(err, mode);
|
|
5114
5112
|
}
|
|
5115
5113
|
});
|
|
5116
5114
|
}
|
|
5115
|
+
function buildRows(overrides) {
|
|
5116
|
+
return Object.keys(DEFAULT_SERVICE_URLS).sort().map((id) => {
|
|
5117
|
+
const defaultUrl = DEFAULT_SERVICE_URLS[id];
|
|
5118
|
+
const effectiveUrl = resolveServiceUrl(id, overrides);
|
|
5119
|
+
return {
|
|
5120
|
+
id,
|
|
5121
|
+
defaultUrl,
|
|
5122
|
+
effectiveUrl,
|
|
5123
|
+
overridden: defaultUrl !== effectiveUrl
|
|
5124
|
+
};
|
|
5125
|
+
});
|
|
5126
|
+
}
|
|
5117
5127
|
function formatRows2(rows) {
|
|
5118
5128
|
const idWidth = Math.max(3, ...rows.map((r) => r.id.length));
|
|
5119
5129
|
const urlWidth = Math.max(7, ...rows.map((r) => r.effectiveUrl.length));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Command-line interface for Topolo developers, operators, and agents, with internal first-party scaffolding available under the topolo platform namespace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|