cabloy 5.1.60 → 5.1.61

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 (76) hide show
  1. package/.claude/hooks/contract-loop-gate.ts +296 -0
  2. package/.claude/settings.json +16 -0
  3. package/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +1 -0
  4. package/.claude/skills/cabloy-contract-loop/SKILL.md +89 -16
  5. package/.claude/skills/cabloy-contract-loop/references/contract-loop-map.md +102 -14
  6. package/.claude/skills/cabloy-contract-loop/references/resource-custom-state-pattern.md +4 -0
  7. package/.claude/skills/cabloy-contract-loop/references/verification-checklist.md +32 -14
  8. package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +11 -0
  9. package/.claude/skills/cabloy-frontend-scaffold/references/follow-up-checklist.md +2 -0
  10. package/.claude/skills/cabloy-module-removal/SKILL.md +144 -0
  11. package/.claude/skills/cabloy-resource-field-update/SKILL.md +7 -0
  12. package/.claude/skills/cabloy-zova-source-reading/SKILL.md +221 -0
  13. package/.claude/skills/cabloy-zova-source-reading/references/analysis-modes.md +91 -0
  14. package/.claude/skills/cabloy-zova-source-reading/references/core-reading-paths.md +117 -0
  15. package/CHANGELOG.md +22 -0
  16. package/CLAUDE.md +10 -0
  17. package/cabloy-docs/.vitepress/config.mjs +50 -4
  18. package/cabloy-docs/ai/cli-to-skill-map.md +7 -0
  19. package/cabloy-docs/ai/docs-skills-rules-mapping.md +14 -0
  20. package/cabloy-docs/ai/future-skill-roadmap.md +10 -7
  21. package/cabloy-docs/ai/introduction.md +1 -0
  22. package/cabloy-docs/ai/playbook-backend-module.md +6 -0
  23. package/cabloy-docs/ai/playbook-module-removal.md +164 -0
  24. package/cabloy-docs/ai/skills.md +11 -0
  25. package/cabloy-docs/backend/dto-guide.md +6 -0
  26. package/cabloy-docs/backend/entity-guide.md +18 -0
  27. package/cabloy-docs/backend/introduction.md +2 -0
  28. package/cabloy-docs/backend/serialization-guide.md +10 -0
  29. package/cabloy-docs/backend/status-guide.md +271 -0
  30. package/cabloy-docs/frontend/api-guide.md +2 -0
  31. package/cabloy-docs/frontend/bean-scene-authoring.md +2 -0
  32. package/cabloy-docs/frontend/cli.md +12 -0
  33. package/cabloy-docs/frontend/command-scene-authoring.md +495 -0
  34. package/cabloy-docs/frontend/design-principles.md +6 -0
  35. package/cabloy-docs/frontend/fetch-interceptor-guide.md +440 -0
  36. package/cabloy-docs/frontend/form-guide.md +795 -0
  37. package/cabloy-docs/frontend/foundation.md +29 -0
  38. package/cabloy-docs/frontend/introduction.md +12 -1
  39. package/cabloy-docs/frontend/ioc-and-beans.md +6 -0
  40. package/cabloy-docs/frontend/mock-guide.md +1 -0
  41. package/cabloy-docs/frontend/model-architecture.md +252 -39
  42. package/cabloy-docs/frontend/model-resource-best-practices.md +379 -0
  43. package/cabloy-docs/frontend/model-resource-cookbook.md +505 -0
  44. package/cabloy-docs/frontend/model-resource-owner-pattern.md +382 -0
  45. package/cabloy-docs/frontend/model-resource-usage-guide.md +318 -0
  46. package/cabloy-docs/frontend/model-state-guide.md +366 -13
  47. package/cabloy-docs/frontend/openapi-sdk-guide.md +5 -2
  48. package/cabloy-docs/frontend/page-guide.md +6 -0
  49. package/cabloy-docs/frontend/quickstart.md +4 -0
  50. package/cabloy-docs/frontend/reading-zova-for-vue-developers.md +266 -0
  51. package/cabloy-docs/frontend/server-data.md +2 -0
  52. package/cabloy-docs/frontend/zova-form-source-reading-map.md +295 -0
  53. package/cabloy-docs/frontend/zova-form-under-the-hood.md +556 -0
  54. package/cabloy-docs/frontend/zova-reactivity-under-the-hood.md +320 -0
  55. package/cabloy-docs/frontend/zova-source-reading-map.md +327 -0
  56. package/cabloy-docs/frontend/zova-vs-vue3-comparison.md +308 -0
  57. package/cabloy-docs/fullstack/contract-loop-playbook.md +350 -0
  58. package/cabloy-docs/fullstack/frontend-metadata-to-backend.md +44 -1
  59. package/cabloy-docs/fullstack/introduction.md +12 -1
  60. package/cabloy-docs/fullstack/openapi-to-sdk.md +19 -9
  61. package/cabloy-docs/fullstack/tutorial-3-frontend-metadata-sharing.md +2 -2
  62. package/cabloy-docs/fullstack/tutorial-4-custom-level-renderers.md +30 -5
  63. package/cabloy-docs/fullstack/tutorial-5-backend-contract-sharing.md +9 -7
  64. package/cabloy-docs/fullstack/tutorial-6-one-contract-four-uses.md +2 -0
  65. package/cabloy-docs/fullstack/tutorials-overview.md +16 -3
  66. package/cabloy-docs/reference/bean-scene-boilerplates.md +2 -0
  67. package/package.json +2 -1
  68. package/scripts/init.ts +2 -18
  69. package/scripts/initTestData.ts +25 -0
  70. package/scripts/upgrade.ts +17 -2
  71. package/vona/pnpm-lock.yaml +94 -4
  72. package/zova/packages-cli/cli/package.json +2 -2
  73. package/zova/packages-cli/cli-set-front/cli/templates/openapi/config/boilerplate/module/openapi.config.ts +6 -1
  74. package/zova/packages-cli/cli-set-front/package.json +1 -1
  75. package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +34 -4
  76. package/zova/pnpm-lock.yaml +20 -20
@@ -46,6 +46,35 @@ The highest-value Zova capabilities to preserve in the unified docs are:
46
46
 
47
47
  For the deeper architectural concepts behind IoC, module boundaries, and scope-based resources, see [IoC and Beans](/frontend/ioc-and-beans), [Modules and Suites](/frontend/modules-and-suites), and [Module Scope](/frontend/module-scope). For the runtime-variant and startup model, see [Environment and Config Guide](/frontend/environment-config-guide), [App Startup Guide](/frontend/app-startup-guide), and [System Startup Guide](/frontend/system-startup-guide).
48
48
 
49
+ ## Recommended reading path for architectural source reading
50
+
51
+ If you want a compact path from public architecture to source-level understanding, use this order:
52
+
53
+ 1. [Reading Zova for Vue Developers](/frontend/reading-zova-for-vue-developers)
54
+ 2. [Zova vs Vue 3 Comparison](/frontend/zova-vs-vue3-comparison)
55
+ 3. [Zova Reactivity Under the Hood](/frontend/zova-reactivity-under-the-hood)
56
+ 4. [Zova Source Reading Map](/frontend/zova-source-reading-map)
57
+ 5. [IoC and Beans](/frontend/ioc-and-beans)
58
+ 6. [Page Guide](/frontend/page-guide)
59
+ 7. [Component Guide](/frontend/component-guide)
60
+ 8. [Model Architecture](/frontend/model-architecture)
61
+ 9. [Model State Guide](/frontend/model-state-guide)
62
+ 10. [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
63
+ 11. [Using ModelResource in Your Module](/frontend/model-resource-usage-guide)
64
+ 12. [Resource Model Best Practices](/frontend/model-resource-best-practices)
65
+ 13. [Resource Model Cookbook](/frontend/model-resource-cookbook)
66
+
67
+ Use this order when you want to understand both the public mental model and the shortest source-reading routes without collapsing Zova back into generic Vue habits.
68
+
69
+ If your main goal is resource-oriented frontend design, the model-focused subpath is:
70
+
71
+ 1. [Model Architecture](/frontend/model-architecture)
72
+ 2. [Model State Guide](/frontend/model-state-guide)
73
+ 3. [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
74
+ 4. [Using ModelResource in Your Module](/frontend/model-resource-usage-guide)
75
+ 5. [Resource Model Best Practices](/frontend/model-resource-best-practices)
76
+ 6. [Resource Model Cookbook](/frontend/model-resource-cookbook)
77
+
49
78
  ## Why this matters for AI development
50
79
 
51
80
  AI systems should not treat Zova as generic Vue with a few utilities.
@@ -32,6 +32,10 @@ Start here when you need the shortest route to the frontend mental model and sta
32
32
 
33
33
  - [Quickstart](/frontend/quickstart)
34
34
  - [Foundation](/frontend/foundation)
35
+ - [Reading Zova for Vue Developers](/frontend/reading-zova-for-vue-developers)
36
+ - [Zova vs Vue 3 Comparison](/frontend/zova-vs-vue3-comparison)
37
+ - [Zova Reactivity Under the Hood](/frontend/zova-reactivity-under-the-hood)
38
+ - [Zova Source Reading Map](/frontend/zova-source-reading-map)
35
39
  - [IoC and Beans](/frontend/ioc-and-beans)
36
40
  - [Behavior Guide](/frontend/behavior-guide)
37
41
  - [Modules and Suites](/frontend/modules-and-suites)
@@ -56,9 +60,12 @@ Use this path when the task is page-oriented, route-oriented, or the first time
56
60
 
57
61
  ### Components and UI flow
58
62
 
59
- Use this path when the task is about UI composition, component contracts, or theme work:
63
+ Use this path when the task is about UI composition, component contracts, form architecture, form internals, form source reading, or theme work:
60
64
 
61
65
  - [Component Guide](/frontend/component-guide)
66
+ - [Form Guide](/frontend/form-guide)
67
+ - [Zova Form Under the Hood](/frontend/zova-form-under-the-hood)
68
+ - [Zova Form Source Reading Map](/frontend/zova-form-source-reading-map)
62
69
  - [Component Props Guide](/frontend/component-props-guide)
63
70
  - [Component v-model Guide](/frontend/component-v-model-guide)
64
71
  - [Generic Component Guide](/frontend/generic-component-guide)
@@ -74,6 +81,10 @@ Use this path when the task is about data loading, API contracts, generated SDKs
74
81
  - [API Guide](/frontend/api-guide)
75
82
  - [Model Architecture](/frontend/model-architecture)
76
83
  - [Model State Guide](/frontend/model-state-guide)
84
+ - [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
85
+ - [Using ModelResource in Your Module](/frontend/model-resource-usage-guide)
86
+ - [Resource Model Best Practices](/frontend/model-resource-best-practices)
87
+ - [Resource Model Cookbook](/frontend/model-resource-cookbook)
77
88
  - [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
78
89
  - [API Schema Guide](/frontend/api-schema-guide)
79
90
  - [SDK Guide](/frontend/sdk-guide)
@@ -200,6 +200,12 @@ Read this together with:
200
200
 
201
201
  Those pages explain how beans fit into module boundaries, scope-based resources, the existing Behavior scene, and the broader Zova architectural model.
202
202
 
203
+ If you want a Vue-to-Zova reading bridge or a deeper runtime/source explanation, also read:
204
+
205
+ - [Reading Zova for Vue Developers](/frontend/reading-zova-for-vue-developers)
206
+ - [Zova Reactivity Under the Hood](/frontend/zova-reactivity-under-the-hood)
207
+ - [Zova Source Reading Map](/frontend/zova-source-reading-map)
208
+
203
209
  ## Implementation checks for frontend bean-architecture changes
204
210
 
205
211
  When editing Zova frontend code, ask:
@@ -56,6 +56,7 @@ Mocking fits naturally with:
56
56
 
57
57
  - [API Guide](/frontend/api-guide)
58
58
  - [Server Data](/frontend/server-data)
59
+ - [Fetch Interceptor Guide](/frontend/fetch-interceptor-guide)
59
60
  - [Page Guide](/frontend/page-guide)
60
61
 
61
62
  A common workflow is:
@@ -1,78 +1,282 @@
1
1
  # Model Architecture
2
2
 
3
- This guide explains the overall model architecture in Zova within the Cabloy monorepo.
3
+ This guide explains the architecture of Zova Model in the Cabloy monorepo.
4
+
5
+ It focuses on the Zova-native role of Model first, then connects that role to the current `a-model` source implementation.
4
6
 
5
7
  ## Why Zova models matter
6
8
 
7
- Zova uses a unified `Model` mechanism to manage several kinds of data that other frontend stacks often split across unrelated tools.
9
+ Zova uses a unified `Model` mechanism to manage several kinds of frontend state that other stacks often split across unrelated tools.
8
10
 
9
11
  This is one of the most important architectural ideas in Zova.
10
12
 
11
- ## Four kinds of global state
13
+ The key point is not only caching remote data.
14
+
15
+ The deeper point is that Zova gives state a dedicated bean-oriented home with:
16
+
17
+ - framework-managed identity
18
+ - query-key namespacing
19
+ - persistence options
20
+ - SSR-aware hydration behavior
21
+ - reuse across pages, components, and services
22
+
23
+ ## Zova-native role of a model
24
+
25
+ A Zova model is a **model bean**.
12
26
 
13
- The model architecture can be understood through four common data categories:
27
+ It is not only a generic Vue composable and it is not only a thin request wrapper.
14
28
 
15
- - asynchronous data, usually from the server
16
- - local storage data
17
- - cookie data
18
- - in-memory data
29
+ Its architectural job is to own data that benefits from broader lifecycle and reuse behavior, especially when that data is:
19
30
 
20
- In Zova, these can all participate in one broader model-centered system instead of forcing developers to switch between unrelated mental models.
31
+ - asynchronous server data
32
+ - local-storage data
33
+ - cookie-backed data
34
+ - in-memory cache-oriented data
35
+ - persistence-aware state that should survive page transitions or refreshes
36
+
37
+ In practice, a model often sits above `$api` and below page rendering:
38
+
39
+ - `$fetch` handles transport-oriented access
40
+ - `$api` handles business-oriented service methods
41
+ - `Model` handles cached, reusable, UI-friendly state ownership
42
+
43
+ Read together with [Server Data](/frontend/server-data) when deciding which abstraction layer a feature should use.
21
44
 
22
45
  ## Relationship to TanStack Query
23
46
 
24
- One key point is explicit: the base of Zova Model is TanStack Query.
47
+ One current-source fact is explicit: Zova Model is built on top of TanStack Query.
25
48
 
26
- That matters because Zova is not discarding the strengths of TanStack Query. It is building a more unified and framework-friendly usage model on top of it.
49
+ That matters because Zova is not replacing TanStack Query with a separate state engine.
27
50
 
28
- ## Key model capabilities
51
+ Instead, Zova wraps TanStack Query inside a model-bean architecture so that:
29
52
 
30
- Several important capabilities remain central in the unified docs:
53
+ - query and mutation APIs fit naturally into the bean system
54
+ - sync and async state categories can use one broader model surface
55
+ - persistence and SSR behavior are expressed in one place
56
+ - model identity becomes part of cache identity
31
57
 
32
- ### 1. Support for async and sync data
58
+ ## Public authoring surface
33
59
 
34
- The model system is not limited to server data. It also extends the same broader mechanism to synchronous data categories.
60
+ Representative model definition:
61
+
62
+ ```typescript
63
+ import { Model } from 'zova';
64
+ import { BeanModelBase } from 'zova-module-a-model';
35
65
 
36
- ### 2. Automatic caching
66
+ @Model()
67
+ export class ModelTodo extends BeanModelBase {}
68
+ ```
37
69
 
38
- Remote data can be cached locally, while local-storage or cookie-backed data can be accessed through unified model patterns.
70
+ At source level, `@Model()` is a bean decorator factory:
39
71
 
40
- ### 3. Automatic update behavior
72
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/lib/model.ts`
41
73
 
42
- The model system supports data freshness and update behavior instead of treating state as static snapshots.
74
+ That file shows that a model is registered on the `model` onion/scene rather than being a special-case standalone mechanism.
43
75
 
44
- ### 4. Reduced duplicate requests
76
+ ## The core architectural idea
45
77
 
46
- When multiple parts of the app need the same data, the framework avoids unnecessary repeated requests.
78
+ The most important current-source insight is this:
47
79
 
48
- ### 5. Memory optimization
80
+ > Zova unifies remote state and several local state categories around query-cache semantics, then exposes that system through model beans.
49
81
 
50
- Model-managed data does not need to occupy memory forever. Cache lifecycle and release behavior matter, especially for large long-running applications.
82
+ That is why model APIs look broader than a normal “data fetching helper”.
51
83
 
52
- ### 6. Persistence
84
+ Even local, cookie, db, and mem state are expressed through model helpers that still participate in model-owned keying, restore, invalidation, and SSR rules.
53
85
 
54
- Model-managed data can participate in persistence strategies so refreshes do not always mean starting from nothing.
86
+ ## Five state families in the current model layer
55
87
 
56
- ### 7. SSR support
88
+ The `a-model` source exposes five main state families through `BeanModelBase` helpers:
57
89
 
58
- The model system helps smooth out SSR differences across data categories and makes hydration more natural.
90
+ - `data` remote/query-style state through `$useStateData(...)`
91
+ - `mem` → in-memory state through `$useStateMem(...)`
92
+ - `local` → local-storage state through `$useStateLocal(...)`
93
+ - `cookie` → cookie-backed state through `$useStateCookie(...)`
94
+ - `db` → async persisted state through `$useStateDb(...)`
59
95
 
60
- ### 8. Namespace isolation
96
+ This is why Zova Model is better understood as a **unified model-state layer** rather than only a remote-data wrapper.
61
97
 
62
- Because data is managed through model beans, the bean identity itself helps provide namespace isolation and reduces collision risk.
98
+ ## How the runtime is assembled
63
99
 
64
- ## Create a model bean
100
+ A compact source-confirmed runtime path is:
65
101
 
66
- Representative pattern:
102
+ 1. `@Model()` registers the class as a model bean
103
+ 2. the `a-model` module monkey bootstraps a shared `QueryClient`
104
+ 3. the monkey injects `$queryClient` onto bean instances
105
+ 4. `BeanModelBase` composes query, mutation, state, and persistence helpers
106
+ 5. helper calls automatically prefix query keys with model identity
107
+ 6. persistence and SSR behavior are applied from model metadata and module config
67
108
 
68
- ```typescript
69
- import { Model } from 'zova';
70
- import { BeanModelBase } from 'zova-module-a-model';
109
+ ### 1. `@Model()` registers a model bean
71
110
 
72
- @Model()
73
- export class ModelTodo extends BeanModelBase {}
111
+ Source:
112
+
113
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/lib/model.ts`
114
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/types/model.ts`
115
+
116
+ These files confirm that:
117
+
118
+ - models are bean-based
119
+ - the scene/onion name is `model`
120
+ - model decorator options currently include `enableSelector?: boolean`
121
+
122
+ ### 2. The module bootstraps a shared query client
123
+
124
+ Source:
125
+
126
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/monkey.ts`
127
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/service/storage.ts`
128
+
129
+ These files show that the module:
130
+
131
+ - creates a `QueryClient`
132
+ - installs `VueQueryPlugin`
133
+ - injects `$queryClient` onto bean instances
134
+ - owns SSR dehydrate/hydrate behavior for query state
135
+
136
+ This is important because model code does not manually construct its own query client.
137
+
138
+ ## `BeanModelBase` is a composed capability stack
139
+
140
+ `BeanModelBase` is a reusable base, not just an empty convenience class.
141
+
142
+ Representative source path:
143
+
144
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.modelBase.ts`
145
+ - `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/`
146
+
147
+ The current source composes a layered model base that provides:
148
+
149
+ - query helpers
150
+ - mutation helpers
151
+ - state helpers
152
+ - persistence helpers
153
+ - cookie/local/db adapters
154
+ - selector-aware key prefixing
155
+
156
+ For source reading, the most important files are:
157
+
158
+ - `bean.model.useQuery.ts`
159
+ - `bean.model.useMutation.ts`
160
+ - `bean.model.useState.ts`
161
+ - `bean.model.query.ts`
162
+ - `bean.model.persister.ts`
163
+
164
+ ## Automatic namespacing and selector-aware identity
165
+
166
+ One of the most important source-level behaviors is automatic key prefixing.
167
+
168
+ Model helpers do not only use the caller-provided `queryKey`.
169
+
170
+ They first prefix it with the model bean identity, and when `enableSelector` is enabled they also prefix it with the selector value.
171
+
172
+ That means a logical user key such as:
173
+
174
+ ```typescript
175
+ ['list']
74
176
  ```
75
177
 
178
+ becomes model-owned cache identity rather than a globally ambiguous key.
179
+
180
+ This is one reason model state can scale more safely across larger apps.
181
+
182
+ ## Persistence architecture
183
+
184
+ The current model layer supports several persistence strategies:
185
+
186
+ - `mem` → no persistence
187
+ - `local` → sync local storage
188
+ - `cookie` → sync cookie storage
189
+ - `db` → async persisted storage through `localforage`
190
+
191
+ Representative source files:
192
+
193
+ - `bean.model.useState.ts`
194
+ - `bean.model.persister.ts`
195
+ - `bean.model.local.ts`
196
+ - `bean.model.cookie.ts`
197
+ - `common/cookieWrapper.ts`
198
+
199
+ A key design detail is that persistence is treated as an extension of model-owned query state rather than as a separate unrelated subsystem.
200
+
201
+ ## SSR behavior
202
+
203
+ Zova Model is SSR-aware.
204
+
205
+ Important current-source behavior includes:
206
+
207
+ - server render dehydrates query state into SSR deferred state
208
+ - client pre-hydration hydrates that query state back into the client query client
209
+ - mutations are not dehydrated
210
+ - sync persisted state such as `local` and `cookie` is not treated the same way as dehydrated async query state
211
+ - `db` state is explicitly marked not to dehydrate
212
+
213
+ Representative source files:
214
+
215
+ - `service/storage.ts`
216
+ - `config/config.ts`
217
+ - `types/query.ts`
218
+ - `bean.model.useQuery.ts`
219
+ - `bean.model.useState.ts`
220
+
221
+ This matters because a model choice can affect hydration behavior, not only local developer ergonomics.
222
+
223
+ ## When state should live in a model
224
+
225
+ A model is usually a good fit when one or more of these are true:
226
+
227
+ - multiple pages or components need the same data
228
+ - remote data should be cached and invalidated consistently
229
+ - the state has persistence value across route changes or reloads
230
+ - SSR and hydration behavior matter
231
+ - the data should have a dedicated owner separate from one page controller
232
+
233
+ A model is often **not** the first choice when:
234
+
235
+ - the state is purely page-local and short-lived
236
+ - the data has no reuse value outside one controller
237
+ - plain controller fields already express the intent clearly
238
+
239
+ That is why Zova asks a different first question than many Vue stacks.
240
+
241
+ Instead of asking only “should this be a store?”, it is often better to ask:
242
+
243
+ 1. which bean should own this data?
244
+ 2. does the data need model-level caching or persistence?
245
+ 3. does SSR or reuse make a model the right boundary?
246
+
247
+ ## Source-reading path for Model
248
+
249
+ If you want the shortest accurate path from public docs into current source, use this order:
250
+
251
+ 1. this page
252
+ 2. [Model State Guide](/frontend/model-state-guide)
253
+ 3. [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
254
+ 4. [Zova Source Reading Map](/frontend/zova-source-reading-map)
255
+ 5. `zova/src/suite/a-demo/modules/demo-todo/src/model/todo.ts`
256
+ 6. `zova/src/suite-vendor/a-zova/modules/a-model/src/lib/model.ts`
257
+ 7. `zova/src/suite-vendor/a-zova/modules/a-model/src/monkey.ts`
258
+ 8. `zova/src/suite-vendor/a-zova/modules/a-model/src/service/storage.ts`
259
+ 9. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useState.ts`
260
+ 10. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.persister.ts`
261
+
262
+ Use representative real models next when you want a richer case:
263
+
264
+ - `zova/src/suite-vendor/a-zova/modules/a-routertabs/src/model/tabs.ts`
265
+ - `zova/src/suite/a-home/modules/home-passport/src/model/passport.ts`
266
+ - `zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts`
267
+
268
+ The `rest-resource` model is especially important because it shows that Zova Model is not only for small feature-local caching.
269
+
270
+ It also supports **generic infrastructure models** that:
271
+
272
+ - use `enableSelector` to isolate one model instance per resource
273
+ - bootstrap resource metadata before normal state usage
274
+ - combine `$fetch`, `$sdk`, and model state in one reusable resource owner
275
+ - expose schema, permissions, form helpers, and CRUD query/mutation flows through one model boundary
276
+ - centralize invalidation rules for list and item-level resource state
277
+
278
+ That example is a good reading target when you want to understand how Zova Model can become a reusable full-feature resource facade instead of only a thin data wrapper.
279
+
76
280
  ## Practical implications for frontend state design
77
281
 
78
282
  When asked to add frontend state, do not immediately assume a generic Vue/Pinia-style answer.
@@ -80,8 +284,17 @@ When asked to add frontend state, do not immediately assume a generic Vue/Pinia-
80
284
  A better default is to ask:
81
285
 
82
286
  1. is this state already a good fit for a Zova model?
83
- 2. is the data async or sync, and does that distinction matter to the model choice?
84
- 3. does SSR or persistence make the model layer especially valuable here?
85
- 4. is there already a model bean that should own this state instead of adding a new ad hoc state container?
287
+ 2. is the data async, mem, local, cookie, or db-oriented?
288
+ 3. do caching, invalidation, or persistence matter?
289
+ 4. does SSR or hydration make the model layer especially valuable here?
290
+ 5. is there already a model bean that should own this state instead of adding a new ad hoc state container?
86
291
 
87
292
  That keeps the code aligned with Zova’s actual architecture.
293
+
294
+ ## Final takeaway
295
+
296
+ The most important architectural insight is simple:
297
+
298
+ > Zova Model is a model-bean layer built on top of TanStack Query that unifies async data, local persistence, cookie state, db persistence, and in-memory state behind one model-owned runtime.
299
+
300
+ Once that clicks, the model APIs stop looking like isolated helpers and start reading as one coherent state architecture.