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,203 @@
|
|
|
1
|
+
# Generated Contract Consumption Specimen
|
|
2
|
+
|
|
3
|
+
This page is a focused specimen for one narrow frontend question:
|
|
4
|
+
|
|
5
|
+
> after backend-authored OpenAPI/schema contract material has already been generated into Zova, what does real frontend consumption look like?
|
|
6
|
+
|
|
7
|
+
Use this page together with:
|
|
8
|
+
|
|
9
|
+
- [Backend OpenAPI to Frontend SDK](/fullstack/openapi-to-sdk)
|
|
10
|
+
- [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
11
|
+
- [Server Data](/frontend/server-data)
|
|
12
|
+
- [SDK Guide](/frontend/sdk-guide)
|
|
13
|
+
- [API Schema Guide](/frontend/api-schema-guide)
|
|
14
|
+
- [OpenAPI Runtime Under the Hood](/frontend/a-openapi-under-the-hood)
|
|
15
|
+
- [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
16
|
+
- [Rest Resource Under the Hood](/frontend/rest-resource-under-the-hood)
|
|
17
|
+
- [Resource List Page Deep Dive](/frontend/resource-list-page-deep-dive)
|
|
18
|
+
- [Resource Entry Page Deep Dive](/frontend/resource-entry-page-deep-dive)
|
|
19
|
+
|
|
20
|
+
> [!TIP]
|
|
21
|
+
> **Generated-contract reading path**
|
|
22
|
+
>
|
|
23
|
+
> 1. **[Backend OpenAPI to Frontend SDK](/fullstack/openapi-to-sdk)** — understand how backend-authored truth crosses the stack boundary
|
|
24
|
+
> 2. **[OpenAPI SDK Guide](/frontend/openapi-sdk-guide)** — configure and generate the frontend contract slice
|
|
25
|
+
> 3. **[Generated Contract Consumption Specimen](/frontend/generated-contract-consumption-specimen)** — see how generated contract material is consumed in practice
|
|
26
|
+
>
|
|
27
|
+
> **You are here:** step 3.
|
|
28
|
+
> **Previous recommended pages:** [Backend OpenAPI to Frontend SDK](/fullstack/openapi-to-sdk) and [OpenAPI SDK Guide](/frontend/openapi-sdk-guide).
|
|
29
|
+
|
|
30
|
+
## Why this page exists
|
|
31
|
+
|
|
32
|
+
Several existing docs already explain parts of this story well:
|
|
33
|
+
|
|
34
|
+
- the fullstack bridge from backend OpenAPI to frontend generation
|
|
35
|
+
- frontend OpenAPI config and module ownership
|
|
36
|
+
- the conceptual roles of `$sdk`, `$apiSchema`, and server-data layers
|
|
37
|
+
- the internals of `a-openapi` and `ModelResource`
|
|
38
|
+
|
|
39
|
+
What was still missing was one narrow page that shows the practical consumer-side chain after generation.
|
|
40
|
+
|
|
41
|
+
This page fills that gap.
|
|
42
|
+
|
|
43
|
+
It is not another generation guide and not another internals page. It is a specimen page about consumption.
|
|
44
|
+
|
|
45
|
+
## Shortest accurate mental model
|
|
46
|
+
|
|
47
|
+
A practical generated-contract consumption path looks like this:
|
|
48
|
+
|
|
49
|
+
1. backend-authored contract truth has already been generated into frontend contract material
|
|
50
|
+
2. frontend accesses that material through generated API/schema surfaces such as `$api`, `$apiSchema`, and `$sdk`
|
|
51
|
+
3. when the API still belongs to one resource boundary, `ModelResource` remains the stable owner
|
|
52
|
+
4. list-page and entry-page shells consume that owner rather than recreating the contract ad hoc
|
|
53
|
+
5. deeper runtime details still belong to the existing under-the-hood pages
|
|
54
|
+
|
|
55
|
+
That means generated contract consumption is not one thing only.
|
|
56
|
+
|
|
57
|
+
It usually moves through:
|
|
58
|
+
|
|
59
|
+
- generated API/schema access
|
|
60
|
+
- owner-level resource consumption
|
|
61
|
+
- page-shell/runtime consumption
|
|
62
|
+
|
|
63
|
+
## Where generated contract material comes from
|
|
64
|
+
|
|
65
|
+
This page starts **after** the forward-chain bridge and generation steps.
|
|
66
|
+
|
|
67
|
+
Those earlier steps are owned by:
|
|
68
|
+
|
|
69
|
+
- [Backend OpenAPI to Frontend SDK](/fullstack/openapi-to-sdk)
|
|
70
|
+
- [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
71
|
+
|
|
72
|
+
Once that handoff is complete, the frontend can consume generated contract material through several surfaces:
|
|
73
|
+
|
|
74
|
+
- generated API services
|
|
75
|
+
- generated API schema accessors
|
|
76
|
+
- `$sdk` schema/runtime helpers
|
|
77
|
+
- higher-level resource owners such as `ModelResource`
|
|
78
|
+
|
|
79
|
+
## Shared consumption chain
|
|
80
|
+
|
|
81
|
+
A practical shared reading path is:
|
|
82
|
+
|
|
83
|
+
1. `zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts`
|
|
84
|
+
2. `zova/src/suite/a-training/modules/training-student/src/model/student.ts`
|
|
85
|
+
3. optional direct schema/api consumer specimen: `zova/src/suite/a-home/modules/home-passport/src/model/passport.ts`
|
|
86
|
+
|
|
87
|
+
That short path already shows the shared contract-consumption layers that both list and entry pages depend on:
|
|
88
|
+
|
|
89
|
+
- generated schema access
|
|
90
|
+
- thin semantic model follow-up when needed
|
|
91
|
+
- stable resource-owner consumption
|
|
92
|
+
|
|
93
|
+
## `$sdk`, `$apiSchema`, and generated-contract surfaces in one view
|
|
94
|
+
|
|
95
|
+
A practical split is:
|
|
96
|
+
|
|
97
|
+
- generated API services expose callable backend operations
|
|
98
|
+
- `$apiSchema` exposes schema-oriented access to those operations
|
|
99
|
+
- `$sdk` is the lower-level schema/runtime bridge beneath those higher-level consumers
|
|
100
|
+
|
|
101
|
+
A clear direct schema specimen exists in:
|
|
102
|
+
|
|
103
|
+
- `zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts`
|
|
104
|
+
|
|
105
|
+
Representative source facts:
|
|
106
|
+
|
|
107
|
+
- `@ApiSchema()` exposes a schema bean for the module
|
|
108
|
+
- methods such as `select()`, `create()`, `view()`, `delete()`, `update()`, `summary()`, and `deleteForce()` call `this.$sdk.createApiSchemas(...)`
|
|
109
|
+
|
|
110
|
+
A second useful specimen is:
|
|
111
|
+
|
|
112
|
+
- `zova/src/suite/a-home/modules/home-passport/src/model/passport.ts`
|
|
113
|
+
|
|
114
|
+
Representative source fact:
|
|
115
|
+
|
|
116
|
+
- `schemaLogin` is derived from `this.apiSchemasLogin.requestBody`
|
|
117
|
+
|
|
118
|
+
Together, these show the first practical boundary in the frontend contract path:
|
|
119
|
+
|
|
120
|
+
> the generated contract does not jump directly from backend OpenAPI into page internals. It first becomes frontend-accessible through schema- and SDK-oriented surfaces.
|
|
121
|
+
|
|
122
|
+
## `ModelResource` as the shared owner before branch split
|
|
123
|
+
|
|
124
|
+
When the generated contract still belongs to one business resource, frontend consumption usually should not create a second competing owner.
|
|
125
|
+
|
|
126
|
+
A strong public specimen for this pattern exists in:
|
|
127
|
+
|
|
128
|
+
- `zova/src/suite/a-training/modules/training-student/src/model/student.ts`
|
|
129
|
+
|
|
130
|
+
Representative source facts:
|
|
131
|
+
|
|
132
|
+
- the module model is a semantic facade, not the primary resource owner
|
|
133
|
+
- it resolves `rest-resource.model.resource` through selector-backed access
|
|
134
|
+
- custom methods such as `summary(id)` and `deleteForce(id)` still delegate to resource-owner query and mutation helpers
|
|
135
|
+
|
|
136
|
+
This is the practical contract-consumption rule that matters most:
|
|
137
|
+
|
|
138
|
+
> when the API still belongs to the same resource, keep `ModelResource` as the stable owner and keep frontend follow-up thin.
|
|
139
|
+
|
|
140
|
+
At this point, the generated contract consumption path splits into two practical branches:
|
|
141
|
+
|
|
142
|
+
- **list branch** -> list route shell, schema row, query state, and table-facing owner surfaces
|
|
143
|
+
- **entry branch** -> entry route shell, `formMeta`, `formSchema`, `formData`, and submit/page-meta owner surfaces
|
|
144
|
+
|
|
145
|
+
## Choose the branch that matches your question
|
|
146
|
+
|
|
147
|
+
### List branch
|
|
148
|
+
|
|
149
|
+
Use this branch when your question is about:
|
|
150
|
+
|
|
151
|
+
- list-page schema and data consumption
|
|
152
|
+
- `schemaRow`, `schemaFilter`, and `select(query)`
|
|
153
|
+
- the route shell and `basic-page:blockPage` handoff
|
|
154
|
+
|
|
155
|
+
Continue with [Generated Contract Consumption: List Branch](/frontend/generated-contract-consumption-list-branch).
|
|
156
|
+
|
|
157
|
+
### Entry branch
|
|
158
|
+
|
|
159
|
+
Use this branch when your question is about:
|
|
160
|
+
|
|
161
|
+
- `formMeta`, `formSchema`, and `formData`
|
|
162
|
+
- `create` / `view` / `update` schema consumption
|
|
163
|
+
- the route shell and `basic-pageentry:blockPageEntry` handoff
|
|
164
|
+
|
|
165
|
+
Continue with [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch).
|
|
166
|
+
|
|
167
|
+
## What this page does not re-explain
|
|
168
|
+
|
|
169
|
+
This page deliberately does **not** re-teach in depth:
|
|
170
|
+
|
|
171
|
+
- how to configure or generate OpenAPI SDK output -> see [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
172
|
+
- the broader server-data abstraction ladder -> see [Server Data](/frontend/server-data)
|
|
173
|
+
- how `$apiSchema` is positioned conceptually -> see [API Schema Guide](/frontend/api-schema-guide)
|
|
174
|
+
- the lower runtime of `$sdk` and schema extraction -> see [OpenAPI Runtime Under the Hood](/frontend/a-openapi-under-the-hood)
|
|
175
|
+
- `ModelResource` internals -> see [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
176
|
+
- the broader `rest-resource` runtime bridge -> see [Rest Resource Under the Hood](/frontend/rest-resource-under-the-hood)
|
|
177
|
+
|
|
178
|
+
Its job is only to show the practical consumer-side handoff after generation.
|
|
179
|
+
|
|
180
|
+
## Where to read next
|
|
181
|
+
|
|
182
|
+
- If your next question is still on the bridge/generation side, return to [Backend OpenAPI to Frontend SDK](/fullstack/openapi-to-sdk) and [OpenAPI SDK Guide](/frontend/openapi-sdk-guide).
|
|
183
|
+
- If your next question is about the list-page branch, continue with [Generated Contract Consumption: List Branch](/frontend/generated-contract-consumption-list-branch).
|
|
184
|
+
- If your next question is about the entry-page branch, continue with [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch).
|
|
185
|
+
- If you now want a proof-oriented layer-by-layer consumer-side workflow, continue with [Generated Contract Consumption Verify Playbook](/frontend/generated-contract-consumption-verify-playbook).
|
|
186
|
+
- If the result is already wrong and you want symptom-first diagnosis, continue with [Generated Contract Consumption Debug Checklist](/frontend/generated-contract-consumption-debug-checklist).
|
|
187
|
+
- If your next question is about the conceptual server-data ladder, continue with [Server Data](/frontend/server-data), [SDK Guide](/frontend/sdk-guide), and [API Schema Guide](/frontend/api-schema-guide).
|
|
188
|
+
- If your next question is about the lower runtime beneath `$sdk`, continue with [OpenAPI Runtime Under the Hood](/frontend/a-openapi-under-the-hood).
|
|
189
|
+
- If your next question is about the resource-owner internals, continue with [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive).
|
|
190
|
+
|
|
191
|
+
## Final takeaway
|
|
192
|
+
|
|
193
|
+
The cleanest way to read generated contract consumption in Zova is not to jump straight from generated OpenAPI into deep runtime internals.
|
|
194
|
+
|
|
195
|
+
Instead, read the chain like this:
|
|
196
|
+
|
|
197
|
+
- generated contract surfaces
|
|
198
|
+
- schema and SDK access
|
|
199
|
+
- stable resource owner
|
|
200
|
+
- pick the list or entry branch
|
|
201
|
+
- deeper runtime internals only if you still need them
|
|
202
|
+
|
|
203
|
+
That reading order keeps the consumer-side contract path visible without flattening the architecture into one giant runtime story.
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Generated Contract Consumption Verify Playbook
|
|
2
|
+
|
|
3
|
+
This page is a proof-oriented verification companion for one narrow frontend question:
|
|
4
|
+
|
|
5
|
+
> after generated contract material has already crossed into Zova, what must be true at each layer before I trust the consumer-side path?
|
|
6
|
+
|
|
7
|
+
Use this page together with:
|
|
8
|
+
|
|
9
|
+
- [Generated Contract Consumption Specimen](/frontend/generated-contract-consumption-specimen)
|
|
10
|
+
- [Generated Contract Consumption: List Branch](/frontend/generated-contract-consumption-list-branch)
|
|
11
|
+
- [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch)
|
|
12
|
+
- [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
13
|
+
- [Server Data](/frontend/server-data)
|
|
14
|
+
- [API Schema Guide](/frontend/api-schema-guide)
|
|
15
|
+
- [OpenAPI Runtime Under the Hood](/frontend/a-openapi-under-the-hood)
|
|
16
|
+
- [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
17
|
+
|
|
18
|
+
> [!TIP]
|
|
19
|
+
> **Generated-contract verification path**
|
|
20
|
+
>
|
|
21
|
+
> 1. **[Generated Contract Consumption Specimen](/frontend/generated-contract-consumption-specimen)** — understand the shared consumer-side path
|
|
22
|
+
> 2. **[Generated Contract Consumption: List Branch](/frontend/generated-contract-consumption-list-branch)** or **[Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch)** — pick the branch that matches your case
|
|
23
|
+
> 3. **[Generated Contract Consumption Verify Playbook](/frontend/generated-contract-consumption-verify-playbook)** — prove the consumer-side path layer by layer
|
|
24
|
+
>
|
|
25
|
+
> **You are here:** step 3.
|
|
26
|
+
> **Previous recommended pages:** [Generated Contract Consumption Specimen](/frontend/generated-contract-consumption-specimen), [Generated Contract Consumption: List Branch](/frontend/generated-contract-consumption-list-branch), and [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch).
|
|
27
|
+
|
|
28
|
+
## Why this page exists
|
|
29
|
+
|
|
30
|
+
The current frontend generated-contract family already gives you:
|
|
31
|
+
|
|
32
|
+
- a conceptual hub page
|
|
33
|
+
- a list-branch specimen
|
|
34
|
+
- an entry-branch specimen
|
|
35
|
+
|
|
36
|
+
What was still missing was one proof-oriented page that tells you what must be true at each consumer layer after a change.
|
|
37
|
+
|
|
38
|
+
This page fills that gap.
|
|
39
|
+
|
|
40
|
+
It is not another generation/config page and not another symptom-first debug page. It is the playbook for proving the consumer-side path is correct.
|
|
41
|
+
|
|
42
|
+
## Phase 1: Scope the consumer path first
|
|
43
|
+
|
|
44
|
+
Before checking any details, decide what kind of question you actually have.
|
|
45
|
+
|
|
46
|
+
### Shared contract-surface question
|
|
47
|
+
|
|
48
|
+
Use this when the issue is still above the branch split:
|
|
49
|
+
|
|
50
|
+
- does the generated contract surface exist?
|
|
51
|
+
- does the module expose the expected schema/API surface at all?
|
|
52
|
+
|
|
53
|
+
### List-branch question
|
|
54
|
+
|
|
55
|
+
Use this when the issue is clearly about:
|
|
56
|
+
|
|
57
|
+
- list-page schema/data consumption
|
|
58
|
+
- `schemaRow`, `schemaFilter`, and `select(query)`
|
|
59
|
+
- the route shell and `basic-page:blockPage` handoff
|
|
60
|
+
|
|
61
|
+
### Entry-branch question
|
|
62
|
+
|
|
63
|
+
Use this when the issue is clearly about:
|
|
64
|
+
|
|
65
|
+
- `formMeta`, `formSchema`, `formData`
|
|
66
|
+
- `create` / `view` / `update` schema consumption
|
|
67
|
+
- the route shell and `basic-pageentry:blockPageEntry` handoff
|
|
68
|
+
|
|
69
|
+
### Deeper internals question
|
|
70
|
+
|
|
71
|
+
If the issue is already below these consumer-side layers, stop here and hand off to the deeper internals pages later instead of forcing this playbook to explain everything.
|
|
72
|
+
|
|
73
|
+
## Phase 2: Prove the generated contract surface
|
|
74
|
+
|
|
75
|
+
Start with the smallest shared consumer-side anchors.
|
|
76
|
+
|
|
77
|
+
Primary anchors:
|
|
78
|
+
|
|
79
|
+
- `zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts`
|
|
80
|
+
- optional direct schema consumer: `zova/src/suite/a-home/modules/home-passport/src/model/passport.ts`
|
|
81
|
+
|
|
82
|
+
What to prove:
|
|
83
|
+
|
|
84
|
+
- the generated schema access surface exists where expected
|
|
85
|
+
- methods such as `select()`, `create()`, `view()`, `update()`, `summary()`, and `deleteForce()` still expose the intended contract slice
|
|
86
|
+
- if the module depends on direct schema-driven consumption, the expected request/response schema access still resolves correctly
|
|
87
|
+
|
|
88
|
+
If this phase fails, do not debug deeper page/runtime behavior yet. The consumer path is already wrong too early.
|
|
89
|
+
|
|
90
|
+
## Phase 3: Prove the stable owner boundary
|
|
91
|
+
|
|
92
|
+
Once the generated surface is present, prove that the module still consumes it through the correct owner boundary.
|
|
93
|
+
|
|
94
|
+
Primary anchor:
|
|
95
|
+
|
|
96
|
+
- `zova/src/suite/a-training/modules/training-student/src/model/student.ts`
|
|
97
|
+
|
|
98
|
+
What to prove:
|
|
99
|
+
|
|
100
|
+
- the module model still keeps `ModelResource` as the stable owner when the API belongs to the same resource
|
|
101
|
+
- thin semantic follow-up still delegates correctly to owner-backed query/mutation helpers
|
|
102
|
+
- the module did not accidentally invent a competing second owner for the same resource contract
|
|
103
|
+
|
|
104
|
+
A practical rule is:
|
|
105
|
+
|
|
106
|
+
> if the generated contract still belongs to the same resource, the consumer path should still stay owner-first.
|
|
107
|
+
|
|
108
|
+
## Phase 4A: Prove the list branch
|
|
109
|
+
|
|
110
|
+
Only enter this phase when the problem is clearly on the list-page branch.
|
|
111
|
+
|
|
112
|
+
Primary anchors:
|
|
113
|
+
|
|
114
|
+
- `zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/resource/controller.tsx`
|
|
115
|
+
- `zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx`
|
|
116
|
+
|
|
117
|
+
What to prove:
|
|
118
|
+
|
|
119
|
+
- the list route shell resolves the expected `resource`
|
|
120
|
+
- `apiSchemasSelect.sdk` still autoloads where expected
|
|
121
|
+
- `schemaRow`, `schemaFilter`, and list data flow are still exposed correctly
|
|
122
|
+
- `basic-page:blockPage` still becomes the deeper list runtime owner
|
|
123
|
+
|
|
124
|
+
If this phase passes, the generated contract has successfully crossed into the list branch.
|
|
125
|
+
|
|
126
|
+
## Phase 4B: Prove the entry branch
|
|
127
|
+
|
|
128
|
+
Only enter this phase when the problem is clearly on the entry-page branch.
|
|
129
|
+
|
|
130
|
+
Primary anchors:
|
|
131
|
+
|
|
132
|
+
- `zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/entry/controller.tsx`
|
|
133
|
+
- `zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockPageEntry/controller.tsx`
|
|
134
|
+
- `zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockForm/controller.tsx`
|
|
135
|
+
- `zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockToolbarRow/controller.tsx`
|
|
136
|
+
|
|
137
|
+
What to prove:
|
|
138
|
+
|
|
139
|
+
- the entry route shell resolves `resource`, `id`, and `formScene`
|
|
140
|
+
- owner-level `formMeta`, `formSchema`, and `formData` still load correctly
|
|
141
|
+
- `blockForm` and `blockToolbarRow` still consume the correct host context
|
|
142
|
+
- the submit and page-meta path still belongs to the deeper page-entry runtime owner rather than scattered local code
|
|
143
|
+
|
|
144
|
+
If this phase passes, the generated contract has successfully crossed into the entry branch.
|
|
145
|
+
|
|
146
|
+
## Phase 5: Escalate only after the proof steps pass
|
|
147
|
+
|
|
148
|
+
Only after the earlier proof steps already pass should you descend into:
|
|
149
|
+
|
|
150
|
+
- `a-openapi` lower runtime internals
|
|
151
|
+
- `ModelResource` internals
|
|
152
|
+
- deeper list runtime internals
|
|
153
|
+
- deeper entry runtime internals
|
|
154
|
+
|
|
155
|
+
That is the boundary that keeps this page useful instead of turning it into a full runtime deep dive.
|
|
156
|
+
|
|
157
|
+
## What this page does not re-explain
|
|
158
|
+
|
|
159
|
+
This page deliberately does **not** re-teach:
|
|
160
|
+
|
|
161
|
+
- frontend OpenAPI config/generation -> see [OpenAPI SDK Guide](/frontend/openapi-sdk-guide)
|
|
162
|
+
- the broader server-data abstraction ladder -> see [Server Data](/frontend/server-data)
|
|
163
|
+
- the conceptual role of `$apiSchema` -> see [API Schema Guide](/frontend/api-schema-guide)
|
|
164
|
+
- lower `a-openapi` runtime internals -> see [OpenAPI Runtime Under the Hood](/frontend/a-openapi-under-the-hood)
|
|
165
|
+
- `ModelResource` internals -> see [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive)
|
|
166
|
+
- deeper list runtime -> see [Resource List Page Deep Dive](/frontend/resource-list-page-deep-dive)
|
|
167
|
+
- deeper entry runtime -> see [Resource Entry Page Deep Dive](/frontend/resource-entry-page-deep-dive)
|
|
168
|
+
|
|
169
|
+
Its job is only to tell you what must be true at each consumer-side layer before you trust the generated-contract path.
|
|
170
|
+
|
|
171
|
+
## Where to read next
|
|
172
|
+
|
|
173
|
+
- If you need the shared consumer-side overview first, return to [Generated Contract Consumption Specimen](/frontend/generated-contract-consumption-specimen).
|
|
174
|
+
- If you need the list or entry branch specimen first, continue with [Generated Contract Consumption: List Branch](/frontend/generated-contract-consumption-list-branch) or [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch).
|
|
175
|
+
- If the visible result is already wrong and you want symptom-first diagnosis, continue with [Generated Contract Consumption Debug Checklist](/frontend/generated-contract-consumption-debug-checklist).
|
|
176
|
+
- If the generated surface itself is missing or stale, hand off to [Backend OpenAPI to Frontend SDK](/fullstack/openapi-to-sdk) and [OpenAPI SDK Guide](/frontend/openapi-sdk-guide).
|
|
177
|
+
- If the issue is below the current boundary, descend into [OpenAPI Runtime Under the Hood](/frontend/a-openapi-under-the-hood), [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive), [Resource List Page Deep Dive](/frontend/resource-list-page-deep-dive), or [Resource Entry Page Deep Dive](/frontend/resource-entry-page-deep-dive).
|
|
178
|
+
|
|
179
|
+
## Final takeaway
|
|
180
|
+
|
|
181
|
+
The cleanest way to verify a generated-contract consumer path is not to jump straight into deep runtime debugging.
|
|
182
|
+
|
|
183
|
+
First prove:
|
|
184
|
+
|
|
185
|
+
- the generated contract surface
|
|
186
|
+
- the stable owner boundary
|
|
187
|
+
- the matching list or entry branch handoff
|
|
188
|
+
|
|
189
|
+
Only then descend into deeper internals if you still need them.
|
|
@@ -13,7 +13,7 @@ This matters in large TypeScript-heavy systems because generic components help k
|
|
|
13
13
|
Example: convert component `card` into a generic component.
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm run zova :refactor:componentGeneric card -- --module=
|
|
16
|
+
npm run zova :refactor:componentGeneric card -- --module=training-student
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Why the CLI matters here
|
|
@@ -28,18 +28,22 @@ Use this page as the main frontend hub, then choose the path that matches your t
|
|
|
28
28
|
|
|
29
29
|
### Getting started and architecture spine
|
|
30
30
|
|
|
31
|
-
Start here when you need the shortest route to the frontend mental model and startup context
|
|
31
|
+
Start here when you need the shortest route to the frontend mental model and startup context.
|
|
32
|
+
|
|
33
|
+
A practical rule is:
|
|
34
|
+
|
|
35
|
+
- if you need the broadest entry page, stay on this page
|
|
36
|
+
- if you need help choosing a topic cluster, continue with [Frontend Source Reading Roadmap](/frontend/frontend-source-reading-roadmap)
|
|
37
|
+
- if you already know the topic and want file-order guidance, continue with [Zova Source Reading Map](/frontend/zova-source-reading-map)
|
|
38
|
+
|
|
39
|
+
Recommended starting set:
|
|
32
40
|
|
|
33
41
|
- [Quickstart](/frontend/quickstart)
|
|
34
42
|
- [Foundation](/frontend/foundation)
|
|
35
43
|
- [Reading Zova for Vue Developers](/frontend/reading-zova-for-vue-developers)
|
|
36
|
-
- [
|
|
37
|
-
- [Zova Reactivity Under the Hood](/frontend/zova-reactivity-under-the-hood)
|
|
44
|
+
- [Frontend Source Reading Roadmap](/frontend/frontend-source-reading-roadmap)
|
|
38
45
|
- [Zova Source Reading Map](/frontend/zova-source-reading-map)
|
|
39
46
|
- [IoC and Beans](/frontend/ioc-and-beans)
|
|
40
|
-
- [Behavior Guide](/frontend/behavior-guide)
|
|
41
|
-
- [Modules and Suites](/frontend/modules-and-suites)
|
|
42
|
-
- [Module Scope](/frontend/module-scope)
|
|
43
47
|
- [Design Principles](/frontend/design-principles)
|
|
44
48
|
- [Environment and Config Guide](/frontend/environment-config-guide)
|
|
45
49
|
- [App Startup Guide](/frontend/app-startup-guide)
|
|
@@ -55,17 +59,33 @@ Use this path when the task is page-oriented, route-oriented, or the first time
|
|
|
55
59
|
- [Page Params Guide](/frontend/page-params-guide)
|
|
56
60
|
- [Zod Guide](/frontend/zod-guide)
|
|
57
61
|
- [Page Route Guide](/frontend/page-route-guide)
|
|
62
|
+
- [A-Router Guide](/frontend/a-router-guide)
|
|
58
63
|
- [Route Alias Guide](/frontend/route-alias-guide)
|
|
59
64
|
- [Navigation Guards Guide](/frontend/navigation-guards-guide)
|
|
65
|
+
- [Zova Router Under the Hood](/frontend/zova-router-under-the-hood)
|
|
66
|
+
- [Router View Hosts Guide](/frontend/router-view-hosts-guide)
|
|
67
|
+
- [Router Tabs Introduction](/frontend/router-tabs-introduction)
|
|
68
|
+
- [Router Tabs Overview](/frontend/router-tabs-overview)
|
|
69
|
+
- [Router Tabs Mechanism](/frontend/router-tabs-mechanism)
|
|
70
|
+
- [Page Meta Guide](/frontend/page-meta-guide)
|
|
71
|
+
- [Router Tabs Layout Integration](/frontend/router-tabs-layout-integration)
|
|
72
|
+
- [Router Tabs vs Stack](/frontend/router-tabs-vs-stack)
|
|
73
|
+
- [Router Stack Guide](/frontend/router-stack-guide)
|
|
74
|
+
- [Router Tabs Route Meta Cookbook](/frontend/router-tabs-route-meta-cookbook)
|
|
60
75
|
|
|
61
76
|
### Components and UI flow
|
|
62
77
|
|
|
63
|
-
Use this path when the task is about UI composition, component contracts, form architecture, form internals, form source reading, or theme work:
|
|
78
|
+
Use this path when the task is about UI composition, component contracts, form or table architecture, form or table internals, form or table source reading, or theme work:
|
|
64
79
|
|
|
65
80
|
- [Component Guide](/frontend/component-guide)
|
|
66
81
|
- [Form Guide](/frontend/form-guide)
|
|
67
82
|
- [Zova Form Under the Hood](/frontend/zova-form-under-the-hood)
|
|
68
83
|
- [Zova Form Source Reading Map](/frontend/zova-form-source-reading-map)
|
|
84
|
+
- [Table Guide](/frontend/table-guide)
|
|
85
|
+
- [TableCell Authoring Cookbook](/frontend/table-cell-cookbook)
|
|
86
|
+
- [Table + Resource CRUD Cookbook](/frontend/table-resource-crud-cookbook)
|
|
87
|
+
- [Zova Table Under the Hood](/frontend/zova-table-under-the-hood)
|
|
88
|
+
- [Zova Table Source Reading Map](/frontend/zova-table-source-reading-map)
|
|
69
89
|
- [Component Props Guide](/frontend/component-props-guide)
|
|
70
90
|
- [Component v-model Guide](/frontend/component-v-model-guide)
|
|
71
91
|
- [Generic Component Guide](/frontend/generic-component-guide)
|
|
@@ -82,6 +102,8 @@ Use this path when the task is about data loading, API contracts, generated SDKs
|
|
|
82
102
|
- [Model Architecture](/frontend/model-architecture)
|
|
83
103
|
- [Model State Guide](/frontend/model-state-guide)
|
|
84
104
|
- [Model Resource Owner Pattern](/frontend/model-resource-owner-pattern)
|
|
105
|
+
- [Rest Resource Under the Hood](/frontend/rest-resource-under-the-hood)
|
|
106
|
+
- [Rest Resource Source Reading Map](/frontend/rest-resource-source-reading-map)
|
|
85
107
|
- [Using ModelResource in Your Module](/frontend/model-resource-usage-guide)
|
|
86
108
|
- [Resource Model Best Practices](/frontend/model-resource-best-practices)
|
|
87
109
|
- [Resource Model Cookbook](/frontend/model-resource-cookbook)
|
|
@@ -42,6 +42,8 @@ In practice, a model often sits above `$api` and below page rendering:
|
|
|
42
42
|
|
|
43
43
|
Read together with [Server Data](/frontend/server-data) when deciding which abstraction layer a feature should use.
|
|
44
44
|
|
|
45
|
+
If your next question is how the generic lower-level model runtime works beneath these abstractions, continue with [A-Model Under the Hood](/frontend/a-model-under-the-hood).
|
|
46
|
+
|
|
45
47
|
## Relationship to TanStack Query
|
|
46
48
|
|
|
47
49
|
One current-source fact is explicit: Zova Model is built on top of TanStack Query.
|
|
@@ -73,6 +75,40 @@ At source level, `@Model()` is a bean decorator factory:
|
|
|
73
75
|
|
|
74
76
|
That file shows that a model is registered on the `model` onion/scene rather than being a special-case standalone mechanism.
|
|
75
77
|
|
|
78
|
+
### A practical thin-facade example
|
|
79
|
+
|
|
80
|
+
This subsection is the first layer of a small source-reading chain around same-resource model facades.
|
|
81
|
+
|
|
82
|
+
Use the three related pages in this order when your question is specifically about a same-resource custom facade:
|
|
83
|
+
|
|
84
|
+
1. this page for the broader role of Zova Model
|
|
85
|
+
2. [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch) for the consumer-side handoff into the owner
|
|
86
|
+
3. [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive) for the owner internals that make that handoff work
|
|
87
|
+
|
|
88
|
+
A current example of a model staying intentionally thin is:
|
|
89
|
+
|
|
90
|
+
- `zova/src/suite/a-training/modules/training-student/src/model/student.ts`
|
|
91
|
+
|
|
92
|
+
That file is useful for one specific architectural point:
|
|
93
|
+
|
|
94
|
+
- `ModelResource` remains the stable resource owner
|
|
95
|
+
- the module model adds resource-specific methods such as `summary(id)` and `deleteForce(id)`
|
|
96
|
+
- those methods still delegate to owner-level helpers such as `queryItem(...)` and `mutationItem(...)`
|
|
97
|
+
|
|
98
|
+
A compact source-reading path for this pattern is:
|
|
99
|
+
|
|
100
|
+
1. `zova/src/suite/a-training/modules/training-student/src/model/student.ts`
|
|
101
|
+
2. `zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts`
|
|
102
|
+
3. `zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/entry/controller.tsx`
|
|
103
|
+
|
|
104
|
+
This is a good pattern when custom frontend behavior still belongs to the same resource and should continue to participate in resource-owned query, mutation, and form semantics.
|
|
105
|
+
|
|
106
|
+
For the entry-branch consumer path that uses this owner-preserving pattern, continue with [Generated Contract Consumption: Entry Branch](/frontend/generated-contract-consumption-entry-branch).
|
|
107
|
+
For the deeper owner internals behind `queryItem(...)`, `mutationItem(...)`, and form-derived helpers, continue with [ModelResource Internals Deep Dive](/frontend/model-resource-internals-deep-dive).
|
|
108
|
+
|
|
109
|
+
It is not the whole story of Zova Model.
|
|
110
|
+
It is a narrow example of resource-owner-preserving facade design inside the broader model architecture.
|
|
111
|
+
|
|
76
112
|
## The core architectural idea
|
|
77
113
|
|
|
78
114
|
The most important current-source insight is this:
|
|
@@ -172,7 +208,7 @@ They first prefix it with the model bean identity, and when `enableSelector` is
|
|
|
172
208
|
That means a logical user key such as:
|
|
173
209
|
|
|
174
210
|
```typescript
|
|
175
|
-
['list']
|
|
211
|
+
['list'];
|
|
176
212
|
```
|
|
177
213
|
|
|
178
214
|
becomes model-owned cache identity rather than a globally ambiguous key.
|
|
@@ -297,4 +333,4 @@ The most important architectural insight is simple:
|
|
|
297
333
|
|
|
298
334
|
> 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
335
|
|
|
300
|
-
Once that clicks, the model APIs stop looking like isolated helpers and start reading as one coherent state architecture.
|
|
336
|
+
Once that clicks, the model APIs stop looking like isolated helpers and start reading as one coherent state architecture.
|
|
@@ -69,7 +69,7 @@ Typical forward-chain case:
|
|
|
69
69
|
### Recommended shape
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
|
-
const StudentResource = '
|
|
72
|
+
const StudentResource = 'training-student:student';
|
|
73
73
|
|
|
74
74
|
@Model()
|
|
75
75
|
export class ModelStudent extends BeanModelBase {
|
|
@@ -83,7 +83,7 @@ export class ModelStudent extends BeanModelBase {
|
|
|
83
83
|
id,
|
|
84
84
|
action: 'summary',
|
|
85
85
|
queryFn: async () => {
|
|
86
|
-
const res = await this.scope.api.
|
|
86
|
+
const res = await this.scope.api.trainingStudent.summary({ params: { id } });
|
|
87
87
|
return res ?? null;
|
|
88
88
|
},
|
|
89
89
|
meta: {
|
|
@@ -97,7 +97,7 @@ export class ModelStudent extends BeanModelBase {
|
|
|
97
97
|
id,
|
|
98
98
|
action: 'deleteForce',
|
|
99
99
|
mutationFn: async () => {
|
|
100
|
-
await this.scope.api.
|
|
100
|
+
await this.scope.api.trainingStudent.deleteForce({ params: { id } });
|
|
101
101
|
},
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -116,7 +116,10 @@ export class ModelStudent extends BeanModelBase {
|
|
|
116
116
|
A custom cell or command can consume the thin facade and trigger the semantic method:
|
|
117
117
|
|
|
118
118
|
```typescript
|
|
119
|
-
const modelStudent = (await ctx.bean._getBean(
|
|
119
|
+
const modelStudent = (await ctx.bean._getBean(
|
|
120
|
+
'training-student.model.student',
|
|
121
|
+
true,
|
|
122
|
+
)) as ModelStudent;
|
|
120
123
|
const querySummary = modelStudent.summary(id);
|
|
121
124
|
const { data: summary } = await querySummary.refetch();
|
|
122
125
|
```
|
|
@@ -148,7 +151,7 @@ summary(id: TableIdentity) {
|
|
|
148
151
|
id,
|
|
149
152
|
action: 'summary',
|
|
150
153
|
queryFn: async () => {
|
|
151
|
-
const res = await this.scope.api.
|
|
154
|
+
const res = await this.scope.api.trainingStudent.summary({ params: { id } });
|
|
152
155
|
return res ?? null;
|
|
153
156
|
},
|
|
154
157
|
meta: {
|
|
@@ -221,7 +224,7 @@ deleteForce(id: TableIdentity) {
|
|
|
221
224
|
id,
|
|
222
225
|
action: 'deleteForce',
|
|
223
226
|
mutationFn: async () => {
|
|
224
|
-
await this.scope.api.
|
|
227
|
+
await this.scope.api.trainingStudent.deleteForce({ params: { id } });
|
|
225
228
|
},
|
|
226
229
|
});
|
|
227
230
|
}
|
|
@@ -248,7 +251,7 @@ publish(id: TableIdentity) {
|
|
|
248
251
|
action: 'publish',
|
|
249
252
|
invalidateSelect: false,
|
|
250
253
|
mutationFn: async () => {
|
|
251
|
-
await this.scope.api.
|
|
254
|
+
await this.scope.api.trainingStudent.publish({ params: { id } });
|
|
252
255
|
},
|
|
253
256
|
onSuccess: async () => {
|
|
254
257
|
await this.$$modelResource.$invalidateQueries({ queryKey: ['select'] });
|
|
@@ -388,7 +391,7 @@ batchArchive(ids: TableIdentity[]) {
|
|
|
388
391
|
return this.$$modelResource.$useMutationData<void, TableIdentity[]>({
|
|
389
392
|
mutationKey: ['batchArchive'],
|
|
390
393
|
mutationFn: async ids => {
|
|
391
|
-
await this.scope.api.
|
|
394
|
+
await this.scope.api.trainingStudent.batchArchive({ ids });
|
|
392
395
|
},
|
|
393
396
|
onSuccess: async () => {
|
|
394
397
|
await this.$$modelResource.$invalidateQueries({ queryKey: ['select'] });
|