mirror of
https://github.com/morluto/rea.git
synced 2026-11-07 23:36:41 +00:00
refactor(domain): own digest and prefixed identifier shapes in one module (#547)
This commit is contained in:
1 parent
828395d510
commit
ea58834940
56 files changed
+314
-162
No files matched your search
@@ -2,11 +2,12 @@ import { z } from "zod";
|
||||
|
||||
import { evidenceSchema, providerSchema } from "./evidence.js";
|
||||
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
||||
import { digestSchema } from "./../domain/digests.js";
|
||||
import { prefixedDigestSchema } from "./../domain/digests.js";
|
||||
|
||||
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
||||
const evidenceIdSchema = z.string().regex(/^ev_[a-f0-9]{64}$/u);
|
||||
const nodeIdSchema = z.string().regex(/^jag_node_[a-f0-9]{64}$/u);
|
||||
const edgeIdSchema = z.string().regex(/^jag_edge_[a-f0-9]{64}$/u);
|
||||
const evidenceIdSchema = prefixedDigestSchema("ev");
|
||||
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
||||
const edgeIdSchema = prefixedDigestSchema("jag_edge");
|
||||
const boundedTextSchema = z.string().min(1);
|
||||
|
||||
/** Literal starting point for one application feature trace. */
|
||||
@@ -51,7 +52,7 @@ const seedMatchSchema = z.strictObject({
|
||||
});
|
||||
|
||||
const tracePathSchema = z.strictObject({
|
||||
path_id: z.string().regex(/^jatp_[a-f0-9]{64}$/u),
|
||||
path_id: prefixedDigestSchema("jatp"),
|
||||
start_node_id: nodeIdSchema,
|
||||
end_node_id: nodeIdSchema,
|
||||
end_kind: z.string().min(1),
|
||||
@@ -83,9 +84,9 @@ const nativeHandoffSchema = z.strictObject({
|
||||
|
||||
/** Evidence-preserving complete reachable subgraph and native-analysis handoffs. */
|
||||
export const applicationFeatureTraceResultSchema = z.strictObject({
|
||||
trace_id: z.string().regex(/^jatr_[a-f0-9]{64}$/u),
|
||||
trace_id: prefixedDigestSchema("jatr"),
|
||||
source_evidence_id: evidenceIdSchema,
|
||||
source_graph_id: z.string().regex(/^jag_[a-f0-9]{64}$/u),
|
||||
source_graph_id: prefixedDigestSchema("jag"),
|
||||
seed: applicationFeatureSeedSchema,
|
||||
direction: z.enum(["outgoing", "incoming", "both"]),
|
||||
seed_matches: z.array(seedMatchSchema),
|
||||
|
||||
Reference in new issue
Block a user