Implement analysis defaults module with default value resolution for CallStatus, NodeStatus, EdgeType, and node attributes
This commit is contained in:
@@ -1 +1,29 @@
|
||||
export {};
|
||||
import type { CallStatus, NodeStatus, EdgeType } from "../schema/enums.js";
|
||||
import type { OperationNodeAttrs } from "../schema/node.js";
|
||||
|
||||
export const defaultCallStatus: CallStatus = "pending";
|
||||
|
||||
export const defaultNodeStatus: NodeStatus = "idle";
|
||||
|
||||
export function defaultEdgeType(edgeType?: string): EdgeType {
|
||||
if (edgeType !== undefined && edgeType !== null) {
|
||||
return edgeType as EdgeType;
|
||||
}
|
||||
return "typed";
|
||||
}
|
||||
|
||||
export function resolveDefaultNodeAttrs(
|
||||
attrs: Partial<OperationNodeAttrs>,
|
||||
defaults: Partial<OperationNodeAttrs> = {},
|
||||
): OperationNodeAttrs {
|
||||
return {
|
||||
name: attrs.name ?? defaults.name ?? "",
|
||||
namespace: attrs.namespace ?? defaults.namespace ?? "",
|
||||
version: attrs.version ?? defaults.version ?? "",
|
||||
type: attrs.type ?? defaults.type ?? "query",
|
||||
inputSchema: attrs.inputSchema ?? defaults.inputSchema ?? {},
|
||||
outputSchema: attrs.outputSchema ?? defaults.outputSchema ?? {},
|
||||
description: attrs.description ?? defaults.description,
|
||||
tags: attrs.tags ?? defaults.tags,
|
||||
};
|
||||
}
|
||||
@@ -1 +1,6 @@
|
||||
export {};
|
||||
export {
|
||||
defaultCallStatus,
|
||||
defaultNodeStatus,
|
||||
defaultEdgeType,
|
||||
resolveDefaultNodeAttrs,
|
||||
} from "./defaults.js";
|
||||
Reference in New Issue
Block a user