@topolo/sdk 0.3.0 → 0.4.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 +1 -1
- package/dist/index.cjs +149 -78
- package/dist/index.d.cts +81 -56
- package/dist/index.d.ts +81 -56
- package/dist/index.js +149 -77
- package/package.json +5 -2
- package/src/application-requirements.ts +10 -6
- package/src/applications.generated.ts +61 -40
- package/src/client.test.ts +108 -19
- package/src/client.ts +126 -8
- package/src/index.ts +1 -1
- package/src/modules/p2p.test.ts +27 -11
- package/src/services.generated.ts +2 -32
- package/src/services.test.ts +6 -23
- package/src/services.ts +1 -2
- package/src/widgets.test.ts +7 -7
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ their own `GET /api/widget` endpoint. The SDK owns the shared payload contract:
|
|
|
103
103
|
import { createTopoloWidgetResponse } from '@topolo/sdk';
|
|
104
104
|
|
|
105
105
|
return Response.json(createTopoloWidgetResponse({
|
|
106
|
-
serviceId: '
|
|
106
|
+
serviceId: '<runtime-service-id>',
|
|
107
107
|
serviceName: 'Example',
|
|
108
108
|
widgets: [
|
|
109
109
|
{
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,6 @@ __export(index_exports, {
|
|
|
27
27
|
DEFAULT_SERVICE_URLS: () => DEFAULT_SERVICE_URLS,
|
|
28
28
|
IdentityModule: () => IdentityModule,
|
|
29
29
|
P2PModule: () => P2PModule,
|
|
30
|
-
PLATFORM_SERVICE_IDS: () => PLATFORM_SERVICE_IDS,
|
|
31
30
|
TOPOLO_WIDGET_ENDPOINT: () => TOPOLO_WIDGET_ENDPOINT,
|
|
32
31
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS: () => TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
33
32
|
TopoloAuthError: () => TopoloAuthError,
|
|
@@ -146,41 +145,20 @@ var SERVICES = {
|
|
|
146
145
|
p2p: "https://p2p.topolo.app",
|
|
147
146
|
pay: "https://pay.topolo.app",
|
|
148
147
|
people: "https://people.topolo.app",
|
|
148
|
+
pulse: "https://pulse.topolo.app",
|
|
149
149
|
"quro.api": "https://api.ol0.me",
|
|
150
150
|
"quro.redirect": "https://ol0.me",
|
|
151
151
|
roadmapper: "https://roadmapper-api.topolo.app",
|
|
152
152
|
sign: "https://sign.topolo.app",
|
|
153
153
|
social_studio: "https://studio-api.topolo.app",
|
|
154
154
|
socialize: "https://socialize-api.topolo.app",
|
|
155
|
+
spaces: "https://spaces.topolo.app",
|
|
155
156
|
status: "https://status.topolo.app",
|
|
156
157
|
support: "https://support.topolo.app",
|
|
157
158
|
survey: "https://survey.topolo.app",
|
|
158
159
|
voice: "https://voice.topolo.app",
|
|
159
160
|
web: "https://web-api.topolo.app"
|
|
160
161
|
};
|
|
161
|
-
var PLATFORM_SERVICE_IDS = {
|
|
162
|
-
books: "srv_0g260hbN8oqv",
|
|
163
|
-
bugfix: "srv_kQ1t8qUSDgNs",
|
|
164
|
-
compose: "srv_aR3ETYmgygmd",
|
|
165
|
-
consent: "srv_8FIGR7Q7zP9r",
|
|
166
|
-
crm: "srv_iCwM4jGXcwlj",
|
|
167
|
-
customer_success: "srv_RWpOxkgZdZbH",
|
|
168
|
-
developers: "srv_NjDq9G9qyyjr",
|
|
169
|
-
director: "srv_wRCnLLbtvmVT",
|
|
170
|
-
flow: "srv_GBCuKkHhnRXv",
|
|
171
|
-
forms: "srv_UE7IcGe80J5o",
|
|
172
|
-
home: "srv_hE6HBldVzjth",
|
|
173
|
-
insights: "srv_DgbBMwWSIhmC",
|
|
174
|
-
inventory: "srv_hmvjbv3ZxDnh",
|
|
175
|
-
localize: "srv_Ze1g9OmXuZjF",
|
|
176
|
-
notify: "srv_9pRdkIjYyKX0",
|
|
177
|
-
p2p: "srv_4BzeLqH0wCve",
|
|
178
|
-
people: "srv_VDMBAonA5fKb",
|
|
179
|
-
sign: "srv_Bd8pRw5ZqRBT",
|
|
180
|
-
status: "srv_topolo_status",
|
|
181
|
-
survey: "srv_RCOi7CJkwf7R",
|
|
182
|
-
voice: "srv_BZANHkshGAK5"
|
|
183
|
-
};
|
|
184
162
|
|
|
185
163
|
// src/applications.generated.ts
|
|
186
164
|
var APPLICATIONS = {
|
|
@@ -260,6 +238,24 @@ var APPLICATIONS = {
|
|
|
260
238
|
}
|
|
261
239
|
]
|
|
262
240
|
},
|
|
241
|
+
"backup": {
|
|
242
|
+
"id": "backup",
|
|
243
|
+
"appDir": "TopoloBackup",
|
|
244
|
+
"name": "topolo-backup",
|
|
245
|
+
"packageName": "topolo-backup",
|
|
246
|
+
"productionUrl": null,
|
|
247
|
+
"services": [],
|
|
248
|
+
"deployTargets": [
|
|
249
|
+
{
|
|
250
|
+
"name": "topolo-backup",
|
|
251
|
+
"kind": "worker",
|
|
252
|
+
"apiUrl": null,
|
|
253
|
+
"domains": [],
|
|
254
|
+
"routes": [],
|
|
255
|
+
"serviceId": null
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
263
259
|
"books": {
|
|
264
260
|
"id": "books",
|
|
265
261
|
"appDir": "TopoloBooks",
|
|
@@ -410,15 +406,6 @@ var APPLICATIONS = {
|
|
|
410
406
|
}
|
|
411
407
|
]
|
|
412
408
|
},
|
|
413
|
-
"cli": {
|
|
414
|
-
"id": "cli",
|
|
415
|
-
"appDir": "TopoloCli",
|
|
416
|
-
"name": "@topolo/cli",
|
|
417
|
-
"packageName": "@topolo/cli",
|
|
418
|
-
"productionUrl": null,
|
|
419
|
-
"services": [],
|
|
420
|
-
"deployTargets": []
|
|
421
|
-
},
|
|
422
409
|
"cloudcontrol": {
|
|
423
410
|
"id": "cloudcontrol",
|
|
424
411
|
"appDir": "TopoloCloudControl",
|
|
@@ -584,24 +571,6 @@ var APPLICATIONS = {
|
|
|
584
571
|
}
|
|
585
572
|
]
|
|
586
573
|
},
|
|
587
|
-
"d1_backup": {
|
|
588
|
-
"id": "d1_backup",
|
|
589
|
-
"appDir": "TopoloD1Backup",
|
|
590
|
-
"name": "topolo-d1-backup",
|
|
591
|
-
"packageName": "topolo-d1-backup",
|
|
592
|
-
"productionUrl": null,
|
|
593
|
-
"services": [],
|
|
594
|
-
"deployTargets": [
|
|
595
|
-
{
|
|
596
|
-
"name": "topolo-d1-backup",
|
|
597
|
-
"kind": "worker",
|
|
598
|
-
"apiUrl": null,
|
|
599
|
-
"domains": [],
|
|
600
|
-
"routes": [],
|
|
601
|
-
"serviceId": null
|
|
602
|
-
}
|
|
603
|
-
]
|
|
604
|
-
},
|
|
605
574
|
"developers": {
|
|
606
575
|
"id": "developers",
|
|
607
576
|
"appDir": "TopoloDevelopers",
|
|
@@ -944,15 +913,6 @@ var APPLICATIONS = {
|
|
|
944
913
|
}
|
|
945
914
|
]
|
|
946
915
|
},
|
|
947
|
-
"mcp": {
|
|
948
|
-
"id": "mcp",
|
|
949
|
-
"appDir": "TopoloMCP",
|
|
950
|
-
"name": "@topolo/mcp",
|
|
951
|
-
"packageName": "@topolo/mcp",
|
|
952
|
-
"productionUrl": null,
|
|
953
|
-
"services": [],
|
|
954
|
-
"deployTargets": []
|
|
955
|
-
},
|
|
956
916
|
"mdm": {
|
|
957
917
|
"id": "mdm",
|
|
958
918
|
"appDir": "TopoloMDM",
|
|
@@ -1087,7 +1047,7 @@ var APPLICATIONS = {
|
|
|
1087
1047
|
"one": {
|
|
1088
1048
|
"id": "one",
|
|
1089
1049
|
"appDir": "TopoloOne",
|
|
1090
|
-
"name": "
|
|
1050
|
+
"name": "TopoloOne",
|
|
1091
1051
|
"packageName": "topolo-oneclick-sso",
|
|
1092
1052
|
"productionUrl": "https://one.topolo.app",
|
|
1093
1053
|
"services": [
|
|
@@ -1208,9 +1168,24 @@ var APPLICATIONS = {
|
|
|
1208
1168
|
"appDir": "TopoloPulse",
|
|
1209
1169
|
"name": "topolo-pulse",
|
|
1210
1170
|
"packageName": "topolo-pulse",
|
|
1211
|
-
"productionUrl":
|
|
1212
|
-
"services": [
|
|
1213
|
-
|
|
1171
|
+
"productionUrl": "https://pulse.topolo.app",
|
|
1172
|
+
"services": [
|
|
1173
|
+
"pulse"
|
|
1174
|
+
],
|
|
1175
|
+
"deployTargets": [
|
|
1176
|
+
{
|
|
1177
|
+
"name": "topolo-pulse",
|
|
1178
|
+
"kind": "worker",
|
|
1179
|
+
"apiUrl": "https://pulse.topolo.app",
|
|
1180
|
+
"domains": [
|
|
1181
|
+
"pulse.topolo.app"
|
|
1182
|
+
],
|
|
1183
|
+
"routes": [
|
|
1184
|
+
"pulse.topolo.app"
|
|
1185
|
+
],
|
|
1186
|
+
"serviceId": "pulse"
|
|
1187
|
+
}
|
|
1188
|
+
]
|
|
1214
1189
|
},
|
|
1215
1190
|
"quro": {
|
|
1216
1191
|
"id": "quro",
|
|
@@ -1393,6 +1368,30 @@ var APPLICATIONS = {
|
|
|
1393
1368
|
}
|
|
1394
1369
|
]
|
|
1395
1370
|
},
|
|
1371
|
+
"spaces": {
|
|
1372
|
+
"id": "spaces",
|
|
1373
|
+
"appDir": "TopoloSpaces",
|
|
1374
|
+
"name": "topolo-spaces",
|
|
1375
|
+
"packageName": "@topolo/spaces",
|
|
1376
|
+
"productionUrl": "https://spaces.topolo.app",
|
|
1377
|
+
"services": [
|
|
1378
|
+
"spaces"
|
|
1379
|
+
],
|
|
1380
|
+
"deployTargets": [
|
|
1381
|
+
{
|
|
1382
|
+
"name": "topolo-spaces",
|
|
1383
|
+
"kind": "worker",
|
|
1384
|
+
"apiUrl": "https://spaces.topolo.app",
|
|
1385
|
+
"domains": [
|
|
1386
|
+
"spaces.topolo.app"
|
|
1387
|
+
],
|
|
1388
|
+
"routes": [
|
|
1389
|
+
"spaces.topolo.app"
|
|
1390
|
+
],
|
|
1391
|
+
"serviceId": "spaces"
|
|
1392
|
+
}
|
|
1393
|
+
]
|
|
1394
|
+
},
|
|
1396
1395
|
"status": {
|
|
1397
1396
|
"id": "status",
|
|
1398
1397
|
"appDir": "TopoloStatus",
|
|
@@ -1574,12 +1573,12 @@ var APPLICATION_REQUIREMENTS = [
|
|
|
1574
1573
|
summary: "Applications must derive identity, organization, scopes, and service entitlement from TopoloAuth rather than inventing parallel auth state.",
|
|
1575
1574
|
appliesTo: ["browser", "api", "tooling", "agent_surface"],
|
|
1576
1575
|
evidence: [
|
|
1577
|
-
"@topolo/auth-client or @topolo/
|
|
1576
|
+
"@topolo/auth-client or @topolo-io/worker-runtime is used where applicable",
|
|
1578
1577
|
"No public command, tool, or SDK method accepts orgId",
|
|
1579
1578
|
"Service slug and Auth service registration are documented for protected services"
|
|
1580
1579
|
],
|
|
1581
1580
|
implementation: [
|
|
1582
|
-
"Use shared auth packages instead of copying token parsing or browser storage flows",
|
|
1581
|
+
"Use shared auth/runtime packages instead of copying token parsing, gateway, or browser storage flows",
|
|
1583
1582
|
"Derive organization from the credential on every request",
|
|
1584
1583
|
"Route OAuth, refresh, logout, and SSO paths according to the shared Auth contract"
|
|
1585
1584
|
]
|
|
@@ -1719,14 +1718,15 @@ var APPLICATION_REQUIREMENTS = [
|
|
|
1719
1718
|
];
|
|
1720
1719
|
function applicationRequirementScopes(application) {
|
|
1721
1720
|
const scopes = /* @__PURE__ */ new Set(["all"]);
|
|
1721
|
+
const appId = application.id;
|
|
1722
1722
|
const hasBrowserSurface = Boolean(application.productionUrl) || application.deployTargets.some((target) => target.kind === "pages");
|
|
1723
1723
|
const hasApiSurface = application.services.length > 0 || application.deployTargets.some((target) => Boolean(target.apiUrl));
|
|
1724
1724
|
if (hasBrowserSurface) scopes.add("browser");
|
|
1725
1725
|
if (hasApiSurface) scopes.add("api");
|
|
1726
|
-
if (
|
|
1726
|
+
if (appId === "cli" || appId === "mcp" || appId === "cloudcontrol") {
|
|
1727
1727
|
scopes.add("tooling");
|
|
1728
1728
|
}
|
|
1729
|
-
if (
|
|
1729
|
+
if (appId === "cli" || appId === "mcp" || hasApiSurface) {
|
|
1730
1730
|
scopes.add("agent_surface");
|
|
1731
1731
|
}
|
|
1732
1732
|
return Array.from(scopes);
|
|
@@ -1845,12 +1845,13 @@ function evaluateRequirement(application, requirement) {
|
|
|
1845
1845
|
return finding(requirement, "met", "CloudControl deploy target metadata is present.", evidence);
|
|
1846
1846
|
}
|
|
1847
1847
|
case "agent-and-operator-surfaces": {
|
|
1848
|
+
const appId = application.id;
|
|
1848
1849
|
if (application.services.length > 0) {
|
|
1849
1850
|
evidence.push(`services=${application.services.join(",")}`);
|
|
1850
1851
|
return finding(requirement, "partial", "SDK service discovery exists; typed SDK/CLI/MCP workflow coverage should be checked as APIs stabilize.", evidence);
|
|
1851
1852
|
}
|
|
1852
|
-
if (
|
|
1853
|
-
evidence.push(`tooling=${
|
|
1853
|
+
if (appId === "cli" || appId === "mcp" || appId === "cloudcontrol") {
|
|
1854
|
+
evidence.push(`tooling=${appId}`);
|
|
1854
1855
|
return finding(requirement, "met", "This application is itself an agent/operator surface.", evidence);
|
|
1855
1856
|
}
|
|
1856
1857
|
return finding(requirement, "missing", "No SDK service or tooling surface is registered.", evidence);
|
|
@@ -1931,6 +1932,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1931
1932
|
credential;
|
|
1932
1933
|
agent;
|
|
1933
1934
|
serviceUrls;
|
|
1935
|
+
serviceIds;
|
|
1934
1936
|
requireConfirmForWrites;
|
|
1935
1937
|
timeoutMs;
|
|
1936
1938
|
fetchImpl;
|
|
@@ -1955,6 +1957,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1955
1957
|
this.credential = options.credential;
|
|
1956
1958
|
this.agent = options.agent;
|
|
1957
1959
|
this.serviceUrls = options.serviceUrls;
|
|
1960
|
+
this.serviceIds = options.serviceIds;
|
|
1958
1961
|
this.requireConfirmForWrites = options.requireConfirmForWrites !== false;
|
|
1959
1962
|
this.timeoutMs = options.timeoutMs ?? 3e4;
|
|
1960
1963
|
this.fetchImpl = options.fetch ?? fetch;
|
|
@@ -1989,7 +1992,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1989
1992
|
const headers = new Headers();
|
|
1990
1993
|
headers.set("Accept", "application/json");
|
|
1991
1994
|
if (opts.body !== void 0) headers.set("Content-Type", "application/json");
|
|
1992
|
-
const platformServiceId =
|
|
1995
|
+
const platformServiceId = resolveConfiguredServiceId(opts.service, this.serviceIds);
|
|
1993
1996
|
if (platformServiceId) headers.set("X-Service-ID", platformServiceId);
|
|
1994
1997
|
applyAuthHeaders(headers, this.credential);
|
|
1995
1998
|
const requestId = generateRequestId();
|
|
@@ -2064,12 +2067,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
2064
2067
|
return parsed;
|
|
2065
2068
|
}
|
|
2066
2069
|
/**
|
|
2067
|
-
* Resolve a service-slug → opaque service-id via TopoloAuth.
|
|
2068
|
-
*
|
|
2069
|
-
* Replaces the SDK-baked `PLATFORM_SERVICE_IDS` map (deprecated in 0.3.0,
|
|
2070
|
-
* removed in 0.4.0). Slug shape accepted: either the canonical Auth slug
|
|
2071
|
-
* (e.g. `topolo-notify`) or the SDK short id (`notify`) — Auth's resolver
|
|
2072
|
-
* understands both.
|
|
2070
|
+
* Resolve a service-slug → opaque service-id via caller config or TopoloAuth.
|
|
2073
2071
|
*
|
|
2074
2072
|
* Cache: 5 minutes per process per `(slug, auth_base_url)`. Negative
|
|
2075
2073
|
* results (404) are cached for 60s so a typo doesn't hot-loop the
|
|
@@ -2084,6 +2082,8 @@ var TopoloClient = class _TopoloClient {
|
|
|
2084
2082
|
if (typeof slug !== "string") return null;
|
|
2085
2083
|
const normalized = slug.trim().toLowerCase();
|
|
2086
2084
|
if (!normalized) return null;
|
|
2085
|
+
const configuredServiceId = resolveConfiguredServiceId(normalized, this.serviceIds);
|
|
2086
|
+
if (configuredServiceId) return configuredServiceId;
|
|
2087
2087
|
const authBase = resolveServiceUrl("auth", this.serviceUrls);
|
|
2088
2088
|
const cacheKey = `${authBase}|${normalized}`;
|
|
2089
2089
|
const now = Date.now();
|
|
@@ -2123,6 +2123,58 @@ var TopoloClient = class _TopoloClient {
|
|
|
2123
2123
|
});
|
|
2124
2124
|
return value;
|
|
2125
2125
|
}
|
|
2126
|
+
/**
|
|
2127
|
+
* List the platform service catalog from the live registry
|
|
2128
|
+
* (`GET /api/services/catalog` on TopoloAuth). Credential-aware: the
|
|
2129
|
+
* caller's credential is attached, so an authenticated caller in an
|
|
2130
|
+
* entitled org also receives the `developer_only` services its role
|
|
2131
|
+
* permits; an unauthenticated/agent caller receives `active` only.
|
|
2132
|
+
*
|
|
2133
|
+
* Resilient: on any network/HTTP failure this falls back to the
|
|
2134
|
+
* build-time generated `APPLICATIONS` snapshot so offline/degraded
|
|
2135
|
+
* callers still get a usable (if static) catalog. The live result is
|
|
2136
|
+
* authoritative; the snapshot is a floor, not a cap.
|
|
2137
|
+
*/
|
|
2138
|
+
async listServices() {
|
|
2139
|
+
try {
|
|
2140
|
+
const res = await this.request({ service: "auth", method: "GET", path: "/api/services/catalog" });
|
|
2141
|
+
const raw = res.data?.services ?? res.services;
|
|
2142
|
+
if (Array.isArray(raw) && raw.length > 0) {
|
|
2143
|
+
const entries = [];
|
|
2144
|
+
for (const item of raw) {
|
|
2145
|
+
const s = item;
|
|
2146
|
+
const serviceId = typeof s.service_id === "string" ? s.service_id : typeof s.id === "string" ? s.id : null;
|
|
2147
|
+
if (!serviceId) continue;
|
|
2148
|
+
entries.push({
|
|
2149
|
+
serviceId,
|
|
2150
|
+
slug: typeof s.app_slug === "string" ? s.app_slug : null,
|
|
2151
|
+
name: typeof s.name === "string" ? s.name : null,
|
|
2152
|
+
description: typeof s.description === "string" ? s.description : null,
|
|
2153
|
+
baseUrl: typeof s.base_url === "string" ? s.base_url : null,
|
|
2154
|
+
status: typeof s.status === "string" ? s.status : null,
|
|
2155
|
+
surfaceKind: typeof s.surface_kind === "string" ? s.surface_kind : null,
|
|
2156
|
+
launchable: s.launchable === true
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
if (entries.length > 0) return entries;
|
|
2160
|
+
}
|
|
2161
|
+
} catch {
|
|
2162
|
+
}
|
|
2163
|
+
return this.generatedCatalogFallback();
|
|
2164
|
+
}
|
|
2165
|
+
generatedCatalogFallback() {
|
|
2166
|
+
const apps = Object.values(APPLICATIONS);
|
|
2167
|
+
return apps.map((app) => ({
|
|
2168
|
+
serviceId: app.id,
|
|
2169
|
+
slug: app.id,
|
|
2170
|
+
name: app.name ?? app.id,
|
|
2171
|
+
description: null,
|
|
2172
|
+
baseUrl: app.productionUrl ?? null,
|
|
2173
|
+
status: "active",
|
|
2174
|
+
surfaceKind: "application",
|
|
2175
|
+
launchable: Boolean(app.productionUrl)
|
|
2176
|
+
}));
|
|
2177
|
+
}
|
|
2126
2178
|
/**
|
|
2127
2179
|
* Introspect the current credential. Returns the caller's resolved identity,
|
|
2128
2180
|
* organization, and permission set. Used by CLI `whoami` and by MCP to gate
|
|
@@ -2159,6 +2211,26 @@ var TopoloClient = class _TopoloClient {
|
|
|
2159
2211
|
};
|
|
2160
2212
|
}
|
|
2161
2213
|
};
|
|
2214
|
+
function resolveConfiguredServiceId(slug, serviceIds) {
|
|
2215
|
+
for (const serviceKey of serviceKeyCandidates(slug)) {
|
|
2216
|
+
const configured = serviceIds?.[serviceKey];
|
|
2217
|
+
if (typeof configured === "string" && configured.trim()) return configured.trim();
|
|
2218
|
+
const envKey = `TOPOLO_SERVICE_ID_${serviceKey.replace(/\./g, "_").toUpperCase()}`;
|
|
2219
|
+
const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
|
|
2220
|
+
if (typeof envValue === "string" && envValue.trim()) return envValue.trim();
|
|
2221
|
+
}
|
|
2222
|
+
return null;
|
|
2223
|
+
}
|
|
2224
|
+
function serviceKeyCandidates(slug) {
|
|
2225
|
+
const normalized = slug.trim().toLowerCase();
|
|
2226
|
+
const withoutTopolo = normalized.startsWith("topolo-") ? normalized.slice("topolo-".length) : normalized;
|
|
2227
|
+
return [.../* @__PURE__ */ new Set([
|
|
2228
|
+
normalized,
|
|
2229
|
+
normalized.replace(/-/g, "_"),
|
|
2230
|
+
withoutTopolo,
|
|
2231
|
+
withoutTopolo.replace(/-/g, "_")
|
|
2232
|
+
])];
|
|
2233
|
+
}
|
|
2162
2234
|
function describeError(body, fallback) {
|
|
2163
2235
|
if (body && typeof body === "object") {
|
|
2164
2236
|
const maybe = body;
|
|
@@ -2725,7 +2797,6 @@ function createTopolo(options) {
|
|
|
2725
2797
|
DEFAULT_SERVICE_URLS,
|
|
2726
2798
|
IdentityModule,
|
|
2727
2799
|
P2PModule,
|
|
2728
|
-
PLATFORM_SERVICE_IDS,
|
|
2729
2800
|
TOPOLO_WIDGET_ENDPOINT,
|
|
2730
2801
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
2731
2802
|
TopoloAuthError,
|
package/dist/index.d.cts
CHANGED
|
@@ -65,12 +65,14 @@ declare const SERVICES: {
|
|
|
65
65
|
readonly p2p: "https://p2p.topolo.app";
|
|
66
66
|
readonly pay: "https://pay.topolo.app";
|
|
67
67
|
readonly people: "https://people.topolo.app";
|
|
68
|
+
readonly pulse: "https://pulse.topolo.app";
|
|
68
69
|
readonly "quro.api": "https://api.ol0.me";
|
|
69
70
|
readonly "quro.redirect": "https://ol0.me";
|
|
70
71
|
readonly roadmapper: "https://roadmapper-api.topolo.app";
|
|
71
72
|
readonly sign: "https://sign.topolo.app";
|
|
72
73
|
readonly social_studio: "https://studio-api.topolo.app";
|
|
73
74
|
readonly socialize: "https://socialize-api.topolo.app";
|
|
75
|
+
readonly spaces: "https://spaces.topolo.app";
|
|
74
76
|
readonly status: "https://status.topolo.app";
|
|
75
77
|
readonly support: "https://support.topolo.app";
|
|
76
78
|
readonly survey: "https://survey.topolo.app";
|
|
@@ -78,15 +80,6 @@ declare const SERVICES: {
|
|
|
78
80
|
readonly web: "https://web-api.topolo.app";
|
|
79
81
|
};
|
|
80
82
|
type ServiceId = keyof typeof SERVICES;
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated since 0.3.0 — opaque service ids are no longer baked into the
|
|
83
|
-
* SDK. Use `TopoloClient.getServiceIdBySlug(slug)` which hits
|
|
84
|
-
* `GET /api/services/by-slug/:slug` on TopoloAuth at runtime. This map is
|
|
85
|
-
* still populated as a build-time snapshot for backward compatibility and
|
|
86
|
-
* will be removed in 0.4.0. Stale entries are expected — do not rely on
|
|
87
|
-
* presence/absence for catalog membership.
|
|
88
|
-
*/
|
|
89
|
-
declare const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>>;
|
|
90
83
|
|
|
91
84
|
declare const APPLICATIONS: {
|
|
92
85
|
readonly admin: {
|
|
@@ -144,6 +137,22 @@ declare const APPLICATIONS: {
|
|
|
144
137
|
readonly serviceId: "auth";
|
|
145
138
|
}];
|
|
146
139
|
};
|
|
140
|
+
readonly backup: {
|
|
141
|
+
readonly id: "backup";
|
|
142
|
+
readonly appDir: "TopoloBackup";
|
|
143
|
+
readonly name: "topolo-backup";
|
|
144
|
+
readonly packageName: "topolo-backup";
|
|
145
|
+
readonly productionUrl: null;
|
|
146
|
+
readonly services: readonly [];
|
|
147
|
+
readonly deployTargets: readonly [{
|
|
148
|
+
readonly name: "topolo-backup";
|
|
149
|
+
readonly kind: "worker";
|
|
150
|
+
readonly apiUrl: null;
|
|
151
|
+
readonly domains: readonly [];
|
|
152
|
+
readonly routes: readonly [];
|
|
153
|
+
readonly serviceId: null;
|
|
154
|
+
}];
|
|
155
|
+
};
|
|
147
156
|
readonly books: {
|
|
148
157
|
readonly id: "books";
|
|
149
158
|
readonly appDir: "TopoloBooks";
|
|
@@ -247,15 +256,6 @@ declare const APPLICATIONS: {
|
|
|
247
256
|
readonly serviceId: "chat";
|
|
248
257
|
}];
|
|
249
258
|
};
|
|
250
|
-
readonly cli: {
|
|
251
|
-
readonly id: "cli";
|
|
252
|
-
readonly appDir: "TopoloCli";
|
|
253
|
-
readonly name: "@topolo/cli";
|
|
254
|
-
readonly packageName: "@topolo/cli";
|
|
255
|
-
readonly productionUrl: null;
|
|
256
|
-
readonly services: readonly [];
|
|
257
|
-
readonly deployTargets: readonly [];
|
|
258
|
-
};
|
|
259
259
|
readonly cloudcontrol: {
|
|
260
260
|
readonly id: "cloudcontrol";
|
|
261
261
|
readonly appDir: "TopoloCloudControl";
|
|
@@ -373,22 +373,6 @@ declare const APPLICATIONS: {
|
|
|
373
373
|
readonly serviceId: "customer_success";
|
|
374
374
|
}];
|
|
375
375
|
};
|
|
376
|
-
readonly d1_backup: {
|
|
377
|
-
readonly id: "d1_backup";
|
|
378
|
-
readonly appDir: "TopoloD1Backup";
|
|
379
|
-
readonly name: "topolo-d1-backup";
|
|
380
|
-
readonly packageName: "topolo-d1-backup";
|
|
381
|
-
readonly productionUrl: null;
|
|
382
|
-
readonly services: readonly [];
|
|
383
|
-
readonly deployTargets: readonly [{
|
|
384
|
-
readonly name: "topolo-d1-backup";
|
|
385
|
-
readonly kind: "worker";
|
|
386
|
-
readonly apiUrl: null;
|
|
387
|
-
readonly domains: readonly [];
|
|
388
|
-
readonly routes: readonly [];
|
|
389
|
-
readonly serviceId: null;
|
|
390
|
-
}];
|
|
391
|
-
};
|
|
392
376
|
readonly developers: {
|
|
393
377
|
readonly id: "developers";
|
|
394
378
|
readonly appDir: "TopoloDevelopers";
|
|
@@ -625,15 +609,6 @@ declare const APPLICATIONS: {
|
|
|
625
609
|
readonly serviceId: "mail";
|
|
626
610
|
}];
|
|
627
611
|
};
|
|
628
|
-
readonly mcp: {
|
|
629
|
-
readonly id: "mcp";
|
|
630
|
-
readonly appDir: "TopoloMCP";
|
|
631
|
-
readonly name: "@topolo/mcp";
|
|
632
|
-
readonly packageName: "@topolo/mcp";
|
|
633
|
-
readonly productionUrl: null;
|
|
634
|
-
readonly services: readonly [];
|
|
635
|
-
readonly deployTargets: readonly [];
|
|
636
|
-
};
|
|
637
612
|
readonly mdm: {
|
|
638
613
|
readonly id: "mdm";
|
|
639
614
|
readonly appDir: "TopoloMDM";
|
|
@@ -731,7 +706,7 @@ declare const APPLICATIONS: {
|
|
|
731
706
|
readonly one: {
|
|
732
707
|
readonly id: "one";
|
|
733
708
|
readonly appDir: "TopoloOne";
|
|
734
|
-
readonly name: "
|
|
709
|
+
readonly name: "TopoloOne";
|
|
735
710
|
readonly packageName: "topolo-oneclick-sso";
|
|
736
711
|
readonly productionUrl: "https://one.topolo.app";
|
|
737
712
|
readonly services: readonly ["one"];
|
|
@@ -811,9 +786,16 @@ declare const APPLICATIONS: {
|
|
|
811
786
|
readonly appDir: "TopoloPulse";
|
|
812
787
|
readonly name: "topolo-pulse";
|
|
813
788
|
readonly packageName: "topolo-pulse";
|
|
814
|
-
readonly productionUrl:
|
|
815
|
-
readonly services: readonly [];
|
|
816
|
-
readonly deployTargets: readonly [
|
|
789
|
+
readonly productionUrl: "https://pulse.topolo.app";
|
|
790
|
+
readonly services: readonly ["pulse"];
|
|
791
|
+
readonly deployTargets: readonly [{
|
|
792
|
+
readonly name: "topolo-pulse";
|
|
793
|
+
readonly kind: "worker";
|
|
794
|
+
readonly apiUrl: "https://pulse.topolo.app";
|
|
795
|
+
readonly domains: readonly ["pulse.topolo.app"];
|
|
796
|
+
readonly routes: readonly ["pulse.topolo.app"];
|
|
797
|
+
readonly serviceId: "pulse";
|
|
798
|
+
}];
|
|
817
799
|
};
|
|
818
800
|
readonly quro: {
|
|
819
801
|
readonly id: "quro";
|
|
@@ -944,6 +926,22 @@ declare const APPLICATIONS: {
|
|
|
944
926
|
readonly serviceId: null;
|
|
945
927
|
}];
|
|
946
928
|
};
|
|
929
|
+
readonly spaces: {
|
|
930
|
+
readonly id: "spaces";
|
|
931
|
+
readonly appDir: "TopoloSpaces";
|
|
932
|
+
readonly name: "topolo-spaces";
|
|
933
|
+
readonly packageName: "@topolo/spaces";
|
|
934
|
+
readonly productionUrl: "https://spaces.topolo.app";
|
|
935
|
+
readonly services: readonly ["spaces"];
|
|
936
|
+
readonly deployTargets: readonly [{
|
|
937
|
+
readonly name: "topolo-spaces";
|
|
938
|
+
readonly kind: "worker";
|
|
939
|
+
readonly apiUrl: "https://spaces.topolo.app";
|
|
940
|
+
readonly domains: readonly ["spaces.topolo.app"];
|
|
941
|
+
readonly routes: readonly ["spaces.topolo.app"];
|
|
942
|
+
readonly serviceId: "spaces";
|
|
943
|
+
}];
|
|
944
|
+
};
|
|
947
945
|
readonly status: {
|
|
948
946
|
readonly id: "status";
|
|
949
947
|
readonly appDir: "TopoloStatus";
|
|
@@ -1110,8 +1108,8 @@ declare const APPLICATION_REQUIREMENTS: readonly [{
|
|
|
1110
1108
|
readonly title: "Use the shared Topolo auth boundary";
|
|
1111
1109
|
readonly summary: "Applications must derive identity, organization, scopes, and service entitlement from TopoloAuth rather than inventing parallel auth state.";
|
|
1112
1110
|
readonly appliesTo: readonly ["browser", "api", "tooling", "agent_surface"];
|
|
1113
|
-
readonly evidence: readonly ["@topolo/auth-client or @topolo/
|
|
1114
|
-
readonly implementation: readonly ["Use shared auth packages instead of copying token parsing or browser storage flows", "Derive organization from the credential on every request", "Route OAuth, refresh, logout, and SSO paths according to the shared Auth contract"];
|
|
1111
|
+
readonly evidence: readonly ["@topolo/auth-client or @topolo-io/worker-runtime is used where applicable", "No public command, tool, or SDK method accepts orgId", "Service slug and Auth service registration are documented for protected services"];
|
|
1112
|
+
readonly implementation: readonly ["Use shared auth/runtime packages instead of copying token parsing, gateway, or browser storage flows", "Derive organization from the credential on every request", "Route OAuth, refresh, logout, and SSO paths according to the shared Auth contract"];
|
|
1115
1113
|
}, {
|
|
1116
1114
|
readonly id: "shared-shell-and-launcher";
|
|
1117
1115
|
readonly title: "Use the shared shell, launcher, and account menu";
|
|
@@ -1198,6 +1196,8 @@ interface TopoloClientOptions {
|
|
|
1198
1196
|
agent: AgentIdentity;
|
|
1199
1197
|
/** Per-service URL overrides. Useful for staging/dev. */
|
|
1200
1198
|
serviceUrls?: Partial<Record<ServiceId, string>>;
|
|
1199
|
+
/** Per-service TopoloAuth service id overrides from the owning app/deployment. */
|
|
1200
|
+
serviceIds?: Partial<Record<ServiceId, string>>;
|
|
1201
1201
|
/**
|
|
1202
1202
|
* When true, mutating helpers (POST/PUT/PATCH/DELETE) require callers to pass
|
|
1203
1203
|
* `{ confirm: true }`. Defaults to true. Set false only for trusted surfaces.
|
|
@@ -1254,10 +1254,26 @@ interface RequestOptions {
|
|
|
1254
1254
|
headers?: Record<string, string>;
|
|
1255
1255
|
signal?: AbortSignal;
|
|
1256
1256
|
}
|
|
1257
|
+
/**
|
|
1258
|
+
* A single entry from the live platform service catalog. Returned by
|
|
1259
|
+
* {@link TopoloClient.listServices}. Shape mirrors the public-safe projection
|
|
1260
|
+
* from TopoloAuth `GET /api/services/catalog`.
|
|
1261
|
+
*/
|
|
1262
|
+
interface TopoloServiceCatalogEntry {
|
|
1263
|
+
serviceId: string;
|
|
1264
|
+
slug: string | null;
|
|
1265
|
+
name: string | null;
|
|
1266
|
+
description: string | null;
|
|
1267
|
+
baseUrl: string | null;
|
|
1268
|
+
status: string | null;
|
|
1269
|
+
surfaceKind: string | null;
|
|
1270
|
+
launchable: boolean;
|
|
1271
|
+
}
|
|
1257
1272
|
declare class TopoloClient {
|
|
1258
1273
|
private readonly credential;
|
|
1259
1274
|
private readonly agent;
|
|
1260
1275
|
private readonly serviceUrls?;
|
|
1276
|
+
private readonly serviceIds?;
|
|
1261
1277
|
private readonly requireConfirmForWrites;
|
|
1262
1278
|
private readonly timeoutMs;
|
|
1263
1279
|
private readonly fetchImpl;
|
|
@@ -1283,12 +1299,7 @@ declare class TopoloClient {
|
|
|
1283
1299
|
*/
|
|
1284
1300
|
request<T = unknown>(opts: RequestOptions): Promise<T>;
|
|
1285
1301
|
/**
|
|
1286
|
-
* Resolve a service-slug → opaque service-id via TopoloAuth.
|
|
1287
|
-
*
|
|
1288
|
-
* Replaces the SDK-baked `PLATFORM_SERVICE_IDS` map (deprecated in 0.3.0,
|
|
1289
|
-
* removed in 0.4.0). Slug shape accepted: either the canonical Auth slug
|
|
1290
|
-
* (e.g. `topolo-notify`) or the SDK short id (`notify`) — Auth's resolver
|
|
1291
|
-
* understands both.
|
|
1302
|
+
* Resolve a service-slug → opaque service-id via caller config or TopoloAuth.
|
|
1292
1303
|
*
|
|
1293
1304
|
* Cache: 5 minutes per process per `(slug, auth_base_url)`. Negative
|
|
1294
1305
|
* results (404) are cached for 60s so a typo doesn't hot-loop the
|
|
@@ -1300,6 +1311,20 @@ declare class TopoloClient {
|
|
|
1300
1311
|
* has acquired an access token.
|
|
1301
1312
|
*/
|
|
1302
1313
|
getServiceIdBySlug(slug: string): Promise<string | null>;
|
|
1314
|
+
/**
|
|
1315
|
+
* List the platform service catalog from the live registry
|
|
1316
|
+
* (`GET /api/services/catalog` on TopoloAuth). Credential-aware: the
|
|
1317
|
+
* caller's credential is attached, so an authenticated caller in an
|
|
1318
|
+
* entitled org also receives the `developer_only` services its role
|
|
1319
|
+
* permits; an unauthenticated/agent caller receives `active` only.
|
|
1320
|
+
*
|
|
1321
|
+
* Resilient: on any network/HTTP failure this falls back to the
|
|
1322
|
+
* build-time generated `APPLICATIONS` snapshot so offline/degraded
|
|
1323
|
+
* callers still get a usable (if static) catalog. The live result is
|
|
1324
|
+
* authoritative; the snapshot is a floor, not a cap.
|
|
1325
|
+
*/
|
|
1326
|
+
listServices(): Promise<TopoloServiceCatalogEntry[]>;
|
|
1327
|
+
private generatedCatalogFallback;
|
|
1303
1328
|
/**
|
|
1304
1329
|
* Introspect the current credential. Returns the caller's resolved identity,
|
|
1305
1330
|
* organization, and permission set. Used by CLI `whoami` and by MCP to gate
|
|
@@ -1831,4 +1856,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
1831
1856
|
};
|
|
1832
1857
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
1833
1858
|
|
|
1834
|
-
export { APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type AgentIdentity, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_SERVICE_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup,
|
|
1859
|
+
export { APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type AgentIdentity, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_SERVICE_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceId, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, TopoloAuthError, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationRequirements, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, requirementsForApplication, resolveServiceUrl, validateTopoloWidgetResponse };
|