cabloy 5.1.59 → 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.
- package/.claude/hooks/contract-loop-gate.ts +296 -0
- package/.claude/settings.json +16 -0
- package/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +1 -0
- package/.claude/skills/cabloy-contract-loop/SKILL.md +103 -14
- package/.claude/skills/cabloy-contract-loop/references/contract-loop-map.md +126 -12
- package/.claude/skills/cabloy-contract-loop/references/resource-custom-state-pattern.md +148 -0
- package/.claude/skills/cabloy-contract-loop/references/verification-checklist.md +49 -13
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +11 -0
- package/.claude/skills/cabloy-frontend-scaffold/references/follow-up-checklist.md +2 -0
- package/.claude/skills/cabloy-module-removal/SKILL.md +144 -0
- package/.claude/skills/cabloy-resource-field-update/SKILL.md +274 -0
- package/.claude/skills/cabloy-resource-field-update/evals/evals.json +53 -0
- package/.claude/skills/cabloy-resource-field-update/references/custom-renderer-demo-checklist.md +102 -0
- package/.claude/skills/cabloy-resource-field-update/references/field-update-decision-tree.md +120 -0
- package/.claude/skills/cabloy-resource-field-update/references/follow-up-checklist.md +80 -0
- package/.claude/skills/cabloy-resource-field-update/references/verification-checklist.md +97 -0
- package/.claude/skills/cabloy-zova-source-reading/SKILL.md +221 -0
- package/.claude/skills/cabloy-zova-source-reading/references/analysis-modes.md +91 -0
- package/.claude/skills/cabloy-zova-source-reading/references/core-reading-paths.md +117 -0
- package/.github/workflows/docs-pages.yml +2 -0
- package/.github/workflows/vona-cov-pg.yml +2 -0
- package/.github/workflows/vona-test-crud.yml +4 -2
- package/.github/workflows/vona-test-mysql.yml +2 -0
- package/.github/workflows/vona-test-pg.yml +2 -0
- package/.github/workflows/vona-test-sqlite3.yml +2 -0
- package/.github/workflows/vona-tsc.yml +2 -0
- package/.github/workflows/zova-ui.yml +2 -0
- package/.gitignore +0 -4
- package/CHANGELOG.md +52 -0
- package/CLAUDE.md +12 -0
- package/README.md +15 -0
- package/cabloy-docs/.vitepress/config.mjs +89 -0
- package/cabloy-docs/ai/class-placement-rule.md +2 -0
- package/cabloy-docs/ai/cli-to-skill-map.md +14 -0
- package/cabloy-docs/ai/docs-skills-rules-mapping.md +14 -0
- package/cabloy-docs/ai/future-skill-roadmap.md +27 -9
- package/cabloy-docs/ai/introduction.md +1 -0
- package/cabloy-docs/ai/playbook-backend-module.md +6 -0
- package/cabloy-docs/ai/playbook-module-removal.md +164 -0
- package/cabloy-docs/ai/skills.md +11 -0
- package/cabloy-docs/backend/bean-scene-authoring.md +350 -0
- package/cabloy-docs/backend/cli.md +26 -1
- package/cabloy-docs/backend/dto-guide.md +6 -0
- package/cabloy-docs/backend/entity-guide.md +18 -0
- package/cabloy-docs/backend/foundation.md +28 -3
- package/cabloy-docs/backend/introduction.md +10 -0
- package/cabloy-docs/backend/serialization-guide.md +10 -0
- package/cabloy-docs/backend/service-guide.md +2 -0
- package/cabloy-docs/backend/status-guide.md +271 -0
- package/cabloy-docs/backend/websocket-call-flow.md +435 -0
- package/cabloy-docs/backend/websocket-guide.md +455 -0
- package/cabloy-docs/backend/websocket-protocol-guide.md +381 -0
- package/cabloy-docs/backend/websocket-usage-guide.md +356 -0
- package/cabloy-docs/frontend/api-guide.md +2 -0
- package/cabloy-docs/frontend/bean-scene-authoring.md +374 -0
- package/cabloy-docs/frontend/behavior-guide.md +449 -0
- package/cabloy-docs/frontend/cli.md +24 -0
- package/cabloy-docs/frontend/command-scene-authoring.md +495 -0
- package/cabloy-docs/frontend/design-principles.md +6 -0
- package/cabloy-docs/frontend/fetch-interceptor-guide.md +440 -0
- package/cabloy-docs/frontend/form-guide.md +795 -0
- package/cabloy-docs/frontend/foundation.md +29 -0
- package/cabloy-docs/frontend/introduction.md +17 -1
- package/cabloy-docs/frontend/ioc-and-beans.md +16 -9
- package/cabloy-docs/frontend/mock-guide.md +1 -0
- package/cabloy-docs/frontend/model-architecture.md +252 -39
- package/cabloy-docs/frontend/model-resource-best-practices.md +379 -0
- package/cabloy-docs/frontend/model-resource-cookbook.md +505 -0
- package/cabloy-docs/frontend/model-resource-owner-pattern.md +382 -0
- package/cabloy-docs/frontend/model-resource-usage-guide.md +318 -0
- package/cabloy-docs/frontend/model-state-guide.md +366 -13
- package/cabloy-docs/frontend/openapi-sdk-guide.md +5 -2
- package/cabloy-docs/frontend/page-guide.md +6 -0
- package/cabloy-docs/frontend/quickstart.md +4 -0
- package/cabloy-docs/frontend/reading-zova-for-vue-developers.md +266 -0
- package/cabloy-docs/frontend/router-tabs-admin-web-comparison.md +206 -0
- package/cabloy-docs/frontend/router-tabs-introduction.md +106 -0
- package/cabloy-docs/frontend/router-tabs-mechanism.md +469 -0
- package/cabloy-docs/frontend/router-tabs-overview.md +227 -0
- package/cabloy-docs/frontend/router-tabs-route-meta-cookbook.md +343 -0
- package/cabloy-docs/frontend/server-data.md +2 -0
- package/cabloy-docs/frontend/ssr-architecture-overview.md +211 -0
- package/cabloy-docs/frontend/ssr-build-deploy-guide.md +308 -0
- package/cabloy-docs/frontend/ssr-review-checklist.md +184 -0
- package/cabloy-docs/frontend/ssr-troubleshooting-guide.md +301 -0
- package/cabloy-docs/frontend/zova-form-source-reading-map.md +295 -0
- package/cabloy-docs/frontend/zova-form-under-the-hood.md +556 -0
- package/cabloy-docs/frontend/zova-reactivity-under-the-hood.md +320 -0
- package/cabloy-docs/frontend/zova-source-reading-map.md +327 -0
- package/cabloy-docs/frontend/zova-vs-vue3-comparison.md +308 -0
- package/cabloy-docs/fullstack/contract-loop-playbook.md +350 -0
- package/cabloy-docs/fullstack/framework-performance.md +3 -3
- package/cabloy-docs/fullstack/frontend-metadata-to-backend.md +44 -1
- package/cabloy-docs/fullstack/introduction.md +40 -0
- package/cabloy-docs/fullstack/openapi-to-sdk.md +19 -9
- package/cabloy-docs/fullstack/quickstart.md +7 -1
- package/cabloy-docs/fullstack/tutorial-1-first-module.md +111 -0
- package/cabloy-docs/fullstack/tutorial-2-first-crud.md +122 -0
- package/cabloy-docs/fullstack/tutorial-3-frontend-metadata-sharing.md +131 -0
- package/cabloy-docs/fullstack/tutorial-4-custom-level-renderers.md +144 -0
- package/cabloy-docs/fullstack/tutorial-5-backend-contract-sharing.md +146 -0
- package/cabloy-docs/fullstack/tutorial-6-one-contract-four-uses.md +170 -0
- package/cabloy-docs/fullstack/tutorials-overview.md +192 -0
- package/cabloy-docs/index.md +4 -3
- package/cabloy-docs/reference/bean-scene-boilerplates.md +75 -0
- package/cabloy-docs/reference/cli-reference.md +2 -0
- package/package.json +7 -2
- package/scripts/initTestData.ts +25 -0
- package/scripts/upgrade.ts +17 -2
- package/vona/packages-cli/cabloy-cli/package.json +2 -2
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.module.ts +4 -0
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/pnpm-lock.yaml +226 -1091
- package/vona/pnpm-workspace.yaml +0 -1
- package/vona/src/suite-vendor/a-vona/modules/a-core/assets/static/img/vona.svg +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-permission/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-permission/src/bean/bean.permission.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-upload/package.json +2 -2
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/package.original.json +1 -1
- package/zova/packages-cli/cli/package.json +3 -3
- package/zova/packages-cli/cli-set-front/cli/templates/init/icon/boilerplate/icons/default/zova.svg +1 -1
- package/zova/packages-cli/cli-set-front/cli/templates/openapi/config/boilerplate/module/openapi.config.ts +6 -1
- package/zova/packages-cli/cli-set-front/package.json +3 -3
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.module.ts +4 -0
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +34 -4
- package/zova/packages-cli/cli-set-front/src/lib/command/create.bean.ts +5 -1
- package/zova/packages-utils/zova-vite/package.json +2 -2
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +282 -1311
- package/zova/pnpm-workspace.yaml +0 -1
- package/zova/src/suite/a-home/modules/home-icon/icons/social/cabloy.svg +1 -1
- package/zova/src/suite/a-home/modules/home-icon/icons/social/vona.svg +1 -1
- package/zova/src/suite/a-home/modules/home-icon/icons/social/zova.svg +1 -1
- package/zova/src/suite/a-home/modules/home-icon/src/.metadata/icons/groups/social.svg +3 -3
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/formFieldSelect/controller.tsx +9 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts +66 -16
- package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-routertabs/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-routertabs/src/model/tabs.ts +60 -18
- package/zova/src/suite-vendor/a-zova/modules/a-table/cli/tableActionRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-table/cli/tableCell/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +4 -4
|
@@ -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,7 +32,12 @@ 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)
|
|
40
|
+
- [Behavior Guide](/frontend/behavior-guide)
|
|
36
41
|
- [Modules and Suites](/frontend/modules-and-suites)
|
|
37
42
|
- [Module Scope](/frontend/module-scope)
|
|
38
43
|
- [Design Principles](/frontend/design-principles)
|
|
@@ -55,9 +60,12 @@ Use this path when the task is page-oriented, route-oriented, or the first time
|
|
|
55
60
|
|
|
56
61
|
### Components and UI flow
|
|
57
62
|
|
|
58
|
-
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:
|
|
59
64
|
|
|
60
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)
|
|
61
69
|
- [Component Props Guide](/frontend/component-props-guide)
|
|
62
70
|
- [Component v-model Guide](/frontend/component-v-model-guide)
|
|
63
71
|
- [Generic Component Guide](/frontend/generic-component-guide)
|
|
@@ -73,9 +81,17 @@ Use this path when the task is about data loading, API contracts, generated SDKs
|
|
|
73
81
|
- [API Guide](/frontend/api-guide)
|
|
74
82
|
- [Model Architecture](/frontend/model-architecture)
|
|
75
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)
|
|
76
88
|
- [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
77
89
|
- [API Schema Guide](/frontend/api-schema-guide)
|
|
78
90
|
- [SDK Guide](/frontend/sdk-guide)
|
|
91
|
+
- [SSR Architecture Overview](/frontend/ssr-architecture-overview)
|
|
92
|
+
- [SSR Build and Deploy Guide](/frontend/ssr-build-deploy-guide)
|
|
93
|
+
- [SSR Troubleshooting Guide](/frontend/ssr-troubleshooting-guide)
|
|
94
|
+
- [SSR Review Checklist](/frontend/ssr-review-checklist)
|
|
79
95
|
- [SSR Overview](/frontend/ssr-overview)
|
|
80
96
|
- [SSR Init Data](/frontend/ssr-init-data)
|
|
81
97
|
- [SSR ClientOnly](/frontend/ssr-client-only)
|
|
@@ -35,9 +35,9 @@ All beans inherit from `BeanBase`, which exposes common framework capabilities a
|
|
|
35
35
|
|
|
36
36
|
## `BeanBase`
|
|
37
37
|
|
|
38
|
-
`BeanBase`
|
|
38
|
+
`BeanBase` sits on top of the simpler core bean surface and is also a host for members extended by modules and adapters.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Core inherited members include:
|
|
41
41
|
|
|
42
42
|
- `sys`
|
|
43
43
|
- `app`
|
|
@@ -46,14 +46,13 @@ Representative members include:
|
|
|
46
46
|
- `scope`
|
|
47
47
|
- `$el`
|
|
48
48
|
- `$event`
|
|
49
|
-
- `$ssr`
|
|
50
|
-
- `$useMeta`
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
Module and adapter layers can extend that surface further. For example, SSR-related modules can add members such as `$ssr` and `$useMeta`.
|
|
53
51
|
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
- `$props`
|
|
52
|
+
More specialized controller bases can also add frontend-specific members:
|
|
53
|
+
|
|
54
|
+
- component-style controller bases expose `$props`
|
|
55
|
+
- page-controller bases expose `$params` and `$query`
|
|
57
56
|
|
|
58
57
|
Module and UI adapters can further extend the base surface.
|
|
59
58
|
|
|
@@ -193,11 +192,19 @@ This matters especially in large systems, where business modules should remain r
|
|
|
193
192
|
|
|
194
193
|
Read this together with:
|
|
195
194
|
|
|
195
|
+
- [Behavior Guide](/frontend/behavior-guide) when the task is about render-time interception, behavior composition, or authoring beans inside the existing Behavior scene
|
|
196
|
+
- [Frontend Bean Scene Authoring](/frontend/bean-scene-authoring) when you need to create a **new bean scene** rather than only adding a bean inside an existing scene
|
|
196
197
|
- [Modules and Suites](/frontend/modules-and-suites)
|
|
197
198
|
- [Module Scope](/frontend/module-scope)
|
|
198
199
|
- [Frontend Design Principles](/frontend/design-principles)
|
|
199
200
|
|
|
200
|
-
Those pages explain how beans fit into module boundaries, scope-based resources, and the broader Zova architectural model.
|
|
201
|
+
Those pages explain how beans fit into module boundaries, scope-based resources, the existing Behavior scene, and the broader Zova architectural model.
|
|
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)
|
|
201
208
|
|
|
202
209
|
## Implementation checks for frontend bean-architecture changes
|
|
203
210
|
|
|
@@ -1,78 +1,282 @@
|
|
|
1
1
|
# Model Architecture
|
|
2
2
|
|
|
3
|
-
This guide explains the
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
27
|
+
It is not only a generic Vue composable and it is not only a thin request wrapper.
|
|
14
28
|
|
|
15
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
49
|
+
That matters because Zova is not replacing TanStack Query with a separate state engine.
|
|
27
50
|
|
|
28
|
-
|
|
51
|
+
Instead, Zova wraps TanStack Query inside a model-bean architecture so that:
|
|
29
52
|
|
|
30
|
-
|
|
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
|
-
|
|
58
|
+
## Public authoring surface
|
|
33
59
|
|
|
34
|
-
|
|
60
|
+
Representative model definition:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { Model } from 'zova';
|
|
64
|
+
import { BeanModelBase } from 'zova-module-a-model';
|
|
35
65
|
|
|
36
|
-
|
|
66
|
+
@Model()
|
|
67
|
+
export class ModelTodo extends BeanModelBase {}
|
|
68
|
+
```
|
|
37
69
|
|
|
38
|
-
|
|
70
|
+
At source level, `@Model()` is a bean decorator factory:
|
|
39
71
|
|
|
40
|
-
|
|
72
|
+
- `zova/src/suite-vendor/a-zova/modules/a-model/src/lib/model.ts`
|
|
41
73
|
|
|
42
|
-
|
|
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
|
-
|
|
76
|
+
## The core architectural idea
|
|
45
77
|
|
|
46
|
-
|
|
78
|
+
The most important current-source insight is this:
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
> Zova unifies remote state and several local state categories around query-cache semantics, then exposes that system through model beans.
|
|
49
81
|
|
|
50
|
-
|
|
82
|
+
That is why model APIs look broader than a normal “data fetching helper”.
|
|
51
83
|
|
|
52
|
-
|
|
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
|
-
|
|
86
|
+
## Five state families in the current model layer
|
|
55
87
|
|
|
56
|
-
|
|
88
|
+
The `a-model` source exposes five main state families through `BeanModelBase` helpers:
|
|
57
89
|
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
98
|
+
## How the runtime is assembled
|
|
63
99
|
|
|
64
|
-
|
|
100
|
+
A compact source-confirmed runtime path is:
|
|
65
101
|
|
|
66
|
-
|
|
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
|
-
|
|
69
|
-
import { Model } from 'zova';
|
|
70
|
-
import { BeanModelBase } from 'zova-module-a-model';
|
|
109
|
+
### 1. `@Model()` registers a model bean
|
|
71
110
|
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|
84
|
-
3.
|
|
85
|
-
4.
|
|
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.
|