ai-database 2.0.2 → 2.1.3
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/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +667 -1
- package/dist/actions.d.ts +247 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +260 -0
- package/dist/actions.js.map +1 -0
- package/dist/ai-promise-db.d.ts +37 -2
- package/dist/ai-promise-db.d.ts.map +1 -1
- package/dist/ai-promise-db.js +530 -92
- package/dist/ai-promise-db.js.map +1 -1
- package/dist/constants.d.ts +16 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +16 -0
- package/dist/constants.js.map +1 -0
- package/dist/events.d.ts +153 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +154 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/memory-provider.d.ts +145 -2
- package/dist/memory-provider.d.ts.map +1 -1
- package/dist/memory-provider.js +569 -13
- package/dist/memory-provider.js.map +1 -1
- package/dist/schema/cascade.d.ts +104 -0
- package/dist/schema/cascade.d.ts.map +1 -0
- package/dist/schema/cascade.js +547 -0
- package/dist/schema/cascade.js.map +1 -0
- package/dist/schema/dependency-graph.d.ts +133 -0
- package/dist/schema/dependency-graph.d.ts.map +1 -0
- package/dist/schema/dependency-graph.js +355 -0
- package/dist/schema/dependency-graph.js.map +1 -0
- package/dist/schema/generation-context.d.ts +202 -0
- package/dist/schema/generation-context.d.ts.map +1 -0
- package/dist/schema/generation-context.js +393 -0
- package/dist/schema/generation-context.js.map +1 -0
- package/dist/schema/index.d.ts +201 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +1221 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/parse.d.ts +225 -0
- package/dist/schema/parse.d.ts.map +1 -0
- package/dist/schema/parse.js +740 -0
- package/dist/schema/parse.js.map +1 -0
- package/dist/schema/provider.d.ts +177 -0
- package/dist/schema/provider.d.ts.map +1 -0
- package/dist/schema/provider.js +258 -0
- package/dist/schema/provider.js.map +1 -0
- package/dist/schema/resolve.d.ts +87 -0
- package/dist/schema/resolve.d.ts.map +1 -0
- package/dist/schema/resolve.js +549 -0
- package/dist/schema/resolve.js.map +1 -0
- package/dist/schema/semantic.d.ts +54 -0
- package/dist/schema/semantic.d.ts.map +1 -0
- package/dist/schema/semantic.js +335 -0
- package/dist/schema/semantic.js.map +1 -0
- package/dist/schema/types.d.ts +528 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +9 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/union-fallback.d.ts +219 -0
- package/dist/schema/union-fallback.d.ts.map +1 -0
- package/dist/schema/union-fallback.js +325 -0
- package/dist/schema/union-fallback.js.map +1 -0
- package/dist/schema/verb-derivation.d.ts +167 -0
- package/dist/schema/verb-derivation.d.ts.map +1 -0
- package/dist/schema/verb-derivation.js +281 -0
- package/dist/schema/verb-derivation.js.map +1 -0
- package/dist/schema.d.ts +25 -867
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +45 -1124
- package/dist/schema.js.map +1 -1
- package/dist/semantic.d.ts +175 -0
- package/dist/semantic.d.ts.map +1 -0
- package/dist/semantic.js +338 -0
- package/dist/semantic.js.map +1 -0
- package/dist/type-guards.d.ts +167 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +247 -0
- package/dist/type-guards.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +168 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +667 -0
- package/dist/validation.js.map +1 -0
- package/package.json +21 -12
- package/.turbo/turbo-build.log +0 -5
- package/TESTING.md +0 -410
- package/TEST_SUMMARY.md +0 -250
- package/TODO.md +0 -128
- package/src/ai-promise-db.ts +0 -1243
- package/src/authorization.ts +0 -1102
- package/src/durable-clickhouse.ts +0 -596
- package/src/durable-promise.ts +0 -582
- package/src/execution-queue.ts +0 -608
- package/src/index.test.ts +0 -868
- package/src/index.ts +0 -337
- package/src/linguistic.ts +0 -404
- package/src/memory-provider.test.ts +0 -1036
- package/src/memory-provider.ts +0 -1119
- package/src/schema.test.ts +0 -1254
- package/src/schema.ts +0 -2296
- package/src/tests.ts +0 -725
- package/src/types.ts +0 -1177
- package/test/README.md +0 -153
- package/test/edge-cases.test.ts +0 -646
- package/test/provider-resolution.test.ts +0 -402
- package/tsconfig.json +0 -9
- package/vitest.config.ts +0 -19
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Graph - builds and manages type dependencies for cascade generation
|
|
3
|
+
*
|
|
4
|
+
* This module provides:
|
|
5
|
+
* - Graph construction from parsed schema relationships
|
|
6
|
+
* - Topological sorting for correct generation order
|
|
7
|
+
* - Cycle detection with clear error messages
|
|
8
|
+
* - Parallel group identification for concurrent generation
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import type { ParsedSchema } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* A node in the schema dependency graph representing an entity type
|
|
15
|
+
*/
|
|
16
|
+
export interface SchemaDepNode {
|
|
17
|
+
/** Type name */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Types this node depends on (hard dependencies from -> and <-) */
|
|
20
|
+
dependsOn: string[];
|
|
21
|
+
/** Types that depend on this node */
|
|
22
|
+
dependedOnBy: string[];
|
|
23
|
+
/** Types this node softly depends on (from ~> and <~ fuzzy operators) */
|
|
24
|
+
softDependsOn: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An edge in the dependency graph representing a relationship
|
|
28
|
+
*/
|
|
29
|
+
export interface SchemaDepEdge {
|
|
30
|
+
/** Source type */
|
|
31
|
+
from: string;
|
|
32
|
+
/** Target type */
|
|
33
|
+
to: string;
|
|
34
|
+
/** Whether this is an array relationship */
|
|
35
|
+
isArray: boolean;
|
|
36
|
+
/** The operator used: ->, ~>, <-, <~ */
|
|
37
|
+
operator: '->' | '~>' | '<-' | '<~';
|
|
38
|
+
/** Field name (may include ? suffix for optional fields) */
|
|
39
|
+
fieldName: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The complete dependency graph structure
|
|
43
|
+
*/
|
|
44
|
+
export interface SchemaDepGraph {
|
|
45
|
+
/** Map of type name to node */
|
|
46
|
+
nodes: Record<string, SchemaDepNode>;
|
|
47
|
+
/** All edges in the graph */
|
|
48
|
+
edges: SchemaDepEdge[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Primitive types that don't create dependencies
|
|
52
|
+
*/
|
|
53
|
+
export declare const PRIMITIVE_TYPES: Set<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Error thrown when a circular dependency is detected
|
|
56
|
+
*/
|
|
57
|
+
export declare class CircularDependencyError extends Error {
|
|
58
|
+
/** The path of types that form the cycle */
|
|
59
|
+
readonly cyclePath: string[];
|
|
60
|
+
constructor(cyclePath: string[]);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build a dependency graph from a parsed schema
|
|
64
|
+
*
|
|
65
|
+
* @param schema - The parsed schema from parseSchema()
|
|
66
|
+
* @returns The dependency graph with nodes and edges
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildDependencyGraph(schema: ParsedSchema): SchemaDepGraph;
|
|
69
|
+
/**
|
|
70
|
+
* Compute topological order for generating types
|
|
71
|
+
*
|
|
72
|
+
* Returns types in order such that dependencies come before dependents.
|
|
73
|
+
* This is essential for cascade generation - we need to create referenced
|
|
74
|
+
* entities before the entities that reference them.
|
|
75
|
+
*
|
|
76
|
+
* @param graph - The dependency graph
|
|
77
|
+
* @param rootType - The root type to start from
|
|
78
|
+
* @param ignoreOptional - If true, optional dependencies don't contribute to ordering
|
|
79
|
+
* @returns Array of type names in generation order (dependencies first, root last)
|
|
80
|
+
* @throws CircularDependencyError if a cycle is detected
|
|
81
|
+
*/
|
|
82
|
+
export declare function topologicalSort(graph: SchemaDepGraph, rootType: string, ignoreOptional?: boolean): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Options for cycle detection
|
|
85
|
+
*/
|
|
86
|
+
export interface DetectCyclesOptions {
|
|
87
|
+
/** If true, optional dependencies are ignored when detecting cycles */
|
|
88
|
+
ignoreOptional?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Detect all cycles in the dependency graph
|
|
92
|
+
*
|
|
93
|
+
* @param graph - The dependency graph to check
|
|
94
|
+
* @param options - Detection options
|
|
95
|
+
* @returns Array of cycles, where each cycle is an array of type names
|
|
96
|
+
* The first and last element of each cycle are the same (showing the loop)
|
|
97
|
+
*/
|
|
98
|
+
export declare function detectCycles(graph: SchemaDepGraph, options?: DetectCyclesOptions): string[][];
|
|
99
|
+
/**
|
|
100
|
+
* Get parallel generation groups - types that can be generated concurrently
|
|
101
|
+
*
|
|
102
|
+
* Returns an array of arrays, where each inner array contains types that
|
|
103
|
+
* can be generated in parallel (they have no dependencies on each other).
|
|
104
|
+
* Groups are ordered so that earlier groups must complete before later ones.
|
|
105
|
+
*
|
|
106
|
+
* @param graph - The dependency graph
|
|
107
|
+
* @param rootType - The root type to start from
|
|
108
|
+
* @returns Array of parallel groups, in execution order
|
|
109
|
+
*/
|
|
110
|
+
export declare function getParallelGroups(graph: SchemaDepGraph, rootType: string): string[][];
|
|
111
|
+
/**
|
|
112
|
+
* Get all dependencies for a specific type (including transitive)
|
|
113
|
+
*
|
|
114
|
+
* @param graph - The dependency graph
|
|
115
|
+
* @param typeName - The type to get dependencies for
|
|
116
|
+
* @returns Set of all type names this type depends on
|
|
117
|
+
*/
|
|
118
|
+
export declare function getAllDependencies(graph: SchemaDepGraph, typeName: string): Set<string>;
|
|
119
|
+
/**
|
|
120
|
+
* Check if the graph has any cycles
|
|
121
|
+
*
|
|
122
|
+
* @param graph - The dependency graph
|
|
123
|
+
* @returns true if cycles exist, false otherwise
|
|
124
|
+
*/
|
|
125
|
+
export declare function hasCycles(graph: SchemaDepGraph): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Get a human-readable visualization of the dependency graph
|
|
128
|
+
*
|
|
129
|
+
* @param graph - The dependency graph
|
|
130
|
+
* @returns Multi-line string showing the graph structure
|
|
131
|
+
*/
|
|
132
|
+
export declare function visualizeGraph(graph: SchemaDepGraph): string;
|
|
133
|
+
//# sourceMappingURL=dependency-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../../src/schema/dependency-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,aAAa,CAAA;AAM5D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,qCAAqC;IACrC,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,yEAAyE;IACzE,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAA;IAChB,wCAAwC;IACxC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACnC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,6BA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construction from parsed schema relationships
|
|
6
|
+
* - Topological sorting for correct generation order
|
|
7
|
+
* - Cycle detection with clear error messages
|
|
8
|
+
* - Parallel group identification for concurrent generation
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Constants
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Primitive types that don't create dependencies
|
|
17
|
+
*/
|
|
18
|
+
export const PRIMITIVE_TYPES = new Set([
|
|
19
|
+
'string',
|
|
20
|
+
'number',
|
|
21
|
+
'boolean',
|
|
22
|
+
'date',
|
|
23
|
+
'datetime',
|
|
24
|
+
'json',
|
|
25
|
+
'markdown',
|
|
26
|
+
'url',
|
|
27
|
+
'email',
|
|
28
|
+
'object',
|
|
29
|
+
'array',
|
|
30
|
+
]);
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// Errors
|
|
33
|
+
// =============================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Error thrown when a circular dependency is detected
|
|
36
|
+
*/
|
|
37
|
+
export class CircularDependencyError extends Error {
|
|
38
|
+
/** The path of types that form the cycle */
|
|
39
|
+
cyclePath;
|
|
40
|
+
constructor(cyclePath) {
|
|
41
|
+
const cycleStr = cyclePath.join(' -> ');
|
|
42
|
+
super(`Circular dependency detected: ${cycleStr}`);
|
|
43
|
+
this.name = 'CircularDependencyError';
|
|
44
|
+
this.cyclePath = cyclePath;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// Graph Construction
|
|
49
|
+
// =============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* Build a dependency graph from a parsed schema
|
|
52
|
+
*
|
|
53
|
+
* @param schema - The parsed schema from parseSchema()
|
|
54
|
+
* @returns The dependency graph with nodes and edges
|
|
55
|
+
*/
|
|
56
|
+
export function buildDependencyGraph(schema) {
|
|
57
|
+
const nodes = {};
|
|
58
|
+
const edges = [];
|
|
59
|
+
// Initialize nodes for all entity types
|
|
60
|
+
for (const [typeName] of schema.entities) {
|
|
61
|
+
nodes[typeName] = {
|
|
62
|
+
name: typeName,
|
|
63
|
+
dependsOn: [],
|
|
64
|
+
dependedOnBy: [],
|
|
65
|
+
softDependsOn: [],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// Process fields to build edges
|
|
69
|
+
for (const [typeName, entity] of schema.entities) {
|
|
70
|
+
for (const [fieldName, field] of entity.fields) {
|
|
71
|
+
// Skip non-relation fields
|
|
72
|
+
if (!field.isRelation || !field.relatedType)
|
|
73
|
+
continue;
|
|
74
|
+
// Skip primitive types
|
|
75
|
+
if (PRIMITIVE_TYPES.has(field.relatedType))
|
|
76
|
+
continue;
|
|
77
|
+
const target = field.relatedType;
|
|
78
|
+
const operator = field.operator;
|
|
79
|
+
const isArray = field.isArray ?? false;
|
|
80
|
+
const isSoft = operator === '~>' || operator === '<~';
|
|
81
|
+
const isBackward = operator === '<-' || operator === '<~';
|
|
82
|
+
const isOptionalField = field.isOptional;
|
|
83
|
+
// Add edge (mark optional in fieldName for cycle detection)
|
|
84
|
+
edges.push({
|
|
85
|
+
from: typeName,
|
|
86
|
+
to: target,
|
|
87
|
+
isArray,
|
|
88
|
+
operator: operator ?? '->',
|
|
89
|
+
fieldName: isOptionalField ? `${fieldName}?` : fieldName,
|
|
90
|
+
});
|
|
91
|
+
// Ensure target node exists (might be external/not in schema)
|
|
92
|
+
if (!nodes[target]) {
|
|
93
|
+
nodes[target] = {
|
|
94
|
+
name: target,
|
|
95
|
+
dependsOn: [],
|
|
96
|
+
dependedOnBy: [],
|
|
97
|
+
softDependsOn: [],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// Determine dependency type based on operator
|
|
101
|
+
const sourceNode = nodes[typeName];
|
|
102
|
+
const targetNode = nodes[target];
|
|
103
|
+
if (isSoft || isOptionalField) {
|
|
104
|
+
// Soft dependency (fuzzy search) or optional field
|
|
105
|
+
if (!sourceNode.softDependsOn.includes(target)) {
|
|
106
|
+
sourceNode.softDependsOn.push(target);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (!isBackward) {
|
|
110
|
+
// Hard dependency for forward exact references (->)
|
|
111
|
+
// Backward references (<-) don't create generation dependencies
|
|
112
|
+
// because the parent creates the child, not vice versa
|
|
113
|
+
if (!sourceNode.dependsOn.includes(target)) {
|
|
114
|
+
sourceNode.dependsOn.push(target);
|
|
115
|
+
}
|
|
116
|
+
if (!targetNode.dependedOnBy.includes(typeName)) {
|
|
117
|
+
targetNode.dependedOnBy.push(typeName);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return { nodes, edges };
|
|
123
|
+
}
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// Topological Sort
|
|
126
|
+
// =============================================================================
|
|
127
|
+
/**
|
|
128
|
+
* Compute topological order for generating types
|
|
129
|
+
*
|
|
130
|
+
* Returns types in order such that dependencies come before dependents.
|
|
131
|
+
* This is essential for cascade generation - we need to create referenced
|
|
132
|
+
* entities before the entities that reference them.
|
|
133
|
+
*
|
|
134
|
+
* @param graph - The dependency graph
|
|
135
|
+
* @param rootType - The root type to start from
|
|
136
|
+
* @param ignoreOptional - If true, optional dependencies don't contribute to ordering
|
|
137
|
+
* @returns Array of type names in generation order (dependencies first, root last)
|
|
138
|
+
* @throws CircularDependencyError if a cycle is detected
|
|
139
|
+
*/
|
|
140
|
+
export function topologicalSort(graph, rootType, ignoreOptional = false) {
|
|
141
|
+
const visited = new Set();
|
|
142
|
+
const visiting = new Set();
|
|
143
|
+
const result = [];
|
|
144
|
+
function visit(typeName, path) {
|
|
145
|
+
if (visited.has(typeName))
|
|
146
|
+
return;
|
|
147
|
+
if (visiting.has(typeName)) {
|
|
148
|
+
// Circular dependency detected
|
|
149
|
+
const cycleStart = path.indexOf(typeName);
|
|
150
|
+
const cyclePath = [...path.slice(cycleStart), typeName];
|
|
151
|
+
throw new CircularDependencyError(cyclePath);
|
|
152
|
+
}
|
|
153
|
+
visiting.add(typeName);
|
|
154
|
+
const node = graph.nodes[typeName];
|
|
155
|
+
if (node) {
|
|
156
|
+
for (const dep of node.dependsOn) {
|
|
157
|
+
// Check if this dependency is optional and should be ignored
|
|
158
|
+
if (ignoreOptional) {
|
|
159
|
+
const edge = graph.edges.find((e) => e.from === typeName && e.to === dep);
|
|
160
|
+
if (edge && graph.nodes[dep]) {
|
|
161
|
+
// Check if field has optional marker
|
|
162
|
+
const fieldIsOptional = edge.fieldName.endsWith('?');
|
|
163
|
+
if (fieldIsOptional)
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
visit(dep, [...path, typeName]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
visiting.delete(typeName);
|
|
171
|
+
visited.add(typeName);
|
|
172
|
+
result.push(typeName);
|
|
173
|
+
}
|
|
174
|
+
visit(rootType, []);
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Detect all cycles in the dependency graph
|
|
179
|
+
*
|
|
180
|
+
* @param graph - The dependency graph to check
|
|
181
|
+
* @param options - Detection options
|
|
182
|
+
* @returns Array of cycles, where each cycle is an array of type names
|
|
183
|
+
* The first and last element of each cycle are the same (showing the loop)
|
|
184
|
+
*/
|
|
185
|
+
export function detectCycles(graph, options = {}) {
|
|
186
|
+
const cycles = [];
|
|
187
|
+
const visited = new Set();
|
|
188
|
+
const recStack = new Set();
|
|
189
|
+
function dfs(node, path) {
|
|
190
|
+
if (recStack.has(node)) {
|
|
191
|
+
// Found a cycle
|
|
192
|
+
const cycleStart = path.indexOf(node);
|
|
193
|
+
const cycle = [...path.slice(cycleStart), node];
|
|
194
|
+
cycles.push(cycle);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (visited.has(node))
|
|
198
|
+
return;
|
|
199
|
+
visited.add(node);
|
|
200
|
+
recStack.add(node);
|
|
201
|
+
const nodeInfo = graph.nodes[node];
|
|
202
|
+
if (nodeInfo) {
|
|
203
|
+
for (const dep of nodeInfo.dependsOn) {
|
|
204
|
+
// Skip optional dependencies if configured
|
|
205
|
+
if (options.ignoreOptional) {
|
|
206
|
+
const edge = graph.edges.find((e) => e.from === node && e.to === dep);
|
|
207
|
+
if (edge) {
|
|
208
|
+
// Check if fieldName ends with ?
|
|
209
|
+
if (edge.fieldName.endsWith('?'))
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
dfs(dep, [...path, node]);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
recStack.delete(node);
|
|
217
|
+
}
|
|
218
|
+
for (const node of Object.keys(graph.nodes)) {
|
|
219
|
+
dfs(node, []);
|
|
220
|
+
}
|
|
221
|
+
return cycles;
|
|
222
|
+
}
|
|
223
|
+
// =============================================================================
|
|
224
|
+
// Parallel Groups
|
|
225
|
+
// =============================================================================
|
|
226
|
+
/**
|
|
227
|
+
* Get parallel generation groups - types that can be generated concurrently
|
|
228
|
+
*
|
|
229
|
+
* Returns an array of arrays, where each inner array contains types that
|
|
230
|
+
* can be generated in parallel (they have no dependencies on each other).
|
|
231
|
+
* Groups are ordered so that earlier groups must complete before later ones.
|
|
232
|
+
*
|
|
233
|
+
* @param graph - The dependency graph
|
|
234
|
+
* @param rootType - The root type to start from
|
|
235
|
+
* @returns Array of parallel groups, in execution order
|
|
236
|
+
*/
|
|
237
|
+
export function getParallelGroups(graph, rootType) {
|
|
238
|
+
const inDegree = {};
|
|
239
|
+
const relevantNodes = new Set();
|
|
240
|
+
// First, find all nodes reachable from root
|
|
241
|
+
function findReachable(node) {
|
|
242
|
+
if (relevantNodes.has(node))
|
|
243
|
+
return;
|
|
244
|
+
relevantNodes.add(node);
|
|
245
|
+
const nodeInfo = graph.nodes[node];
|
|
246
|
+
if (nodeInfo) {
|
|
247
|
+
for (const dep of nodeInfo.dependsOn) {
|
|
248
|
+
findReachable(dep);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
findReachable(rootType);
|
|
253
|
+
// Initialize in-degrees for relevant nodes only
|
|
254
|
+
for (const node of relevantNodes) {
|
|
255
|
+
inDegree[node] = 0;
|
|
256
|
+
}
|
|
257
|
+
// Count incoming edges (dependencies)
|
|
258
|
+
for (const node of relevantNodes) {
|
|
259
|
+
const nodeInfo = graph.nodes[node];
|
|
260
|
+
if (nodeInfo) {
|
|
261
|
+
for (const dep of nodeInfo.dependsOn) {
|
|
262
|
+
if (relevantNodes.has(dep)) {
|
|
263
|
+
const currentDegree = inDegree[node] ?? 0;
|
|
264
|
+
inDegree[node] = currentDegree + 1;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const groups = [];
|
|
270
|
+
while (Object.keys(inDegree).length > 0) {
|
|
271
|
+
// Find all nodes with in-degree 0 (no remaining dependencies)
|
|
272
|
+
const group = Object.entries(inDegree)
|
|
273
|
+
.filter(([, degree]) => degree === 0)
|
|
274
|
+
.map(([node]) => node);
|
|
275
|
+
if (group.length === 0) {
|
|
276
|
+
// Remaining nodes have cycles - break to avoid infinite loop
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
groups.push(group);
|
|
280
|
+
// Remove processed nodes and update in-degrees
|
|
281
|
+
for (const node of group) {
|
|
282
|
+
delete inDegree[node];
|
|
283
|
+
// Reduce in-degree of nodes that depend on this node
|
|
284
|
+
for (const dependent of graph.nodes[node]?.dependedOnBy ?? []) {
|
|
285
|
+
if (dependent in inDegree) {
|
|
286
|
+
const currentDegree = inDegree[dependent] ?? 0;
|
|
287
|
+
inDegree[dependent] = currentDegree - 1;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return groups;
|
|
293
|
+
}
|
|
294
|
+
// =============================================================================
|
|
295
|
+
// Utility Functions
|
|
296
|
+
// =============================================================================
|
|
297
|
+
/**
|
|
298
|
+
* Get all dependencies for a specific type (including transitive)
|
|
299
|
+
*
|
|
300
|
+
* @param graph - The dependency graph
|
|
301
|
+
* @param typeName - The type to get dependencies for
|
|
302
|
+
* @returns Set of all type names this type depends on
|
|
303
|
+
*/
|
|
304
|
+
export function getAllDependencies(graph, typeName) {
|
|
305
|
+
const deps = new Set();
|
|
306
|
+
function collect(node) {
|
|
307
|
+
const nodeInfo = graph.nodes[node];
|
|
308
|
+
if (!nodeInfo)
|
|
309
|
+
return;
|
|
310
|
+
for (const dep of nodeInfo.dependsOn) {
|
|
311
|
+
if (!deps.has(dep)) {
|
|
312
|
+
deps.add(dep);
|
|
313
|
+
collect(dep);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
collect(typeName);
|
|
318
|
+
return deps;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Check if the graph has any cycles
|
|
322
|
+
*
|
|
323
|
+
* @param graph - The dependency graph
|
|
324
|
+
* @returns true if cycles exist, false otherwise
|
|
325
|
+
*/
|
|
326
|
+
export function hasCycles(graph) {
|
|
327
|
+
return detectCycles(graph).length > 0;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get a human-readable visualization of the dependency graph
|
|
331
|
+
*
|
|
332
|
+
* @param graph - The dependency graph
|
|
333
|
+
* @returns Multi-line string showing the graph structure
|
|
334
|
+
*/
|
|
335
|
+
export function visualizeGraph(graph) {
|
|
336
|
+
const lines = ['Dependency Graph:', ''];
|
|
337
|
+
for (const [name, node] of Object.entries(graph.nodes)) {
|
|
338
|
+
lines.push(`${name}:`);
|
|
339
|
+
if (node.dependsOn.length > 0) {
|
|
340
|
+
lines.push(` -> ${node.dependsOn.join(', ')} (hard deps)`);
|
|
341
|
+
}
|
|
342
|
+
if (node.softDependsOn.length > 0) {
|
|
343
|
+
lines.push(` ~> ${node.softDependsOn.join(', ')} (soft deps)`);
|
|
344
|
+
}
|
|
345
|
+
if (node.dependedOnBy.length > 0) {
|
|
346
|
+
lines.push(` <- ${node.dependedOnBy.join(', ')} (depended on by)`);
|
|
347
|
+
}
|
|
348
|
+
if (node.dependsOn.length === 0 && node.softDependsOn.length === 0) {
|
|
349
|
+
lines.push(` (no dependencies)`);
|
|
350
|
+
}
|
|
351
|
+
lines.push('');
|
|
352
|
+
}
|
|
353
|
+
return lines.join('\n');
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=dependency-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-graph.js","sourceRoot":"","sources":["../../src/schema/dependency-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgDH,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACrC,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,UAAU;IACV,MAAM;IACN,UAAU;IACV,KAAK;IACL,OAAO;IACP,QAAQ;IACR,OAAO;CACR,CAAC,CAAA;AAEF,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,4CAA4C;IAC5B,SAAS,CAAU;IAEnC,YAAY,SAAmB;QAC7B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACvC,KAAK,CAAC,iCAAiC,QAAQ,EAAE,CAAC,CAAA;QAClD,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;CACF;AAED,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAoB;IACvD,MAAM,KAAK,GAAkC,EAAE,CAAA;IAC/C,MAAM,KAAK,GAAoB,EAAE,CAAA;IAEjC,wCAAwC;IACxC,KAAK,MAAM,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