@sixb/server 0.1.4 → 0.1.5

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.js CHANGED
@@ -1212,6 +1212,9 @@ var ActionCatalogItemSchema = z3.object({
1212
1212
  effects: z3.boolean()
1213
1213
  })
1214
1214
  });
1215
+ var ActionDetailSchema = ActionCatalogItemSchema.extend({
1216
+ inputSchema: z3.record(z3.unknown())
1217
+ });
1215
1218
  var ActionRunStatusSchema = z3.enum([
1216
1219
  "queued",
1217
1220
  "running",
@@ -1671,6 +1674,7 @@ function registerActionRunRoutes(app, host) {
1671
1674
  }
1672
1675
 
1673
1676
  // src/routes/actions.ts
1677
+ import { schemaFieldsToJsonSchema } from "@sixb/core/internal/ontology";
1674
1678
  function serializeAction(action) {
1675
1679
  return ActionCatalogItemSchema.parse({
1676
1680
  id: action.id,
@@ -1694,7 +1698,16 @@ function serializeAction(action) {
1694
1698
  }
1695
1699
  });
1696
1700
  }
1697
- function registerActionRoutes(app, _host) {
1701
+ function serializeActionDetail(action, host) {
1702
+ return ActionDetailSchema.parse({
1703
+ ...serializeAction(action),
1704
+ inputSchema: schemaFieldsToJsonSchema({
1705
+ fields: action.params,
1706
+ valueTypesById: host.definitions.ontology.getValueTypesById()
1707
+ })
1708
+ });
1709
+ }
1710
+ function registerActionRoutes(app, host) {
1698
1711
  return app.get("/api/actions", async (context) => {
1699
1712
  const actions = requireRequestSixb(context).actions.list();
1700
1713
  return actions.map(serializeAction);
@@ -1713,10 +1726,10 @@ function registerActionRoutes(app, _host) {
1713
1726
  set.status = 404;
1714
1727
  return { error: "Action not found" };
1715
1728
  }
1716
- return serializeAction(action);
1729
+ return serializeActionDetail(action, host);
1717
1730
  }, {
1718
1731
  params: ActionIdParamsSchema,
1719
- response: { 200: ActionCatalogItemSchema, 404: ErrorResponseSchema },
1732
+ response: { 200: ActionDetailSchema, 404: ErrorResponseSchema },
1720
1733
  detail: {
1721
1734
  summary: "Get action metadata",
1722
1735
  tags: [OPENAPI_TAGS.actions.name],
@@ -12873,4 +12886,4 @@ export {
12873
12886
  SixbServer
12874
12887
  };
12875
12888
 
12876
- //# debugId=7EBA739DF50836F764756E2164756E21
12889
+ //# debugId=D4859E1909D00F4164756E2164756E21