cabloy 5.1.61 → 5.1.62
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/skills/cabloy-backend-scaffold/SKILL.md +2 -0
- package/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +1 -1
- package/.claude/skills/cabloy-domain-planning/SKILL.md +212 -0
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +2 -0
- package/CHANGELOG.md +42 -0
- package/CLAUDE.md +1 -0
- package/cabloy-docs/.vitepress/config.mjs +158 -12
- package/cabloy-docs/ai/docs-skills-rules-mapping.md +8 -0
- package/cabloy-docs/ai/future-skill-roadmap.md +2 -0
- package/cabloy-docs/ai/skills.md +1 -0
- package/cabloy-docs/backend/backend-contract-emission-output-inspection.md +189 -0
- package/cabloy-docs/backend/backend-contract-emission-source-reading-map.md +160 -0
- package/cabloy-docs/backend/backend-contract-emission-specimen.md +170 -0
- package/cabloy-docs/backend/backend-resource-module-contract-chain.md +323 -0
- package/cabloy-docs/backend/backend-source-reading-debug-checklist.md +173 -0
- package/cabloy-docs/backend/backend-source-reading-roadmap.md +129 -0
- package/cabloy-docs/backend/backend-source-reading-verify-playbook.md +166 -0
- package/cabloy-docs/backend/bean-scene-authoring.md +4 -4
- package/cabloy-docs/backend/broadcast-guide.md +3 -3
- package/cabloy-docs/backend/cli.md +20 -11
- package/cabloy-docs/backend/config-guide.md +4 -4
- package/cabloy-docs/backend/controller-aop-guide.md +10 -10
- package/cabloy-docs/backend/controller-guide.md +12 -2
- package/cabloy-docs/backend/crud-workflow.md +7 -3
- package/cabloy-docs/backend/dto-guide.md +12 -2
- package/cabloy-docs/backend/dto-infer-generation.md +201 -25
- package/cabloy-docs/backend/election-guide.md +2 -2
- package/cabloy-docs/backend/entity-guide.md +12 -3
- package/cabloy-docs/backend/error-guide.md +3 -3
- package/cabloy-docs/backend/event-guide.md +4 -4
- package/cabloy-docs/backend/external-aop-guide.md +2 -2
- package/cabloy-docs/backend/field-indexes.md +9 -3
- package/cabloy-docs/backend/foundation.md +8 -8
- package/cabloy-docs/backend/i18n-guide.md +6 -6
- package/cabloy-docs/backend/internal-aop-guide.md +2 -2
- package/cabloy-docs/backend/introduction.md +13 -0
- package/cabloy-docs/backend/migration-and-changes.md +3 -3
- package/cabloy-docs/backend/model-guide.md +16 -6
- package/cabloy-docs/backend/openapi-guide.md +3 -0
- package/cabloy-docs/backend/queue-guide.md +3 -3
- package/cabloy-docs/backend/redlock-guide.md +2 -2
- package/cabloy-docs/backend/schedule-guide.md +2 -2
- package/cabloy-docs/backend/scripts.md +8 -0
- package/cabloy-docs/backend/serialization-guide.md +2 -2
- package/cabloy-docs/backend/service-guide.md +18 -9
- package/cabloy-docs/backend/startup-guide.md +5 -5
- package/cabloy-docs/backend/status-guide.md +7 -7
- package/cabloy-docs/backend/unit-testing.md +3 -3
- package/cabloy-docs/backend/vona-source-reading-map.md +157 -0
- package/cabloy-docs/backend/websocket-protocol-guide.md +5 -5
- package/cabloy-docs/backend/websocket-usage-guide.md +15 -8
- package/cabloy-docs/frontend/a-model-under-the-hood.md +281 -0
- package/cabloy-docs/frontend/a-openapi-under-the-hood.md +248 -0
- package/cabloy-docs/frontend/a-router-guide.md +307 -0
- package/cabloy-docs/frontend/api-guide.md +4 -4
- package/cabloy-docs/frontend/api-schema-guide.md +1 -0
- package/cabloy-docs/frontend/app-startup-guide.md +7 -4
- package/cabloy-docs/frontend/bean-scene-authoring.md +1 -1
- package/cabloy-docs/frontend/behavior-guide.md +16 -16
- package/cabloy-docs/frontend/cli.md +5 -5
- package/cabloy-docs/frontend/command-scene-authoring.md +17 -8
- package/cabloy-docs/frontend/component-guide.md +5 -5
- package/cabloy-docs/frontend/component-props-guide.md +1 -1
- package/cabloy-docs/frontend/component-v-model-guide.md +2 -2
- package/cabloy-docs/frontend/filter-query-select-data-flow-guide.md +260 -0
- package/cabloy-docs/frontend/form-guide.md +19 -28
- package/cabloy-docs/frontend/form-scene-to-page-meta-guide.md +303 -0
- package/cabloy-docs/frontend/foundation.md +10 -6
- package/cabloy-docs/frontend/frontend-source-reading-roadmap.md +249 -0
- package/cabloy-docs/frontend/generated-contract-consumption-debug-checklist.md +190 -0
- package/cabloy-docs/frontend/generated-contract-consumption-entry-branch.md +205 -0
- package/cabloy-docs/frontend/generated-contract-consumption-list-branch.md +157 -0
- package/cabloy-docs/frontend/generated-contract-consumption-specimen.md +203 -0
- package/cabloy-docs/frontend/generated-contract-consumption-verify-playbook.md +189 -0
- package/cabloy-docs/frontend/generic-component-guide.md +1 -1
- package/cabloy-docs/frontend/introduction.md +29 -7
- package/cabloy-docs/frontend/model-architecture.md +38 -2
- package/cabloy-docs/frontend/model-resource-cookbook.md +11 -8
- package/cabloy-docs/frontend/model-resource-internals-deep-dive.md +238 -0
- package/cabloy-docs/frontend/model-resource-owner-pattern.md +22 -2
- package/cabloy-docs/frontend/model-resource-usage-guide.md +22 -6
- package/cabloy-docs/frontend/model-state-guide.md +12 -9
- package/cabloy-docs/frontend/module-scope.md +8 -8
- package/cabloy-docs/frontend/modules-and-suites.md +2 -1
- package/cabloy-docs/frontend/navigation-guards-guide.md +7 -0
- package/cabloy-docs/frontend/openapi-sdk-guide.md +12 -4
- package/cabloy-docs/frontend/page-guide.md +9 -9
- package/cabloy-docs/frontend/page-meta-guide.md +466 -0
- package/cabloy-docs/frontend/page-params-guide.md +3 -3
- package/cabloy-docs/frontend/page-query-guide.md +2 -2
- package/cabloy-docs/frontend/page-route-guide.md +6 -0
- package/cabloy-docs/frontend/permission-formscene-action-visibility-guide.md +263 -0
- package/cabloy-docs/frontend/quickstart.md +14 -2
- package/cabloy-docs/frontend/resource-entry-page-deep-dive.md +271 -0
- package/cabloy-docs/frontend/resource-list-page-deep-dive.md +279 -0
- package/cabloy-docs/frontend/rest-resource-source-reading-map.md +522 -0
- package/cabloy-docs/frontend/rest-resource-under-the-hood.md +622 -0
- package/cabloy-docs/frontend/root-behaviors-guide.md +282 -0
- package/cabloy-docs/frontend/route-alias-guide.md +6 -0
- package/cabloy-docs/frontend/router-stack-guide.md +229 -0
- package/cabloy-docs/frontend/router-tabs-introduction.md +26 -3
- package/cabloy-docs/frontend/router-tabs-layout-integration.md +367 -0
- package/cabloy-docs/frontend/router-tabs-mechanism.md +6 -0
- package/cabloy-docs/frontend/router-tabs-route-meta-cookbook.md +7 -0
- package/cabloy-docs/frontend/router-tabs-vs-stack.md +167 -0
- package/cabloy-docs/frontend/router-view-hosts-guide.md +450 -0
- package/cabloy-docs/frontend/server-data.md +2 -1
- package/cabloy-docs/frontend/system-startup-guide.md +2 -2
- package/cabloy-docs/frontend/table-action-visibility-permission-flow-guide.md +263 -0
- package/cabloy-docs/frontend/table-cell-cookbook.md +568 -0
- package/cabloy-docs/frontend/table-guide.md +373 -0
- package/cabloy-docs/frontend/table-resource-crud-cookbook.md +496 -0
- package/cabloy-docs/frontend/zova-app-guide.md +251 -0
- package/cabloy-docs/frontend/zova-form-source-reading-map.md +7 -9
- package/cabloy-docs/frontend/zova-form-under-the-hood.md +5 -0
- package/cabloy-docs/frontend/zova-router-under-the-hood.md +561 -0
- package/cabloy-docs/frontend/zova-source-reading-map.md +101 -7
- package/cabloy-docs/frontend/zova-table-controller-render-supplement.md +225 -0
- package/cabloy-docs/frontend/zova-table-source-reading-map.md +317 -0
- package/cabloy-docs/frontend/zova-table-under-the-hood.md +532 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions-debug-checklist.md +245 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions-source-reading-map.md +139 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions-verify-playbook.md +248 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions.md +511 -0
- package/cabloy-docs/fullstack/contract-loop-playbook.md +8 -2
- package/cabloy-docs/fullstack/edition-collaboration-differences.md +6 -0
- package/cabloy-docs/fullstack/frontend-metadata-to-backend.md +181 -48
- package/cabloy-docs/fullstack/introduction.md +3 -0
- package/cabloy-docs/fullstack/openapi-to-sdk.md +116 -2
- package/cabloy-docs/fullstack/suites-and-modules.md +333 -0
- package/cabloy-docs/fullstack/tutorial-1-first-module.md +3 -0
- package/cabloy-docs/fullstack/tutorial-2-first-crud.md +4 -0
- package/cabloy-docs/fullstack/tutorial-3-frontend-metadata-sharing.md +4 -0
- package/cabloy-docs/fullstack/tutorial-4-custom-level-renderers.md +31 -19
- package/cabloy-docs/fullstack/tutorial-5-backend-contract-sharing.md +5 -0
- package/cabloy-docs/fullstack/tutorial-6-one-contract-four-uses.md +4 -0
- package/cabloy-docs/fullstack/tutorials-overview.md +1 -1
- package/cabloy-docs/reference/bean-scene-boilerplates.md +13 -13
- package/cabloy-docs/reference/package-map.md +4 -3
- package/package.json +1 -1
- package/vona/pnpm-lock.yaml +22 -258
- package/vona/src/suite/a-training/modules/training-student/package.json +53 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/index.ts +400 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/locales.ts +18 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/this.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/bean/meta.index.ts +12 -0
- package/vona/src/suite/a-training/modules/training-student/src/bean/meta.version.ts +21 -0
- package/vona/src/suite/a-training/modules/training-student/src/bean/ssrMenu.student.ts +29 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +15 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +15 -0
- package/vona/src/suite/a-training/modules/training-student/src/controller/student.ts +74 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx +28 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectReq.tsx +44 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectRes.tsx +11 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectResItem.tsx +45 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSummary.tsx +42 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentUpdate.tsx +28 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentView.tsx +25 -0
- package/vona/src/suite/a-training/modules/training-student/src/entity/student.tsx +84 -0
- package/vona/src/suite/a-training/modules/training-student/src/index.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/model/student.ts +10 -0
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +57 -0
- package/vona/src/suite/a-training/modules/training-student/test/student.test.ts +173 -0
- package/vona/src/suite/a-training/modules/training-student/tsconfig.build.json +11 -0
- package/vona/src/suite/a-training/modules/training-student/tsconfig.json +7 -0
- package/vona/src/suite/a-training/package.json +12 -0
- package/vona/src/suite/a-training/tsconfig.base.json +4 -0
- package/vona/src/suite/a-training/tsconfig.json +10 -0
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +406 -680
- package/zova/src/suite/a-training/modules/training-student/cli/openapi.config.ts +9 -0
- package/zova/src/suite/a-training/modules/training-student/package.json +52 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/component/formFieldLevel.ts +31 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/index.ts +258 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/locales.ts +7 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/this.ts +2 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/index.ts +3 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +196 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +4146 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/trainingStudent.ts +151 -0
- package/zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts +43 -0
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionDeleteForce.tsx +51 -0
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionSummary.tsx +56 -0
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.level.tsx +63 -0
- package/zova/src/suite/a-training/modules/training-student/src/component/formFieldLevel/controller.tsx +117 -0
- package/zova/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +9 -0
- package/zova/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +9 -0
- package/zova/src/suite/a-training/modules/training-student/src/index.ts +2 -0
- package/zova/src/suite/a-training/modules/training-student/src/model/student.ts +42 -0
- package/zova/src/suite/a-training/modules/training-student/tsconfig.build.json +13 -0
- package/zova/src/suite/a-training/modules/training-student/tsconfig.json +5 -0
- package/zova/src/suite/a-training/package.json +12 -0
- package/zova/src/suite/a-training/tsconfig.base.json +4 -0
- package/zova/src/suite/a-training/tsconfig.json +4 -0
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/formFieldSelect/controller.tsx +29 -7
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/select/controller.tsx +34 -11
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/controller.tsx +3 -3
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/lib/tableCell.ts +1 -1
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Model Runtime Under the Hood
|
|
2
|
+
|
|
3
|
+
This guide explains the lower-level runtime of `a-model` in Zova through the current public Cabloy Basic source.
|
|
4
|
+
|
|
5
|
+
Use this page when you want to understand:
|
|
6
|
+
|
|
7
|
+
- how the model module bootstraps its shared query infrastructure
|
|
8
|
+
- how `$queryClient` becomes available on beans
|
|
9
|
+
- how the model inheritance stack is assembled
|
|
10
|
+
- how query keys are prefixed and normalized
|
|
11
|
+
- how `useQuery`, state helpers, and persister behavior fit together
|
|
12
|
+
- how SSR dehydrate/hydrate and stale-time rules participate in the model runtime
|
|
13
|
+
|
|
14
|
+
## Why this page exists
|
|
15
|
+
|
|
16
|
+
Several existing docs already explain the role and usage of models well:
|
|
17
|
+
|
|
18
|
+
- [Model Architecture](/frontend/model-architecture)
|
|
19
|
+
- [Model State Guide](/frontend/model-state-guide)
|
|
20
|
+
- [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
|
|
21
|
+
- [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
22
|
+
|
|
23
|
+
What those pages do not isolate directly is the lower-level generic `a-model` runtime chain.
|
|
24
|
+
|
|
25
|
+
That is the gap this page fills.
|
|
26
|
+
|
|
27
|
+
## The shortest accurate mental model
|
|
28
|
+
|
|
29
|
+
A practical mental model is:
|
|
30
|
+
|
|
31
|
+
1. `@Model()` registers a model bean on the model scene
|
|
32
|
+
2. the `a-model` module monkey bootstraps a shared `QueryClient`
|
|
33
|
+
3. the monkey injects `$queryClient` onto bean instances
|
|
34
|
+
4. `BeanModelBase` is the public entry into a deeper inheritance stack for query, mutation, state, and persistence behavior
|
|
35
|
+
5. all model query/state operations prefix keys by model identity, and selector-enabled models add selector identity too
|
|
36
|
+
6. `useQuery`, state helpers, and persister behavior cooperate to apply SSR-aware stale/hydration/persistence rules
|
|
37
|
+
|
|
38
|
+
That means the model layer is not only a set of convenience helpers. It is a lower-level shared query/persistence runtime for the frontend.
|
|
39
|
+
|
|
40
|
+
## Source-confirmed reading path
|
|
41
|
+
|
|
42
|
+
When reading this topic, use this order:
|
|
43
|
+
|
|
44
|
+
1. `zova/src/suite-vendor/a-zova/modules/a-model/src/monkey.ts`
|
|
45
|
+
2. `zova/src/suite-vendor/a-zova/modules/a-model/src/service/storage.ts`
|
|
46
|
+
3. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.modelBase.ts`
|
|
47
|
+
4. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.last.ts`
|
|
48
|
+
5. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.query.ts`
|
|
49
|
+
6. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useQuery.ts`
|
|
50
|
+
7. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useState.ts`
|
|
51
|
+
8. `zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.persister.ts`
|
|
52
|
+
9. `zova/src/suite-vendor/a-zova/modules/a-model/src/config/config.ts`
|
|
53
|
+
|
|
54
|
+
That order moves from module bootstrapping, to shared query storage, to the public model bean entry, then into identity, query, useQuery, state, persister, and finally default config behavior.
|
|
55
|
+
|
|
56
|
+
## monkey/bootstrap and `QueryClient` wiring
|
|
57
|
+
|
|
58
|
+
The module monkey lives in:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/monkey.ts
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The source confirms that:
|
|
65
|
+
|
|
66
|
+
- `appInitialize()` creates/initializes shared storage
|
|
67
|
+
- `moduleLoaded()` lets the storage service finish module-level setup
|
|
68
|
+
- `beanInit(...)` defines `$queryClient` on beans
|
|
69
|
+
- `$queryClient` is resolved through `useQueryClient()` and marked raw
|
|
70
|
+
|
|
71
|
+
This is the first important lower-level rule:
|
|
72
|
+
|
|
73
|
+
- the model runtime is bootstrapped at module/app level before higher model helpers are used
|
|
74
|
+
|
|
75
|
+
## `ServiceStorage` and shared query lifecycle
|
|
76
|
+
|
|
77
|
+
The shared query-storage/runtime owner lives in:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/service/storage.ts
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Its main jobs are:
|
|
84
|
+
|
|
85
|
+
- create the shared `QueryClient`
|
|
86
|
+
- create the `QueryCache`
|
|
87
|
+
- install the Vue Query plugin into the app
|
|
88
|
+
- on the server, dehydrate query state after render
|
|
89
|
+
- on the client, hydrate query state during SSR pre-hydration
|
|
90
|
+
- clear the query client after server rendering completes
|
|
91
|
+
|
|
92
|
+
This is the second important lower-level rule:
|
|
93
|
+
|
|
94
|
+
- the model runtime is not only about per-model helper methods
|
|
95
|
+
- it also owns one shared query lifecycle around SSR and client hydration
|
|
96
|
+
|
|
97
|
+
## The public model bean entry and inheritance stack
|
|
98
|
+
|
|
99
|
+
The public bean entry lives in:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.modelBase.ts
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
It is intentionally thin:
|
|
106
|
+
|
|
107
|
+
- `BeanModelBase extends BeanModelFirst`
|
|
108
|
+
|
|
109
|
+
A key lower-level identity layer appears in:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.last.ts
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This file confirms that:
|
|
116
|
+
|
|
117
|
+
- selector identity is stored on the model when `enableSelector` is on
|
|
118
|
+
- `self` and `scopeSelf` provide access to the effective model bean/runtime scope
|
|
119
|
+
|
|
120
|
+
This is the rule to keep in mind when reading the rest of the runtime:
|
|
121
|
+
|
|
122
|
+
- `BeanModelBase` is the public entry
|
|
123
|
+
- the lower-level behavior is assembled through the internal inheritance chain beneath it
|
|
124
|
+
|
|
125
|
+
## Query-key prefixing and normalization
|
|
126
|
+
|
|
127
|
+
The core query identity logic lives in:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.query.ts
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The most important lower-level rule is `_forceQueryKeyPrefix(...)`.
|
|
134
|
+
|
|
135
|
+
The source confirms that query keys are prefixed with:
|
|
136
|
+
|
|
137
|
+
- bean full name
|
|
138
|
+
- selector, when selector mode is enabled
|
|
139
|
+
|
|
140
|
+
This matters because model query identity is not only whatever the caller typed in `queryKey`.
|
|
141
|
+
|
|
142
|
+
The model runtime namespaces the key automatically.
|
|
143
|
+
|
|
144
|
+
This same layer also owns:
|
|
145
|
+
|
|
146
|
+
- `$setQueryData(...)`
|
|
147
|
+
- `$invalidateQueries(...)`
|
|
148
|
+
- `$refetchQueries(...)`
|
|
149
|
+
- `$queryFind(...)`
|
|
150
|
+
- filter normalization through `$normalizeFilters(...)`
|
|
151
|
+
|
|
152
|
+
That means key prefixing and invalidation are part of the same lower-level runtime layer.
|
|
153
|
+
|
|
154
|
+
## `useQuery` runtime behavior
|
|
155
|
+
|
|
156
|
+
The query wrapper lives in:
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useQuery.ts
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The source confirms that `useQuery` behavior is not passed through untouched.
|
|
163
|
+
|
|
164
|
+
It adds:
|
|
165
|
+
|
|
166
|
+
- prefixed query keys
|
|
167
|
+
- persister integration
|
|
168
|
+
- default error handling
|
|
169
|
+
- SSR-aware stale-time branching
|
|
170
|
+
|
|
171
|
+
The important SSR-aware rule is:
|
|
172
|
+
|
|
173
|
+
- async queries use configured async stale time by default
|
|
174
|
+
- during client SSR pre-hydration, cached SSR data can switch to SSR stale-time behavior
|
|
175
|
+
|
|
176
|
+
That means stale-time behavior is part of the model runtime contract, not only a local query option.
|
|
177
|
+
|
|
178
|
+
## State helper families as one runtime family
|
|
179
|
+
|
|
180
|
+
The state helper layer lives mainly in:
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useState.ts
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This is where the five main state families are exposed:
|
|
187
|
+
|
|
188
|
+
- `data`
|
|
189
|
+
- `mem`
|
|
190
|
+
- `local`
|
|
191
|
+
- `cookie`
|
|
192
|
+
- `db`
|
|
193
|
+
|
|
194
|
+
The important lower-level point is that these are not unrelated helpers.
|
|
195
|
+
|
|
196
|
+
They are one model-owned runtime family built on shared query/persistence identity.
|
|
197
|
+
|
|
198
|
+
A practical reading rule is:
|
|
199
|
+
|
|
200
|
+
- different state families differ in persistence/storage and SSR behavior
|
|
201
|
+
- but they still participate in one model runtime vocabulary and query-key system
|
|
202
|
+
|
|
203
|
+
## Persister storage selection and restore/save/remove behavior
|
|
204
|
+
|
|
205
|
+
The persister layer lives in:
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.persister.ts
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Its main jobs are:
|
|
212
|
+
|
|
213
|
+
- choose the storage backend
|
|
214
|
+
- compute storage key and prefix
|
|
215
|
+
- apply `buster`
|
|
216
|
+
- apply `maxAge`
|
|
217
|
+
- restore persisted state
|
|
218
|
+
- save persisted state
|
|
219
|
+
- remove persisted state
|
|
220
|
+
- prefix persisted query identity consistently with the model/query runtime
|
|
221
|
+
|
|
222
|
+
The storage options include:
|
|
223
|
+
|
|
224
|
+
- cookie
|
|
225
|
+
- local
|
|
226
|
+
- db
|
|
227
|
+
|
|
228
|
+
This is the clearest lower-level source for understanding why model persistence behavior differs by state family and why restored state still respects model identity.
|
|
229
|
+
|
|
230
|
+
## Default config behavior
|
|
231
|
+
|
|
232
|
+
The default model-runtime config lives in:
|
|
233
|
+
|
|
234
|
+
```text
|
|
235
|
+
zova/src/suite-vendor/a-zova/modules/a-model/src/config/config.ts
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
This file confirms default behavior such as:
|
|
239
|
+
|
|
240
|
+
- query retry/refetch defaults
|
|
241
|
+
- async stale time
|
|
242
|
+
- SSR stale time
|
|
243
|
+
- persistence max-age defaults
|
|
244
|
+
- dehydration rules for sync persister-backed queries
|
|
245
|
+
|
|
246
|
+
This is the place to check when the runtime feels surprising even though your page/model code looks correct.
|
|
247
|
+
|
|
248
|
+
## What this page does not re-explain
|
|
249
|
+
|
|
250
|
+
This page does **not** fully re-explain:
|
|
251
|
+
|
|
252
|
+
- the architectural role of Model -> see [Model Architecture](/frontend/model-architecture)
|
|
253
|
+
- the public helper-family usage -> see [Model State Guide](/frontend/model-state-guide)
|
|
254
|
+
- the resource-owner pattern -> see [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
|
|
255
|
+
- the resource-owner internals -> see [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
256
|
+
|
|
257
|
+
Its job is only to explain the lower-level generic `a-model` runtime.
|
|
258
|
+
|
|
259
|
+
## Where to read next
|
|
260
|
+
|
|
261
|
+
Use these next steps depending on your question:
|
|
262
|
+
|
|
263
|
+
- if you want the architectural role of Model, read [Model Architecture](/frontend/model-architecture)
|
|
264
|
+
- if you want state helper usage, read [Model State Guide](/frontend/model-state-guide)
|
|
265
|
+
- if you want resource-owner patterns built on this runtime, read [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
|
|
266
|
+
- if you want the resource-owner itself, read [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
267
|
+
- if you want the lower OpenAPI/schema substrate beneath some model behavior, read [A-OpenAPI Under the Hood](/frontend/a-openapi-under-the-hood)
|
|
268
|
+
|
|
269
|
+
## Final takeaway
|
|
270
|
+
|
|
271
|
+
The most accurate way to read `a-model` is not as one set of convenience wrappers around TanStack Query.
|
|
272
|
+
|
|
273
|
+
Read it as the lower-level frontend model runtime that:
|
|
274
|
+
|
|
275
|
+
- bootstraps a shared query client
|
|
276
|
+
- injects query access into beans
|
|
277
|
+
- composes model identity and selector-aware query-key namespacing
|
|
278
|
+
- applies persistence and SSR-aware hydration/stale behavior
|
|
279
|
+
- supports higher-level model and resource-owner patterns on top of that lower runtime
|
|
280
|
+
|
|
281
|
+
That is the source-confirmed role of `a-model` in the current Cabloy Basic frontend architecture.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# OpenAPI Runtime Under the Hood
|
|
2
|
+
|
|
3
|
+
This guide explains the lower-level runtime of `a-openapi` in Zova through the current public Cabloy Basic source.
|
|
4
|
+
|
|
5
|
+
Use this page when you want to understand:
|
|
6
|
+
|
|
7
|
+
- how `$sdk` becomes available on beans
|
|
8
|
+
- what `ModelSdk` and `SysSdk` each own
|
|
9
|
+
- how bootstrap and permissions loading work
|
|
10
|
+
- how request/query/filter/body/row/paged schema surfaces are derived
|
|
11
|
+
- why `a-openapi` is a lower-level shared runtime substrate for resource, model, and table consumers
|
|
12
|
+
|
|
13
|
+
## Why this page exists
|
|
14
|
+
|
|
15
|
+
Several existing docs already explain usage and positioning around the server-data ladder:
|
|
16
|
+
|
|
17
|
+
- [Server Data](/frontend/server-data)
|
|
18
|
+
- [SDK Guide](/frontend/sdk-guide)
|
|
19
|
+
- [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
20
|
+
- [API Schema Guide](/frontend/api-schema-guide)
|
|
21
|
+
|
|
22
|
+
What those pages do not isolate directly is the source-first runtime path inside `a-openapi` itself.
|
|
23
|
+
|
|
24
|
+
That is the gap this page fills.
|
|
25
|
+
|
|
26
|
+
## The shortest accurate mental model
|
|
27
|
+
|
|
28
|
+
A practical mental model is:
|
|
29
|
+
|
|
30
|
+
1. `a-openapi` injects `$sdk` onto beans through its module monkey
|
|
31
|
+
2. `$sdk` resolves a locale-scoped `ModelSdk`
|
|
32
|
+
3. `ModelSdk` exposes bootstrap, permissions, sdk, schema, Zod, and default-value helpers
|
|
33
|
+
4. `SysSdk` owns the lower cache/fetch layer for bootstrap/docs/schemas
|
|
34
|
+
5. `schema.ts` extracts request/query/filter/body/row/paged schema surfaces and applies scene-aware property selection
|
|
35
|
+
6. downstream resource/model/table consumers reuse those lower-level surfaces rather than rebuilding them independently
|
|
36
|
+
|
|
37
|
+
That means `a-openapi` is not only about generated SDK usage. It is also the lower-level schema/runtime bridge beneath the higher-level frontend runtime.
|
|
38
|
+
|
|
39
|
+
## Source-confirmed reading path
|
|
40
|
+
|
|
41
|
+
When reading this topic, use this order:
|
|
42
|
+
|
|
43
|
+
1. `zova/src/suite-vendor/a-zova/modules/a-openapi/src/monkey.ts`
|
|
44
|
+
2. `zova/src/suite-vendor/a-zova/modules/a-openapi/src/model/sdk.ts`
|
|
45
|
+
3. `zova/src/suite-vendor/a-zova/modules/a-openapi/src/bean/sys.sdk.ts`
|
|
46
|
+
4. `zova/src/suite-vendor/a-zova/modules/a-openapi/src/lib/schema.ts`
|
|
47
|
+
5. `zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/rest.ts`
|
|
48
|
+
6. optional supporting files:
|
|
49
|
+
- `zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/sdk.ts`
|
|
50
|
+
- `zova/src/suite-vendor/a-zova/modules/a-openapi/src/config/config.ts`
|
|
51
|
+
|
|
52
|
+
That order moves from bean-level injection, to the locale-scoped model surface, to the lower fetch/cache layer, to the schema extraction layer, and finally to the schema/type contract.
|
|
53
|
+
|
|
54
|
+
## `$sdk` injection and locale-scoped runtime
|
|
55
|
+
|
|
56
|
+
The injection layer lives in:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
zova/src/suite-vendor/a-zova/modules/a-openapi/src/monkey.ts
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The key source-confirmed behavior is:
|
|
63
|
+
|
|
64
|
+
- `beanInit(...)` defines `$sdk` on bean instances
|
|
65
|
+
- `$sdk` points to a ref-like current `ModelSdk`
|
|
66
|
+
- `moduleLoaded(...)` loads the SDK model for the current locale
|
|
67
|
+
- locale changes trigger `_loadSdk()` again
|
|
68
|
+
|
|
69
|
+
That means `$sdk` is not a static global object.
|
|
70
|
+
|
|
71
|
+
It is a runtime-injected, locale-scoped model surface.
|
|
72
|
+
|
|
73
|
+
## `ModelSdk` responsibilities
|
|
74
|
+
|
|
75
|
+
The selector-backed model lives in:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
zova/src/suite-vendor/a-zova/modules/a-openapi/src/model/sdk.ts
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The current source confirms that `ModelSdk` is:
|
|
82
|
+
|
|
83
|
+
- `@Model({ enableSelector: true })`
|
|
84
|
+
- selector-backed by locale
|
|
85
|
+
- responsible for:
|
|
86
|
+
- `getBootstrap(resource)`
|
|
87
|
+
- `getPermissions(resource)`
|
|
88
|
+
- `getSdk(api, method)`
|
|
89
|
+
- `getSchema(schemaName)`
|
|
90
|
+
- `getZodSchema(schemaName)`
|
|
91
|
+
- `getSchemaDefaultValue(schemaName)`
|
|
92
|
+
- `createApiSchemas(api, method)`
|
|
93
|
+
- `loadSchemaProperties(schema, schemaScene)`
|
|
94
|
+
- `schemaToZodSchema(schema)`
|
|
95
|
+
|
|
96
|
+
A practical reading rule is:
|
|
97
|
+
|
|
98
|
+
- `ModelSdk` is the higher model-facing façade over lower OpenAPI runtime state
|
|
99
|
+
- it is the surface most downstream consumers actually reuse
|
|
100
|
+
|
|
101
|
+
## `SysSdk` responsibilities
|
|
102
|
+
|
|
103
|
+
The lower runtime owner lives in:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
zova/src/suite-vendor/a-zova/modules/a-openapi/src/bean/sys.sdk.ts
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Its main jobs are:
|
|
110
|
+
|
|
111
|
+
- store loaded bootstraps
|
|
112
|
+
- store loaded schemas
|
|
113
|
+
- store loaded operation SDK entries by API and method
|
|
114
|
+
- fetch bootstrap data
|
|
115
|
+
- fetch operation-level OpenAPI docs
|
|
116
|
+
- cache schemas and operation objects in reactive stores
|
|
117
|
+
- reload caches during SSR HMR reload paths
|
|
118
|
+
|
|
119
|
+
This is the lower-level owner beneath `ModelSdk`.
|
|
120
|
+
|
|
121
|
+
A practical rule is:
|
|
122
|
+
|
|
123
|
+
- `ModelSdk` is the model-facing surface
|
|
124
|
+
- `SysSdk` is the lower cache/fetch owner
|
|
125
|
+
|
|
126
|
+
## Bootstrap and permissions loading
|
|
127
|
+
|
|
128
|
+
The bootstrap path is defined in `ModelSdk.getBootstrap(resource)`.
|
|
129
|
+
|
|
130
|
+
The source confirms that:
|
|
131
|
+
|
|
132
|
+
- bootstrap data is loaded first
|
|
133
|
+
- permissions are then loaded through `getPermissions(resource)`
|
|
134
|
+
- on the server, permissions are autoloaded as part of the bootstrap path
|
|
135
|
+
- on the client, permission queries are refetched when needed
|
|
136
|
+
|
|
137
|
+
That means bootstrap and permissions are part of the same lower-level OpenAPI/runtime ladder, not unrelated utilities.
|
|
138
|
+
|
|
139
|
+
## `getSdk(...)` and schema preloading
|
|
140
|
+
|
|
141
|
+
The operation-level SDK path is centered on:
|
|
142
|
+
|
|
143
|
+
- `ModelSdk.getSdk(api, apiMethod)`
|
|
144
|
+
- `SysSdk.loadSdk(...)`
|
|
145
|
+
|
|
146
|
+
The source confirms that:
|
|
147
|
+
|
|
148
|
+
- one operation-level SDK entry is keyed by API path and request method
|
|
149
|
+
- schema docs are fetched through the lower OpenAPI fetch path
|
|
150
|
+
- component schemas referenced by the operation document are cached into `SysSdk.schemas`
|
|
151
|
+
- operation metadata is cached into `SysSdk.sdks`
|
|
152
|
+
|
|
153
|
+
That means `getSdk(...)` is not only a fetch helper. It is also a preloading point for the schema runtime that later powers query/body/row/filter access.
|
|
154
|
+
|
|
155
|
+
## `createApiSchemas(...)` and derived schema surfaces
|
|
156
|
+
|
|
157
|
+
The high-value consumer-facing helper is:
|
|
158
|
+
|
|
159
|
+
- `createApiSchemas(api, method)`
|
|
160
|
+
|
|
161
|
+
The source confirms that it exposes these derived surfaces:
|
|
162
|
+
|
|
163
|
+
- `query`
|
|
164
|
+
- `filter`
|
|
165
|
+
- `requestBody`
|
|
166
|
+
- `responseBody`
|
|
167
|
+
- `paged`
|
|
168
|
+
- `row`
|
|
169
|
+
|
|
170
|
+
This is the most practical lower-level bridge from raw OpenAPI docs into the higher-level resource, form, and table runtimes.
|
|
171
|
+
|
|
172
|
+
A practical reading rule is:
|
|
173
|
+
|
|
174
|
+
- downstream consumers should reuse these derived schema surfaces
|
|
175
|
+
- they should not rebuild request/query/body/row extraction rules independently
|
|
176
|
+
|
|
177
|
+
## `schema.ts` and scene-aware property loading
|
|
178
|
+
|
|
179
|
+
The canonical schema extraction layer lives in:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
zova/src/suite-vendor/a-zova/modules/a-openapi/src/lib/schema.ts
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
This file owns the main lower-level helpers for:
|
|
186
|
+
|
|
187
|
+
- request body schema extraction
|
|
188
|
+
- response body schema extraction
|
|
189
|
+
- request query schema extraction
|
|
190
|
+
- filter-schema extraction
|
|
191
|
+
- scene-aware property loading
|
|
192
|
+
- JSON-schema-to-Zod conversion
|
|
193
|
+
|
|
194
|
+
The most important scene-aware rule is in `loadSchemaProperties(...)`:
|
|
195
|
+
|
|
196
|
+
- property metadata can be extended by `rest.*`
|
|
197
|
+
- scene-specific overlays such as `table`, `form`, `form-view`, `form-create`, and `filter` are applied
|
|
198
|
+
- field ordering is resolved through `rest.order`
|
|
199
|
+
|
|
200
|
+
That means `a-openapi` is not only a transport/schema lookup layer.
|
|
201
|
+
|
|
202
|
+
It is also the lower-level metadata shaping layer for schema-driven UI behavior.
|
|
203
|
+
|
|
204
|
+
## Current consumers that prove the contract
|
|
205
|
+
|
|
206
|
+
The clearest current consumers of `a-openapi` runtime are:
|
|
207
|
+
|
|
208
|
+
- `rest-resource/src/model/resource.ts`
|
|
209
|
+
- list and entry page shells that reuse `ModelResource`
|
|
210
|
+
- table/form runtimes that consume schema surfaces derived from `createApiSchemas(...)` and `loadSchemaProperties(...)`
|
|
211
|
+
|
|
212
|
+
This is enough to show that `a-openapi` should be understood as shared runtime substrate rather than one isolated SDK helper.
|
|
213
|
+
|
|
214
|
+
## What this page does not re-explain
|
|
215
|
+
|
|
216
|
+
This page does **not** fully re-explain:
|
|
217
|
+
|
|
218
|
+
- how to configure or generate OpenAPI SDK output -> see [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
219
|
+
- the broader server-data abstraction ladder -> see [Server Data](/frontend/server-data)
|
|
220
|
+
- how `$apiSchema` is positioned conceptually -> see [API Schema Guide](/frontend/api-schema-guide)
|
|
221
|
+
- downstream resource-owner or table runtime behavior -> see the relevant resource/table deep dives
|
|
222
|
+
|
|
223
|
+
Its job is only to explain the lower-level `a-openapi` runtime and source path.
|
|
224
|
+
|
|
225
|
+
## Where to read next
|
|
226
|
+
|
|
227
|
+
Use these next steps depending on your question:
|
|
228
|
+
|
|
229
|
+
- if you want the broader server-data ladder, read [Server Data](/frontend/server-data)
|
|
230
|
+
- if you want OpenAPI generation/config usage, read [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
231
|
+
- if you want schema-driven UI positioning, read [API Schema Guide](/frontend/api-schema-guide)
|
|
232
|
+
- if you want the resource-owner consumer side, read [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
233
|
+
- if you want the table/resource consumer side, read [Zova Table Under the Hood](/frontend/zova-table-under-the-hood) and the resource deep dives
|
|
234
|
+
|
|
235
|
+
## Final takeaway
|
|
236
|
+
|
|
237
|
+
The most accurate way to read `a-openapi` is not as one generated-client helper.
|
|
238
|
+
|
|
239
|
+
Read it as the lower-level schema/runtime bridge that:
|
|
240
|
+
|
|
241
|
+
- injects `$sdk`
|
|
242
|
+
- scopes SDK/runtime state by locale
|
|
243
|
+
- loads bootstrap, permissions, operation docs, and component schemas
|
|
244
|
+
- derives request/query/filter/body/row/paged schema surfaces
|
|
245
|
+
- applies scene-aware schema-property shaping
|
|
246
|
+
- supports higher-level resource, form, and table consumers
|
|
247
|
+
|
|
248
|
+
That is the source-confirmed role of `a-openapi` in the current Cabloy Basic frontend architecture.
|