@spfn/core 0.1.0-alpha.64 → 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.
Files changed (37) hide show
  1. package/README.md +5 -5
  2. package/dist/{auto-loader-CdsxOceW.d.ts → auto-loader-JFaZ9gON.d.ts} +3 -2
  3. package/dist/cache/index.d.ts +211 -0
  4. package/dist/cache/index.js +992 -0
  5. package/dist/cache/index.js.map +1 -0
  6. package/dist/client/index.d.ts +2 -2
  7. package/dist/codegen/generators/index.d.ts +7 -6
  8. package/dist/codegen/generators/index.js +208 -27
  9. package/dist/codegen/generators/index.js.map +1 -1
  10. package/dist/codegen/index.d.ts +67 -118
  11. package/dist/codegen/index.js +1419 -1295
  12. package/dist/codegen/index.js.map +1 -1
  13. package/dist/database-errors-CoPrcOpq.d.ts +86 -0
  14. package/dist/db/index.d.ts +316 -9
  15. package/dist/db/index.js +6 -6
  16. package/dist/db/index.js.map +1 -1
  17. package/dist/error-handler-wjLL3v-a.d.ts +44 -0
  18. package/dist/errors/index.d.ts +119 -0
  19. package/dist/errors/index.js +160 -0
  20. package/dist/errors/index.js.map +1 -0
  21. package/dist/index-DHiAqhKv.d.ts +101 -0
  22. package/dist/index.d.ts +2 -228
  23. package/dist/index.js +274 -292
  24. package/dist/index.js.map +1 -1
  25. package/dist/middleware/index.d.ts +33 -0
  26. package/dist/middleware/index.js +890 -0
  27. package/dist/middleware/index.js.map +1 -0
  28. package/dist/route/index.d.ts +172 -7
  29. package/dist/route/index.js +209 -70
  30. package/dist/route/index.js.map +1 -1
  31. package/dist/server/index.js +267 -176
  32. package/dist/server/index.js.map +1 -1
  33. package/dist/{types-Bd8YsFSU.d.ts → types-CAON3Mmg.d.ts} +1 -1
  34. package/package.json +19 -2
  35. package/dist/bind-CSzshBtm.d.ts +0 -17
  36. package/dist/contract-generator-CqKsfsNE.d.ts +0 -52
  37. package/dist/postgres-errors-lw1aRUFe.d.ts +0 -397
@@ -1,10 +1,71 @@
1
- import { d as HttpMethod } from '../types-Bd8YsFSU.js';
2
- import { G as Generator } from '../contract-generator-CqKsfsNE.js';
3
- export { C as ContractGeneratorConfig, a as GeneratorOptions, c as createContractGenerator } from '../contract-generator-CqKsfsNE.js';
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';
4
+ import { H as HttpMethod } from '../types-CAON3Mmg.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
  *
@@ -50,6 +111,8 @@ interface ClientGenerationOptions {
50
111
  outputPath: string;
51
112
  /** Base URL for the API client */
52
113
  baseUrl?: string;
114
+ /** API object name (default: 'api') */
115
+ apiName?: string;
53
116
  /** Include type imports? */
54
117
  includeTypes?: boolean;
55
118
  /** Generate JSDoc comments? */
@@ -75,118 +138,4 @@ interface GenerationStats {
75
138
  duration: number;
76
139
  }
77
140
 
78
- /**
79
- * Contract Scanner
80
- *
81
- * Scans server/contracts directory and extracts exported contracts
82
- */
83
-
84
- /**
85
- * Scan for contract files and extract contract exports
86
- *
87
- * All contracts must use absolute paths (e.g., path: '/teams/:id')
88
- *
89
- * @param contractsDir - Path to lib/contracts/ directory
90
- * @returns Array of contract-to-route mappings
91
- */
92
- declare function scanContracts(contractsDir: string): Promise<RouteContractMapping[]>;
93
-
94
- /**
95
- * Route Scanner Utilities
96
- *
97
- * Helper functions for grouping and organizing route-contract mappings
98
- */
99
-
100
- /**
101
- * Group mappings by resource
102
- */
103
- declare function groupByResource(mappings: RouteContractMapping[]): Record<string, RouteContractMapping[]>;
104
-
105
- /**
106
- * Client Code Generator
107
- *
108
- * Generates type-safe API client code from route-contract mappings
109
- */
110
-
111
- /**
112
- * Generate API client code
113
- */
114
- declare function generateClient(mappings: RouteContractMapping[], options: ClientGenerationOptions): Promise<GenerationStats>;
115
-
116
- /**
117
- * Contract Watcher & Client Generator
118
- *
119
- * Watches contract files and regenerates client code
120
- */
121
- interface WatchGenerateOptions {
122
- /** Routes directory (default: src/server/routes) */
123
- routesDir?: string;
124
- /** Output path for generated client (default: src/lib/api.ts) */
125
- outputPath?: string;
126
- /** Base URL for API client */
127
- baseUrl?: string;
128
- /** Enable debug logging */
129
- debug?: boolean;
130
- /** Watch mode (default: true) */
131
- watch?: boolean;
132
- }
133
- /**
134
- * Watch contracts and generate client code
135
- */
136
- declare function watchAndGenerate(options?: WatchGenerateOptions): Promise<void>;
137
-
138
- /**
139
- * Codegen Orchestrator
140
- *
141
- * Manages multiple code generators and coordinates their execution
142
- */
143
-
144
- interface OrchestratorOptions {
145
- /** List of generators to orchestrate */
146
- generators: Generator[];
147
- /** Project root directory */
148
- cwd?: string;
149
- /** Enable debug logging */
150
- debug?: boolean;
151
- }
152
- declare class CodegenOrchestrator {
153
- private readonly generators;
154
- private readonly cwd;
155
- private readonly debug;
156
- private isGenerating;
157
- private pendingRegenerations;
158
- constructor(options: OrchestratorOptions);
159
- /**
160
- * Run all generators once
161
- */
162
- generateAll(): Promise<void>;
163
- /**
164
- * Start watch mode
165
- */
166
- watch(): Promise<void>;
167
- }
168
-
169
- /**
170
- * Codegen Configuration Loader
171
- *
172
- * Loads codegen configuration from .spfnrc.json or package.json
173
- */
174
-
175
- interface CodegenConfig {
176
- generators?: Array<{
177
- path: string;
178
- } | ({
179
- name: string;
180
- enabled?: boolean;
181
- } & Record<string, any>)>;
182
- }
183
- /**
184
- * Load codegen configuration from .spfnrc.json or package.json
185
- */
186
- declare function loadCodegenConfig(cwd: string): CodegenConfig;
187
- /**
188
- * Create generator instances from configuration
189
- */
190
- declare function createGeneratorsFromConfig(config: CodegenConfig, cwd: string): Promise<Generator[]>;
191
-
192
- export { type ClientGenerationOptions, type CodegenConfig, CodegenOrchestrator, type GenerationStats, Generator, 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 };