@fougere/core 0.1.0-alpha.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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -0
  3. package/dist/binding.d.ts +63 -0
  4. package/dist/binding.d.ts.map +1 -0
  5. package/dist/binding.js +107 -0
  6. package/dist/binding.js.map +1 -0
  7. package/dist/boot.d.ts +38 -0
  8. package/dist/boot.d.ts.map +1 -0
  9. package/dist/boot.js +53 -0
  10. package/dist/boot.js.map +1 -0
  11. package/dist/bootstrap.d.ts +4 -0
  12. package/dist/bootstrap.d.ts.map +1 -0
  13. package/dist/bootstrap.js +825 -0
  14. package/dist/bootstrap.js.map +1 -0
  15. package/dist/builtins/config.d.ts +4 -0
  16. package/dist/builtins/config.d.ts.map +1 -0
  17. package/dist/builtins/config.js +6 -0
  18. package/dist/builtins/config.js.map +1 -0
  19. package/dist/builtins/logger.d.ts +28 -0
  20. package/dist/builtins/logger.d.ts.map +1 -0
  21. package/dist/builtins/logger.js +76 -0
  22. package/dist/builtins/logger.js.map +1 -0
  23. package/dist/call.d.ts +172 -0
  24. package/dist/call.d.ts.map +1 -0
  25. package/dist/call.js +209 -0
  26. package/dist/call.js.map +1 -0
  27. package/dist/collector.d.ts +28 -0
  28. package/dist/collector.d.ts.map +1 -0
  29. package/dist/collector.js +32 -0
  30. package/dist/collector.js.map +1 -0
  31. package/dist/config-loader.d.ts +59 -0
  32. package/dist/config-loader.d.ts.map +1 -0
  33. package/dist/config-loader.js +97 -0
  34. package/dist/config-loader.js.map +1 -0
  35. package/dist/contract.d.ts +43 -0
  36. package/dist/contract.d.ts.map +1 -0
  37. package/dist/contract.js +29 -0
  38. package/dist/contract.js.map +1 -0
  39. package/dist/crud.d.ts +61 -0
  40. package/dist/crud.d.ts.map +1 -0
  41. package/dist/crud.js +85 -0
  42. package/dist/crud.js.map +1 -0
  43. package/dist/define.d.ts +8 -0
  44. package/dist/define.d.ts.map +1 -0
  45. package/dist/define.js +9 -0
  46. package/dist/define.js.map +1 -0
  47. package/dist/egress.d.ts +78 -0
  48. package/dist/egress.d.ts.map +1 -0
  49. package/dist/egress.js +185 -0
  50. package/dist/egress.js.map +1 -0
  51. package/dist/emit.d.ts +51 -0
  52. package/dist/emit.d.ts.map +1 -0
  53. package/dist/emit.js +57 -0
  54. package/dist/emit.js.map +1 -0
  55. package/dist/errors.d.ts +22 -0
  56. package/dist/errors.d.ts.map +1 -0
  57. package/dist/errors.js +74 -0
  58. package/dist/errors.js.map +1 -0
  59. package/dist/frond-config.d.ts +80 -0
  60. package/dist/frond-config.d.ts.map +1 -0
  61. package/dist/frond-config.js +32 -0
  62. package/dist/frond-config.js.map +1 -0
  63. package/dist/graph.d.ts +33 -0
  64. package/dist/graph.d.ts.map +1 -0
  65. package/dist/graph.js +142 -0
  66. package/dist/graph.js.map +1 -0
  67. package/dist/handler-parser.d.ts +82 -0
  68. package/dist/handler-parser.d.ts.map +1 -0
  69. package/dist/handler-parser.js +505 -0
  70. package/dist/handler-parser.js.map +1 -0
  71. package/dist/imports.d.ts +22 -0
  72. package/dist/imports.d.ts.map +1 -0
  73. package/dist/imports.js +80 -0
  74. package/dist/imports.js.map +1 -0
  75. package/dist/index.d.ts +43 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +37 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/invocation.d.ts +20 -0
  80. package/dist/invocation.d.ts.map +1 -0
  81. package/dist/invocation.js +15 -0
  82. package/dist/invocation.js.map +1 -0
  83. package/dist/middleware/error-handler.d.ts +15 -0
  84. package/dist/middleware/error-handler.d.ts.map +1 -0
  85. package/dist/middleware/error-handler.js +29 -0
  86. package/dist/middleware/error-handler.js.map +1 -0
  87. package/dist/middleware/logger.d.ts +14 -0
  88. package/dist/middleware/logger.d.ts.map +1 -0
  89. package/dist/middleware/logger.js +25 -0
  90. package/dist/middleware/logger.js.map +1 -0
  91. package/dist/middleware.d.ts +75 -0
  92. package/dist/middleware.d.ts.map +1 -0
  93. package/dist/middleware.js +89 -0
  94. package/dist/middleware.js.map +1 -0
  95. package/dist/operation.d.ts +87 -0
  96. package/dist/operation.d.ts.map +1 -0
  97. package/dist/operation.js +95 -0
  98. package/dist/operation.js.map +1 -0
  99. package/dist/orm.d.ts +96 -0
  100. package/dist/orm.d.ts.map +1 -0
  101. package/dist/orm.js +33 -0
  102. package/dist/orm.js.map +1 -0
  103. package/dist/presenter.d.ts +63 -0
  104. package/dist/presenter.d.ts.map +1 -0
  105. package/dist/presenter.js +72 -0
  106. package/dist/presenter.js.map +1 -0
  107. package/dist/remote.d.ts +48 -0
  108. package/dist/remote.d.ts.map +1 -0
  109. package/dist/remote.js +135 -0
  110. package/dist/remote.js.map +1 -0
  111. package/dist/repository.d.ts +55 -0
  112. package/dist/repository.d.ts.map +1 -0
  113. package/dist/repository.js +26 -0
  114. package/dist/repository.js.map +1 -0
  115. package/dist/scan-cache.d.ts +10 -0
  116. package/dist/scan-cache.d.ts.map +1 -0
  117. package/dist/scan-cache.js +92 -0
  118. package/dist/scan-cache.js.map +1 -0
  119. package/dist/scanner.d.ts +34 -0
  120. package/dist/scanner.d.ts.map +1 -0
  121. package/dist/scanner.js +595 -0
  122. package/dist/scanner.js.map +1 -0
  123. package/dist/seed.d.ts +28 -0
  124. package/dist/seed.d.ts.map +1 -0
  125. package/dist/seed.js +110 -0
  126. package/dist/seed.js.map +1 -0
  127. package/dist/types.d.ts +387 -0
  128. package/dist/types.d.ts.map +1 -0
  129. package/dist/types.js +2 -0
  130. package/dist/types.js.map +1 -0
  131. package/dist/verify.d.ts +57 -0
  132. package/dist/verify.d.ts.map +1 -0
  133. package/dist/verify.js +147 -0
  134. package/dist/verify.js.map +1 -0
  135. package/package.json +47 -0
package/dist/graph.js ADDED
@@ -0,0 +1,142 @@
1
+ /** Build the full entity dependency graph from scanned fronds. */
2
+ export function buildGraph(fronds) {
3
+ const nodes = new Map();
4
+ // First pass: create nodes and collect refs
5
+ for (const frond of fronds) {
6
+ for (const entity of frond.entities) {
7
+ const refs = [];
8
+ for (const [, field] of Object.entries(entity.entityClass.getFields())) {
9
+ if (field.role?.relation?.kind === 'one') {
10
+ const resolved = field.role.relation.to();
11
+ const targetName = typeof resolved === 'function' && 'name' in resolved
12
+ ? resolved.name.toLowerCase()
13
+ : undefined;
14
+ if (targetName)
15
+ refs.push(targetName);
16
+ }
17
+ }
18
+ nodes.set(entity.name, { name: entity.name, frond: frond.name, refs, referencedBy: [] });
19
+ }
20
+ }
21
+ // Second pass: populate referencedBy
22
+ for (const [, node] of nodes) {
23
+ for (const ref of node.refs) {
24
+ const target = nodes.get(ref);
25
+ if (target)
26
+ target.referencedBy.push(node.name);
27
+ }
28
+ }
29
+ return nodes;
30
+ }
31
+ /**
32
+ * Cluster entities into domains using connected component analysis.
33
+ * Entities linked by refs (in either direction) belong to the same cluster.
34
+ */
35
+ export function clusterEntities(nodes) {
36
+ const visited = new Set();
37
+ const clusters = [];
38
+ // BFS to find connected components
39
+ for (const [name] of nodes) {
40
+ if (visited.has(name))
41
+ continue;
42
+ const cluster = [];
43
+ const queue = [name];
44
+ while (queue.length > 0) {
45
+ const current = queue.shift();
46
+ if (visited.has(current))
47
+ continue;
48
+ visited.add(current);
49
+ cluster.push(current);
50
+ const node = nodes.get(current);
51
+ for (const ref of [...node.refs, ...node.referencedBy]) {
52
+ if (!visited.has(ref) && nodes.has(ref)) {
53
+ queue.push(ref);
54
+ }
55
+ }
56
+ }
57
+ if (cluster.length > 0)
58
+ clusters.push(cluster);
59
+ }
60
+ // Name each cluster by its hub (most referenced entity)
61
+ return clusters.map((entities) => {
62
+ const hub = entities
63
+ .map((name) => ({ name, score: nodes.get(name).referencedBy.length }))
64
+ .sort((a, b) => b.score - a.score)[0];
65
+ return {
66
+ name: hub.name,
67
+ entities,
68
+ crossRefs: [],
69
+ };
70
+ });
71
+ }
72
+ /**
73
+ * If there's only one big cluster, try to split it using Kernighan-Lin-style
74
+ * heuristic: find the entity with the fewest cross-links and use it as a cut point.
75
+ */
76
+ export function suggestSplit(nodes, minClusterSize = 2) {
77
+ const clusters = clusterEntities(nodes);
78
+ // If already multiple clusters, just annotate cross-refs
79
+ if (clusters.length > 1) {
80
+ return annotateCrossRefs(clusters, nodes);
81
+ }
82
+ // No entities at all — nothing to cluster (empty or fresh workspace).
83
+ if (clusters.length === 0)
84
+ return clusters;
85
+ // Single cluster — try to find natural cut points
86
+ const allEntities = clusters[0].entities;
87
+ if (allEntities.length <= minClusterSize)
88
+ return clusters;
89
+ // Score each entity by how many unique "groups" it connects
90
+ // Entities with high betweenness are boundaries, not cluster members
91
+ const subClusters = [];
92
+ const assigned = new Set();
93
+ // Start with entities that have no outgoing refs (leaves/roots)
94
+ const roots = allEntities.filter((name) => nodes.get(name).refs.length === 0);
95
+ for (const root of roots) {
96
+ if (assigned.has(root))
97
+ continue;
98
+ const group = [root];
99
+ assigned.add(root);
100
+ // Add entities that reference this root
101
+ for (const refBy of nodes.get(root).referencedBy) {
102
+ if (!assigned.has(refBy)) {
103
+ group.push(refBy);
104
+ assigned.add(refBy);
105
+ }
106
+ }
107
+ subClusters.push(group);
108
+ }
109
+ // Any remaining unassigned entities form their own group
110
+ const remaining = allEntities.filter((name) => !assigned.has(name));
111
+ if (remaining.length > 0)
112
+ subClusters.push(remaining);
113
+ // Convert to domain clusters
114
+ const result = subClusters.map((entities) => {
115
+ const hub = entities
116
+ .map((name) => ({ name, score: nodes.get(name).referencedBy.length }))
117
+ .sort((a, b) => b.score - a.score)[0];
118
+ return { name: hub.name, entities, crossRefs: [] };
119
+ });
120
+ return annotateCrossRefs(result, nodes);
121
+ }
122
+ function annotateCrossRefs(clusters, nodes) {
123
+ const entityToCluster = new Map();
124
+ for (const cluster of clusters) {
125
+ for (const entity of cluster.entities) {
126
+ entityToCluster.set(entity, cluster.name);
127
+ }
128
+ }
129
+ for (const cluster of clusters) {
130
+ for (const entity of cluster.entities) {
131
+ const node = nodes.get(entity);
132
+ for (const ref of node.refs) {
133
+ const targetCluster = entityToCluster.get(ref);
134
+ if (targetCluster && targetCluster !== cluster.name) {
135
+ cluster.crossRefs.push({ from: entity, to: ref, targetCluster });
136
+ }
137
+ }
138
+ }
139
+ }
140
+ return clusters;
141
+ }
142
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAmBA,kEAAkE;AAClE,MAAM,UAAU,UAAU,CAAC,MAAyB;IAClD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE5C,4CAA4C;IAC5C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,IAAI,GAAa,EAAE,CAAC;YAC1B,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC;gBACvE,IAAI,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;oBACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBAC1C,MAAM,UAAU,GAAG,OAAO,QAAQ,KAAK,UAAU,IAAI,MAAM,IAAI,QAAQ;wBACrE,CAAC,CAAE,QAAQ,CAAC,IAAe,CAAC,WAAW,EAAE;wBACzC,CAAC,CAAC,SAAS,CAAC;oBACd,IAAI,UAAU;wBAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;YACD,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,YA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CAAC;oBACpD,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,82 @@
1
+ /** A parsed type reference — supports primitives, entities, arrays, generics. */
2
+ export interface ParsedType {
3
+ /** Raw type text as written in source (e.g. 'Pagination<Post>'). */
4
+ raw: string;
5
+ /** Base type name (e.g. 'Pagination', 'string', 'Post'). */
6
+ name: string;
7
+ /** Whether this is an array (T[] or Array<T>) — true at any depth. */
8
+ array?: boolean;
9
+ /**
10
+ * How MANY array levels: `string[]` is 1, `string[][]` is 2. `array` only ever said
11
+ * "at least one", which sufficed while one level meant one thing. It stopped sufficing
12
+ * when a presenter method started taking the page — there the outer level IS the page
13
+ * and what remains is the field, so telling `string[]` from `string[][]` is telling a
14
+ * computed string from a computed list.
15
+ */
16
+ arrayDepth?: number;
17
+ /** Generic type arguments (e.g. for Pagination<Post> → [{ name: 'Post' }]). */
18
+ generics?: ParsedType[];
19
+ /** Whether the type is nullable (T | null | undefined). */
20
+ nullable?: boolean;
21
+ /** Whether this is a Promise wrapper (unwrapped in output). */
22
+ promise?: boolean;
23
+ }
24
+ /** A parsed method parameter. */
25
+ export interface ParsedParam {
26
+ name: string;
27
+ type: ParsedType;
28
+ optional?: boolean;
29
+ }
30
+ /** A parsed method signature from a handler source file. */
31
+ export interface ParsedMethod {
32
+ name: string;
33
+ params: ParsedParam[];
34
+ returnType?: ParsedType;
35
+ /**
36
+ * Came from a base class, not from the file being scanned. What a prefab
37
+ * handler declares about its own ops beats this — the scan reads a signature
38
+ * and guesses, the builder knows.
39
+ */
40
+ inherited?: boolean;
41
+ /**
42
+ * The operation in words — the first sentence of the method's doc comment.
43
+ *
44
+ * Not a new thing to write: handlers already carry it (`/** Judge: the author,
45
+ * a draft… *&#47;`), the AST already holds it, and nothing read it. A caller that
46
+ * discovers an operation over the wire has its name and its schema; what the
47
+ * operation is FOR lived only in the source.
48
+ */
49
+ description?: string;
50
+ }
51
+ /**
52
+ * Parse ALL method signatures from a handler source file (CRUD included).
53
+ *
54
+ * Used by the binding algorithm — every operation gets a BindingPlan.
55
+ * When projectRoot is provided, follows heritage clauses to parse parent methods.
56
+ */
57
+ /**
58
+ * What a handler file yielded — its methods, AND what the pass could not open.
59
+ *
60
+ * The second half is why this is a pair rather than an array: an unresolvable base
61
+ * class used to give the same answer as a base class with no method, so an op
62
+ * inherited from an installed package was missing from the façade in silence. The
63
+ * pair travels through the scan cache, which is why {@link PARSER_VERSION} moved.
64
+ */
65
+ export interface HandlerParse {
66
+ methods: ParsedMethod[];
67
+ /** Base classes whose source this pass could not open. Empty is a claim. */
68
+ unresolvedHeritage: string[];
69
+ }
70
+ export declare function parseAllHandlerMethods(filePath: string, projectRoot?: string): Promise<HandlerParse>;
71
+ /**
72
+ * Parse a presenter source file and extract all method signatures.
73
+ *
74
+ * Returns all methods (no CRUD filtering) — each method is a computed field.
75
+ */
76
+ export declare function parsePresenterMethods(filePath: string): Promise<ParsedMethod[]>;
77
+ /**
78
+ * Parse constructor parameter types from a source file's default class.
79
+ * Returns type names (e.g. ['PostOrm', 'Logger']) for DI resolution.
80
+ */
81
+ export declare function parseConstructorParams(filePath: string): Promise<ParsedParam[]>;
82
+ //# sourceMappingURL=handler-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler-parser.d.ts","sourceRoot":"","sources":["../src/handler-parser.ts"],"names":[],"mappings":"AAqBA,iFAAiF;AACjF,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAA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