graphenix-format 1.2.1 → 1.4.0

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/types.d.ts CHANGED
@@ -82,15 +82,85 @@ export interface SubgraphDefinition {
82
82
  metadata?: Record<string, unknown>;
83
83
  extensions?: Record<string, unknown>;
84
84
  }
85
+ /**
86
+ * JSON Schema object (typically draft-07) used by tooling to validate runtime payloads.
87
+ * Kept as a generic object so authors can use `$ref`, `definitions`, etc.
88
+ */
89
+ export type JsonSchemaObject = Record<string, unknown>;
90
+ /**
91
+ * Worox-graph entry contract: describes expected execution inputs and structure.
92
+ * Aligns with `@woroces/worox-graph` `GraphEntryContract` (I/O visibility **layer 01**).
93
+ */
94
+ export interface GraphEntryContract {
95
+ /** Short human-readable description of what the graph expects at entry. */
96
+ summary?: string;
97
+ /**
98
+ * Path descriptors for execution branches that must run (shape is engine-specific;
99
+ * often node-id lists or segmented paths).
100
+ */
101
+ requiredExecutionPaths?: unknown[];
102
+ /**
103
+ * Optional JSON Schema for the merged **execution** object after graph entry
104
+ * (validated separately with `validateExecutionAgainstContract` when tooling enables it).
105
+ */
106
+ executionSchema?: JsonSchemaObject;
107
+ /** Notable or optional execution paths for diagnostics or docs. */
108
+ notableExecutionPaths?: unknown[];
109
+ [key: string]: unknown;
110
+ }
111
+ /**
112
+ * Worox-graph response contract: describes the final output shape.
113
+ * Aligns with `@woroces/worox-graph` `GraphResponseContract` (I/O visibility **layer 08**).
114
+ */
115
+ export interface GraphResponseContract {
116
+ summary?: string;
117
+ /**
118
+ * JSON Schema for the graph **final output** value
119
+ * (validated separately with `validateFinalOutputAgainstContract` when tooling enables it).
120
+ */
121
+ finalOutputSchema?: JsonSchemaObject;
122
+ [key: string]: unknown;
123
+ }
124
+ /**
125
+ * Optional document-level metadata. Known keys `graphEntry` / `graphResponse` mirror
126
+ * worox-graph graph JSON and are copied to `variables.__graphModel` by consumers.
127
+ */
128
+ /**
129
+ * Planning-only catalog request (worox-graph task `metadata.catalogRequest`).
130
+ * Execution is unchanged. Canonical shape: `@woroces/worox-graph` `refs.ts`.
131
+ */
132
+ export type WoroxCatalogRequest = Record<string, unknown>;
133
+ /**
134
+ * Planning-only catalog binding (worox-graph task `metadata.catalogBinding`).
135
+ * Execution is unchanged. Canonical shape: `@woroces/worox-graph` `refs.ts`.
136
+ */
137
+ export type WoroxCatalogBinding = Record<string, unknown>;
138
+ /**
139
+ * Document-level planning catalog requests (worox-graph `metadata.catalogRequests`).
140
+ * Execution is unchanged. Canonical shape: `@woroces/worox-graph` `refs.ts`.
141
+ */
142
+ export type WoroxCatalogRequests = WoroxCatalogRequest[] | Record<string, WoroxCatalogRequest>;
143
+ export type GraphDocumentMetadata = {
144
+ graphEntry?: GraphEntryContract;
145
+ graphResponse?: GraphResponseContract;
146
+ /** Planning-only; aligns with worox-graph graph JSON `metadata.catalogRequests`. */
147
+ catalogRequests?: WoroxCatalogRequests;
148
+ } & Record<string, unknown>;
85
149
  export interface GraphDocument {
86
150
  formatVersion: string;
87
151
  id: string;
88
152
  name?: string;
89
153
  description?: string;
90
154
  tags?: string[];
155
+ /** Structural graph (ports, `GraphInput` / `GraphOutput`). */
91
156
  graph: Graph;
92
157
  types?: TypeDefinition[];
93
158
  subgraphs?: SubgraphDefinition[];
159
+ /**
160
+ * Optional worox-graph-aligned contracts for planning and I/O documentation.
161
+ * Prefer this surface over duplicating the same data only under `extensions`.
162
+ */
163
+ metadata?: GraphDocumentMetadata;
94
164
  extensions?: Record<string, unknown>;
95
165
  }
96
166
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;I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AAc,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
@@ -0,0 +1,22 @@
1
+ import Ajv from "ajv";
2
+ import type { GraphDocument } from "./types";
3
+ import type { ValidationResult } from "./validate";
4
+ export interface WoroxRuntimeValidationOptions {
5
+ /**
6
+ * AJV instance used to compile `executionSchema` / `finalOutputSchema`.
7
+ * When omitted, a shared default instance (`strict: false`, `allErrors: true`) is used.
8
+ */
9
+ ajv?: Ajv;
10
+ }
11
+ /**
12
+ * Validates `execution` against `document.metadata.graphEntry.executionSchema` when present.
13
+ * If there is no schema, or `graphEntry` is missing, returns `{ valid: true, errors: [] }`.
14
+ * This is optional tooling; graphenix planning does not require it.
15
+ */
16
+ export declare function validateExecutionAgainstContract(document: GraphDocument, execution: unknown, options?: WoroxRuntimeValidationOptions): ValidationResult;
17
+ /**
18
+ * Validates `finalOutput` against `document.metadata.graphResponse.finalOutputSchema` when present.
19
+ * If there is no schema, or `graphResponse` is missing, returns `{ valid: true, errors: [] }`.
20
+ */
21
+ export declare function validateFinalOutputAgainstContract(document: GraphDocument, finalOutput: unknown, options?: WoroxRuntimeValidationOptions): ValidationResult;
22
+ //# sourceMappingURL=validateWorox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateWorox.d.ts","sourceRoot":"","sources":["../src/validateWorox.ts"],"names":[],"mappings":"AAAA,OAAO,GAAgD,MAAM,KAAK,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAmB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAyBpE,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,OAAO,EAClB,OAAO,CAAC,EAAE,6BAA6B,GACtC,gBAAgB,CAwBlB;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,OAAO,EACpB,OAAO,CAAC,EAAE,6BAA6B,GACtC,gBAAgB,CAwBlB"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateExecutionAgainstContract = validateExecutionAgainstContract;
7
+ exports.validateFinalOutputAgainstContract = validateFinalOutputAgainstContract;
8
+ const ajv_1 = __importDefault(require("ajv"));
9
+ const defaultAjv = new ajv_1.default({
10
+ allErrors: true,
11
+ strict: false
12
+ });
13
+ function normalizeError(error) {
14
+ return {
15
+ message: error.message ?? "Validation error",
16
+ path: error.instancePath || error.schemaPath,
17
+ keyword: error.keyword,
18
+ params: (error.params ?? {})
19
+ };
20
+ }
21
+ function runCompiled(validate, data) {
22
+ const valid = validate(data);
23
+ if (valid) {
24
+ return { valid: true, errors: [] };
25
+ }
26
+ const errors = (validate.errors ?? []).map(normalizeError);
27
+ return { valid: false, errors };
28
+ }
29
+ /**
30
+ * Validates `execution` against `document.metadata.graphEntry.executionSchema` when present.
31
+ * If there is no schema, or `graphEntry` is missing, returns `{ valid: true, errors: [] }`.
32
+ * This is optional tooling; graphenix planning does not require it.
33
+ */
34
+ function validateExecutionAgainstContract(document, execution, options) {
35
+ const schema = document.metadata?.graphEntry?.executionSchema;
36
+ if (schema === undefined || schema === null || typeof schema !== "object") {
37
+ return { valid: true, errors: [] };
38
+ }
39
+ const ajv = options?.ajv ?? defaultAjv;
40
+ let validate;
41
+ try {
42
+ validate = ajv.compile(schema);
43
+ }
44
+ catch (e) {
45
+ const message = e instanceof Error ? e.message : String(e);
46
+ return {
47
+ valid: false,
48
+ errors: [
49
+ {
50
+ message: `Invalid executionSchema: ${message}`,
51
+ path: "/metadata/graphEntry/executionSchema",
52
+ keyword: "compile",
53
+ params: {}
54
+ }
55
+ ]
56
+ };
57
+ }
58
+ return runCompiled(validate, execution);
59
+ }
60
+ /**
61
+ * Validates `finalOutput` against `document.metadata.graphResponse.finalOutputSchema` when present.
62
+ * If there is no schema, or `graphResponse` is missing, returns `{ valid: true, errors: [] }`.
63
+ */
64
+ function validateFinalOutputAgainstContract(document, finalOutput, options) {
65
+ const schema = document.metadata?.graphResponse?.finalOutputSchema;
66
+ if (schema === undefined || schema === null || typeof schema !== "object") {
67
+ return { valid: true, errors: [] };
68
+ }
69
+ const ajv = options?.ajv ?? defaultAjv;
70
+ let validate;
71
+ try {
72
+ validate = ajv.compile(schema);
73
+ }
74
+ catch (e) {
75
+ const message = e instanceof Error ? e.message : String(e);
76
+ return {
77
+ valid: false,
78
+ errors: [
79
+ {
80
+ message: `Invalid finalOutputSchema: ${message}`,
81
+ path: "/metadata/graphResponse/finalOutputSchema",
82
+ keyword: "compile",
83
+ params: {}
84
+ }
85
+ ]
86
+ };
87
+ }
88
+ return runCompiled(validate, finalOutput);
89
+ }
90
+ //# sourceMappingURL=validateWorox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateWorox.js","sourceRoot":"","sources":["../src/validateWorox.ts"],"names":[],"mappings":";;;;;AAwCA,4EA4BC;AAMD,gFA4BC;AAtGD,8CAAmE;AAInE,MAAM,UAAU,GAAG,IAAI,aAAG,CAAC;IACzB,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,KAAkB;IACxC,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,kBAAkB;QAC5C,IAAI,EAAE,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,UAAU;QAC5C,OAAO,EAAE,KAAK,CAAC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JSON relates to the **port-based** `Graph` type in graphenix-format. It applies to authors using both `@woroces/worox-graph` and `graphenix-format` validation.
4
+
5
+ ## Two representations
6
+
7
+ | Area | worox-graph | graphenix-format core `Graph` |
8
+ |------|----------------|--------------------------------|
9
+ | Topology | Task nodes, edges, `outputMapping`, finalizers | Nodes, edges, **ports**, `GraphInput` / `GraphOutput` |
10
+ | Execution shape | Engine-specific (tasks, DAG scheduling) | **Execution-agnostic** static description |
11
+ | I/O contracts | Often embedded in graph JSON and tooling | **Optional** `metadata.graphEntry` / `metadata.graphResponse` on the **document** |
12
+ | Planning (catalog) | Optional `metadata.catalogRequests`; per task node `metadata.catalogRequest` / `metadata.catalogBinding` | Same optional keys on **`GraphDocument.metadata`** and **node `metadata`** in this package’s schema (execution unchanged) |
13
+
14
+ worox-graph focuses on runnable task graphs and visibility into execution paths. graphenix-format describes a **static** graph layout (ports, graph-level inputs/outputs) without prescribing how the runtime schedules tasks.
15
+
16
+ Planning-only catalog fields do not alter execution; canonical shapes live in `@woroces/worox-graph` (`refs.ts`). graphenix-format exposes matching optional JSON Schema `$defs` (`WoroxCatalogRequest`, `WoroxCatalogBinding`, `WoroxCatalogRequests`) for tooling that wants a single validator story.
17
+
18
+ ## Where worox-graph JSON lives
19
+
20
+ - **Canonical for this package:** optional **`GraphDocument.metadata.graphEntry`** and **`GraphDocument.metadata.graphResponse`** (first-class optional fields). These match the worox contracts used when values are copied to `variables.__graphModel` and keep a single place for validation and docs.
21
+ - **`extensions`:** you may still place namespaced worox-only payloads under `extensions` (e.g. legacy or engine-specific blobs). That does **not** replace `metadata.graphEntry` / `metadata.graphResponse` when you want graphenix-format schema and types to validate the same shapes as worox-graph.
22
+
23
+ FR-GXF-1 does **not** change graphenix-format’s execution model: the core `Graph` remains port-based.
24
+
25
+ ## DAG nodes vs ports: is there a converter?
26
+
27
+ **Not in graphenix-format today.** A future **optional** converter could map worox task nodes ↔ port graphs; nothing in the entry/response metadata requires or implies that mapping. Until such a tool exists, treat worox graph JSON and graphenix `Graph` as related **documentation and planning** layers, not automatic transforms of each other.
28
+
29
+ ## See also
30
+
31
+ - README: **Worox-graph alignment** (I/O layers 01 / 08).
32
+ - `schema/graphenix-format-1.0.0.schema.json`: `$defs/GraphEntryContract`, `$defs/GraphResponseContract`, and optional worox planning `$defs` (`WoroxCatalogRequest`, `WoroxCatalogBinding`, `WoroxCatalogRequests`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphenix-format",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Graphenix graph description format: JSON schema, validation, and CRUD helpers.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
@@ -15,7 +15,8 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
- "schema"
18
+ "schema",
19
+ "docs"
19
20
  ],
20
21
  "keywords": [
21
22
  "graph",