@topolo/sdk 0.8.1 → 0.8.3

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 CHANGED
@@ -129,6 +129,7 @@ var APP_API_URLS = {
129
129
  bugfix: "https://bugfix.topolo.app",
130
130
  bytes: "https://bytes.topolo.app",
131
131
  calendar: "https://calendar.topolo.app",
132
+ campaigns: "https://campaigns.topolo.app",
132
133
  capacity: "https://capacity.topolo.app",
133
134
  chat: "https://chat.topolo.app",
134
135
  commerce: "https://commerce.topolo.app",
@@ -389,6 +390,38 @@ var APPLICATIONS = {
389
390
  }
390
391
  ]
391
392
  },
393
+ "campaigns": {
394
+ "id": "campaigns",
395
+ "appDir": "TopoloCampaigns",
396
+ "name": "topolo-campaigns",
397
+ "packageName": "topolo-campaigns",
398
+ "productionUrl": "https://campaigns.topolo.app",
399
+ "services": [
400
+ "campaigns"
401
+ ],
402
+ "deployTargets": [
403
+ {
404
+ "name": "topolo-campaigns",
405
+ "kind": "worker",
406
+ "apiUrl": "https://campaigns.topolo.app",
407
+ "domains": [
408
+ "campaigns.topolo.app"
409
+ ],
410
+ "routes": [
411
+ "campaigns.topolo.app"
412
+ ],
413
+ "appId": "campaigns"
414
+ },
415
+ {
416
+ "name": "topolo-campaigns-api",
417
+ "kind": "worker",
418
+ "apiUrl": null,
419
+ "domains": [],
420
+ "routes": [],
421
+ "appId": null
422
+ }
423
+ ]
424
+ },
392
425
  "capacity": {
393
426
  "id": "capacity",
394
427
  "appDir": "TopoloCapacity",
@@ -2569,7 +2602,21 @@ var TopoloClient = class _TopoloClient {
2569
2602
  return match;
2570
2603
  }
2571
2604
  async callAction(action, input = {}, options = {}) {
2605
+ const entry = await this.getAction(action);
2606
+ return this.executeResolvedAction(entry, input, options);
2607
+ }
2608
+ async readAction(action, input = {}, options = {}) {
2572
2609
  const entry = await this.getAction(action);
2610
+ const agentAccess = entry.agentAccess ?? (entry.destructive ? "off" : entry.readOnly && !entry.requiresConfirmation ? "auto" : "confirm");
2611
+ if (entry.method !== "GET" || !entry.readOnly || entry.destructive || entry.requiresConfirmation || agentAccess !== "auto") {
2612
+ throw new TopoloPermissionError(
2613
+ `Topolo action "${entry.actionId}" is not an automatic read-only action.`,
2614
+ entry.requiredPermission ? [entry.requiredPermission] : []
2615
+ );
2616
+ }
2617
+ return this.executeResolvedAction(entry, input, options);
2618
+ }
2619
+ async executeResolvedAction(entry, input, options) {
2573
2620
  const agentAccess = entry.agentAccess ?? (entry.destructive ? "off" : entry.readOnly && !entry.requiresConfirmation ? "auto" : "confirm");
2574
2621
  if (agentAccess === "off") {
2575
2622
  throw new TopoloPermissionError(
@@ -2641,6 +2688,7 @@ var TopoloClient = class _TopoloClient {
2641
2688
  const kind = payload.credentialType === "api_key" ? "api_key" : "access_token";
2642
2689
  return {
2643
2690
  kind,
2691
+ authorizationMode: normalizeCredentialAuthorizationMode(payload.authorizationMode, kind),
2644
2692
  user: {
2645
2693
  id: user.id,
2646
2694
  email: user.email,
@@ -2903,6 +2951,11 @@ function objectToQuery(value) {
2903
2951
  }
2904
2952
  return Object.keys(query).length > 0 ? query : void 0;
2905
2953
  }
2954
+ function normalizeCredentialAuthorizationMode(value, kind) {
2955
+ if (kind === "api_key") return "api_key";
2956
+ if (value === "context_rbac" || value === "oauth_scopes" || value === "session_rbac") return value;
2957
+ return "unknown";
2958
+ }
2906
2959
  function describeError(body, fallback) {
2907
2960
  if (body && typeof body === "object") {
2908
2961
  const maybe = body;
package/dist/index.d.cts CHANGED
@@ -267,6 +267,13 @@ declare class TopoloClient {
267
267
  resourceId: string;
268
268
  };
269
269
  }): Promise<T>;
270
+ readAction<T = unknown>(action: string, input?: Record<string, unknown>, options?: {
271
+ resource?: {
272
+ resourceType: string;
273
+ resourceId: string;
274
+ };
275
+ }): Promise<T>;
276
+ private executeResolvedAction;
270
277
  /**
271
278
  * Bundled generated registry for tooling that audits platform packaging, not
272
279
  * for deciding what the current credential may use.
@@ -285,6 +292,7 @@ declare class TopoloClient {
285
292
  }
286
293
  interface CredentialIntrospection {
287
294
  kind: 'api_key' | 'access_token';
295
+ authorizationMode: 'context_rbac' | 'oauth_scopes' | 'session_rbac' | 'api_key' | 'unknown';
288
296
  user: {
289
297
  id: string;
290
298
  email: string;
@@ -325,6 +333,7 @@ declare const APP_API_URLS: {
325
333
  readonly bugfix: "https://bugfix.topolo.app";
326
334
  readonly bytes: "https://bytes.topolo.app";
327
335
  readonly calendar: "https://calendar.topolo.app";
336
+ readonly campaigns: "https://campaigns.topolo.app";
328
337
  readonly capacity: "https://capacity.topolo.app";
329
338
  readonly chat: "https://chat.topolo.app";
330
339
  readonly commerce: "https://commerce.topolo.app";
@@ -532,6 +541,29 @@ declare const APPLICATIONS: {
532
541
  readonly appId: null;
533
542
  }];
534
543
  };
544
+ readonly campaigns: {
545
+ readonly id: "campaigns";
546
+ readonly appDir: "TopoloCampaigns";
547
+ readonly name: "topolo-campaigns";
548
+ readonly packageName: "topolo-campaigns";
549
+ readonly productionUrl: "https://campaigns.topolo.app";
550
+ readonly services: readonly ["campaigns"];
551
+ readonly deployTargets: readonly [{
552
+ readonly name: "topolo-campaigns";
553
+ readonly kind: "worker";
554
+ readonly apiUrl: "https://campaigns.topolo.app";
555
+ readonly domains: readonly ["campaigns.topolo.app"];
556
+ readonly routes: readonly ["campaigns.topolo.app"];
557
+ readonly appId: "campaigns";
558
+ }, {
559
+ readonly name: "topolo-campaigns-api";
560
+ readonly kind: "worker";
561
+ readonly apiUrl: null;
562
+ readonly domains: readonly [];
563
+ readonly routes: readonly [];
564
+ readonly appId: null;
565
+ }];
566
+ };
535
567
  readonly capacity: {
536
568
  readonly id: "capacity";
537
569
  readonly appDir: "TopoloCapacity";
package/dist/index.d.ts CHANGED
@@ -267,6 +267,13 @@ declare class TopoloClient {
267
267
  resourceId: string;
268
268
  };
269
269
  }): Promise<T>;
270
+ readAction<T = unknown>(action: string, input?: Record<string, unknown>, options?: {
271
+ resource?: {
272
+ resourceType: string;
273
+ resourceId: string;
274
+ };
275
+ }): Promise<T>;
276
+ private executeResolvedAction;
270
277
  /**
271
278
  * Bundled generated registry for tooling that audits platform packaging, not
272
279
  * for deciding what the current credential may use.
@@ -285,6 +292,7 @@ declare class TopoloClient {
285
292
  }
286
293
  interface CredentialIntrospection {
287
294
  kind: 'api_key' | 'access_token';
295
+ authorizationMode: 'context_rbac' | 'oauth_scopes' | 'session_rbac' | 'api_key' | 'unknown';
288
296
  user: {
289
297
  id: string;
290
298
  email: string;
@@ -325,6 +333,7 @@ declare const APP_API_URLS: {
325
333
  readonly bugfix: "https://bugfix.topolo.app";
326
334
  readonly bytes: "https://bytes.topolo.app";
327
335
  readonly calendar: "https://calendar.topolo.app";
336
+ readonly campaigns: "https://campaigns.topolo.app";
328
337
  readonly capacity: "https://capacity.topolo.app";
329
338
  readonly chat: "https://chat.topolo.app";
330
339
  readonly commerce: "https://commerce.topolo.app";
@@ -532,6 +541,29 @@ declare const APPLICATIONS: {
532
541
  readonly appId: null;
533
542
  }];
534
543
  };
544
+ readonly campaigns: {
545
+ readonly id: "campaigns";
546
+ readonly appDir: "TopoloCampaigns";
547
+ readonly name: "topolo-campaigns";
548
+ readonly packageName: "topolo-campaigns";
549
+ readonly productionUrl: "https://campaigns.topolo.app";
550
+ readonly services: readonly ["campaigns"];
551
+ readonly deployTargets: readonly [{
552
+ readonly name: "topolo-campaigns";
553
+ readonly kind: "worker";
554
+ readonly apiUrl: "https://campaigns.topolo.app";
555
+ readonly domains: readonly ["campaigns.topolo.app"];
556
+ readonly routes: readonly ["campaigns.topolo.app"];
557
+ readonly appId: "campaigns";
558
+ }, {
559
+ readonly name: "topolo-campaigns-api";
560
+ readonly kind: "worker";
561
+ readonly apiUrl: null;
562
+ readonly domains: readonly [];
563
+ readonly routes: readonly [];
564
+ readonly appId: null;
565
+ }];
566
+ };
535
567
  readonly capacity: {
536
568
  readonly id: "capacity";
537
569
  readonly appDir: "TopoloCapacity";
package/dist/index.js CHANGED
@@ -71,6 +71,7 @@ var APP_API_URLS = {
71
71
  bugfix: "https://bugfix.topolo.app",
72
72
  bytes: "https://bytes.topolo.app",
73
73
  calendar: "https://calendar.topolo.app",
74
+ campaigns: "https://campaigns.topolo.app",
74
75
  capacity: "https://capacity.topolo.app",
75
76
  chat: "https://chat.topolo.app",
76
77
  commerce: "https://commerce.topolo.app",
@@ -331,6 +332,38 @@ var APPLICATIONS = {
331
332
  }
332
333
  ]
333
334
  },
335
+ "campaigns": {
336
+ "id": "campaigns",
337
+ "appDir": "TopoloCampaigns",
338
+ "name": "topolo-campaigns",
339
+ "packageName": "topolo-campaigns",
340
+ "productionUrl": "https://campaigns.topolo.app",
341
+ "services": [
342
+ "campaigns"
343
+ ],
344
+ "deployTargets": [
345
+ {
346
+ "name": "topolo-campaigns",
347
+ "kind": "worker",
348
+ "apiUrl": "https://campaigns.topolo.app",
349
+ "domains": [
350
+ "campaigns.topolo.app"
351
+ ],
352
+ "routes": [
353
+ "campaigns.topolo.app"
354
+ ],
355
+ "appId": "campaigns"
356
+ },
357
+ {
358
+ "name": "topolo-campaigns-api",
359
+ "kind": "worker",
360
+ "apiUrl": null,
361
+ "domains": [],
362
+ "routes": [],
363
+ "appId": null
364
+ }
365
+ ]
366
+ },
334
367
  "capacity": {
335
368
  "id": "capacity",
336
369
  "appDir": "TopoloCapacity",
@@ -2511,7 +2544,21 @@ var TopoloClient = class _TopoloClient {
2511
2544
  return match;
2512
2545
  }
2513
2546
  async callAction(action, input = {}, options = {}) {
2547
+ const entry = await this.getAction(action);
2548
+ return this.executeResolvedAction(entry, input, options);
2549
+ }
2550
+ async readAction(action, input = {}, options = {}) {
2514
2551
  const entry = await this.getAction(action);
2552
+ const agentAccess = entry.agentAccess ?? (entry.destructive ? "off" : entry.readOnly && !entry.requiresConfirmation ? "auto" : "confirm");
2553
+ if (entry.method !== "GET" || !entry.readOnly || entry.destructive || entry.requiresConfirmation || agentAccess !== "auto") {
2554
+ throw new TopoloPermissionError(
2555
+ `Topolo action "${entry.actionId}" is not an automatic read-only action.`,
2556
+ entry.requiredPermission ? [entry.requiredPermission] : []
2557
+ );
2558
+ }
2559
+ return this.executeResolvedAction(entry, input, options);
2560
+ }
2561
+ async executeResolvedAction(entry, input, options) {
2515
2562
  const agentAccess = entry.agentAccess ?? (entry.destructive ? "off" : entry.readOnly && !entry.requiresConfirmation ? "auto" : "confirm");
2516
2563
  if (agentAccess === "off") {
2517
2564
  throw new TopoloPermissionError(
@@ -2583,6 +2630,7 @@ var TopoloClient = class _TopoloClient {
2583
2630
  const kind = payload.credentialType === "api_key" ? "api_key" : "access_token";
2584
2631
  return {
2585
2632
  kind,
2633
+ authorizationMode: normalizeCredentialAuthorizationMode(payload.authorizationMode, kind),
2586
2634
  user: {
2587
2635
  id: user.id,
2588
2636
  email: user.email,
@@ -2845,6 +2893,11 @@ function objectToQuery(value) {
2845
2893
  }
2846
2894
  return Object.keys(query).length > 0 ? query : void 0;
2847
2895
  }
2896
+ function normalizeCredentialAuthorizationMode(value, kind) {
2897
+ if (kind === "api_key") return "api_key";
2898
+ if (value === "context_rbac" || value === "oauth_scopes" || value === "session_rbac") return value;
2899
+ return "unknown";
2900
+ }
2848
2901
  function describeError(body, fallback) {
2849
2902
  if (body && typeof body === "object") {
2850
2903
  const maybe = body;
@@ -86,6 +86,7 @@ var APP_API_URLS = {
86
86
  bugfix: "https://bugfix.topolo.app",
87
87
  bytes: "https://bytes.topolo.app",
88
88
  calendar: "https://calendar.topolo.app",
89
+ campaigns: "https://campaigns.topolo.app",
89
90
  capacity: "https://capacity.topolo.app",
90
91
  chat: "https://chat.topolo.app",
91
92
  commerce: "https://commerce.topolo.app",
@@ -43,6 +43,7 @@ var APP_API_URLS = {
43
43
  bugfix: "https://bugfix.topolo.app",
44
44
  bytes: "https://bytes.topolo.app",
45
45
  calendar: "https://calendar.topolo.app",
46
+ campaigns: "https://campaigns.topolo.app",
46
47
  capacity: "https://capacity.topolo.app",
47
48
  chat: "https://chat.topolo.app",
48
49
  commerce: "https://commerce.topolo.app",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/sdk",
3
- "version": "0.8.1",
4
- "topoloPublishedVersion": "0.8.0",
3
+ "version": "0.8.3",
4
+ "topoloPublishedVersion": "0.8.3",
5
5
  "description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",