@topolo/sdk 0.4.0 → 0.4.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 +19 -4
- package/dist/index.cjs +482 -221
- package/dist/index.d.cts +466 -271
- package/dist/index.d.ts +466 -271
- package/dist/index.js +482 -221
- package/package.json +1 -1
- package/src/application-requirements.ts +16 -5
- package/src/applications.generated.ts +349 -171
- package/src/client.test.ts +170 -11
- package/src/client.ts +165 -64
- package/src/modules/p2p.test.ts +25 -2
- package/src/services.generated.ts +4 -2
- package/src/services.test.ts +11 -5
package/src/modules/p2p.test.ts
CHANGED
|
@@ -14,6 +14,26 @@ function stubFetch(responses: Array<{ status?: number; body?: unknown }>) {
|
|
|
14
14
|
headers: { 'Content-Type': 'application/json' },
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
if (String(url).includes('/api/services/catalog')) {
|
|
18
|
+
return new Response(JSON.stringify({
|
|
19
|
+
data: {
|
|
20
|
+
services: [
|
|
21
|
+
{
|
|
22
|
+
service_id: 'srv_p2p',
|
|
23
|
+
app_slug: 'topolo-p2p',
|
|
24
|
+
name: 'Topolo P2P',
|
|
25
|
+
base_url: 'https://p2p.topolo.app',
|
|
26
|
+
surface_kind: 'api',
|
|
27
|
+
status: 'active',
|
|
28
|
+
granted_permissions: ['srv_p2p.directory:read'],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
}), {
|
|
33
|
+
status: 200,
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
17
37
|
const next = responses.shift() ?? { status: 200, body: { success: true, data: {} } };
|
|
18
38
|
return new Response(JSON.stringify(next.body ?? { success: true, data: {} }), {
|
|
19
39
|
status: next.status ?? 200,
|
|
@@ -24,7 +44,10 @@ function stubFetch(responses: Array<{ status?: number; body?: unknown }>) {
|
|
|
24
44
|
}
|
|
25
45
|
|
|
26
46
|
function requestCalls(calls: Array<{ url: string; init: RequestInit }>) {
|
|
27
|
-
return calls.filter((call) =>
|
|
47
|
+
return calls.filter((call) =>
|
|
48
|
+
!call.url.includes('/api/services/by-slug/') &&
|
|
49
|
+
!call.url.includes('/api/services/catalog')
|
|
50
|
+
);
|
|
28
51
|
}
|
|
29
52
|
|
|
30
53
|
function clientWith(impl: typeof fetch) {
|
|
@@ -138,7 +161,7 @@ describe('P2PModule.publishCapability', () => {
|
|
|
138
161
|
expect(sent.trust_level).toBe('standard');
|
|
139
162
|
const url = new URL(call.url);
|
|
140
163
|
expect(url.pathname).toBe('/api/p2p/internal/capabilities/sync');
|
|
141
|
-
expect((
|
|
164
|
+
expect((call.init.method ?? '').toUpperCase()).toBe('POST');
|
|
142
165
|
});
|
|
143
166
|
|
|
144
167
|
it('honours an explicit acting_for_org_id when the platform key is publishing for another org', async () => {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export const SERVICES = {
|
|
6
6
|
agent: "https://agent-api.topolo.app",
|
|
7
7
|
auth: "https://auth.topolo.app",
|
|
8
|
+
backup: "https://backup.topolo.app",
|
|
8
9
|
books: "https://books.topolo.app",
|
|
9
10
|
bugfix: "https://bugfix.topolo.app",
|
|
10
11
|
bytes: "https://bytes-api.topolo.app",
|
|
@@ -15,7 +16,6 @@ export const SERVICES = {
|
|
|
15
16
|
compose: "https://compose.topolo.app",
|
|
16
17
|
consent: "https://consent.topolo.app",
|
|
17
18
|
crm: "https://crm-api.topolo.app",
|
|
18
|
-
customer_success: "https://success.topolo.app",
|
|
19
19
|
developers: "https://developers.topolo.app",
|
|
20
20
|
director: "https://director.topolo.app",
|
|
21
21
|
feed: "https://feed-api.topolo.app",
|
|
@@ -29,9 +29,10 @@ export const SERVICES = {
|
|
|
29
29
|
localize: "https://localize.topolo.app",
|
|
30
30
|
mail: "https://mail.topolo.app",
|
|
31
31
|
mdm: "https://mdm-api.topolo.app",
|
|
32
|
-
|
|
32
|
+
messages: "https://messages.topolo.app",
|
|
33
33
|
nexus: "https://nexus-api.topolo.app",
|
|
34
34
|
notify: "https://notify.topolo.app",
|
|
35
|
+
observability_watch: "https://observability-watch.topolo.app",
|
|
35
36
|
one: "https://one.topolo.app",
|
|
36
37
|
p2p: "https://p2p.topolo.app",
|
|
37
38
|
pay: "https://pay.topolo.app",
|
|
@@ -45,6 +46,7 @@ export const SERVICES = {
|
|
|
45
46
|
socialize: "https://socialize-api.topolo.app",
|
|
46
47
|
spaces: "https://spaces.topolo.app",
|
|
47
48
|
status: "https://status.topolo.app",
|
|
49
|
+
success: "https://success.topolo.app",
|
|
48
50
|
support: "https://support.topolo.app",
|
|
49
51
|
survey: "https://survey.topolo.app",
|
|
50
52
|
voice: "https://voice.topolo.app",
|
package/src/services.test.ts
CHANGED
|
@@ -21,12 +21,10 @@ const EXPECTED_APPLICATION_IDS = [
|
|
|
21
21
|
'calendar',
|
|
22
22
|
'capacity',
|
|
23
23
|
'chat',
|
|
24
|
-
'cloudcontrol',
|
|
25
24
|
'commerce',
|
|
26
25
|
'compose',
|
|
27
26
|
'consent',
|
|
28
27
|
'crm',
|
|
29
|
-
'customer_success',
|
|
30
28
|
'developers',
|
|
31
29
|
'director',
|
|
32
30
|
'docs',
|
|
@@ -41,7 +39,7 @@ const EXPECTED_APPLICATION_IDS = [
|
|
|
41
39
|
'localize',
|
|
42
40
|
'mail',
|
|
43
41
|
'mdm',
|
|
44
|
-
'
|
|
42
|
+
'messages',
|
|
45
43
|
'nexus',
|
|
46
44
|
'notify',
|
|
47
45
|
'observability_watch',
|
|
@@ -57,6 +55,7 @@ const EXPECTED_APPLICATION_IDS = [
|
|
|
57
55
|
'socialize',
|
|
58
56
|
'spaces',
|
|
59
57
|
'status',
|
|
58
|
+
'success',
|
|
60
59
|
'support',
|
|
61
60
|
'survey',
|
|
62
61
|
'voice',
|
|
@@ -75,7 +74,7 @@ describe('service registry', () => {
|
|
|
75
74
|
web: 'https://web-api.topolo.app',
|
|
76
75
|
});
|
|
77
76
|
expect(DEFAULT_SERVICE_URLS).toMatchObject({
|
|
78
|
-
|
|
77
|
+
success: 'https://success.topolo.app',
|
|
79
78
|
forms: 'https://forms.topolo.app',
|
|
80
79
|
survey: 'https://survey.topolo.app',
|
|
81
80
|
});
|
|
@@ -118,14 +117,21 @@ describe('application catalog', () => {
|
|
|
118
117
|
}
|
|
119
118
|
});
|
|
120
119
|
|
|
121
|
-
it('treats TopoloWeb runtime as a deploy
|
|
120
|
+
it('treats TopoloWeb runtime as a standalone deploy, not an agent-callable API service', () => {
|
|
122
121
|
expect(APPLICATIONS.web.services).toEqual(['web']);
|
|
123
122
|
expect(
|
|
124
123
|
APPLICATIONS.web.deployTargets.find((target) => target.name === 'topolo-web-api')?.serviceId,
|
|
125
124
|
).toBe('web');
|
|
125
|
+
// topolo-web-runtime (Astro, sites.topolo.app) deploys from its own wrangler
|
|
126
|
+
// config and is intentionally listed as non-callable, so it can never be an
|
|
127
|
+
// agent-callable service.
|
|
126
128
|
expect(
|
|
127
129
|
APPLICATIONS.web.deployTargets.find((target) => target.name === 'topolo-web-runtime')?.serviceId,
|
|
128
130
|
).toBeNull();
|
|
131
|
+
const callableTargetNames = APPLICATIONS.web.deployTargets
|
|
132
|
+
.filter((target) => target.serviceId)
|
|
133
|
+
.map((target) => target.name);
|
|
134
|
+
expect(callableTargetNames).not.toContain('topolo-web-runtime');
|
|
129
135
|
});
|
|
130
136
|
|
|
131
137
|
it('treats TopoloFeed analytics as telemetry, not an agent-callable API service', () => {
|