ugly-app 0.1.210 → 0.1.211
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/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +1 -1
- package/src/cli/version.ts +1 -1
- package/templates/CLAUDE.md +2 -2
- package/templates/shared/collections.ts +11 -5
package/dist/cli/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.1.
|
|
1
|
+
export declare const CLI_VERSION = "0.1.211";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/cli/version.js
CHANGED
package/package.json
CHANGED
package/src/cli/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by prebuild — do not edit manually
|
|
2
|
-
export const CLI_VERSION = "0.1.
|
|
2
|
+
export const CLI_VERSION = "0.1.211";
|
package/templates/CLAUDE.md
CHANGED
|
@@ -59,10 +59,10 @@ submitFeedback: authReq({
|
|
|
59
59
|
Every endpoint is accessible via both WebSocket (`socket.request(name, input)`) and HTTP (`POST /api/:name { input }`).
|
|
60
60
|
|
|
61
61
|
## Adding a collection
|
|
62
|
-
1. Define the Zod schema and
|
|
62
|
+
1. Define the Zod schema and derive the type in `shared/collections.ts`:
|
|
63
63
|
```typescript
|
|
64
64
|
export const TodoSchema = z.object({ userId: z.string(), text: z.string(), done: z.boolean() });
|
|
65
|
-
export type Todo =
|
|
65
|
+
export type Todo = InferDocType<typeof TodoSchema>;
|
|
66
66
|
```
|
|
67
67
|
2. Add the collection to `defineCollections()` with `schema: TodoSchema`
|
|
68
68
|
3. Add indexes in `shared/collections.ts`, then run `npm run db:init`
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type {
|
|
2
|
+
import type { InferDocType, UserBase } from 'ugly-app/shared';
|
|
3
3
|
import { defineCollections, defineDbIndexes } from 'ugly-app/shared';
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
// ─── Schemas & Types ─────────────────────────────────────────────────────────
|
|
6
|
+
// Define each collection's Zod schema, then derive the type with InferDocType.
|
|
7
|
+
// The schema is the single source of truth — never define a separate interface.
|
|
8
|
+
|
|
9
|
+
export const UserSchema = z.object({
|
|
10
|
+
// name: z.string().optional(),
|
|
11
|
+
// avatarUrl: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
export type User = InferDocType<typeof UserSchema> & UserBase;
|
|
8
14
|
|
|
9
15
|
export const TodoSchema = z.object({
|
|
10
16
|
userId: z.string(),
|
|
11
17
|
text: z.string(),
|
|
12
18
|
done: z.boolean(),
|
|
13
19
|
});
|
|
14
|
-
export type Todo =
|
|
20
|
+
export type Todo = InferDocType<typeof TodoSchema>;
|
|
15
21
|
|
|
16
22
|
// --- Collections ---
|
|
17
23
|
// meta options:
|