@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.
@@ -1,6 +1,6 @@
1
1
  import type { SixbHostView } from "@sixb/core";
2
2
  import type { Elysia } from "elysia";
3
- export declare function registerActionRoutes(app: Elysia, _host: SixbHostView): Elysia<"", {
3
+ export declare function registerActionRoutes(app: Elysia, host: SixbHostView): Elysia<"", {
4
4
  decorator: {};
5
5
  store: {};
6
6
  derive: {};
@@ -88,6 +88,7 @@ export declare function registerActionRoutes(app: Elysia, _host: SixbHostView):
88
88
  edits: boolean;
89
89
  effects: boolean;
90
90
  };
91
+ inputSchema: Record<string, unknown>;
91
92
  description?: string | undefined;
92
93
  objectTypeId?: string | undefined;
93
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/routes/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAuCpC,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EpE"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/routes/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAqDpC,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EnE"}
@@ -179,6 +179,98 @@ export declare const ActionCatalogItemSchema: z.ZodObject<{
179
179
  description?: string | undefined;
180
180
  objectTypeId?: string | undefined;
181
181
  }>;
182
+ export declare const ActionDetailSchema: z.ZodObject<{
183
+ id: z.ZodString;
184
+ name: z.ZodString;
185
+ description: z.ZodOptional<z.ZodString>;
186
+ objectTypeId: z.ZodOptional<z.ZodString>;
187
+ params: z.ZodArray<z.ZodObject<{
188
+ id: z.ZodString;
189
+ name: z.ZodString;
190
+ description: z.ZodOptional<z.ZodString>;
191
+ required: z.ZodOptional<z.ZodBoolean>;
192
+ nullable: z.ZodOptional<z.ZodBoolean>;
193
+ semanticType: z.ZodOptional<z.ZodString>;
194
+ schema: z.ZodUnknown;
195
+ }, "strip", z.ZodTypeAny, {
196
+ id: string;
197
+ name: string;
198
+ description?: string | undefined;
199
+ nullable?: boolean | undefined;
200
+ required?: boolean | undefined;
201
+ semanticType?: string | undefined;
202
+ schema?: unknown;
203
+ }, {
204
+ id: string;
205
+ name: string;
206
+ description?: string | undefined;
207
+ nullable?: boolean | undefined;
208
+ required?: boolean | undefined;
209
+ semanticType?: string | undefined;
210
+ schema?: unknown;
211
+ }>, "many">;
212
+ phases: z.ZodObject<{
213
+ validate: z.ZodBoolean;
214
+ writeback: z.ZodBoolean;
215
+ edits: z.ZodBoolean;
216
+ effects: z.ZodBoolean;
217
+ }, "strip", z.ZodTypeAny, {
218
+ validate: boolean;
219
+ writeback: boolean;
220
+ edits: boolean;
221
+ effects: boolean;
222
+ }, {
223
+ validate: boolean;
224
+ writeback: boolean;
225
+ edits: boolean;
226
+ effects: boolean;
227
+ }>;
228
+ } & {
229
+ /** Strict JSON Schema for the params object accepted by an Action request. */
230
+ inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
231
+ }, "strip", z.ZodTypeAny, {
232
+ id: string;
233
+ name: string;
234
+ params: {
235
+ id: string;
236
+ name: string;
237
+ description?: string | undefined;
238
+ nullable?: boolean | undefined;
239
+ required?: boolean | undefined;
240
+ semanticType?: string | undefined;
241
+ schema?: unknown;
242
+ }[];
243
+ phases: {
244
+ validate: boolean;
245
+ writeback: boolean;
246
+ edits: boolean;
247
+ effects: boolean;
248
+ };
249
+ inputSchema: Record<string, unknown>;
250
+ description?: string | undefined;
251
+ objectTypeId?: string | undefined;
252
+ }, {
253
+ id: string;
254
+ name: string;
255
+ params: {
256
+ id: string;
257
+ name: string;
258
+ description?: string | undefined;
259
+ nullable?: boolean | undefined;
260
+ required?: boolean | undefined;
261
+ semanticType?: string | undefined;
262
+ schema?: unknown;
263
+ }[];
264
+ phases: {
265
+ validate: boolean;
266
+ writeback: boolean;
267
+ edits: boolean;
268
+ effects: boolean;
269
+ };
270
+ inputSchema: Record<string, unknown>;
271
+ description?: string | undefined;
272
+ objectTypeId?: string | undefined;
273
+ }>;
182
274
  export declare const ActionRunStatusSchema: z.ZodEnum<["queued", "running", "succeeded", "failed", "cancelled"]>;
183
275
  export declare const ActionRunPhaseSchema: z.ZodEnum<["request", "enqueue", "validation", "writeback", "edits", "commit", "effects", "cancelled"]>;
184
276
  export declare const ActionRunsQuerySchema: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/schemas/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAA;AA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B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAItC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sixb/server",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "HTTP and WebSocket API server for Sixb",
5
5
  "keywords": [
6
6
  "sixb",
@@ -1,10 +1,12 @@
1
1
  import type { ActionDefinition, SixbHostView } from "@sixb/core"
2
+ import { schemaFieldsToJsonSchema } from "@sixb/core/internal/ontology"
2
3
  import type { Elysia } from "elysia"
3
4
  import { bearerSecurityRequirement } from "../auth/access-token-boundary"
4
5
  import { requireRequestSixb } from "../auth/scope"
5
6
  import { OPENAPI_TAGS } from "../openapi/tags"
6
7
  import {
7
8
  ActionCatalogItemSchema,
9
+ ActionDetailSchema,
8
10
  ActionIdParamsSchema,
9
11
  RequestActionBodySchema,
10
12
  RequestActionResponseSchema,
@@ -38,7 +40,20 @@ function serializeAction(
38
40
  })
39
41
  }
40
42
 
41
- export function registerActionRoutes(app: Elysia, _host: SixbHostView) {
43
+ function serializeActionDetail(
44
+ action: ActionDefinition,
45
+ host: SixbHostView
46
+ ): ReturnType<typeof ActionDetailSchema.parse> {
47
+ return ActionDetailSchema.parse({
48
+ ...serializeAction(action),
49
+ inputSchema: schemaFieldsToJsonSchema({
50
+ fields: action.params,
51
+ valueTypesById: host.definitions.ontology.getValueTypesById(),
52
+ }),
53
+ })
54
+ }
55
+
56
+ export function registerActionRoutes(app: Elysia, host: SixbHostView) {
42
57
  return app
43
58
  .get(
44
59
  "/api/actions",
@@ -66,11 +81,11 @@ export function registerActionRoutes(app: Elysia, _host: SixbHostView) {
66
81
  return { error: "Action not found" }
67
82
  }
68
83
 
69
- return serializeAction(action)
84
+ return serializeActionDetail(action, host)
70
85
  },
71
86
  {
72
87
  params: ActionIdParamsSchema,
73
- response: { 200: ActionCatalogItemSchema, 404: ErrorResponseSchema },
88
+ response: { 200: ActionDetailSchema, 404: ErrorResponseSchema },
74
89
  detail: {
75
90
  summary: "Get action metadata",
76
91
  tags: [OPENAPI_TAGS.actions.name],
@@ -53,6 +53,11 @@ export const ActionCatalogItemSchema = z.object({
53
53
  }),
54
54
  })
55
55
 
56
+ export const ActionDetailSchema = ActionCatalogItemSchema.extend({
57
+ /** Strict JSON Schema for the params object accepted by an Action request. */
58
+ inputSchema: z.record(z.unknown()),
59
+ })
60
+
56
61
  export const ActionRunStatusSchema = z.enum([
57
62
  "queued",
58
63
  "running",