lazypock 0.1.0 → 0.1.1
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/README.md +98 -0
- package/dist/chunk-3MZJ5HCD.js +190 -0
- package/dist/chunk-3MZJ5HCD.js.map +1 -0
- package/dist/cli.cjs +221 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.global.js +229 -0
- package/dist/cli.global.js.map +1 -0
- package/dist/cli.js +91 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +262 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +188 -12
- package/dist/index.d.ts +188 -12
- package/dist/index.global.js +254 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +80 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -1
- package/src/cli.ts +117 -0
- package/src/client.ts +48 -0
- package/src/codegen.ts +149 -0
- package/src/collection.ts +33 -21
- package/src/index.ts +28 -408
- package/src/lazypock.ts +481 -0
- package/src/schema.ts +39 -0
- package/src/typegen.ts +137 -0
- package/src/types.ts +36 -2
package/README.md
CHANGED
|
@@ -36,6 +36,104 @@ const file = await client.files.upload(fileInput.files[0]);
|
|
|
36
36
|
client.collection('posts').subscribe('*', (e) => console.log(e.action, e.record));
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Type Safety
|
|
40
|
+
|
|
41
|
+
The SDK offers three levels of type safety — pick what fits your project.
|
|
42
|
+
|
|
43
|
+
### 1. Fully typed via codegen (recommended)
|
|
44
|
+
|
|
45
|
+
Connect to your API once and generate a typed client — every collection becomes
|
|
46
|
+
an interface with the exact field types from your schema (selects become string
|
|
47
|
+
unions, relations become record IDs, etc.).
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# In your app, after installing lazypock:
|
|
51
|
+
npx lazypock-gen \
|
|
52
|
+
--url http://localhost:4000/api \
|
|
53
|
+
--email admin@example.com \
|
|
54
|
+
--password your-password
|
|
55
|
+
# writes ./lazypock.types.ts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Then in your app:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { createClient } from './lazypock.types';
|
|
62
|
+
|
|
63
|
+
const client = createClient({ baseUrl: 'http://localhost:4000/api' });
|
|
64
|
+
await client.login('admin@example.com', 'password');
|
|
65
|
+
|
|
66
|
+
// Collection access is fully type-checked:
|
|
67
|
+
const post = await client.collection('posts').getOne('abc123');
|
|
68
|
+
// post.title — string, post.published — boolean, …
|
|
69
|
+
|
|
70
|
+
await client.collection('posts').create({ title: 'x' }); // ✓
|
|
71
|
+
await client.collection('posts').create({ nope: 1 }); // ✗ compile error
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Collection names are strict by design.** The typed client accepts only the
|
|
75
|
+
> literal collection names from your schema (`'posts'`, `'users'`, …) and rejects
|
|
76
|
+
> typos at compile time. If you need a *dynamic* collection name (e.g. a route
|
|
77
|
+
> param), use the base client or a cast:
|
|
78
|
+
>
|
|
79
|
+
> ```typescript
|
|
80
|
+
> const base = new LazypockClient({ baseUrl: 'http://localhost:4000/api' });
|
|
81
|
+
> base.collection(name); // dynamic, untyped
|
|
82
|
+
> client.collection(name as keyof LazypockCollections); // typed escape hatch
|
|
83
|
+
> ```
|
|
84
|
+
|
|
85
|
+
### 2. Hand-written generics (no codegen)
|
|
86
|
+
|
|
87
|
+
Pass a record interface to `collection<T>()` or use `.typed<T>()`:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
interface Post {
|
|
91
|
+
id: string;
|
|
92
|
+
title: string;
|
|
93
|
+
published: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const postsSvc = client.collection('posts').typed<Post>();
|
|
97
|
+
const post = await postsSvc.getOne('abc123'); // post.title: string
|
|
98
|
+
|
|
99
|
+
await postsSvc.create({ title: 'Hi', published: true }); // ✓
|
|
100
|
+
await postsSvc.create({ title: 'Hi', nope: 1 }); // ✗ compile error
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3. Runtime schema types (experimental)
|
|
104
|
+
|
|
105
|
+
Fetch schemas at runtime and let the client derive field types:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
const res = await fetch('http://localhost:4000/api/collections', {
|
|
109
|
+
headers: { Authorization: 'Bearer ' + token },
|
|
110
|
+
});
|
|
111
|
+
const { items } = await res.json(); // CollectionSchema[]
|
|
112
|
+
|
|
113
|
+
const client = new LazypockClient({
|
|
114
|
+
baseUrl: 'http://localhost:4000/api',
|
|
115
|
+
types: { schemas: items },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const code = client.generateTypes(); // string — write to lazypock.types.ts
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### CLI reference
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
lazypock-gen [options]
|
|
125
|
+
|
|
126
|
+
Options:
|
|
127
|
+
--url <url> API base URL (or LAZYPOCK_URL)
|
|
128
|
+
--email <email> Superuser email (or LAZYPOCK_EMAIL)
|
|
129
|
+
--password <pw> Superuser password (or LAZYPOCK_PASSWORD)
|
|
130
|
+
--out <file> Output file (default: lazypock.types.ts)
|
|
131
|
+
--package <name> Package name to import (default: lazypock)
|
|
132
|
+
--skip-system Skip system collections
|
|
133
|
+
```
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
|
|
39
137
|
## API Reference
|
|
40
138
|
|
|
41
139
|
### LazypockClient
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// src/typegen.ts
|
|
2
|
+
function fieldTypeScriptType(field, fallback = "unknown") {
|
|
3
|
+
const opts = field.options ?? {};
|
|
4
|
+
switch (field.type) {
|
|
5
|
+
case "text":
|
|
6
|
+
case "email":
|
|
7
|
+
case "url":
|
|
8
|
+
case "editor":
|
|
9
|
+
case "date":
|
|
10
|
+
case "datetime":
|
|
11
|
+
return "string";
|
|
12
|
+
case "number":
|
|
13
|
+
return "number";
|
|
14
|
+
case "bool":
|
|
15
|
+
return "boolean";
|
|
16
|
+
case "select": {
|
|
17
|
+
const values = Array.isArray(opts.values) ? opts.values : [];
|
|
18
|
+
if (values.length > 0) {
|
|
19
|
+
return values.map((v) => JSON.stringify(String(v))).join(" | ");
|
|
20
|
+
}
|
|
21
|
+
return "string";
|
|
22
|
+
}
|
|
23
|
+
case "multi_select": {
|
|
24
|
+
const values = Array.isArray(opts.values) ? opts.values : [];
|
|
25
|
+
if (values.length > 0) {
|
|
26
|
+
return `(${values.map((v) => JSON.stringify(String(v))).join(" | ")})[]`;
|
|
27
|
+
}
|
|
28
|
+
return "string[]";
|
|
29
|
+
}
|
|
30
|
+
case "file":
|
|
31
|
+
return "string";
|
|
32
|
+
case "multi_file":
|
|
33
|
+
return "string[]";
|
|
34
|
+
case "json":
|
|
35
|
+
case "geo":
|
|
36
|
+
return "Record<string, unknown>";
|
|
37
|
+
case "relation":
|
|
38
|
+
return (opts.maxSelect ?? 1) > 1 ? "string[]" : "string";
|
|
39
|
+
case "password":
|
|
40
|
+
return "never";
|
|
41
|
+
default:
|
|
42
|
+
return fallback;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function fieldTypeKind(field) {
|
|
46
|
+
const opts = field.options ?? {};
|
|
47
|
+
switch (field.type) {
|
|
48
|
+
case "text":
|
|
49
|
+
case "email":
|
|
50
|
+
case "url":
|
|
51
|
+
case "editor":
|
|
52
|
+
case "date":
|
|
53
|
+
case "datetime":
|
|
54
|
+
case "select":
|
|
55
|
+
case "file":
|
|
56
|
+
return "string";
|
|
57
|
+
case "number":
|
|
58
|
+
return "number";
|
|
59
|
+
case "bool":
|
|
60
|
+
return "boolean";
|
|
61
|
+
case "multi_select":
|
|
62
|
+
case "multi_file":
|
|
63
|
+
return "string-array";
|
|
64
|
+
case "json":
|
|
65
|
+
case "geo":
|
|
66
|
+
return "json";
|
|
67
|
+
case "relation":
|
|
68
|
+
return (opts.maxSelect ?? 1) > 1 ? "relation-many" : "relation";
|
|
69
|
+
case "password":
|
|
70
|
+
return "password";
|
|
71
|
+
default:
|
|
72
|
+
return "unknown";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function schemaFieldType(field) {
|
|
76
|
+
switch (fieldTypeKind(field)) {
|
|
77
|
+
case "string":
|
|
78
|
+
return String;
|
|
79
|
+
case "number":
|
|
80
|
+
return Number;
|
|
81
|
+
case "boolean":
|
|
82
|
+
return Boolean;
|
|
83
|
+
case "string-array":
|
|
84
|
+
return [String];
|
|
85
|
+
case "relation":
|
|
86
|
+
return String;
|
|
87
|
+
case "relation-many":
|
|
88
|
+
return [String];
|
|
89
|
+
case "json":
|
|
90
|
+
return Object;
|
|
91
|
+
case "password":
|
|
92
|
+
return void 0;
|
|
93
|
+
case "unknown":
|
|
94
|
+
return void 0;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/codegen.ts
|
|
99
|
+
function collectionTypeName(name) {
|
|
100
|
+
return name.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("").replace(/^[0-9]/, "_$&");
|
|
101
|
+
}
|
|
102
|
+
function fieldKey(name) {
|
|
103
|
+
return name.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
104
|
+
}
|
|
105
|
+
function generateTypes(collections, options = {}) {
|
|
106
|
+
const {
|
|
107
|
+
packageName = "lazypock",
|
|
108
|
+
includeBaseFields = true,
|
|
109
|
+
skipSystem = false
|
|
110
|
+
} = options;
|
|
111
|
+
const filtered = skipSystem ? collections.filter(
|
|
112
|
+
(c) => !c.system && !c.name.startsWith("_") && c.name !== "users"
|
|
113
|
+
) : collections;
|
|
114
|
+
const sections = [];
|
|
115
|
+
sections.push(`// \u2500\u2500 Auto-generated by lazypock-ts \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
116
|
+
// Do not edit by hand. Regenerate with: npx lazypock-gen
|
|
117
|
+
// Schema snapshot: ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
118
|
+
if (includeBaseFields) {
|
|
119
|
+
sections.push(`export interface BaseRecord {
|
|
120
|
+
id: string;
|
|
121
|
+
collectionId: string;
|
|
122
|
+
collectionName: string;
|
|
123
|
+
created: string;
|
|
124
|
+
updated: string;
|
|
125
|
+
}`);
|
|
126
|
+
}
|
|
127
|
+
for (const coll of filtered) {
|
|
128
|
+
const typeName = collectionTypeName(coll.name);
|
|
129
|
+
const fields = coll.fields ?? [];
|
|
130
|
+
const lines = fields.map((f) => memberLine(f)).filter((l) => l !== "");
|
|
131
|
+
const body = lines.join("\n");
|
|
132
|
+
sections.push(
|
|
133
|
+
`export interface ${typeName}Record${renderInterface({
|
|
134
|
+
extends: includeBaseFields ? "BaseRecord" : void 0,
|
|
135
|
+
body
|
|
136
|
+
})}`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
sections.push(`export interface AuthRecord extends BaseRecord {
|
|
140
|
+
email: string;
|
|
141
|
+
verified: boolean;
|
|
142
|
+
}`);
|
|
143
|
+
const mapEntries = filtered.map(
|
|
144
|
+
(c) => ` "${c.name}": ${collectionTypeName(c.name)}Record${c.type === "auth" ? " & AuthRecord" : ""};`
|
|
145
|
+
).join("\n");
|
|
146
|
+
sections.push(`export interface LazypockCollections {
|
|
147
|
+
${mapEntries}
|
|
148
|
+
}`);
|
|
149
|
+
sections.push(`import { LazypockClient, type LazypockClientOptions, type CollectionService } from "${packageName}";
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Create a Lazypock client typed against this schema snapshot.
|
|
153
|
+
* Collection access is fully type-checked:
|
|
154
|
+
* client.collection("posts").create({ title: "x" }) // title must exist
|
|
155
|
+
*/
|
|
156
|
+
export function createClient(options: LazypockClientOptions): TypedClient {
|
|
157
|
+
return new TypedClient(options);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export class TypedClient extends LazypockClient {
|
|
161
|
+
override collection<K extends keyof LazypockCollections>(name: K): CollectionService<LazypockCollections[K]>;
|
|
162
|
+
override collection(name: string): CollectionService<unknown> {
|
|
163
|
+
return super.collection(name) as unknown as CollectionService<unknown>;
|
|
164
|
+
}
|
|
165
|
+
}`);
|
|
166
|
+
return sections.join("\n\n") + "\n";
|
|
167
|
+
}
|
|
168
|
+
function renderInterface(opts) {
|
|
169
|
+
const ext = opts.extends ? ` extends ${opts.extends}` : "";
|
|
170
|
+
if (!opts.body) return `${ext} {}`;
|
|
171
|
+
return `${ext} {
|
|
172
|
+
${opts.body}
|
|
173
|
+
}`;
|
|
174
|
+
}
|
|
175
|
+
function memberLine(f) {
|
|
176
|
+
const key = fieldKey(f.name);
|
|
177
|
+
const req = f.required || f.type === "password" ? "" : "?";
|
|
178
|
+
const type = fieldTypeScriptType(f);
|
|
179
|
+
if (type === "never") return "";
|
|
180
|
+
return ` ${JSON.stringify(key)}${req}: ${type};`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export {
|
|
184
|
+
fieldTypeScriptType,
|
|
185
|
+
fieldTypeKind,
|
|
186
|
+
schemaFieldType,
|
|
187
|
+
collectionTypeName,
|
|
188
|
+
generateTypes
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=chunk-3MZJ5HCD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/typegen.ts","../src/codegen.ts"],"sourcesContent":["// ── Type mapping (runtime + codegen) ────────────────────\n// Maps server field types to TypeScript types.\n// Shared by the runtime `SchemaTypes` helper and the codegen CLI.\n\nimport type { SchemaField } from \"./schema\";\n\n/**\n * Map a single server field to its TypeScript type string.\n * Used by the codegen CLI to emit interface members.\n *\n * @param field The field definition.\n * @param fallback Fallback type for unknown field types (default `unknown`).\n */\nexport function fieldTypeScriptType(\n\tfield: SchemaField,\n\tfallback = \"unknown\",\n): string {\n\tconst opts = field.options ?? {};\n\tswitch (field.type) {\n\t\tcase \"text\":\n\t\tcase \"email\":\n\t\tcase \"url\":\n\t\tcase \"editor\":\n\t\tcase \"date\":\n\t\tcase \"datetime\":\n\t\t\treturn \"string\";\n\t\tcase \"number\":\n\t\t\treturn \"number\";\n\t\tcase \"bool\":\n\t\t\treturn \"boolean\";\n\t\tcase \"select\": {\n\t\t\tconst values = Array.isArray(opts.values) ? opts.values : [];\n\t\t\tif (values.length > 0) {\n\t\t\t\treturn values.map((v) => JSON.stringify(String(v))).join(\" | \");\n\t\t\t}\n\t\t\treturn \"string\";\n\t\t}\n\t\tcase \"multi_select\": {\n\t\t\tconst values = Array.isArray(opts.values) ? opts.values : [];\n\t\t\tif (values.length > 0) {\n\t\t\t\treturn `(${values.map((v) => JSON.stringify(String(v))).join(\" | \")})[]`;\n\t\t\t}\n\t\t\treturn \"string[]\";\n\t\t}\n\t\tcase \"file\":\n\t\t\treturn \"string\";\n\t\tcase \"multi_file\":\n\t\t\treturn \"string[]\";\n\t\tcase \"json\":\n\t\tcase \"geo\":\n\t\t\treturn \"Record<string, unknown>\";\n\t\tcase \"relation\":\n\t\t\t// Relations store the target record's ID (string) — or an array\n\t\t\t// of IDs when multi-relation (maxSelect > 1).\n\t\t\treturn (opts.maxSelect ?? 1) > 1 ? \"string[]\" : \"string\";\n\t\tcase \"password\":\n\t\t\t// Passwords are write-only; never expose on read models.\n\t\t\treturn \"never\";\n\t\tdefault:\n\t\t\treturn fallback;\n\t}\n}\n\n/**\n * Returns the runtime type kind for a field — used by {@link schemaFieldType}\n * to build structural types at runtime.\n */\nexport type FieldTypeKind =\n\t| \"string\"\n\t| \"number\"\n\t| \"boolean\"\n\t| \"string-array\"\n\t| \"json\"\n\t| \"relation\"\n\t| \"relation-many\"\n\t| \"password\"\n\t| \"unknown\";\n\n/** Map a server field to its runtime type kind. */\nexport function fieldTypeKind(field: SchemaField): FieldTypeKind {\n\tconst opts = field.options ?? {};\n\tswitch (field.type) {\n\t\tcase \"text\":\n\t\tcase \"email\":\n\t\tcase \"url\":\n\t\tcase \"editor\":\n\t\tcase \"date\":\n\t\tcase \"datetime\":\n\t\tcase \"select\":\n\t\tcase \"file\":\n\t\t\treturn \"string\";\n\t\tcase \"number\":\n\t\t\treturn \"number\";\n\t\tcase \"bool\":\n\t\t\treturn \"boolean\";\n\t\tcase \"multi_select\":\n\t\tcase \"multi_file\":\n\t\t\treturn \"string-array\";\n\t\tcase \"json\":\n\t\tcase \"geo\":\n\t\t\treturn \"json\";\n\t\tcase \"relation\":\n\t\t\treturn (opts.maxSelect ?? 1) > 1 ? \"relation-many\" : \"relation\";\n\t\tcase \"password\":\n\t\t\treturn \"password\";\n\t\tdefault:\n\t\t\treturn \"unknown\";\n\t}\n}\n\n/**\n * Derive a TypeScript field type from a {@link SchemaField} — the runtime\n * counterpart to the codegen mapper. Lets consumers build typed clients\n * from a fetched schema without running the CLI.\n */\nexport function schemaFieldType(field: SchemaField): unknown {\n\tswitch (fieldTypeKind(field)) {\n\t\tcase \"string\":\n\t\t\treturn String;\n\t\tcase \"number\":\n\t\t\treturn Number;\n\t\tcase \"boolean\":\n\t\t\treturn Boolean;\n\t\tcase \"string-array\":\n\t\t\treturn [String] as const;\n\t\tcase \"relation\":\n\t\t\treturn String;\n\t\tcase \"relation-many\":\n\t\t\treturn [String] as const;\n\t\tcase \"json\":\n\t\t\treturn Object;\n\t\tcase \"password\":\n\t\t\treturn undefined;\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t}\n}\n","// ── Codegen ─────────────────────────────────────────────\n// Generates a `lazypock.types.ts` module from the live API schema.\n//\n// The generated file exports:\n// - One interface per collection (e.g. `PostsRecord`)\n// - A `LazypockCollections` map: { posts: PostsRecord; users: UsersRecord; ... }\n// - A `createClient()` factory pre-bound to those types, so\n// `client.collection(\"posts\").create({ title: \"x\" })` is fully type-checked.\n//\n// The CLI in `src/cli.ts` wires this to `GET /collections`.\n\nimport type { CollectionSchema, SchemaField } from \"./schema\";\nimport { fieldTypeScriptType } from \"./typegen\";\n\n/** Format a raw collection name into a valid TS identifier (PascalCase). */\nexport function collectionTypeName(name: string): string {\n\treturn name\n\t\t.split(/[^a-zA-Z0-9]+/)\n\t\t.filter(Boolean)\n\t\t.map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n\t\t.join(\"\")\n\t\t.replace(/^[0-9]/, \"_$&\");\n}\n\n/** Interface member name — sanitize hyphens/spaces but keep readability. */\nexport function fieldKey(name: string): string {\n\treturn name.replace(/[^a-zA-Z0-9_]/g, \"_\");\n}\n\n\n\n/**\n * Generate the full TypeScript source for the typed SDK module.\n *\n * @param collections Collections fetched from the API.\n * @param options Generation options.\n */\nexport function generateTypes(\n\tcollections: CollectionSchema[],\n\toptions: {\n\t\t/** Import specifier for the lazypock package (default `lazypock`). */\n\t\tpackageName?: string;\n\t\t/** Emit base record fields (id, created, updated, …). Default true. */\n\t\tincludeBaseFields?: boolean;\n\t\t/** Skip system collections (names starting with `_` or `users`). Default false. */\n\t\tskipSystem?: boolean;\n\t} = {},\n): string {\n\tconst {\n\t\tpackageName = \"lazypock\",\n\t\tincludeBaseFields = true,\n\t\tskipSystem = false,\n\t} = options;\n\n\tconst filtered = skipSystem\n\t\t? collections.filter(\n\t\t\t\t(c) => !c.system && !c.name.startsWith(\"_\") && c.name !== \"users\",\n\t\t\t)\n\t\t: collections;\n\n\tconst sections: string[] = [];\n\tsections.push(`// ── Auto-generated by lazypock-ts ──────────────────────────\n// Do not edit by hand. Regenerate with: npx lazypock-gen\n// Schema snapshot: ${new Date().toISOString()}`);\n\n\tif (includeBaseFields) {\n\t\tsections.push(`export interface BaseRecord {\n id: string;\n collectionId: string;\n collectionName: string;\n created: string;\n updated: string;\n}`);\n\t}\n\n\t// One interface per collection\n\tfor (const coll of filtered) {\n\t\tconst typeName = collectionTypeName(coll.name);\n\t\tconst fields = coll.fields ?? [];\n\t\tconst lines = fields.map((f) => memberLine(f)).filter((l) => l !== \"\");\n\t\tconst body = lines.join(\"\\n\");\n\t\tsections.push(\n\t\t\t`export interface ${typeName}Record${renderInterface({\n\t\t\t\textends: includeBaseFields ? \"BaseRecord\" : undefined,\n\t\t\t\tbody,\n\t\t\t})}`,\n\t\t);\n\t}\n\n\t// Auth collection type\n\tsections.push(`export interface AuthRecord extends BaseRecord {\n email: string;\n verified: boolean;\n}`);\n\n\t// Collections map\n\tconst mapEntries = filtered\n\t\t.map(\n\t\t\t(c) =>\n\t\t\t\t` \"${c.name}\": ${collectionTypeName(c.name)}Record${\n\t\t\t\t\tc.type === \"auth\" ? \" & AuthRecord\" : \"\"\n\t\t\t\t};`,\n\t\t)\n\t\t.join(\"\\n\");\n\tsections.push(`export interface LazypockCollections {\n${mapEntries}\n}`);\n\n\t// createClient factory\n\tsections.push(`import { LazypockClient, type LazypockClientOptions, type CollectionService } from \"${packageName}\";\n\n/**\n * Create a Lazypock client typed against this schema snapshot.\n * Collection access is fully type-checked:\n * client.collection(\"posts\").create({ title: \"x\" }) // title must exist\n */\nexport function createClient(options: LazypockClientOptions): TypedClient {\n return new TypedClient(options);\n}\n\nexport class TypedClient extends LazypockClient {\n override collection<K extends keyof LazypockCollections>(name: K): CollectionService<LazypockCollections[K]>;\n override collection(name: string): CollectionService<unknown> {\n return super.collection(name) as unknown as CollectionService<unknown>;\n }\n}`);\n\n\treturn sections.join(\"\\n\\n\") + \"\\n\";\n}\n\n/**\n * Render the interface body including the extends clause.\n * Empty body → ` extends BaseRecord {}` (valid TS).\n */\nfunction renderInterface(opts: { extends?: string; body: string }): string {\n\tconst ext = opts.extends ? ` extends ${opts.extends}` : \"\";\n\tif (!opts.body) return `${ext} {}`;\n\treturn `${ext} {\\n${opts.body}\\n}`;\n}\n\n/** Render a single interface member line for a field. */\nfunction memberLine(f: SchemaField): string {\n\tconst key = fieldKey(f.name);\n\tconst req = f.required || f.type === \"password\" ? \"\" : \"?\";\n\tconst type = fieldTypeScriptType(f);\n\t// `never` members (passwords) are omitted from read models.\n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;AAGA,SAAS,WAAW,GAAwB;AAC3C,QAAM,MAAM,SAAS,EAAE,IAAI;AAC3B,QAAM,MAAM,EAAE,YAAY,EAAE,SAAS,aAAa,KAAK;AACvD,QAAM,OAAO,oBAAoB,CAAC;AAElC,MAAI,SAAS,QAAS,QAAO;AAC7B,SAAO,KAAK,KAAK,UAAU,GAAG,CAAC,GAAG,GAAG,KAAK,IAAI;AAC/C;","names":[]}
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// src/cli.ts
|
|
5
|
+
var import_promises = require("fs/promises");
|
|
6
|
+
var import_node_path = require("path");
|
|
7
|
+
|
|
8
|
+
// src/typegen.ts
|
|
9
|
+
function fieldTypeScriptType(field, fallback = "unknown") {
|
|
10
|
+
const opts = field.options ?? {};
|
|
11
|
+
switch (field.type) {
|
|
12
|
+
case "text":
|
|
13
|
+
case "email":
|
|
14
|
+
case "url":
|
|
15
|
+
case "editor":
|
|
16
|
+
case "date":
|
|
17
|
+
case "datetime":
|
|
18
|
+
return "string";
|
|
19
|
+
case "number":
|
|
20
|
+
return "number";
|
|
21
|
+
case "bool":
|
|
22
|
+
return "boolean";
|
|
23
|
+
case "select": {
|
|
24
|
+
const values = Array.isArray(opts.values) ? opts.values : [];
|
|
25
|
+
if (values.length > 0) {
|
|
26
|
+
return values.map((v) => JSON.stringify(String(v))).join(" | ");
|
|
27
|
+
}
|
|
28
|
+
return "string";
|
|
29
|
+
}
|
|
30
|
+
case "multi_select": {
|
|
31
|
+
const values = Array.isArray(opts.values) ? opts.values : [];
|
|
32
|
+
if (values.length > 0) {
|
|
33
|
+
return `(${values.map((v) => JSON.stringify(String(v))).join(" | ")})[]`;
|
|
34
|
+
}
|
|
35
|
+
return "string[]";
|
|
36
|
+
}
|
|
37
|
+
case "file":
|
|
38
|
+
return "string";
|
|
39
|
+
case "multi_file":
|
|
40
|
+
return "string[]";
|
|
41
|
+
case "json":
|
|
42
|
+
case "geo":
|
|
43
|
+
return "Record<string, unknown>";
|
|
44
|
+
case "relation":
|
|
45
|
+
return (opts.maxSelect ?? 1) > 1 ? "string[]" : "string";
|
|
46
|
+
case "password":
|
|
47
|
+
return "never";
|
|
48
|
+
default:
|
|
49
|
+
return fallback;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/codegen.ts
|
|
54
|
+
function collectionTypeName(name) {
|
|
55
|
+
return name.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("").replace(/^[0-9]/, "_$&");
|
|
56
|
+
}
|
|
57
|
+
function fieldKey(name) {
|
|
58
|
+
return name.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
59
|
+
}
|
|
60
|
+
function generateTypes(collections, options = {}) {
|
|
61
|
+
const {
|
|
62
|
+
packageName = "lazypock",
|
|
63
|
+
includeBaseFields = true,
|
|
64
|
+
skipSystem = false
|
|
65
|
+
} = options;
|
|
66
|
+
const filtered = skipSystem ? collections.filter(
|
|
67
|
+
(c) => !c.system && !c.name.startsWith("_") && c.name !== "users"
|
|
68
|
+
) : collections;
|
|
69
|
+
const sections = [];
|
|
70
|
+
sections.push(`// \u2500\u2500 Auto-generated by lazypock-ts \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
71
|
+
// Do not edit by hand. Regenerate with: npx lazypock-gen
|
|
72
|
+
// Schema snapshot: ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
73
|
+
if (includeBaseFields) {
|
|
74
|
+
sections.push(`export interface BaseRecord {
|
|
75
|
+
id: string;
|
|
76
|
+
collectionId: string;
|
|
77
|
+
collectionName: string;
|
|
78
|
+
created: string;
|
|
79
|
+
updated: string;
|
|
80
|
+
}`);
|
|
81
|
+
}
|
|
82
|
+
for (const coll of filtered) {
|
|
83
|
+
const typeName = collectionTypeName(coll.name);
|
|
84
|
+
const fields = coll.fields ?? [];
|
|
85
|
+
const lines = fields.map((f) => memberLine(f)).filter((l) => l !== "");
|
|
86
|
+
const body = lines.join("\n");
|
|
87
|
+
sections.push(
|
|
88
|
+
`export interface ${typeName}Record${renderInterface({
|
|
89
|
+
extends: includeBaseFields ? "BaseRecord" : void 0,
|
|
90
|
+
body
|
|
91
|
+
})}`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
sections.push(`export interface AuthRecord extends BaseRecord {
|
|
95
|
+
email: string;
|
|
96
|
+
verified: boolean;
|
|
97
|
+
}`);
|
|
98
|
+
const mapEntries = filtered.map(
|
|
99
|
+
(c) => ` "${c.name}": ${collectionTypeName(c.name)}Record${c.type === "auth" ? " & AuthRecord" : ""};`
|
|
100
|
+
).join("\n");
|
|
101
|
+
sections.push(`export interface LazypockCollections {
|
|
102
|
+
${mapEntries}
|
|
103
|
+
}`);
|
|
104
|
+
sections.push(`import { LazypockClient, type LazypockClientOptions, type CollectionService } from "${packageName}";
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Create a Lazypock client typed against this schema snapshot.
|
|
108
|
+
* Collection access is fully type-checked:
|
|
109
|
+
* client.collection("posts").create({ title: "x" }) // title must exist
|
|
110
|
+
*/
|
|
111
|
+
export function createClient(options: LazypockClientOptions): TypedClient {
|
|
112
|
+
return new TypedClient(options);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class TypedClient extends LazypockClient {
|
|
116
|
+
override collection<K extends keyof LazypockCollections>(name: K): CollectionService<LazypockCollections[K]>;
|
|
117
|
+
override collection(name: string): CollectionService<unknown> {
|
|
118
|
+
return super.collection(name) as unknown as CollectionService<unknown>;
|
|
119
|
+
}
|
|
120
|
+
}`);
|
|
121
|
+
return sections.join("\n\n") + "\n";
|
|
122
|
+
}
|
|
123
|
+
function renderInterface(opts) {
|
|
124
|
+
const ext = opts.extends ? ` extends ${opts.extends}` : "";
|
|
125
|
+
if (!opts.body) return `${ext} {}`;
|
|
126
|
+
return `${ext} {
|
|
127
|
+
${opts.body}
|
|
128
|
+
}`;
|
|
129
|
+
}
|
|
130
|
+
function memberLine(f) {
|
|
131
|
+
const key = fieldKey(f.name);
|
|
132
|
+
const req = f.required || f.type === "password" ? "" : "?";
|
|
133
|
+
const type = fieldTypeScriptType(f);
|
|
134
|
+
if (type === "never") return "";
|
|
135
|
+
return ` ${JSON.stringify(key)}${req}: ${type};`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/cli.ts
|
|
139
|
+
function fail(msg) {
|
|
140
|
+
console.error(`
|
|
141
|
+
\u274C ${msg}
|
|
142
|
+
`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
function parseArgs(argv) {
|
|
146
|
+
const args = [...argv];
|
|
147
|
+
const get = (flag, envKey, def = "") => {
|
|
148
|
+
const i = args.indexOf(flag);
|
|
149
|
+
if (i !== -1 && i + 1 < args.length) return args[i + 1];
|
|
150
|
+
return process.env[envKey] ?? def;
|
|
151
|
+
};
|
|
152
|
+
const has = (flag) => args.includes(flag);
|
|
153
|
+
const url = get("--url", "LAZYPOCK_URL");
|
|
154
|
+
const email = get("--email", "LAZYPOCK_EMAIL");
|
|
155
|
+
const password = get("--password", "LAZYPOCK_PASSWORD");
|
|
156
|
+
if (!url) fail("Missing API URL. Pass --url or set LAZYPOCK_URL.");
|
|
157
|
+
if (!email)
|
|
158
|
+
fail("Missing superuser email. Pass --email or set LAZYPOCK_EMAIL.");
|
|
159
|
+
if (!password)
|
|
160
|
+
fail("Missing password. Pass --password or set LAZYPOCK_PASSWORD.");
|
|
161
|
+
const out = get("--out", "LAZYPOCK_OUT", "lazypock.types.ts");
|
|
162
|
+
const packageName = get("--package", "LAZYPOCK_PACKAGE", "lazypock");
|
|
163
|
+
return {
|
|
164
|
+
url,
|
|
165
|
+
email,
|
|
166
|
+
password,
|
|
167
|
+
out,
|
|
168
|
+
packageName,
|
|
169
|
+
skipSystem: has("--skip-system")
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
async function fetchCollections(opts) {
|
|
173
|
+
const loginUrl = opts.url.replace(/\/+$/, "") + "/superusers/login";
|
|
174
|
+
const loginRes = await fetch(loginUrl, {
|
|
175
|
+
method: "POST",
|
|
176
|
+
headers: { "Content-Type": "application/json" },
|
|
177
|
+
body: JSON.stringify({ email: opts.email, password: opts.password })
|
|
178
|
+
});
|
|
179
|
+
if (!loginRes.ok) {
|
|
180
|
+
const text = await loginRes.text();
|
|
181
|
+
fail(`Superuser login failed (${loginRes.status}). ${text.slice(0, 200)}`);
|
|
182
|
+
}
|
|
183
|
+
const loginData = await loginRes.json();
|
|
184
|
+
if (!loginData.token) fail("Login response did not include a token.");
|
|
185
|
+
const collUrl = opts.url.replace(/\/+$/, "") + "/collections";
|
|
186
|
+
const collRes = await fetch(collUrl, {
|
|
187
|
+
headers: { Authorization: "Bearer " + loginData.token }
|
|
188
|
+
});
|
|
189
|
+
if (!collRes.ok) {
|
|
190
|
+
const text = await collRes.text();
|
|
191
|
+
fail(
|
|
192
|
+
`Failed to fetch collections (${collRes.status}). ${text.slice(0, 200)}`
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return await collRes.json();
|
|
196
|
+
}
|
|
197
|
+
async function main() {
|
|
198
|
+
const opts = parseArgs(process.argv.slice(2));
|
|
199
|
+
console.log(`
|
|
200
|
+
\u{1F50C} Connecting to ${opts.url} as ${opts.email} \u2026`);
|
|
201
|
+
const { items } = await fetchCollections(opts);
|
|
202
|
+
console.log(`\u{1F4E6} Found ${items.length} collection(s).`);
|
|
203
|
+
const source = generateTypes(items, {
|
|
204
|
+
packageName: opts.packageName,
|
|
205
|
+
skipSystem: opts.skipSystem
|
|
206
|
+
});
|
|
207
|
+
const outPath = (0, import_node_path.resolve)(process.cwd(), opts.out);
|
|
208
|
+
await (0, import_promises.writeFile)(outPath, source, "utf8");
|
|
209
|
+
console.log(`\u2705 Wrote ${outPath} (${source.length} bytes).`);
|
|
210
|
+
console.log(
|
|
211
|
+
`
|
|
212
|
+
Import it in your app:
|
|
213
|
+
import { createClient } from './${opts.out.replace(/\.ts$/, "")}';
|
|
214
|
+
`
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
main().catch((err) => {
|
|
218
|
+
console.error(err);
|
|
219
|
+
process.exit(1);
|
|
220
|
+
});
|
|
221
|
+
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/typegen.ts","../src/codegen.ts"],"sourcesContent":["#!/usr/bin/env node\n// ── Codegen CLI ─────────────────────────────────────────\n// `lazypock-gen` — fetches the live collection schema from a Lazypock\n// API and writes a fully-typed `lazypock.types.ts` module.\n//\n// Usage:\n// npx lazypock-gen --url http://localhost:4000/api --email admin@... --password ...\n//\n// Or via env vars (no flags):\n// LAZYPOCK_URL=... LAZYPOCK_EMAIL=... LAZYPOCK_PASSWORD=... npx lazypock-gen\n\nimport { writeFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { generateTypes } from \"./codegen\";\nimport type { CollectionsResponse } from \"./schema\";\n\ninterface CliOptions {\n\turl: string;\n\temail: string;\n\tpassword: string;\n\tout: string;\n\tpackageName: string;\n\tskipSystem: boolean;\n}\n\nfunction fail(msg: string): never {\n\tconsole.error(`\\n❌ ${msg}\\n`);\n\tprocess.exit(1);\n}\n\nfunction parseArgs(argv: string[]): CliOptions {\n\tconst args = [...argv];\n\tconst get = (flag: string, envKey: string, def = \"\"): string => {\n\t\tconst i = args.indexOf(flag);\n\t\tif (i !== -1 && i + 1 < args.length) return args[i + 1];\n\t\treturn process.env[envKey] ?? def;\n\t};\n\tconst has = (flag: string): boolean => args.includes(flag);\n\n\tconst url = get(\"--url\", \"LAZYPOCK_URL\");\n\tconst email = get(\"--email\", \"LAZYPOCK_EMAIL\");\n\tconst password = get(\"--password\", \"LAZYPOCK_PASSWORD\");\n\n\tif (!url) fail(\"Missing API URL. Pass --url or set LAZYPOCK_URL.\");\n\tif (!email)\n\t\tfail(\"Missing superuser email. Pass --email or set LAZYPOCK_EMAIL.\");\n\tif (!password)\n\t\tfail(\"Missing password. Pass --password or set LAZYPOCK_PASSWORD.\");\n\n\tconst out = get(\"--out\", \"LAZYPOCK_OUT\", \"lazypock.types.ts\");\n\tconst packageName = get(\"--package\", \"LAZYPOCK_PACKAGE\", \"lazypock\");\n\n\treturn {\n\t\turl,\n\t\temail,\n\t\tpassword,\n\t\tout,\n\t\tpackageName,\n\t\tskipSystem: has(\"--skip-system\"),\n\t};\n}\n\nasync function fetchCollections(\n\topts: CliOptions,\n): Promise<CollectionsResponse> {\n\t// Step 1: login as superuser to get a token\n\tconst loginUrl = opts.url.replace(/\\/+$/, \"\") + \"/superusers/login\";\n\tconst loginRes = await fetch(loginUrl, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tbody: JSON.stringify({ email: opts.email, password: opts.password }),\n\t});\n\tif (!loginRes.ok) {\n\t\tconst text = await loginRes.text();\n\t\tfail(`Superuser login failed (${loginRes.status}). ${text.slice(0, 200)}`);\n\t}\n\tconst loginData = (await loginRes.json()) as { token?: string };\n\tif (!loginData.token) fail(\"Login response did not include a token.\");\n\n\t// Step 2: fetch collections\n\tconst collUrl = opts.url.replace(/\\/+$/, \"\") + \"/collections\";\n\tconst collRes = await fetch(collUrl, {\n\t\theaders: { Authorization: \"Bearer \" + loginData.token },\n\t});\n\tif (!collRes.ok) {\n\t\tconst text = await collRes.text();\n\t\tfail(\n\t\t\t`Failed to fetch collections (${collRes.status}). ${text.slice(0, 200)}`,\n\t\t);\n\t}\n\treturn (await collRes.json()) as CollectionsResponse;\n}\n\nasync function main(): Promise<void> {\n\tconst opts = parseArgs(process.argv.slice(2));\n\tconsole.log(`\\n🔌 Connecting to ${opts.url} as ${opts.email} …`);\n\n\tconst { items } = await fetchCollections(opts);\n\tconsole.log(`📦 Found ${items.length} collection(s).`);\n\n\tconst source = generateTypes(items, {\n\t\tpackageName: opts.packageName,\n\t\tskipSystem: opts.skipSystem,\n\t});\n\n\tconst outPath = resolve(process.cwd(), opts.out);\n\tawait writeFile(outPath, source, \"utf8\");\n\tconsole.log(`✅ Wrote ${outPath} (${source.length} bytes).`);\n\tconsole.log(\n\t\t`\\nImport it in your app:\\n import { createClient } from './${opts.out.replace(/\\.ts$/, \"\")}';\\n`,\n\t);\n}\n\nmain().catch((err) => {\n\tconsole.error(err);\n\tprocess.exit(1);\n});\n","// ── Type mapping (runtime + codegen) ────────────────────\n// Maps server field types to TypeScript types.\n// Shared by the runtime `SchemaTypes` helper and the codegen CLI.\n\nimport type { SchemaField } from \"./schema\";\n\n/**\n * Map a single server field to its TypeScript type string.\n * Used by the codegen CLI to emit interface members.\n *\n * @param field The field definition.\n * @param fallback Fallback type for unknown field types (default `unknown`).\n */\nexport function fieldTypeScriptType(\n\tfield: SchemaField,\n\tfallback = \"unknown\",\n): string {\n\tconst opts = field.options ?? {};\n\tswitch (field.type) {\n\t\tcase \"text\":\n\t\tcase \"email\":\n\t\tcase \"url\":\n\t\tcase \"editor\":\n\t\tcase \"date\":\n\t\tcase \"datetime\":\n\t\t\treturn \"string\";\n\t\tcase \"number\":\n\t\t\treturn \"number\";\n\t\tcase \"bool\":\n\t\t\treturn \"boolean\";\n\t\tcase \"select\": {\n\t\t\tconst values = Array.isArray(opts.values) ? opts.values : [];\n\t\t\tif (values.length > 0) {\n\t\t\t\treturn values.map((v) => JSON.stringify(String(v))).join(\" | \");\n\t\t\t}\n\t\t\treturn \"string\";\n\t\t}\n\t\tcase \"multi_select\": {\n\t\t\tconst values = Array.isArray(opts.values) ? opts.values : [];\n\t\t\tif (values.length > 0) {\n\t\t\t\treturn `(${values.map((v) => JSON.stringify(String(v))).join(\" | \")})[]`;\n\t\t\t}\n\t\t\treturn \"string[]\";\n\t\t}\n\t\tcase \"file\":\n\t\t\treturn \"string\";\n\t\tcase \"multi_file\":\n\t\t\treturn \"string[]\";\n\t\tcase \"json\":\n\t\tcase \"geo\":\n\t\t\treturn \"Record<string, unknown>\";\n\t\tcase \"relation\":\n\t\t\t// Relations store the target record's ID (string) — or an array\n\t\t\t// of IDs when multi-relation (maxSelect > 1).\n\t\t\treturn (opts.maxSelect ?? 1) > 1 ? \"string[]\" : \"string\";\n\t\tcase \"password\":\n\t\t\t// Passwords are write-only; never expose on read models.\n\t\t\treturn \"never\";\n\t\tdefault:\n\t\t\treturn fallback;\n\t}\n}\n\n/**\n * Returns the runtime type kind for a field — used by {@link schemaFieldType}\n * to build structural types at runtime.\n */\nexport type FieldTypeKind =\n\t| \"string\"\n\t| \"number\"\n\t| \"boolean\"\n\t| \"string-array\"\n\t| \"json\"\n\t| \"relation\"\n\t| \"relation-many\"\n\t| \"password\"\n\t| \"unknown\";\n\n/** Map a server field to its runtime type kind. */\nexport function fieldTypeKind(field: SchemaField): FieldTypeKind {\n\tconst opts = field.options ?? {};\n\tswitch (field.type) {\n\t\tcase \"text\":\n\t\tcase \"email\":\n\t\tcase \"url\":\n\t\tcase \"editor\":\n\t\tcase \"date\":\n\t\tcase \"datetime\":\n\t\tcase \"select\":\n\t\tcase \"file\":\n\t\t\treturn \"string\";\n\t\tcase \"number\":\n\t\t\treturn \"number\";\n\t\tcase \"bool\":\n\t\t\treturn \"boolean\";\n\t\tcase \"multi_select\":\n\t\tcase \"multi_file\":\n\t\t\treturn \"string-array\";\n\t\tcase \"json\":\n\t\tcase \"geo\":\n\t\t\treturn \"json\";\n\t\tcase \"relation\":\n\t\t\treturn (opts.maxSelect ?? 1) > 1 ? \"relation-many\" : \"relation\";\n\t\tcase \"password\":\n\t\t\treturn \"password\";\n\t\tdefault:\n\t\t\treturn \"unknown\";\n\t}\n}\n\n/**\n * Derive a TypeScript field type from a {@link SchemaField} — the runtime\n * counterpart to the codegen mapper. Lets consumers build typed clients\n * from a fetched schema without running the CLI.\n */\nexport function schemaFieldType(field: SchemaField): unknown {\n\tswitch (fieldTypeKind(field)) {\n\t\tcase \"string\":\n\t\t\treturn String;\n\t\tcase \"number\":\n\t\t\treturn Number;\n\t\tcase \"boolean\":\n\t\t\treturn Boolean;\n\t\tcase \"string-array\":\n\t\t\treturn [String] as const;\n\t\tcase \"relation\":\n\t\t\treturn String;\n\t\tcase \"relation-many\":\n\t\t\treturn [String] as const;\n\t\tcase \"json\":\n\t\t\treturn Object;\n\t\tcase \"password\":\n\t\t\treturn undefined;\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t}\n}\n","// ── Codegen ─────────────────────────────────────────────\n// Generates a `lazypock.types.ts` module from the live API schema.\n//\n// The generated file exports:\n// - One interface per collection (e.g. `PostsRecord`)\n// - A `LazypockCollections` map: { posts: PostsRecord; users: UsersRecord; ... }\n// - A `createClient()` factory pre-bound to those types, so\n// `client.collection(\"posts\").create({ title: \"x\" })` is fully type-checked.\n//\n// The CLI in `src/cli.ts` wires this to `GET /collections`.\n\nimport type { CollectionSchema, SchemaField } from \"./schema\";\nimport { fieldTypeScriptType } from \"./typegen\";\n\n/** Format a raw collection name into a valid TS identifier (PascalCase). */\nexport function collectionTypeName(name: string): string {\n\treturn name\n\t\t.split(/[^a-zA-Z0-9]+/)\n\t\t.filter(Boolean)\n\t\t.map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n\t\t.join(\"\")\n\t\t.replace(/^[0-9]/, \"_$&\");\n}\n\n/** Interface member name — sanitize hyphens/spaces but keep readability. */\nexport function fieldKey(name: string): string {\n\treturn name.replace(/[^a-zA-Z0-9_]/g, \"_\");\n}\n\n\n\n/**\n * Generate the full TypeScript source for the typed SDK module.\n *\n * @param collections Collections fetched from the API.\n * @param options Generation options.\n */\nexport function generateTypes(\n\tcollections: CollectionSchema[],\n\toptions: {\n\t\t/** Import specifier for the lazypock package (default `lazypock`). */\n\t\tpackageName?: string;\n\t\t/** Emit base record fields (id, created, updated, …). Default true. */\n\t\tincludeBaseFields?: boolean;\n\t\t/** Skip system collections (names starting with `_` or `users`). Default false. */\n\t\tskipSystem?: boolean;\n\t} = {},\n): string {\n\tconst {\n\t\tpackageName = \"lazypock\",\n\t\tincludeBaseFields = true,\n\t\tskipSystem = false,\n\t} = options;\n\n\tconst filtered = skipSystem\n\t\t? collections.filter(\n\t\t\t\t(c) => !c.system && !c.name.startsWith(\"_\") && c.name !== \"users\",\n\t\t\t)\n\t\t: collections;\n\n\tconst sections: string[] = [];\n\tsections.push(`// ── Auto-generated by lazypock-ts ──────────────────────────\n// Do not edit by hand. Regenerate with: npx lazypock-gen\n// Schema snapshot: ${new Date().toISOString()}`);\n\n\tif (includeBaseFields) {\n\t\tsections.push(`export interface BaseRecord {\n id: string;\n collectionId: string;\n collectionName: string;\n created: string;\n updated: string;\n}`);\n\t}\n\n\t// One interface per collection\n\tfor (const coll of filtered) {\n\t\tconst typeName = collectionTypeName(coll.name);\n\t\tconst fields = coll.fields ?? [];\n\t\tconst lines = fields.map((f) => memberLine(f)).filter((l) => l !== \"\");\n\t\tconst body = lines.join(\"\\n\");\n\t\tsections.push(\n\t\t\t`export interface ${typeName}Record${renderInterface({\n\t\t\t\textends: includeBaseFields ? \"BaseRecord\" : undefined,\n\t\t\t\tbody,\n\t\t\t})}`,\n\t\t);\n\t}\n\n\t// Auth collection type\n\tsections.push(`export interface AuthRecord extends BaseRecord {\n email: string;\n verified: boolean;\n}`);\n\n\t// Collections map\n\tconst mapEntries = filtered\n\t\t.map(\n\t\t\t(c) =>\n\t\t\t\t` \"${c.name}\": ${collectionTypeName(c.name)}Record${\n\t\t\t\t\tc.type === \"auth\" ? \" & AuthRecord\" : \"\"\n\t\t\t\t};`,\n\t\t)\n\t\t.join(\"\\n\");\n\tsections.push(`export interface LazypockCollections {\n${mapEntries}\n}`);\n\n\t// createClient factory\n\tsections.push(`import { LazypockClient, type LazypockClientOptions, type CollectionService } from \"${packageName}\";\n\n/**\n * Create a Lazypock client typed against this schema snapshot.\n * Collection access is fully type-checked:\n * client.collection(\"posts\").create({ title: \"x\" }) // title must exist\n */\nexport function createClient(options: LazypockClientOptions): TypedClient {\n return new TypedClient(options);\n}\n\nexport class TypedClient extends LazypockClient {\n override collection<K extends keyof LazypockCollections>(name: K): CollectionService<LazypockCollections[K]>;\n override collection(name: string): CollectionService<unknown> {\n return super.collection(name) as unknown as CollectionService<unknown>;\n }\n}`);\n\n\treturn sections.join(\"\\n\\n\") + \"\\n\";\n}\n\n/**\n * Render the interface body including the extends clause.\n * Empty body → ` extends BaseRecord {}` (valid TS).\n */\nfunction renderInterface(opts: { extends?: string; body: string }): string {\n\tconst ext = opts.extends ? ` extends ${opts.extends}` : \"\";\n\tif (!opts.body) return `${ext} {}`;\n\treturn `${ext} {\\n${opts.body}\\n}`;\n}\n\n/** Render a single interface member line for a field. */\nfunction memberLine(f: SchemaField): string {\n\tconst key = fieldKey(f.name);\n\tconst req = f.required || f.type === \"password\" ? \"\" : \"?\";\n\tconst type = fieldTypeScriptType(f);\n\t// `never` members (passwords) are omitted from read models.\n\tif (type === \"never\") return \"\";\n\treturn ` ${JSON.stringify(key)}${req}: ${type};`;\n}\n"],"mappings":";;;;AAWA,sBAA0B;AAC1B,uBAAwB;;;ACCjB,SAAS,oBACf,OACA,WAAW,WACF;AACT,QAAM,OAAO,MAAM,WAAW,CAAC;AAC/B,UAAQ,MAAM,MAAM;AAAA,IACnB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR,KAAK,UAAU;AACd,YAAM,SAAS,MAAM,QAAQ,KAAK,MAAM,IAAI,KAAK,SAAS,CAAC;AAC3D,UAAI,OAAO,SAAS,GAAG;AACtB,eAAO,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,OAAO,CAAC,CAAC,C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