schemock 0.0.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/dist/adapters/index.d.mts +1364 -0
  4. package/dist/adapters/index.d.ts +1364 -0
  5. package/dist/adapters/index.js +36988 -0
  6. package/dist/adapters/index.js.map +1 -0
  7. package/dist/adapters/index.mjs +36972 -0
  8. package/dist/adapters/index.mjs.map +1 -0
  9. package/dist/cli/index.d.mts +831 -0
  10. package/dist/cli/index.d.ts +831 -0
  11. package/dist/cli/index.js +4425 -0
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/cli/index.mjs +4401 -0
  14. package/dist/cli/index.mjs.map +1 -0
  15. package/dist/cli.js +6776 -0
  16. package/dist/index.d.mts +8 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +39439 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/index.mjs +39367 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/middleware/index.d.mts +688 -0
  23. package/dist/middleware/index.d.ts +688 -0
  24. package/dist/middleware/index.js +921 -0
  25. package/dist/middleware/index.js.map +1 -0
  26. package/dist/middleware/index.mjs +899 -0
  27. package/dist/middleware/index.mjs.map +1 -0
  28. package/dist/react/index.d.mts +316 -0
  29. package/dist/react/index.d.ts +316 -0
  30. package/dist/react/index.js +466 -0
  31. package/dist/react/index.js.map +1 -0
  32. package/dist/react/index.mjs +456 -0
  33. package/dist/react/index.mjs.map +1 -0
  34. package/dist/runtime/index.d.mts +814 -0
  35. package/dist/runtime/index.d.ts +814 -0
  36. package/dist/runtime/index.js +1270 -0
  37. package/dist/runtime/index.js.map +1 -0
  38. package/dist/runtime/index.mjs +1246 -0
  39. package/dist/runtime/index.mjs.map +1 -0
  40. package/dist/schema/index.d.mts +838 -0
  41. package/dist/schema/index.d.ts +838 -0
  42. package/dist/schema/index.js +696 -0
  43. package/dist/schema/index.js.map +1 -0
  44. package/dist/schema/index.mjs +681 -0
  45. package/dist/schema/index.mjs.map +1 -0
  46. package/dist/types-C1MiZh1d.d.ts +96 -0
  47. package/dist/types-C2bd2vgy.d.mts +773 -0
  48. package/dist/types-C2bd2vgy.d.ts +773 -0
  49. package/dist/types-C9VMgu3E.d.mts +289 -0
  50. package/dist/types-DV2DS7wj.d.mts +96 -0
  51. package/dist/types-c2AN3vky.d.ts +289 -0
  52. package/package.json +116 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Schemock Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # Schemock 🍀
2
+
3
+ > Schema-first mocking for frontend developers
4
+
5
+ **Define once. Mock instantly. Ship faster.**
6
+
7
+ ## What is Schemock?
8
+
9
+ Schemock flips the traditional API development workflow. Instead of waiting for backend APIs, frontend developers define their data needs upfront and get:
10
+
11
+ - ✅ **Instant working mocks** - Full CRUD with persistence
12
+ - ✅ **Type-safe API client** - Generated from your schema
13
+ - ✅ **OpenAPI export** - Hand off to backend team
14
+ - ✅ **Zero production overhead** - 99.3% bundle reduction via compile-time elimination
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ npm install schemock
20
+ npx schemock init
21
+ ```
22
+
23
+ Define your schema:
24
+
25
+ ```typescript
26
+ // src/schemas/index.ts
27
+ import { defineData, field, hasMany } from 'schemock/schema';
28
+
29
+ export const User = defineData('user', {
30
+ id: field.uuid(),
31
+ name: field.person.fullName(),
32
+ email: field.internet.email(),
33
+ posts: hasMany('post'),
34
+ });
35
+
36
+ export const Post = defineData('post', {
37
+ id: field.uuid(),
38
+ title: field.lorem.sentence(),
39
+ authorId: field.ref('user'),
40
+ });
41
+ ```
42
+
43
+ Generate everything:
44
+
45
+ ```bash
46
+ npx schemock generate
47
+ ```
48
+
49
+ Use in your app:
50
+
51
+ ```typescript
52
+ import { useData, useMutate } from 'schemock/react';
53
+ import { User } from './schemas';
54
+
55
+ function UserList() {
56
+ const { data: users, loading } = useData(User);
57
+ const { create } = useMutate(User);
58
+
59
+ // Full CRUD works instantly - no backend needed!
60
+ }
61
+ ```
62
+
63
+ ## Why Schemock?
64
+
65
+ | Traditional | With Schemock |
66
+ |-------------|---------------|
67
+ | Wait for backend API | Start building immediately |
68
+ | Write mock handlers manually | Auto-generated from schema |
69
+ | Mock code ships to production | Compile-time eliminated (99.3% reduction) |
70
+ | FE/BE contracts drift | Schema is single source of truth |
71
+
72
+ ## Documentation
73
+
74
+ See the [design docs](./design/) for detailed architecture and implementation plans.
75
+
76
+ ## Status
77
+
78
+ 🚧 **In Development** - Not ready for production use yet.
79
+
80
+ ## License
81
+
82
+ MIT