@luckystack/devkit 0.10.1 → 0.10.2
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 +5 -1
- package/CLAUDE.md +1 -1
- package/dist/index.js +82 -11
- package/dist/index.js.map +1 -1
- package/docs/type-map-generation.md +10 -2
- package/package.json +2 -2
|
@@ -196,6 +196,8 @@ const clientInputTypeResult = serverFile
|
|
|
196
196
|
|
|
197
197
|
Each `*TypeDetailsFromFile` returns `{ text, unresolvedSymbols }`; the symbols are merged into `unresolvedTypeAliases` / `namedImports` exactly the same way as in the API loop.
|
|
198
198
|
|
|
199
|
+
When a server file exists, its `auth` and `rateLimit` are read with the SAME extractors as the API side (`extractAuth` / `extractRateLimit`) and feed `syncMetaMap`. Only server-backed routes (cases 1 and 2) get a `syncMetaMap` / `syncInputSchemas` entry: a client-only sync is not a callable route, so there is nothing for the test-runner to sweep.
|
|
200
|
+
|
|
199
201
|
---
|
|
200
202
|
|
|
201
203
|
## Functions interface (`generateServerFunctions`)
|
|
@@ -294,6 +296,10 @@ export interface ApiMetaEntry { method, auth: { login, additional? }, rateLimit?
|
|
|
294
296
|
export const apiMetaMap: Record<...> = { ... };
|
|
295
297
|
export const getApiMeta = (...): ApiMetaEntry | undefined => ...;
|
|
296
298
|
|
|
299
|
+
export interface SyncMetaEntry { auth: { login, additional? }, rateLimit? };
|
|
300
|
+
export const syncMetaMap: Record<...> = { ... }; // server-backed syncs only
|
|
301
|
+
export const getSyncMeta = (...): SyncMetaEntry | undefined => ...;
|
|
302
|
+
|
|
297
303
|
export type SyncServerResponse<T = unknown> = ...;
|
|
298
304
|
export type SyncClientResponse<T = unknown> = ...;
|
|
299
305
|
|
|
@@ -323,7 +329,7 @@ Before writing, `validateGeneratedTypeIdentifiers(content)` parses the content w
|
|
|
323
329
|
|
|
324
330
|
### `schemasContent` -> `apiInputSchemas.generated.ts`
|
|
325
331
|
|
|
326
|
-
Built by `buildSchemasContent
|
|
332
|
+
Built by `buildSchemasContent`. Loops over the API map again, runs each input type through `typeTextToZodSource` (from `typeMap/zodEmitter.ts`), and emits:
|
|
327
333
|
|
|
328
334
|
```typescript
|
|
329
335
|
import { z } from 'zod';
|
|
@@ -340,7 +346,9 @@ export const getApiInputSchema = (pagePath, apiName, version): z.ZodTypeAny | un
|
|
|
340
346
|
apiInputSchemas[pagePath]?.[apiName]?.[version];
|
|
341
347
|
```
|
|
342
348
|
|
|
343
|
-
`typeTextToZodSource` walks the TS-AST of the inline type literal and emits Zod source. Unsupported shapes fall back to `z.any() /* unparseable input type */` with a TODO.
|
|
349
|
+
`typeTextToZodSource` walks the TS-AST of the inline type literal and emits Zod source. Unsupported shapes fall back to `z.any() /* unparseable input type */` with a TODO.
|
|
350
|
+
|
|
351
|
+
A sibling `syncInputSchemas` / `getSyncInputSchema` pair covers every server-backed sync route, built from its `clientInput` (the `data` the client sends) with the same converter and fallback. It exists so the test-runner sweeps (contract / fuzz) can reach sync routes the way they reach API routes. Sync input fallbacks to `z.any()` are recorded in `apiTypeDiagnostics.generated.json` exactly like API ones. Output and stream types never get a schema.
|
|
344
352
|
|
|
345
353
|
### `docsData` -> `apiDocs.generated.json`
|
|
346
354
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luckystack/devkit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test": "vitest run"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@luckystack/core": "^0.10.
|
|
59
|
+
"@luckystack/core": "^0.10.2",
|
|
60
60
|
"chokidar": "^5.0.0",
|
|
61
61
|
"dotenv": "^17.0.0"
|
|
62
62
|
},
|