feat(schema): add OperationNodeAttrs and CallNodeAttrs TypeBox schemas
This commit is contained in:
@@ -9,3 +9,5 @@ export {
|
||||
type EdgeType,
|
||||
Nullable,
|
||||
} from "./enums.js";
|
||||
|
||||
export * from "./node.js";
|
||||
|
||||
@@ -1 +1,40 @@
|
||||
export {};
|
||||
import { Type, type Static } from "@alkdev/typebox";
|
||||
import { OperationTypeEnum, CallStatusEnum } from "./enums.js";
|
||||
|
||||
export const OperationNodeAttrs = Type.Object({
|
||||
name: Type.String(),
|
||||
namespace: Type.String(),
|
||||
version: Type.String(),
|
||||
type: OperationTypeEnum,
|
||||
inputSchema: Type.Unknown(),
|
||||
outputSchema: Type.Unknown(),
|
||||
description: Type.Optional(Type.String()),
|
||||
tags: Type.Optional(Type.Array(Type.String())),
|
||||
});
|
||||
export type OperationNodeAttrs = Static<typeof OperationNodeAttrs>;
|
||||
|
||||
export const CallNodeAttrs = Type.Object({
|
||||
requestId: Type.String(),
|
||||
operationId: Type.String(),
|
||||
status: CallStatusEnum,
|
||||
parentRequestId: Type.Optional(Type.String()),
|
||||
input: Type.Unknown(),
|
||||
output: Type.Optional(Type.Unknown()),
|
||||
error: Type.Optional(
|
||||
Type.Object({
|
||||
code: Type.String(),
|
||||
message: Type.String(),
|
||||
details: Type.Optional(Type.Unknown()),
|
||||
}),
|
||||
),
|
||||
identity: Type.Optional(
|
||||
Type.Object({
|
||||
id: Type.String(),
|
||||
scopes: Type.Array(Type.String()),
|
||||
resources: Type.Optional(Type.Record(Type.String(), Type.Array(Type.String()))),
|
||||
}),
|
||||
),
|
||||
startedAt: Type.Optional(Type.String()),
|
||||
completedAt: Type.Optional(Type.String()),
|
||||
});
|
||||
export type CallNodeAttrs = Static<typeof CallNodeAttrs>;
|
||||
Reference in New Issue
Block a user