@topolo/sdk 0.9.5 → 0.9.7

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
@@ -363,7 +363,9 @@ var APPLICATIONS = {
363
363
  "domains": [
364
364
  "bugfix.topolo.app"
365
365
  ],
366
- "routes": [],
366
+ "routes": [
367
+ "bugfix.topolo.app"
368
+ ],
367
369
  "appId": "bugfix"
368
370
  }
369
371
  ]
@@ -479,7 +481,9 @@ var APPLICATIONS = {
479
481
  "domains": [
480
482
  "capacity.topolo.app"
481
483
  ],
482
- "routes": [],
484
+ "routes": [
485
+ "capacity.topolo.app"
486
+ ],
483
487
  "appId": "capacity"
484
488
  }
485
489
  ]
@@ -1221,7 +1225,9 @@ var APPLICATIONS = {
1221
1225
  "domains": [
1222
1226
  "observability-watch.topolo.app"
1223
1227
  ],
1224
- "routes": [],
1228
+ "routes": [
1229
+ "observability-watch.topolo.app"
1230
+ ],
1225
1231
  "appId": "observability_watch"
1226
1232
  }
1227
1233
  ]
@@ -3568,9 +3574,15 @@ function slugify(value) {
3568
3574
  return String(value || "").trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3569
3575
  }
3570
3576
  function singularize(value) {
3577
+ const irregular = /* @__PURE__ */ new Map([
3578
+ ["analyses", "analysis"],
3579
+ ["buses", "bus"],
3580
+ ["statuses", "status"]
3581
+ ]);
3582
+ if (irregular.has(value)) return irregular.get(value);
3571
3583
  if (value.endsWith("ies") && value.length > 3) return `${value.slice(0, -3)}y`;
3572
- if (value.endsWith("sses")) return value.slice(0, -2);
3573
- if (value.endsWith("s") && !value.endsWith("ss")) return value.slice(0, -1);
3584
+ if (/(?:ches|shes|sses|xes|zes)$/.test(value)) return value.slice(0, -2);
3585
+ if (value.endsWith("s") && !/(?:ss|us|is)$/.test(value)) return value.slice(0, -1);
3574
3586
  return value || "resource";
3575
3587
  }
3576
3588
  function operationFor(action) {
@@ -3584,6 +3596,11 @@ function resourceFor(action) {
3584
3596
  const pathToken = String(action.path || "").split("/").filter((token) => token && token !== "api" && !token.startsWith("{")).find((token) => !OPERATION_TOKENS.has(slugify(token)));
3585
3597
  return singularize(slugify(pathToken || "resource").replaceAll("-", "_"));
3586
3598
  }
3599
+ function collectionFor(action, resource) {
3600
+ const named = String(action.name || "").split(/[._:-]+/).filter(Boolean).find((token) => !OPERATION_TOKENS.has(token));
3601
+ if (named) return slugify(named).replaceAll("-", "_");
3602
+ return resource.endsWith("s") ? resource : `${resource}s`;
3603
+ }
3587
3604
  function isConcreteOutputSchema(schema) {
3588
3605
  if (!isRecord3(schema)) return false;
3589
3606
  if (typeof schema.$ref === "string" && schema.$ref.trim()) return true;
@@ -3614,6 +3631,7 @@ function derivedOutputSchema(action) {
3614
3631
  "x-topolo-contract-precision": "structural"
3615
3632
  };
3616
3633
  if (operation === "list" || operation === "search") {
3634
+ const collection = collectionFor(action, resource);
3617
3635
  return {
3618
3636
  title: `${action.title || action.name} response`,
3619
3637
  description: `Collection response returned by ${action.name}. The service may return the collection directly or in an envelope.`,
@@ -3624,7 +3642,7 @@ function derivedOutputSchema(action) {
3624
3642
  properties: {
3625
3643
  data: { oneOf: [records, { type: "object", additionalProperties: true }] },
3626
3644
  items: records,
3627
- [resource.endsWith("s") ? resource : `${resource}s`]: records,
3645
+ [collection]: records,
3628
3646
  count: { type: "integer", minimum: 0 },
3629
3647
  nextCursor: { type: ["string", "null"] }
3630
3648
  },
@@ -3751,7 +3769,7 @@ function enrichActionContract(manifest, action, allActions = manifest.actions ||
3751
3769
  const rollbackActionId = typeof existing.rollbackActionId === "string" && existing.rollbackActionId.trim() ? existing.rollbackActionId.trim() : recovery.mode === "compensating_action" ? recovery.actionId : void 0;
3752
3770
  const inputExample = sampleForSchema(action.inputSchema);
3753
3771
  const examples = Array.isArray(existing.examples) && existing.examples.length > 0 ? existing.examples : [{ input: inputExample ?? {}, expected: `A response matching the published outputSchema for ${action.name}.` }];
3754
- const docsUrl = `https://docs.topolo.app/reference/actions/?service=${encodeURIComponent(service)}&action=${encodeURIComponent(action.name)}`;
3772
+ const docsUrl = `https://docs.topolo.app/reference/actions?service=${encodeURIComponent(service)}&action=${encodeURIComponent(action.name)}`;
3755
3773
  const existingDocsUrl = typeof existing.docsUrl === "string" && existing.docsUrl.trim() ? existing.docsUrl.trim() : void 0;
3756
3774
  return {
3757
3775
  outputSchema,
package/dist/index.d.cts CHANGED
@@ -662,7 +662,7 @@ declare const APPLICATIONS: {
662
662
  readonly kind: "worker";
663
663
  readonly apiUrl: "https://bugfix.topolo.app";
664
664
  readonly domains: readonly ["bugfix.topolo.app"];
665
- readonly routes: readonly [];
665
+ readonly routes: readonly ["bugfix.topolo.app"];
666
666
  readonly appId: "bugfix";
667
667
  }];
668
668
  };
@@ -747,7 +747,7 @@ declare const APPLICATIONS: {
747
747
  readonly kind: "worker";
748
748
  readonly apiUrl: "https://capacity.topolo.app";
749
749
  readonly domains: readonly ["capacity.topolo.app"];
750
- readonly routes: readonly [];
750
+ readonly routes: readonly ["capacity.topolo.app"];
751
751
  readonly appId: "capacity";
752
752
  }];
753
753
  };
@@ -1290,7 +1290,7 @@ declare const APPLICATIONS: {
1290
1290
  readonly kind: "worker";
1291
1291
  readonly apiUrl: "https://observability-watch.topolo.app";
1292
1292
  readonly domains: readonly ["observability-watch.topolo.app"];
1293
- readonly routes: readonly [];
1293
+ readonly routes: readonly ["observability-watch.topolo.app"];
1294
1294
  readonly appId: "observability_watch";
1295
1295
  }];
1296
1296
  };
package/dist/index.d.ts CHANGED
@@ -662,7 +662,7 @@ declare const APPLICATIONS: {
662
662
  readonly kind: "worker";
663
663
  readonly apiUrl: "https://bugfix.topolo.app";
664
664
  readonly domains: readonly ["bugfix.topolo.app"];
665
- readonly routes: readonly [];
665
+ readonly routes: readonly ["bugfix.topolo.app"];
666
666
  readonly appId: "bugfix";
667
667
  }];
668
668
  };
@@ -747,7 +747,7 @@ declare const APPLICATIONS: {
747
747
  readonly kind: "worker";
748
748
  readonly apiUrl: "https://capacity.topolo.app";
749
749
  readonly domains: readonly ["capacity.topolo.app"];
750
- readonly routes: readonly [];
750
+ readonly routes: readonly ["capacity.topolo.app"];
751
751
  readonly appId: "capacity";
752
752
  }];
753
753
  };
@@ -1290,7 +1290,7 @@ declare const APPLICATIONS: {
1290
1290
  readonly kind: "worker";
1291
1291
  readonly apiUrl: "https://observability-watch.topolo.app";
1292
1292
  readonly domains: readonly ["observability-watch.topolo.app"];
1293
- readonly routes: readonly [];
1293
+ readonly routes: readonly ["observability-watch.topolo.app"];
1294
1294
  readonly appId: "observability_watch";
1295
1295
  }];
1296
1296
  };
package/dist/index.js CHANGED
@@ -302,7 +302,9 @@ var APPLICATIONS = {
302
302
  "domains": [
303
303
  "bugfix.topolo.app"
304
304
  ],
305
- "routes": [],
305
+ "routes": [
306
+ "bugfix.topolo.app"
307
+ ],
306
308
  "appId": "bugfix"
307
309
  }
308
310
  ]
@@ -418,7 +420,9 @@ var APPLICATIONS = {
418
420
  "domains": [
419
421
  "capacity.topolo.app"
420
422
  ],
421
- "routes": [],
423
+ "routes": [
424
+ "capacity.topolo.app"
425
+ ],
422
426
  "appId": "capacity"
423
427
  }
424
428
  ]
@@ -1160,7 +1164,9 @@ var APPLICATIONS = {
1160
1164
  "domains": [
1161
1165
  "observability-watch.topolo.app"
1162
1166
  ],
1163
- "routes": [],
1167
+ "routes": [
1168
+ "observability-watch.topolo.app"
1169
+ ],
1164
1170
  "appId": "observability_watch"
1165
1171
  }
1166
1172
  ]
@@ -3507,9 +3513,15 @@ function slugify(value) {
3507
3513
  return String(value || "").trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3508
3514
  }
3509
3515
  function singularize(value) {
3516
+ const irregular = /* @__PURE__ */ new Map([
3517
+ ["analyses", "analysis"],
3518
+ ["buses", "bus"],
3519
+ ["statuses", "status"]
3520
+ ]);
3521
+ if (irregular.has(value)) return irregular.get(value);
3510
3522
  if (value.endsWith("ies") && value.length > 3) return `${value.slice(0, -3)}y`;
3511
- if (value.endsWith("sses")) return value.slice(0, -2);
3512
- if (value.endsWith("s") && !value.endsWith("ss")) return value.slice(0, -1);
3523
+ if (/(?:ches|shes|sses|xes|zes)$/.test(value)) return value.slice(0, -2);
3524
+ if (value.endsWith("s") && !/(?:ss|us|is)$/.test(value)) return value.slice(0, -1);
3513
3525
  return value || "resource";
3514
3526
  }
3515
3527
  function operationFor(action) {
@@ -3523,6 +3535,11 @@ function resourceFor(action) {
3523
3535
  const pathToken = String(action.path || "").split("/").filter((token) => token && token !== "api" && !token.startsWith("{")).find((token) => !OPERATION_TOKENS.has(slugify(token)));
3524
3536
  return singularize(slugify(pathToken || "resource").replaceAll("-", "_"));
3525
3537
  }
3538
+ function collectionFor(action, resource) {
3539
+ const named = String(action.name || "").split(/[._:-]+/).filter(Boolean).find((token) => !OPERATION_TOKENS.has(token));
3540
+ if (named) return slugify(named).replaceAll("-", "_");
3541
+ return resource.endsWith("s") ? resource : `${resource}s`;
3542
+ }
3526
3543
  function isConcreteOutputSchema(schema) {
3527
3544
  if (!isRecord3(schema)) return false;
3528
3545
  if (typeof schema.$ref === "string" && schema.$ref.trim()) return true;
@@ -3553,6 +3570,7 @@ function derivedOutputSchema(action) {
3553
3570
  "x-topolo-contract-precision": "structural"
3554
3571
  };
3555
3572
  if (operation === "list" || operation === "search") {
3573
+ const collection = collectionFor(action, resource);
3556
3574
  return {
3557
3575
  title: `${action.title || action.name} response`,
3558
3576
  description: `Collection response returned by ${action.name}. The service may return the collection directly or in an envelope.`,
@@ -3563,7 +3581,7 @@ function derivedOutputSchema(action) {
3563
3581
  properties: {
3564
3582
  data: { oneOf: [records, { type: "object", additionalProperties: true }] },
3565
3583
  items: records,
3566
- [resource.endsWith("s") ? resource : `${resource}s`]: records,
3584
+ [collection]: records,
3567
3585
  count: { type: "integer", minimum: 0 },
3568
3586
  nextCursor: { type: ["string", "null"] }
3569
3587
  },
@@ -3690,7 +3708,7 @@ function enrichActionContract(manifest, action, allActions = manifest.actions ||
3690
3708
  const rollbackActionId = typeof existing.rollbackActionId === "string" && existing.rollbackActionId.trim() ? existing.rollbackActionId.trim() : recovery.mode === "compensating_action" ? recovery.actionId : void 0;
3691
3709
  const inputExample = sampleForSchema(action.inputSchema);
3692
3710
  const examples = Array.isArray(existing.examples) && existing.examples.length > 0 ? existing.examples : [{ input: inputExample ?? {}, expected: `A response matching the published outputSchema for ${action.name}.` }];
3693
- const docsUrl = `https://docs.topolo.app/reference/actions/?service=${encodeURIComponent(service)}&action=${encodeURIComponent(action.name)}`;
3711
+ const docsUrl = `https://docs.topolo.app/reference/actions?service=${encodeURIComponent(service)}&action=${encodeURIComponent(action.name)}`;
3694
3712
  const existingDocsUrl = typeof existing.docsUrl === "string" && existing.docsUrl.trim() ? existing.docsUrl.trim() : void 0;
3695
3713
  return {
3696
3714
  outputSchema,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/sdk",
3
- "version": "0.9.5",
4
- "topoloPublishedVersion": "0.9.5",
3
+ "version": "0.9.7",
4
+ "topoloPublishedVersion": "0.9.7",
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",