@topolo/sdk 0.1.2 → 0.2.1
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.cjs +27 -4
- package/dist/index.d.cts +36 -10
- package/dist/index.d.ts +36 -10
- package/dist/index.js +27 -4
- package/package.json +4 -2
- package/src/services.generated.ts +34 -0
- package/src/services.ts +17 -19
package/dist/index.cjs
CHANGED
|
@@ -93,18 +93,41 @@ var TopoloHttpError = class extends TopoloSdkError {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
// src/services.ts
|
|
97
|
-
var
|
|
96
|
+
// src/services.generated.ts
|
|
97
|
+
var SERVICES = {
|
|
98
|
+
agent: "https://topolo-agent-worker.topolo.workers.dev",
|
|
98
99
|
auth: "https://auth.topolo.app",
|
|
99
|
-
|
|
100
|
+
bugfix: "https://bugfix.topolo.app",
|
|
101
|
+
bytes: "https://r2-media-manager-worker.topolo.workers.dev",
|
|
102
|
+
chat: "https://chat.topolo.app",
|
|
103
|
+
commerce: "https://topolo-commerce-api.topolo.workers.dev",
|
|
104
|
+
crm: "https://crm-api.topolo.app",
|
|
105
|
+
forecast: "https://forecast-worker-production.topolo.workers.dev",
|
|
106
|
+
learn: "https://topololearn-api.topolo.workers.dev",
|
|
107
|
+
mdm: "https://nodo-mdm-api.topolo.app",
|
|
108
|
+
messaging: "https://messages.topolo.app",
|
|
109
|
+
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
110
|
+
one: "https://topoloone-worker.topolo.workers.dev",
|
|
111
|
+
pay: "https://topolo-pay.topolo.workers.dev",
|
|
112
|
+
"quro.api": "https://api.ol0.me",
|
|
113
|
+
"quro.redirect": "https://ol0.me",
|
|
114
|
+
roadmapper: "https://roadmapper-api.topolo.app",
|
|
115
|
+
social_studio: "https://topolo-social-studio-api.topolo.workers.dev",
|
|
116
|
+
socialize: "https://socialize-prod-api.topolo.workers.dev",
|
|
117
|
+
support: "https://support.topolo.app",
|
|
118
|
+
"web.api": "https://web-api.topolo.app",
|
|
119
|
+
"web.runtime": "https://sites.topolo.app"
|
|
100
120
|
};
|
|
101
121
|
var PLATFORM_SERVICE_IDS = {
|
|
102
122
|
crm: "srv_iCwM4jGXcwlj"
|
|
103
123
|
};
|
|
124
|
+
|
|
125
|
+
// src/services.ts
|
|
126
|
+
var DEFAULT_SERVICE_URLS = SERVICES;
|
|
104
127
|
function resolveServiceUrl(service, overrides) {
|
|
105
128
|
const override = overrides?.[service];
|
|
106
129
|
if (override) return override;
|
|
107
|
-
const envKey = `TOPOLO_SERVICE_URL_${service.toUpperCase()}`;
|
|
130
|
+
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
|
|
108
131
|
const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
|
|
109
132
|
if (envValue) return envValue;
|
|
110
133
|
return DEFAULT_SERVICE_URLS[service];
|
package/dist/index.d.cts
CHANGED
|
@@ -31,24 +31,50 @@ interface AgentIdentity {
|
|
|
31
31
|
agentName?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
declare const SERVICES: {
|
|
35
|
+
readonly agent: "https://topolo-agent-worker.topolo.workers.dev";
|
|
36
|
+
readonly auth: "https://auth.topolo.app";
|
|
37
|
+
readonly bugfix: "https://bugfix.topolo.app";
|
|
38
|
+
readonly bytes: "https://r2-media-manager-worker.topolo.workers.dev";
|
|
39
|
+
readonly chat: "https://chat.topolo.app";
|
|
40
|
+
readonly commerce: "https://topolo-commerce-api.topolo.workers.dev";
|
|
41
|
+
readonly crm: "https://crm-api.topolo.app";
|
|
42
|
+
readonly forecast: "https://forecast-worker-production.topolo.workers.dev";
|
|
43
|
+
readonly learn: "https://topololearn-api.topolo.workers.dev";
|
|
44
|
+
readonly mdm: "https://nodo-mdm-api.topolo.app";
|
|
45
|
+
readonly messaging: "https://messages.topolo.app";
|
|
46
|
+
readonly nexus: "https://topolo-nexus-gateway.topolo.workers.dev";
|
|
47
|
+
readonly one: "https://topoloone-worker.topolo.workers.dev";
|
|
48
|
+
readonly pay: "https://topolo-pay.topolo.workers.dev";
|
|
49
|
+
readonly "quro.api": "https://api.ol0.me";
|
|
50
|
+
readonly "quro.redirect": "https://ol0.me";
|
|
51
|
+
readonly roadmapper: "https://roadmapper-api.topolo.app";
|
|
52
|
+
readonly social_studio: "https://topolo-social-studio-api.topolo.workers.dev";
|
|
53
|
+
readonly socialize: "https://socialize-prod-api.topolo.workers.dev";
|
|
54
|
+
readonly support: "https://support.topolo.app";
|
|
55
|
+
readonly "web.api": "https://web-api.topolo.app";
|
|
56
|
+
readonly "web.runtime": "https://sites.topolo.app";
|
|
57
|
+
};
|
|
58
|
+
type ServiceId = keyof typeof SERVICES;
|
|
59
|
+
declare const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>>;
|
|
60
|
+
|
|
34
61
|
/**
|
|
35
|
-
* Service registry — base URLs for
|
|
62
|
+
* Service registry — base URLs for every Topolo platform service.
|
|
63
|
+
*
|
|
64
|
+
* Source of truth lives in each app's `topolo.cloudcontrol.json`. The
|
|
65
|
+
* `SERVICES` map is regenerated from those files via
|
|
66
|
+
* `scripts/generate-services.mjs`; edit the JSON, not the generated file.
|
|
36
67
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
68
|
+
* Any entry can be overridden per-call via `TopoloClient` options, or globally
|
|
69
|
+
* via env vars like `TOPOLO_SERVICE_URL_CRM` or `TOPOLO_SERVICE_URL_WEB_API`
|
|
70
|
+
* (dots in service IDs become underscores in env vars).
|
|
39
71
|
*
|
|
40
72
|
* IMPORTANT: The SDK NEVER accepts `orgId` as a parameter. Every request is
|
|
41
73
|
* scoped to the organization embedded in the auth credential (JWT claim or
|
|
42
74
|
* API-key binding). This is the load-bearing cross-org isolation guarantee.
|
|
43
75
|
*/
|
|
44
|
-
|
|
76
|
+
|
|
45
77
|
declare const DEFAULT_SERVICE_URLS: Record<ServiceId, string>;
|
|
46
|
-
/**
|
|
47
|
-
* Service IDs as registered in TopoloAuth's service catalog. These are sent in
|
|
48
|
-
* the `X-Service-ID` header when the platform needs to route an API-key
|
|
49
|
-
* introspection or permission check.
|
|
50
|
-
*/
|
|
51
|
-
declare const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>>;
|
|
52
78
|
declare function resolveServiceUrl(service: ServiceId, overrides?: Partial<Record<ServiceId, string>>): string;
|
|
53
79
|
|
|
54
80
|
interface TopoloClientOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -31,24 +31,50 @@ interface AgentIdentity {
|
|
|
31
31
|
agentName?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
declare const SERVICES: {
|
|
35
|
+
readonly agent: "https://topolo-agent-worker.topolo.workers.dev";
|
|
36
|
+
readonly auth: "https://auth.topolo.app";
|
|
37
|
+
readonly bugfix: "https://bugfix.topolo.app";
|
|
38
|
+
readonly bytes: "https://r2-media-manager-worker.topolo.workers.dev";
|
|
39
|
+
readonly chat: "https://chat.topolo.app";
|
|
40
|
+
readonly commerce: "https://topolo-commerce-api.topolo.workers.dev";
|
|
41
|
+
readonly crm: "https://crm-api.topolo.app";
|
|
42
|
+
readonly forecast: "https://forecast-worker-production.topolo.workers.dev";
|
|
43
|
+
readonly learn: "https://topololearn-api.topolo.workers.dev";
|
|
44
|
+
readonly mdm: "https://nodo-mdm-api.topolo.app";
|
|
45
|
+
readonly messaging: "https://messages.topolo.app";
|
|
46
|
+
readonly nexus: "https://topolo-nexus-gateway.topolo.workers.dev";
|
|
47
|
+
readonly one: "https://topoloone-worker.topolo.workers.dev";
|
|
48
|
+
readonly pay: "https://topolo-pay.topolo.workers.dev";
|
|
49
|
+
readonly "quro.api": "https://api.ol0.me";
|
|
50
|
+
readonly "quro.redirect": "https://ol0.me";
|
|
51
|
+
readonly roadmapper: "https://roadmapper-api.topolo.app";
|
|
52
|
+
readonly social_studio: "https://topolo-social-studio-api.topolo.workers.dev";
|
|
53
|
+
readonly socialize: "https://socialize-prod-api.topolo.workers.dev";
|
|
54
|
+
readonly support: "https://support.topolo.app";
|
|
55
|
+
readonly "web.api": "https://web-api.topolo.app";
|
|
56
|
+
readonly "web.runtime": "https://sites.topolo.app";
|
|
57
|
+
};
|
|
58
|
+
type ServiceId = keyof typeof SERVICES;
|
|
59
|
+
declare const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>>;
|
|
60
|
+
|
|
34
61
|
/**
|
|
35
|
-
* Service registry — base URLs for
|
|
62
|
+
* Service registry — base URLs for every Topolo platform service.
|
|
63
|
+
*
|
|
64
|
+
* Source of truth lives in each app's `topolo.cloudcontrol.json`. The
|
|
65
|
+
* `SERVICES` map is regenerated from those files via
|
|
66
|
+
* `scripts/generate-services.mjs`; edit the JSON, not the generated file.
|
|
36
67
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
68
|
+
* Any entry can be overridden per-call via `TopoloClient` options, or globally
|
|
69
|
+
* via env vars like `TOPOLO_SERVICE_URL_CRM` or `TOPOLO_SERVICE_URL_WEB_API`
|
|
70
|
+
* (dots in service IDs become underscores in env vars).
|
|
39
71
|
*
|
|
40
72
|
* IMPORTANT: The SDK NEVER accepts `orgId` as a parameter. Every request is
|
|
41
73
|
* scoped to the organization embedded in the auth credential (JWT claim or
|
|
42
74
|
* API-key binding). This is the load-bearing cross-org isolation guarantee.
|
|
43
75
|
*/
|
|
44
|
-
|
|
76
|
+
|
|
45
77
|
declare const DEFAULT_SERVICE_URLS: Record<ServiceId, string>;
|
|
46
|
-
/**
|
|
47
|
-
* Service IDs as registered in TopoloAuth's service catalog. These are sent in
|
|
48
|
-
* the `X-Service-ID` header when the platform needs to route an API-key
|
|
49
|
-
* introspection or permission check.
|
|
50
|
-
*/
|
|
51
|
-
declare const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>>;
|
|
52
78
|
declare function resolveServiceUrl(service: ServiceId, overrides?: Partial<Record<ServiceId, string>>): string;
|
|
53
79
|
|
|
54
80
|
interface TopoloClientOptions {
|
package/dist/index.js
CHANGED
|
@@ -56,18 +56,41 @@ var TopoloHttpError = class extends TopoloSdkError {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
// src/services.ts
|
|
60
|
-
var
|
|
59
|
+
// src/services.generated.ts
|
|
60
|
+
var SERVICES = {
|
|
61
|
+
agent: "https://topolo-agent-worker.topolo.workers.dev",
|
|
61
62
|
auth: "https://auth.topolo.app",
|
|
62
|
-
|
|
63
|
+
bugfix: "https://bugfix.topolo.app",
|
|
64
|
+
bytes: "https://r2-media-manager-worker.topolo.workers.dev",
|
|
65
|
+
chat: "https://chat.topolo.app",
|
|
66
|
+
commerce: "https://topolo-commerce-api.topolo.workers.dev",
|
|
67
|
+
crm: "https://crm-api.topolo.app",
|
|
68
|
+
forecast: "https://forecast-worker-production.topolo.workers.dev",
|
|
69
|
+
learn: "https://topololearn-api.topolo.workers.dev",
|
|
70
|
+
mdm: "https://nodo-mdm-api.topolo.app",
|
|
71
|
+
messaging: "https://messages.topolo.app",
|
|
72
|
+
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
73
|
+
one: "https://topoloone-worker.topolo.workers.dev",
|
|
74
|
+
pay: "https://topolo-pay.topolo.workers.dev",
|
|
75
|
+
"quro.api": "https://api.ol0.me",
|
|
76
|
+
"quro.redirect": "https://ol0.me",
|
|
77
|
+
roadmapper: "https://roadmapper-api.topolo.app",
|
|
78
|
+
social_studio: "https://topolo-social-studio-api.topolo.workers.dev",
|
|
79
|
+
socialize: "https://socialize-prod-api.topolo.workers.dev",
|
|
80
|
+
support: "https://support.topolo.app",
|
|
81
|
+
"web.api": "https://web-api.topolo.app",
|
|
82
|
+
"web.runtime": "https://sites.topolo.app"
|
|
63
83
|
};
|
|
64
84
|
var PLATFORM_SERVICE_IDS = {
|
|
65
85
|
crm: "srv_iCwM4jGXcwlj"
|
|
66
86
|
};
|
|
87
|
+
|
|
88
|
+
// src/services.ts
|
|
89
|
+
var DEFAULT_SERVICE_URLS = SERVICES;
|
|
67
90
|
function resolveServiceUrl(service, overrides) {
|
|
68
91
|
const override = overrides?.[service];
|
|
69
92
|
if (override) return override;
|
|
70
|
-
const envKey = `TOPOLO_SERVICE_URL_${service.toUpperCase()}`;
|
|
93
|
+
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
|
|
71
94
|
const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
|
|
72
95
|
if (envValue) return envValue;
|
|
73
96
|
return DEFAULT_SERVICE_URLS[service];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
"src"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
+
"generate:services": "node scripts/generate-services.mjs",
|
|
22
|
+
"prebuild": "node scripts/generate-services.mjs",
|
|
21
23
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
22
24
|
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
23
|
-
"typecheck": "tsc --noEmit",
|
|
25
|
+
"typecheck": "node scripts/generate-services.mjs && tsc --noEmit",
|
|
24
26
|
"test": "vitest run",
|
|
25
27
|
"test:watch": "vitest"
|
|
26
28
|
},
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-services.mjs. Do not edit by hand.
|
|
2
|
+
// Source of truth: topolo.cloudcontrol.json in every app repo.
|
|
3
|
+
// Regenerate: npm run generate:services
|
|
4
|
+
|
|
5
|
+
export const SERVICES = {
|
|
6
|
+
agent: "https://topolo-agent-worker.topolo.workers.dev",
|
|
7
|
+
auth: "https://auth.topolo.app",
|
|
8
|
+
bugfix: "https://bugfix.topolo.app",
|
|
9
|
+
bytes: "https://r2-media-manager-worker.topolo.workers.dev",
|
|
10
|
+
chat: "https://chat.topolo.app",
|
|
11
|
+
commerce: "https://topolo-commerce-api.topolo.workers.dev",
|
|
12
|
+
crm: "https://crm-api.topolo.app",
|
|
13
|
+
forecast: "https://forecast-worker-production.topolo.workers.dev",
|
|
14
|
+
learn: "https://topololearn-api.topolo.workers.dev",
|
|
15
|
+
mdm: "https://nodo-mdm-api.topolo.app",
|
|
16
|
+
messaging: "https://messages.topolo.app",
|
|
17
|
+
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
18
|
+
one: "https://topoloone-worker.topolo.workers.dev",
|
|
19
|
+
pay: "https://topolo-pay.topolo.workers.dev",
|
|
20
|
+
"quro.api": "https://api.ol0.me",
|
|
21
|
+
"quro.redirect": "https://ol0.me",
|
|
22
|
+
roadmapper: "https://roadmapper-api.topolo.app",
|
|
23
|
+
social_studio: "https://topolo-social-studio-api.topolo.workers.dev",
|
|
24
|
+
socialize: "https://socialize-prod-api.topolo.workers.dev",
|
|
25
|
+
support: "https://support.topolo.app",
|
|
26
|
+
"web.api": "https://web-api.topolo.app",
|
|
27
|
+
"web.runtime": "https://sites.topolo.app",
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
export type ServiceId = keyof typeof SERVICES;
|
|
31
|
+
|
|
32
|
+
export const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>> = {
|
|
33
|
+
crm: "srv_iCwM4jGXcwlj",
|
|
34
|
+
};
|
package/src/services.ts
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Service registry — base URLs for
|
|
2
|
+
* Service registry — base URLs for every Topolo platform service.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
4
|
+
* Source of truth lives in each app's `topolo.cloudcontrol.json`. The
|
|
5
|
+
* `SERVICES` map is regenerated from those files via
|
|
6
|
+
* `scripts/generate-services.mjs`; edit the JSON, not the generated file.
|
|
7
|
+
*
|
|
8
|
+
* Any entry can be overridden per-call via `TopoloClient` options, or globally
|
|
9
|
+
* via env vars like `TOPOLO_SERVICE_URL_CRM` or `TOPOLO_SERVICE_URL_WEB_API`
|
|
10
|
+
* (dots in service IDs become underscores in env vars).
|
|
6
11
|
*
|
|
7
12
|
* IMPORTANT: The SDK NEVER accepts `orgId` as a parameter. Every request is
|
|
8
13
|
* scoped to the organization embedded in the auth credential (JWT claim or
|
|
9
14
|
* API-key binding). This is the load-bearing cross-org isolation guarantee.
|
|
10
15
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
import {
|
|
17
|
+
SERVICES,
|
|
18
|
+
PLATFORM_SERVICE_IDS,
|
|
19
|
+
type ServiceId,
|
|
20
|
+
} from './services.generated.js';
|
|
14
21
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
crm: 'https://topolo-crm-worker.topolo.workers.dev',
|
|
18
|
-
};
|
|
22
|
+
export { SERVICES, PLATFORM_SERVICE_IDS };
|
|
23
|
+
export type { ServiceId };
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
* Service IDs as registered in TopoloAuth's service catalog. These are sent in
|
|
22
|
-
* the `X-Service-ID` header when the platform needs to route an API-key
|
|
23
|
-
* introspection or permission check.
|
|
24
|
-
*/
|
|
25
|
-
export const PLATFORM_SERVICE_IDS: Partial<Record<ServiceId, string>> = {
|
|
26
|
-
crm: 'srv_iCwM4jGXcwlj',
|
|
27
|
-
};
|
|
25
|
+
export const DEFAULT_SERVICE_URLS: Record<ServiceId, string> = SERVICES;
|
|
28
26
|
|
|
29
27
|
export function resolveServiceUrl(
|
|
30
28
|
service: ServiceId,
|
|
@@ -33,7 +31,7 @@ export function resolveServiceUrl(
|
|
|
33
31
|
const override = overrides?.[service];
|
|
34
32
|
if (override) return override;
|
|
35
33
|
|
|
36
|
-
const envKey = `TOPOLO_SERVICE_URL_${service.toUpperCase()}`;
|
|
34
|
+
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, '_').toUpperCase()}`;
|
|
37
35
|
const envValue = typeof process !== 'undefined' ? process.env?.[envKey] : undefined;
|
|
38
36
|
if (envValue) return envValue;
|
|
39
37
|
|