@spfn/core 0.1.0-alpha.65 → 0.1.0-alpha.68

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.
@@ -1,10 +1,71 @@
1
+ import { G as Generator, a as GeneratorTrigger } from '../index-DHiAqhKv.js';
2
+ export { C as ContractGeneratorConfig, b as GeneratorOptions, c as createContractGenerator } from '../index-DHiAqhKv.js';
3
+ import '../auto-loader-JFaZ9gON.js';
1
4
  import { H as HttpMethod } from '../types-CAON3Mmg.js';
2
- import { G as Generator, a as GeneratorTrigger } from '../generator-DHiAqhKv.js';
3
- export { C as ContractGeneratorConfig, b as GeneratorOptions, c as createContractGenerator } from '../generator-DHiAqhKv.js';
4
5
  import 'hono';
5
6
  import 'hono/utils/http-status';
6
7
  import '@sinclair/typebox';
7
8
 
9
+ /**
10
+ * Codegen Orchestrator
11
+ *
12
+ * Manages multiple code generators and coordinates their execution
13
+ */
14
+
15
+ interface OrchestratorOptions {
16
+ /** List of generators to orchestrate */
17
+ generators: Generator[];
18
+ /** Project root directory */
19
+ cwd?: string;
20
+ /** Enable debug logging */
21
+ debug?: boolean;
22
+ }
23
+ declare class CodegenOrchestrator {
24
+ private readonly generators;
25
+ private readonly cwd;
26
+ private readonly debug;
27
+ private isGenerating;
28
+ private pendingRegenerations;
29
+ constructor(options: OrchestratorOptions);
30
+ /**
31
+ * Check if generator should run for given trigger
32
+ */
33
+ private shouldRun;
34
+ /**
35
+ * Run all generators once
36
+ *
37
+ * @param trigger - How the generators are being triggered
38
+ */
39
+ generateAll(trigger?: GeneratorTrigger): Promise<void>;
40
+ /**
41
+ * Start watch mode
42
+ */
43
+ watch(): Promise<void>;
44
+ }
45
+
46
+ /**
47
+ * Codegen Configuration Loader
48
+ *
49
+ * Loads codegen configuration from .spfnrc.json or package.json
50
+ */
51
+
52
+ interface CodegenConfig {
53
+ generators?: Array<{
54
+ path: string;
55
+ } | ({
56
+ name: string;
57
+ enabled?: boolean;
58
+ } & Record<string, any>)>;
59
+ }
60
+ /**
61
+ * Load codegen configuration from .spfnrc.json or package.json
62
+ */
63
+ declare function loadCodegenConfig(cwd: string): CodegenConfig;
64
+ /**
65
+ * Create generator instances from configuration
66
+ */
67
+ declare function createGeneratorsFromConfig(config: CodegenConfig, cwd: string): Promise<Generator[]>;
68
+
8
69
  /**
9
70
  * Code Generation Types
10
71
  *
@@ -77,124 +138,4 @@ interface GenerationStats {
77
138
  duration: number;
78
139
  }
79
140
 
80
- /**
81
- * Contract Scanner
82
- *
83
- * Scans server/contracts directory and extracts exported contracts
84
- */
85
-
86
- /**
87
- * Scan for contract files and extract contract exports
88
- *
89
- * All contracts must use absolute paths (e.g., path: '/teams/:id')
90
- *
91
- * @param contractsDir - Path to lib/contracts/ directory
92
- * @returns Array of contract-to-route mappings
93
- */
94
- declare function scanContracts(contractsDir: string): Promise<RouteContractMapping[]>;
95
-
96
- /**
97
- * Route Scanner Utilities
98
- *
99
- * Helper functions for grouping and organizing route-contract mappings
100
- */
101
-
102
- /**
103
- * Group mappings by resource
104
- */
105
- declare function groupByResource(mappings: RouteContractMapping[]): Record<string, RouteContractMapping[]>;
106
-
107
- /**
108
- * Client Code Generator
109
- *
110
- * Generates type-safe API client code from route-contract mappings
111
- */
112
-
113
- /**
114
- * Generate API client code
115
- */
116
- declare function generateClient(mappings: RouteContractMapping[], options: ClientGenerationOptions): Promise<GenerationStats>;
117
-
118
- /**
119
- * Contract Watcher & Client Generator
120
- *
121
- * Watches contract files and regenerates client code
122
- */
123
- interface WatchGenerateOptions {
124
- /** Routes directory (default: src/server/routes) */
125
- routesDir?: string;
126
- /** Output path for generated client (default: src/lib/api.ts) */
127
- outputPath?: string;
128
- /** Base URL for API client */
129
- baseUrl?: string;
130
- /** Enable debug logging */
131
- debug?: boolean;
132
- /** Watch mode (default: true) */
133
- watch?: boolean;
134
- }
135
- /**
136
- * Watch contracts and generate client code
137
- */
138
- declare function watchAndGenerate(options?: WatchGenerateOptions): Promise<void>;
139
-
140
- /**
141
- * Codegen Orchestrator
142
- *
143
- * Manages multiple code generators and coordinates their execution
144
- */
145
-
146
- interface OrchestratorOptions {
147
- /** List of generators to orchestrate */
148
- generators: Generator[];
149
- /** Project root directory */
150
- cwd?: string;
151
- /** Enable debug logging */
152
- debug?: boolean;
153
- }
154
- declare class CodegenOrchestrator {
155
- private readonly generators;
156
- private readonly cwd;
157
- private readonly debug;
158
- private isGenerating;
159
- private pendingRegenerations;
160
- constructor(options: OrchestratorOptions);
161
- /**
162
- * Check if generator should run for given trigger
163
- */
164
- private shouldRun;
165
- /**
166
- * Run all generators once
167
- *
168
- * @param trigger - How the generators are being triggered
169
- */
170
- generateAll(trigger?: GeneratorTrigger): Promise<void>;
171
- /**
172
- * Start watch mode
173
- */
174
- watch(): Promise<void>;
175
- }
176
-
177
- /**
178
- * Codegen Configuration Loader
179
- *
180
- * Loads codegen configuration from .spfnrc.json or package.json
181
- */
182
-
183
- interface CodegenConfig {
184
- generators?: Array<{
185
- path: string;
186
- } | ({
187
- name: string;
188
- enabled?: boolean;
189
- } & Record<string, any>)>;
190
- }
191
- /**
192
- * Load codegen configuration from .spfnrc.json or package.json
193
- */
194
- declare function loadCodegenConfig(cwd: string): CodegenConfig;
195
- /**
196
- * Create generator instances from configuration
197
- */
198
- declare function createGeneratorsFromConfig(config: CodegenConfig, cwd: string): Promise<Generator[]>;
199
-
200
- export { type ClientGenerationOptions, type CodegenConfig, CodegenOrchestrator, type GenerationStats, Generator, GeneratorTrigger, HttpMethod, type OrchestratorOptions, type ResourceRoutes, type RouteContractMapping, createGeneratorsFromConfig, generateClient, groupByResource, loadCodegenConfig, scanContracts, watchAndGenerate };
141
+ export { type ClientGenerationOptions, type CodegenConfig, CodegenOrchestrator, type GenerationStats, Generator, GeneratorTrigger, HttpMethod, type OrchestratorOptions, type ResourceRoutes, type RouteContractMapping, createGeneratorsFromConfig, loadCodegenConfig };